mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-18 05:20:54 +08:00
Add ordered scope
This commit is contained in:
parent
1bb54d20cf
commit
3db48c44f7
3 changed files with 6 additions and 5 deletions
|
@ -69,7 +69,7 @@ class GlobalActivitiesController < ApplicationController
|
|||
end
|
||||
|
||||
def team_filter
|
||||
render json: current_user.teams.order('LOWER(name)').global_activity_filter(activity_filters, params[:query])
|
||||
render json: current_user.teams.ordered.global_activity_filter(activity_filters, params[:query])
|
||||
end
|
||||
|
||||
def user_filter
|
||||
|
|
|
@ -12,6 +12,7 @@ class Team < ApplicationRecord
|
|||
|
||||
after_create :generate_template_project
|
||||
scope :teams_select, -> { select(:id, :name).order(name: :asc) }
|
||||
scope :ordered, -> { order('LOWER(name)') }
|
||||
|
||||
auto_strip_attributes :name, :description, nullify: false
|
||||
validates :name,
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<%= hidden_field(:user, :current_team_id) %>
|
||||
<div class="dropdown-header"><%= t('nav.team_switch_title') %></div>
|
||||
<div class="team-container">
|
||||
<% current_user.teams.order('LOWER(name)').each do |team| %>
|
||||
<% current_user.teams.ordered.each do |team| %>
|
||||
<li class="team-name-item">
|
||||
<a href="#"
|
||||
data-id="<%= team.id %>"
|
||||
|
@ -191,9 +191,9 @@
|
|||
</li>
|
||||
<li>
|
||||
<%= link_to Constants::ACADEMY_TR_LINK,
|
||||
class: "academy-link flag",
|
||||
title: I18n.t('nav.academy_tooltip'),
|
||||
target: :_blank do
|
||||
class: "academy-link flag",
|
||||
title: I18n.t('nav.academy_tooltip'),
|
||||
target: :_blank do
|
||||
%>
|
||||
<div class="icon-container">
|
||||
<span class="fas fa-graduation-cap"></span>
|
||||
|
|
Loading…
Reference in a new issue