mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-25 09:13:02 +08:00
Redesign of sorting button for projects/experiments cards
This commit is contained in:
parent
7f415a551d
commit
47ccf38662
7 changed files with 33 additions and 25 deletions
|
@ -529,6 +529,7 @@
|
|||
if (projectsViewSort !== $(this).data('sort')) {
|
||||
$('#sortMenuDropdown a').removeClass('disabled');
|
||||
projectsViewSort = $(this).data('sort');
|
||||
$('#sortMenu').html(I18n.t('general.sort.' + projectsViewSort + '_html'));
|
||||
loadCardsView();
|
||||
$(this).addClass('disabled');
|
||||
$('#sortMenu').dropdown('toggle');
|
||||
|
|
|
@ -17,6 +17,18 @@ $color-module-hover: $brand-primary;
|
|||
}
|
||||
}
|
||||
|
||||
#sortMenu {
|
||||
border-color: $color-white;
|
||||
|
||||
&:not(:focus) {
|
||||
color: $color-silver-chalice;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Secondary navigation */
|
||||
|
||||
.navbar-nav {
|
||||
|
@ -483,7 +495,7 @@ li.module-hover {
|
|||
height: 400px;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 35px;
|
||||
margin-top: 45px;
|
||||
margin-top: 15px;
|
||||
max-width: 700px;
|
||||
|
||||
.panel-title {
|
||||
|
|
|
@ -232,7 +232,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
# This is the "info" view
|
||||
current_team_switch(@project.team)
|
||||
@current_sort = @project.experiments_order
|
||||
@current_sort = @project.experiments_order || :new
|
||||
end
|
||||
|
||||
def notifications
|
||||
|
|
|
@ -122,17 +122,16 @@
|
|||
<!-- project sort -->
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<span class="hidden-xs"><%= t'projects.index.sort' %></span>
|
||||
<span class="visible-xs-inline"><i class="fas fa-sort"></i></span>
|
||||
<span><%= t("general.sort.#{@current_sort}_html") %></span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul id="sortMenuDropdown" class="dropdown-menu" aria-labelledby="sortMenu">
|
||||
<% ["new", "old", "atoz", "ztoa"].each do |sort| %>
|
||||
<li>
|
||||
<% if @current_sort != sort %>
|
||||
<a href="#" data-sort="<%= sort %>"><%= t('projects.index.sort_' + sort) %></a>
|
||||
<a href="#" data-sort="<%= sort %>"><%= t("general.sort.#{sort}_html") %></a>
|
||||
<% else %>
|
||||
<a class="disabled" href="#" data-sort="<%= sort %>"><%= t('projects.index.sort_' + sort) %></a>
|
||||
<a class="disabled" href="#" data-sort="<%= sort %>"><%= t("general.sort.#{sort}_html") %></a>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -12,17 +12,18 @@
|
|||
<!-- experiment sort -->
|
||||
<div class="dropdown pull-left">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<span class="hidden-xs"><%= t'projects.index.sort' %></span>
|
||||
<span class="visible-xs-inline"><i class="fas fa-sort"></i></span>
|
||||
<span><%= t("general.sort.#{@current_sort}_html") %></span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="sortMenu">
|
||||
<% ["new", "old", "atoz", "ztoa"].each do |sort| %>
|
||||
<% if @current_sort != sort %>
|
||||
<li><a href="?<%= {sort: sort}.reject{|v| v.to_s == "0"}.to_query %>"><%= t('projects.index.sort_' + sort) %></a></li>
|
||||
<% else %>
|
||||
<li class="disabled"><a href="#"><%= t('projects.index.sort_' + sort) %></a></li>
|
||||
<% end %>
|
||||
<li>
|
||||
<% if @current_sort != sort %>
|
||||
<a href="?<%= {sort: sort}.reject{|v| v.to_s == "0"}.to_query %>"><%= t("general.sort.#{sort}_html") %></a>
|
||||
<% else %>
|
||||
<a class="disabled" href="#"><%= t("general.sort.#{sort}_html") %></a>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="dropdown attachments-order" id="dd-att-step-<%= step.id %>">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<span id="dd-att-step-<%= step.id %>-label">
|
||||
<%= t("protocols.steps.attachments.sort.#{step.current_view_state(current_user).state.dig('assets', 'sort')}_html") %>
|
||||
<%= t("general.sort.#{step.current_view_state(current_user).state.dig('assets', 'sort')}_html") %>
|
||||
</span>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<% ['new', 'old', 'atoz', 'ztoa'].each do |sort| %>
|
||||
<li>
|
||||
<a data-order="<%= sort %>" onClick="reorderAttachments(this, '<%= step.id %>', '<%= sort %>')">
|
||||
<%= t("protocols.steps.attachments.sort.#{sort}_html") %>
|
||||
<%= t("general.sort.#{sort}_html") %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -266,11 +266,6 @@ en:
|
|||
delete_user_confirm: "Are you sure you wish to remove user %{user} from project %{project}?"
|
||||
team_filter: "Show projects from"
|
||||
all_filter: "All"
|
||||
sort: "Sort by"
|
||||
sort_new: "Newest first"
|
||||
sort_old: "Oldest first"
|
||||
sort_atoz: "From A to Z"
|
||||
sort_ztoa: "From Z to A"
|
||||
start_date: "Start date:"
|
||||
activity_tab: "Activity"
|
||||
users_tab: "Users"
|
||||
|
@ -1820,11 +1815,6 @@ en:
|
|||
complete_title: "Complete Step"
|
||||
uncomplete_title: "Uncomplete Step"
|
||||
attachments:
|
||||
sort:
|
||||
new_html: "Newest first ↓"
|
||||
old_html: "Oldest first ↑"
|
||||
atoz_html: "Name ↓"
|
||||
ztoa_html: "Name ↑"
|
||||
modified_label: "Modified:"
|
||||
new:
|
||||
add_step_title: "Add new step"
|
||||
|
@ -2029,6 +2019,11 @@ en:
|
|||
more_comments: "More comments"
|
||||
comment_placeholder: "Your Message"
|
||||
comment_placeholder_new: "Add new comment…"
|
||||
sort:
|
||||
new_html: "Newest first ↓"
|
||||
old_html: "Oldest first ↑"
|
||||
atoz_html: "Name ↓"
|
||||
ztoa_html: "Name ↑"
|
||||
module:
|
||||
one: "task"
|
||||
other: "tasks"
|
||||
|
|
Loading…
Reference in a new issue