Skip to content
Snippets Groups Projects
Unverified Commit dee54671 authored by Sébastien Gaya's avatar Sébastien Gaya Committed by GitHub
Browse files

Merge pull request #1521 from noesya/adjustments-server-websites

Ajustements partie Admin serveur
parents 09c74811 2cebb469
No related branches found
No related tags found
No related merge requests found
//= require activestorage
//= require popper
//= require bootstrap-sprockets
//= require jquery3
//= require jquery_ujs
//= require notyf/notyf.min
//= require simple_form_bs5_file_input
//= require sortablejs/Sortable
//= require summernote/summernote-bs5
//= require_self
//= require ./admin/commons/nav
//= require ./admin/commons/sso
//= require_tree ./application/plugins
//= require ./admin/plugins/sortable
//= require_tree ./server
window.osuny = {};
window.osuny.websites = {};
\ No newline at end of file
window.osuny.websites.batchSyncThemes = {
init: function () {
'use strict';
this.syncAllBtn = document.querySelector('.js-sync-all-theme-versions');
this.syncBtns = document.querySelectorAll('.js-sync-theme-version');
this.syncAllBtn.addEventListener('click', this.syncAll.bind(this));
},
syncAll: function (e) {
'use strict';
var i;
e.preventDefault();
for (i = 0; i < this.syncBtns.length; i += 1) {
this.syncBtns[i].click();
}
},
invoke: function () {
'use strict';
return {
init: this.init.bind(this)
};
}
}.invoke();
window.addEventListener('DOMContentLoaded', function () {
'use strict';
if (document.body.classList.contains('websites-manage_versions')) {
window.osuny.websites.batchSyncThemes.init();
}
});
class Server::WebsitesController < Server::ApplicationController
before_action :load_websites, only: [:index, :manage_versions, :update_all_themes]
before_action :load_website, except: [:index, :manage_versions, :update_all_themes]
before_action :load_websites, only: [:index, :manage_versions, :clean_and_rebuild_all_websites]
before_action :load_website, except: [:index, :manage_versions, :clean_and_rebuild_all_websites]
has_scope :for_theme_version
has_scope :for_production
......@@ -19,11 +19,11 @@ class Server::WebsitesController < Server::ApplicationController
add_breadcrumb "Gestion des versions"
end
def update_all_themes
def clean_and_rebuild_all_websites
@websites.find_each do |website|
website.clean_and_rebuild
end
redirect_back(fallback_location: manage_versions_server_websites_path, notice: t('server_admin.websites.update_all_themes_notice'))
redirect_back(fallback_location: manage_versions_server_websites_path, notice: t('server_admin.websites.clean_and_rebuild_all_websites_notice'))
end
def sync_theme_version
......
......@@ -32,7 +32,7 @@
</main>
<%= render "admin/layouts/themes/pure/commands" %>
<%= render "admin/layouts/themes/pure/footer" %>
<%= javascript_include_tag 'admin/pure' %>
<%= javascript_include_tag 'server' %>
<%= render 'bugsnag' %>
</body>
</html>
......@@ -44,7 +44,7 @@
sync_theme_version_server_website_path(website),
method: :post,
remote: true,
class: button_classes if website.url.present? && website.theme_version_url.present? %>
class: "#{button_classes} js-sync-theme-version" if website.url.present? && website.theme_version_url.present? %>
<%= link_to t('server_admin.websites.buttons.theme.update'),
update_theme_server_website_path(website),
method: :post,
......@@ -58,8 +58,11 @@
</div>
<% content_for :action_bar_left do %>
<%= link_to "Synchroniser toutes les versions de thème",
"#",
class: "#{button_classes} js-sync-all-theme-versions" %>
<%= link_to "Tout mettre à jour",
update_all_themes_server_websites_path(current_scopes),
clean_and_rebuild_all_websites_server_websites_path(current_scopes),
method: :post,
class: button_classes %>
<% end %>
\ No newline at end of file
......@@ -337,8 +337,8 @@ en:
theme:
sync: Sync version
update: Update theme
clean_and_rebuild_all_websites_notice: All themes will be updated. This can take a few minutes.
sync_theme_version_notice: The theme's version of %{website} has been synced
update_all_themes_notice: All themes will be updated. This can take a few minutes.
update_theme_notice: The theme of %{website} will be updated in a moment
seo: SEO
simple_form:
......
......@@ -144,7 +144,7 @@ fr:
summary:
label: Résumé
hint: Un texte court, comme un chapô pour un article. Ne mettez pas tout le contenu ici, pour ça, il y a les blocs !
translation:
translation:
button: Traduire avec LibreTranslate
done: Traduction effectuée ! Merci de relire avant d'enregistrer.
running: Traduction en cours
......@@ -337,8 +337,8 @@ fr:
theme:
sync: Synchroniser la version
update: Mettre à jour le thème
clean_and_rebuild_all_websites_notice: Tous les thèmes vont être mis à jour. Cela peut prendre quelques minutes.
sync_theme_version_notice: La version du thème de %{website} a été synchronisée
update_all_themes_notice: Tous les thèmes vont être mis à jour. Cela peut prendre quelques minutes.
update_theme_notice: Le thème de %{website} va être mis à jour dans quelques instants
seo: SEO
simple_form:
......
......@@ -4,7 +4,7 @@ namespace :server do
resources :websites do
collection do
get :manage_versions
post :update_all_themes
post :clean_and_rebuild_all_websites
end
member do
post :sync_theme_version
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment