mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 09:13:05 +08:00
Merge pull request #4529 from okriuchykhin/ok_SCI_6943_v2
Unify tags loading order [SCI-6943]
This commit is contained in:
commit
63a1b35a45
5 changed files with 8 additions and 13 deletions
|
@ -7,7 +7,7 @@ class MyModuleTagsController < ApplicationController
|
|||
|
||||
def index_edit
|
||||
@my_module_tags = @my_module.my_module_tags.order(:id)
|
||||
@unassigned_tags = @my_module.unassigned_tags
|
||||
@unassigned_tags = @my_module.unassigned_tags.order(:id)
|
||||
@new_mmt = MyModuleTag.new(my_module: @my_module)
|
||||
@new_tag = Tag.new(project: @my_module.experiment.project)
|
||||
|
||||
|
|
|
@ -188,12 +188,7 @@ class MyModule < ApplicationRecord
|
|||
end
|
||||
|
||||
def unassigned_tags
|
||||
Tag.find_by_sql(
|
||||
"SELECT DISTINCT tags.id, tags.name, tags.color FROM tags " +
|
||||
"INNER JOIN experiments ON experiments.project_id = tags.project_id " +
|
||||
"WHERE experiments.id = #{experiment_id.to_s} AND tags.id NOT IN " +
|
||||
"(SELECT DISTINCT tag_id FROM my_module_tags WHERE my_module_tags.my_module_id = #{id.to_s})"
|
||||
)
|
||||
experiment.project.tags.where.not(id: tags)
|
||||
end
|
||||
|
||||
def last_activities(count = Constants::ACTIVITY_AND_NOTIF_SEARCH_LIMIT)
|
||||
|
|
|
@ -6,7 +6,7 @@ module Reports::Docx::DrawMyModule
|
|||
link_style = @link_style
|
||||
scinote_url = @scinote_url
|
||||
my_module = subject.my_module
|
||||
tags = my_module.tags
|
||||
tags = my_module.tags.order(:id)
|
||||
return unless can_read_my_module?(@user, my_module)
|
||||
|
||||
@docx.h3 do
|
||||
|
@ -48,10 +48,10 @@ module Reports::Docx::DrawMyModule
|
|||
end
|
||||
end
|
||||
|
||||
if tags.any?
|
||||
if tags.present?
|
||||
@docx.p do
|
||||
text I18n.t('projects.reports.elements.module.tags_header')
|
||||
my_module.tags.each do |tag|
|
||||
tags.each do |tag|
|
||||
text ' '
|
||||
text "[#{tag.name}]", color: tag.color.delete('#')
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="tags-container pull-right">
|
||||
<% tags2 = my_module.tags[0..3] %>
|
||||
<% tags2 = my_module.tags.order(:id).take(4) %>
|
||||
<% tags2.each do |tag| %>
|
||||
<div style="color: <%= tag.color %>"
|
||||
class="<%= "last" if tag == tags2[-1] %>"
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
<div class="pull-left">
|
||||
<%= t('projects.reports.elements.module.tags_header') %>
|
||||
</div>
|
||||
<% if my_module.tags.present? %>
|
||||
<% my_module.tags.each do |tag| %>
|
||||
<% if (tags = my_module.tags.order(:id)).present? %>
|
||||
<% tags.each do |tag| %>
|
||||
<div class="pull-left module-tag" style="background-color: <%= tag.color %>;">
|
||||
<%= tag.name %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue