mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 13:28:53 +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
|
end
|
||||||
|
|
||||||
def team_filter
|
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
|
end
|
||||||
|
|
||||||
def user_filter
|
def user_filter
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Team < ApplicationRecord
|
||||||
|
|
||||||
after_create :generate_template_project
|
after_create :generate_template_project
|
||||||
scope :teams_select, -> { select(:id, :name).order(name: :asc) }
|
scope :teams_select, -> { select(:id, :name).order(name: :asc) }
|
||||||
|
scope :ordered, -> { order('LOWER(name)') }
|
||||||
|
|
||||||
auto_strip_attributes :name, :description, nullify: false
|
auto_strip_attributes :name, :description, nullify: false
|
||||||
validates :name,
|
validates :name,
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<%= hidden_field(:user, :current_team_id) %>
|
<%= hidden_field(:user, :current_team_id) %>
|
||||||
<div class="dropdown-header"><%= t('nav.team_switch_title') %></div>
|
<div class="dropdown-header"><%= t('nav.team_switch_title') %></div>
|
||||||
<div class="team-container">
|
<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">
|
<li class="team-name-item">
|
||||||
<a href="#"
|
<a href="#"
|
||||||
data-id="<%= team.id %>"
|
data-id="<%= team.id %>"
|
||||||
|
@ -191,9 +191,9 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to Constants::ACADEMY_TR_LINK,
|
<%= link_to Constants::ACADEMY_TR_LINK,
|
||||||
class: "academy-link flag",
|
class: "academy-link flag",
|
||||||
title: I18n.t('nav.academy_tooltip'),
|
title: I18n.t('nav.academy_tooltip'),
|
||||||
target: :_blank do
|
target: :_blank do
|
||||||
%>
|
%>
|
||||||
<div class="icon-container">
|
<div class="icon-container">
|
||||||
<span class="fas fa-graduation-cap"></span>
|
<span class="fas fa-graduation-cap"></span>
|
||||||
|
|
Loading…
Add table
Reference in a new issue