mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
save as draft or publish
This commit is contained in:
parent
caf6054e66
commit
d0f0a293f3
@ -55,9 +55,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$uibModal',
|
|||||||
$scope.twitterSetting = { name: 'twitter_name', value: settingsPromise.twitter_name };
|
$scope.twitterSetting = { name: 'twitter_name', value: settingsPromise.twitter_name };
|
||||||
$scope.aboutTitleSetting = { name: 'about_title', value: settingsPromise.about_title };
|
$scope.aboutTitleSetting = { name: 'about_title', value: settingsPromise.about_title };
|
||||||
$scope.aboutBodySetting = { name: 'about_body', value: settingsPromise.about_body };
|
$scope.aboutBodySetting = { name: 'about_body', value: settingsPromise.about_body };
|
||||||
$scope.privacyBodySetting = { name: 'privacy_body', value: settingsPromise.privacy_body };
|
|
||||||
$scope.privacyDpoSetting = { name: 'privacy_dpo', value: settingsPromise.privacy_dpo };
|
$scope.privacyDpoSetting = { name: 'privacy_dpo', value: settingsPromise.privacy_dpo };
|
||||||
$scope.privacyDraftSetting = { name: 'privacy_draft', value: privacyDraftsPromise.setting.value };
|
|
||||||
$scope.aboutContactsSetting = { name: 'about_contacts', value: settingsPromise.about_contacts };
|
$scope.aboutContactsSetting = { name: 'about_contacts', value: settingsPromise.about_contacts };
|
||||||
$scope.homeBlogpostSetting = { name: 'home_blogpost', value: settingsPromise.home_blogpost };
|
$scope.homeBlogpostSetting = { name: 'home_blogpost', value: settingsPromise.home_blogpost };
|
||||||
$scope.machineExplicationsAlert = { name: 'machine_explications_alert', value: settingsPromise.machine_explications_alert };
|
$scope.machineExplicationsAlert = { name: 'machine_explications_alert', value: settingsPromise.machine_explications_alert };
|
||||||
@ -125,8 +123,11 @@ Application.Controllers.controller('SettingsController', ['$scope', '$uibModal',
|
|||||||
value: (settingsPromise.display_name_enable === 'true')
|
value: (settingsPromise.display_name_enable === 'true')
|
||||||
};
|
};
|
||||||
|
|
||||||
// binding to the privacy policy revision select
|
// By default, we display the currently published privacy policy
|
||||||
$scope.policyVersion = null;
|
$scope.privacyPolicy = {
|
||||||
|
version: null,
|
||||||
|
bodyTemp: settingsPromise.privacy_body
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For use with 'ng-class', returns the CSS class name for the uploads previews.
|
* For use with 'ng-class', returns the CSS class name for the uploads previews.
|
||||||
@ -170,20 +171,33 @@ Application.Controllers.controller('SettingsController', ['$scope', '$uibModal',
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The privacy policy has its own special save function because updating the policy must notify all users
|
||||||
|
*/
|
||||||
$scope.savePrivacyPolicy = function () {
|
$scope.savePrivacyPolicy = function () {
|
||||||
// open modal
|
// open modal
|
||||||
const modalInstance = $uibModal.open({
|
const modalInstance = $uibModal.open({
|
||||||
templateUrl: '<%= asset_path "admin/settings/save_policy.html" %>',
|
templateUrl: '<%= asset_path "admin/settings/save_policy.html" %>',
|
||||||
controller: 'SavePolicyController'
|
controller: 'SavePolicyController',
|
||||||
|
resolve: {
|
||||||
|
saveCb () { return $scope.save; },
|
||||||
|
privacyPolicy () { return $scope.privacyPolicy; }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// once done, update the invoice model and inform the admin
|
// once done, update the client data
|
||||||
return modalInstance.result.then(function (res) {
|
modalInstance.result.then(function (type) {
|
||||||
$scope.invoices.unshift(res.avoir);
|
Setting.get({ name: 'privacy_draft', history: true }, function (data) {
|
||||||
return Invoice.get({ id: invoice.id }, function (data) {
|
// reset history
|
||||||
invoice.has_avoir = data.has_avoir;
|
$scope.privacyDraftsHistory = [];
|
||||||
return growl.success(_t('invoices.refund_invoice_successfully_created'));
|
data.setting.history.forEach(function (draft) {
|
||||||
});
|
$scope.privacyDraftsHistory.push({ id: draft.id, name: _t('settings.privacy.draft_from_USER_DATE', { USER: draft.user, DATE: draft.created_at }), content: draft.value });
|
||||||
|
});
|
||||||
|
if (type === 'privacy_draft') {
|
||||||
|
// FIXME
|
||||||
|
$scope.privacyPolicy.version = data.setting.history[data.setting.history.length - 1].id;
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -242,7 +256,12 @@ Application.Controllers.controller('SettingsController', ['$scope', '$uibModal',
|
|||||||
* Change the revision of the displayed privacy policy, from drafts history
|
* Change the revision of the displayed privacy policy, from drafts history
|
||||||
*/
|
*/
|
||||||
$scope.handlePolicyRevisionChange = function () {
|
$scope.handlePolicyRevisionChange = function () {
|
||||||
$scope.privacyDraftSetting.value = $scope.privacyDraftsHistory[$scope.policyVersion].content;
|
for (const draft of $scope.privacyDraftsHistory) {
|
||||||
|
if (draft.id == $scope.privacyPolicy.version) {
|
||||||
|
$scope.privacyPolicy.bodyTemp = draft.content;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* PRIVATE SCOPE */
|
/* PRIVATE SCOPE */
|
||||||
@ -288,7 +307,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$uibModal',
|
|||||||
}
|
}
|
||||||
|
|
||||||
privacyDraftsPromise.setting.history.forEach(function (draft) {
|
privacyDraftsPromise.setting.history.forEach(function (draft) {
|
||||||
$scope.privacyDraftsHistory.push({ id: draft.id, name: _t('settings.privacy.draft_from_USER_DATE', { USER: draft.user, DATE: draft.created_at }), content: draft.value });
|
$scope.privacyDraftsHistory.push({ id: draft.id, name: _t('settings.privacy.draft_from_USER_DATE', { USER: draft.user.name, DATE: moment(draft.created_at).format('L LT') }), content: draft.value });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -302,17 +321,30 @@ Application.Controllers.controller('SettingsController', ['$scope', '$uibModal',
|
|||||||
/**
|
/**
|
||||||
* Controller used in the invoice refunding modal window
|
* Controller used in the invoice refunding modal window
|
||||||
*/
|
*/
|
||||||
Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModalInstance', 'growl', '_t',
|
Application.Controllers.controller('SavePolicyController', ['$scope', '$uibModalInstance', 'saveCb', 'privacyPolicy',
|
||||||
function ($scope, $uibModalInstance, growl, _t) {
|
function ($scope, $uibModalInstance, saveCb, privacyPolicy) {
|
||||||
/* PUBLIC SCOPE */
|
/* PUBLIC SCOPE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save as draft the current text
|
||||||
|
*/
|
||||||
$scope.save = function () {
|
$scope.save = function () {
|
||||||
|
saveCb({ name: 'privacy_draft', value: privacyPolicy.bodyTemp });
|
||||||
|
$uibModalInstance.close('privacy_draft');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish the current text as the new privacy policy
|
||||||
|
*/
|
||||||
$scope.publish = function () {
|
$scope.publish = function () {
|
||||||
|
saveCb({ name: 'privacy_body', value: privacyPolicy.bodyTemp });
|
||||||
|
$uibModalInstance.close('privacy_body');
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Cancel the saving, dismiss the modal window
|
||||||
|
*/
|
||||||
$scope.cancel = function () {
|
$scope.cancel = function () {
|
||||||
|
$uibModalInstance.dismiss('cancel');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 col-md-offset-1">
|
<div class="col-md-4 col-md-offset-1">
|
||||||
<select class="form-control m-b" ng-options="d.id as d.name for d in privacyDraftsHistory" ng-model="policyVersion" ng-change="handlePolicyRevisionChange()">
|
<select class="form-control m-b" ng-options="d.id as d.name for d in privacyDraftsHistory" ng-model="privacyPolicy.version" ng-change="handlePolicyRevisionChange()">
|
||||||
<option value="" translate>{{ 'settings.privacy.current_policy' }}</option>
|
<option value="" translate>{{ 'settings.privacy.current_policy' }}</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="text-justify" ng-model="privacyBodySetting.value" medium-editor options='{"placeholder": "{{ "settings.input_the_main_content" | translate }}",
|
<div class="text-justify" ng-model="privacyPolicy.bodyTemp" medium-editor options='{"placeholder": "{{ "settings.input_the_main_content" | translate }}",
|
||||||
"buttons": ["bold", "italic", "anchor", "header1", "header2" ]
|
"buttons": ["bold", "italic", "anchor", "header1", "header2" ]
|
||||||
}'>
|
}'>
|
||||||
|
|
||||||
|
@ -688,6 +688,7 @@ en:
|
|||||||
about_title: "\"About\" page title"
|
about_title: "\"About\" page title"
|
||||||
about_body: "\"About\" page content"
|
about_body: "\"About\" page content"
|
||||||
about_contacts: "\"About\" page contacts"
|
about_contacts: "\"About\" page contacts"
|
||||||
|
privacy_draft: "privacy policy draft"
|
||||||
privacy_body: "privacy policy"
|
privacy_body: "privacy policy"
|
||||||
privacy_dpo: "data protection officer address"
|
privacy_dpo: "data protection officer address"
|
||||||
booking_window_start: "opening time"
|
booking_window_start: "opening time"
|
||||||
|
@ -688,6 +688,7 @@ es:
|
|||||||
about_title: "Título de la página \"Acerca de\""
|
about_title: "Título de la página \"Acerca de\""
|
||||||
about_body: "Contenido de la página \"Acerca de\""
|
about_body: "Contenido de la página \"Acerca de\""
|
||||||
about_contacts: "Página contactos\"Acerca de\""
|
about_contacts: "Página contactos\"Acerca de\""
|
||||||
|
privacy_draft: "privacy policy draft" # translation_missing
|
||||||
privacy_body: "privacy policy" # translation_missing
|
privacy_body: "privacy policy" # translation_missing
|
||||||
privacy_dpo: "data protection officer address" # translation_missing
|
privacy_dpo: "data protection officer address" # translation_missing
|
||||||
booking_window_start: "hora de apertura"
|
booking_window_start: "hora de apertura"
|
||||||
|
@ -688,6 +688,7 @@ fr:
|
|||||||
about_title: "titre de la page \"À propos\""
|
about_title: "titre de la page \"À propos\""
|
||||||
about_body: "corps de la page \"À propos\""
|
about_body: "corps de la page \"À propos\""
|
||||||
about_contacts: "contacts sur la page \"À propos\""
|
about_contacts: "contacts sur la page \"À propos\""
|
||||||
|
privacy_draft: "brouillon de la politique de confidentialité"
|
||||||
privacy_body: "la politique de confidentialité"
|
privacy_body: "la politique de confidentialité"
|
||||||
privacy_dpo: "l'adresse du délégué à la protection des données"
|
privacy_dpo: "l'adresse du délégué à la protection des données"
|
||||||
booking_window_start: "l'heure d'ouverture"
|
booking_window_start: "l'heure d'ouverture"
|
||||||
|
@ -688,6 +688,7 @@ pt:
|
|||||||
about_title: "\"Sobre\" título da página"
|
about_title: "\"Sobre\" título da página"
|
||||||
about_body: "\"Sobre\" conteúdo da página"
|
about_body: "\"Sobre\" conteúdo da página"
|
||||||
about_contacts: "\"Sobre\" página de contatos"
|
about_contacts: "\"Sobre\" página de contatos"
|
||||||
|
privacy_draft: "privacy policy draft" # translation_missing
|
||||||
privacy_body: "privacy policy" # translation_missing
|
privacy_body: "privacy policy" # translation_missing
|
||||||
privacy_dpo: "data protection officer address" # translation_missing
|
privacy_dpo: "data protection officer address" # translation_missing
|
||||||
booking_window_start: "Horário de abertura"
|
booking_window_start: "Horário de abertura"
|
||||||
|
Loading…
Reference in New Issue
Block a user