Skip to content

Commit

Permalink
Fix #732, make the sidebar floating ad add a "go to top" button
Browse files Browse the repository at this point in the history
  • Loading branch information
xhero committed Nov 30, 2021
1 parent c801afa commit bfc55b0
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/admin/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def new
active_admin_comments if !is_selection_mode?
end

sidebar :actions, :only => :show do
sidebar :actions, :class => "sidebar_tabs", :only => :show do
render :partial => "activeadmin/section_sidebar_show", :locals => { :item => @arbre_context.assigns[:item] }
end

Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/marc_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,6 @@ function marc_editor_get_model() {
return $("#marc_editor_panel").data("editor-model");
}

function marc_editor_go_to_top() {
$('html, body').animate({ scrollTop: 0 }, 'fast');
}
21 changes: 14 additions & 7 deletions app/views/activeadmin/_section_sidebar_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@
:class => "muscat_icon_link muscat_icon_link_list") %>
</li>

<%if @item && @item.id && @item.respond_to?(:allow_holding?) && @item.allow_holding? %>
<li class="muscat_icon_separator"></li>
<li class="muscat_icon_link">
<%= link_to("#{I18n.t :new_holding}", new_admin_holding_path(source_id: @item.id),
:class => "muscat_icon_link muscat_icon_link_new") %>
</li>
<%end%>
<% if item.is_a?(Source) %>
<li class="muscat_icon_link">
<%= link_to(I18n.t(:go_to_top), "javascript:marc_editor_go_to_top()",
:class => "muscat_icon_link muscat_icon_link_up") %>
</li>
<% end %>
<%if @item && @item.id && @item.respond_to?(:allow_holding?) && @item.allow_holding? %>
<li class="muscat_icon_separator"></li>
<li class="muscat_icon_link">
<%= link_to("#{I18n.t :new_holding}", new_admin_holding_path(source_id: @item.id),
:class => "muscat_icon_link muscat_icon_link_new") %>
</li>
<%end%>

<li class="muscat_icon_separator"></li>

Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ de:
# Sidebar
delete: "Löschen"
to_the_list: "Zurück zur Liste"
go_to_top: "Zurück zum Anfang"
edit: "Bearbeiten"
new: "Erstellen"
duplicate: "Kopieren"
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ en:
# Sidebar
delete: "Delete"
to_the_list: "Return to the list"
go_to_top: "Back to the top"
edit: "Edit"
new: "Create"
duplicate: "Duplicate"
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ es:
# Sidebar
delete: "Borrar"
to_the_list: "Volver a la lista"
go_to_top: "Volver al principio"
edit: "Editar"
new: "Crear"
duplicate: "Duplicar"
Expand Down
3 changes: 2 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,11 @@ fr:
# Sidebar
delete: "Supprimer"
to_the_list: "Retourner à la liste"
go_to_top: "Retour en haut de la page"
edit: "Modifier"
new: "Créer"
duplicate: "Dupliquer"
merge: "MERGE"
merge: "Fusionner"
no_action: "Aucune action possible"
reindex: "Ré-indexer"
resave: "Resauver"
Expand Down
1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ it:
# Sidebar
delete: "Cancella"
to_the_list: "Ritorna all'indice"
go_to_top: "Ritorna in cima"
edit: "Modifica"
new: "Crea"
duplicate: "Duplica"
Expand Down
1 change: 1 addition & 0 deletions config/locales/pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ pl:
# Sidebar
delete: Usuń
to_the_list: Wróć do listy
go_to_top: Powrót na górę
edit: Edytuj
new: Utwórz
duplicate: Powiel
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ pt:
# Sidebar
delete: "Apagar"
to_the_list: "Retornar à lista"
go_to_top: "Voltar ao início"
edit: "Editar"
new: "Criar"
duplicate: "Duplicar"
Expand Down
Binary file added public/images/marc-icons/up_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bfc55b0

Please sign in to comment.