mirror of
https://github.com/danielbrendel/hortusfox-web.git
synced 2026-01-05 20:30:34 -06:00
Public photo sharing
This commit is contained in:
@@ -39,8 +39,11 @@ class ShareController extends BaseController {
|
||||
$asset = $request->params()->query('asset', null);
|
||||
$title = $request->params()->query('title', null);
|
||||
$type = $request->params()->query('type', null);
|
||||
$public = $request->params()->query('public', null);
|
||||
$description = $request->params()->query('description', null);
|
||||
$keywords = $request->params()->query('keywords', null);
|
||||
|
||||
$result = ApiModule::sharePhoto($asset, $title, $type);
|
||||
$result = ApiModule::sharePhoto($asset, $title, $type, $public, $description, $keywords);
|
||||
|
||||
if ($result->code != 200) {
|
||||
throw new \Exception($result->msg);
|
||||
|
||||
@@ -420,5 +420,8 @@ return [
|
||||
'backup_settings_stored' => 'Backup cronjob settings were saved succesfully',
|
||||
'auto_backup_not_active' => 'The auto-backup feature has not been activated yet',
|
||||
'shared_photos' => 'Shared Photos',
|
||||
'confirm_remove_shared_photo' => 'Do you really want to remove this item?'
|
||||
'confirm_remove_shared_photo' => 'Do you really want to remove this item?',
|
||||
'share_photo_public' => 'Share this photo publicly',
|
||||
'share_photo_description' => 'Description',
|
||||
'share_photo_keywords' => 'Keywords'
|
||||
];
|
||||
@@ -10,10 +10,13 @@ class ApiModule {
|
||||
* @param $asset
|
||||
* @param $title
|
||||
* @param $type
|
||||
* @param $public
|
||||
* @param $description
|
||||
* @param $keywords
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function sharePhoto($asset, $title, $type)
|
||||
public static function sharePhoto($asset, $title, $type, $public, $description, $keywords)
|
||||
{
|
||||
try {
|
||||
$file = null;
|
||||
@@ -31,7 +34,10 @@ class ApiModule {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
||||
'title' => $title,
|
||||
'workspace' => app('workspace'),
|
||||
'hortusfox_photo' => curl_file_create($file)
|
||||
'hortusfox_photo' => curl_file_create($file),
|
||||
'public' => $public,
|
||||
'description' => $description,
|
||||
'keywords' => $keywords
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
@@ -940,11 +940,11 @@ window.vue = new Vue({
|
||||
window.vue.bShowSharePhoto = true;
|
||||
},
|
||||
|
||||
performPhotoShare: function(asset, title, type, result, button, error) {
|
||||
performPhotoShare: function(asset, title, _public, description, keywords, type, result, button, error) {
|
||||
let origButtonHtml = button.innerHTML;
|
||||
button.innerHTML = '<i class=\'fas fa-spinner fa-spin\'></i> ' + window.vue.loadingPleaseWait;
|
||||
|
||||
window.vue.ajaxRequest('post', window.location.origin + '/share/photo/post', { asset: asset, title: title, type: type }, function(response) {
|
||||
window.vue.ajaxRequest('post', window.location.origin + '/share/photo/post', { asset: asset, title: title, public: _public, description: description, keywords: keywords, type: type }, function(response) {
|
||||
button.innerHTML = origButtonHtml;
|
||||
|
||||
if (response.code == 200) {
|
||||
|
||||
@@ -1092,6 +1092,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input type="checkbox" class="checkbox" id="share-photo-public" value="0" onclick="if (this.checked) { document.getElementById('share-photo-public-data').classList.remove('is-hidden'); } else { document.getElementById('share-photo-public-data').classList.add('is-hidden'); }"> <span>{{ __('app.share_photo_public') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="share-photo-public-data" class="is-hidden">
|
||||
<div class="field">
|
||||
<label class="label">{{ __('app.share_photo_description') }}</label>
|
||||
<div class="control">
|
||||
<input type="text" class="input" id="share-photo-description">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label">{{ __('app.share_photo_keywords') }}</label>
|
||||
<div class="control">
|
||||
<input type="text" class="input" id="share-photo-keywords">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<p class="is-color-error is-hidden" id="share-photo-error"></p>
|
||||
</div>
|
||||
@@ -1109,7 +1131,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot is-stretched">
|
||||
<button id="share-photo-submit-action" class="button is-success" onclick="window.vue.performPhotoShare(document.getElementById('share-photo-id').value, document.getElementById('share-photo-title').value, document.getElementById('share-photo-type').value, document.getElementById('share-photo-link'), this, document.getElementById('share-photo-error'));">{{ __('app.share') }}</button>
|
||||
<button id="share-photo-submit-action" class="button is-success" onclick="window.vue.performPhotoShare(document.getElementById('share-photo-id').value, document.getElementById('share-photo-title').value, document.getElementById('share-photo-public').checked, document.getElementById('share-photo-description').value, document.getElementById('share-photo-keywords').value, document.getElementById('share-photo-type').value, document.getElementById('share-photo-link'), this, document.getElementById('share-photo-error'));">{{ __('app.share') }}</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user