queries need to be rethink
This commit is contained in:
parent
caf0426bd4
commit
167a71272a
|
@ -2,6 +2,8 @@ class Asset
|
|||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
mount_uploader :data, FileAssetUploader
|
||||
|
||||
|
@ -16,15 +18,10 @@ class Asset
|
|||
|
||||
belongs_to :asset_category
|
||||
belongs_to :assetable, polymorphic: true
|
||||
has_and_belongs_to_many :tags, :class_name => "AssetTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "AssetTag"
|
||||
|
||||
before_save :clean_tags
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def clean_tags
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
class Panel::Announcement::BackEnd::TagsController < Admin::TagsController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'announcement'
|
||||
end
|
||||
|
||||
end
|
|
@ -199,12 +199,6 @@ class Bulletin
|
|||
return nil
|
||||
end
|
||||
|
||||
# def sorted_tags
|
||||
# #tags.order_by(I18n.locale, :asc)
|
||||
# tags
|
||||
# end
|
||||
|
||||
|
||||
def to_preview
|
||||
preview_object = Preview.new(:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_announcement_front_end_bulletin_path",:object_class_type=>"Bulletin")
|
||||
|
||||
|
|
|
@ -61,11 +61,6 @@ class ArchiveFile
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
|
||||
def get_file_icon( file_data )
|
||||
file_icon = "<span class=\"o-archives-file-type\">#{file_data.split('.')[-1]}</span>".html_safe
|
||||
|
|
|
@ -62,11 +62,6 @@ class Qa
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
class GalleryImage
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::Timestamps
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
mount_uploader :file, GalleryUploader
|
||||
mount_uploader :file, GalleryUploader
|
||||
|
||||
field :title
|
||||
field :description, localize: true
|
||||
field :title
|
||||
field :description, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "GalleryTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "GalleryTag"
|
||||
|
||||
belongs_to :gallery_album
|
||||
belongs_to :gallery_album
|
||||
|
||||
end
|
|
@ -4,6 +4,8 @@ class WritingBook
|
|||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
|
@ -17,7 +19,7 @@ class WritingBook
|
|||
field :publisher, localize: true
|
||||
field :editor, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalBookTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalBookTag"
|
||||
|
||||
has_and_belongs_to_many :book_author_types
|
||||
|
||||
|
@ -78,11 +80,6 @@ class WritingBook
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -3,6 +3,9 @@ class WritingConference
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -13,7 +16,7 @@ class WritingConference
|
|||
field :location, localize: true
|
||||
field :sponsor, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalConferenceTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalConferenceTag"
|
||||
has_and_belongs_to_many :conference_author_types
|
||||
has_and_belongs_to_many :conference_paper_types
|
||||
has_and_belongs_to_many :conference_co_authors
|
||||
|
@ -79,11 +82,6 @@ class WritingConference
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,6 +5,9 @@ class Diploma
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -15,7 +18,7 @@ class Diploma
|
|||
field :department, localize: true
|
||||
field :degree, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalDiplomaTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalDiplomaTag"
|
||||
|
||||
field :year
|
||||
field :language
|
||||
|
@ -51,11 +54,6 @@ class Diploma
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,6 +5,9 @@ class Experience
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -14,7 +17,7 @@ class Experience
|
|||
field :department, localize: true
|
||||
field :job_title, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalExperienceTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalExperienceTag"
|
||||
|
||||
belongs_to :experience_category
|
||||
|
||||
|
@ -65,11 +68,6 @@ class Experience
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,13 +5,16 @@ class Honor
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
||||
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalHonorTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalHonorTag"
|
||||
|
||||
belongs_to :honor_category
|
||||
|
||||
|
@ -62,11 +65,6 @@ class Honor
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -3,13 +3,16 @@ class WritingJournal
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
||||
field :paper_title, localize: true
|
||||
field :journal_title, localize: true
|
||||
field :authors, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalJournalTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalJournalTag"
|
||||
has_and_belongs_to_many :journal_author_types
|
||||
has_and_belongs_to_many :journal_level_types
|
||||
has_and_belongs_to_many :journal_co_authors
|
||||
|
@ -80,11 +83,6 @@ class WritingJournal
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,6 +5,9 @@ class Lab
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -15,7 +18,7 @@ class Lab
|
|||
field :participating_professor, localize: true
|
||||
field :participating_student, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalLabTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalLabTag"
|
||||
|
||||
field :year
|
||||
field :language
|
||||
|
@ -71,11 +74,6 @@ class Lab
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,6 +5,9 @@ class WritingPatent
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -13,7 +16,7 @@ class WritingPatent
|
|||
field :patent_title, localize: true
|
||||
field :authors, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalPatentTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalPatentTag"
|
||||
|
||||
belongs_to :writing_patent_category
|
||||
|
||||
|
@ -71,11 +74,6 @@ class WritingPatent
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,6 +5,9 @@ class Project
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -15,7 +18,7 @@ class Project
|
|||
field :participator, localize: true
|
||||
field :unit, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalProjectTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalProjectTag"
|
||||
|
||||
belongs_to :project_category
|
||||
|
||||
|
@ -73,11 +76,6 @@ class Project
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -5,6 +5,9 @@ class Research
|
|||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
include OrbitTag::Taggable
|
||||
taggable
|
||||
|
||||
# scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
|
||||
LANGUAGE_TYPES = [ "English", "Chinese" ]
|
||||
|
@ -14,7 +17,7 @@ class Research
|
|||
field :authors, localize: true
|
||||
field :extracted_chapters, localize: true
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalResearchTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalResearchTag"
|
||||
|
||||
field :year
|
||||
field :language
|
||||
|
@ -68,11 +71,6 @@ class Research
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
|
@ -58,11 +58,6 @@ class WebLink
|
|||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
VALID_LOCALES.each do |locale|
|
||||
if (title_translations[locale].blank? rescue true)
|
||||
|
|
Loading…
Reference in New Issue