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
|
||||
|
|
|
@ -60,11 +60,6 @@ class Qa
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -76,11 +78,6 @@ class WritingBook
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -4,6 +4,9 @@ class Diploma
|
|||
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) }
|
||||
|
||||
|
@ -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
|
||||
|
@ -49,11 +52,6 @@ class Diploma
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -4,6 +4,9 @@ class Experience
|
|||
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) }
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -63,11 +66,6 @@ class Experience
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -4,6 +4,9 @@ class Honor
|
|||
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) }
|
||||
|
||||
|
@ -11,7 +14,7 @@ class Honor
|
|||
|
||||
|
||||
|
||||
has_and_belongs_to_many :tags, :class_name => "PersonalHonorTag"
|
||||
# has_and_belongs_to_many :tags, :class_name => "PersonalHonorTag"
|
||||
|
||||
belongs_to :honor_category
|
||||
|
||||
|
@ -60,11 +63,6 @@ class Honor
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -4,6 +4,9 @@ class Lab
|
|||
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) }
|
||||
|
||||
|
@ -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
|
||||
|
@ -69,11 +72,6 @@ class Lab
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -4,6 +4,9 @@ class WritingPatent
|
|||
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) }
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -69,11 +72,6 @@ class WritingPatent
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -4,6 +4,9 @@ class Project
|
|||
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) }
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -71,11 +74,6 @@ class Project
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -4,6 +4,9 @@ class Research
|
|||
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) }
|
||||
|
||||
|
@ -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
|
||||
|
@ -66,11 +69,6 @@ class Research
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
|
@ -56,11 +56,6 @@ class WebLink
|
|||
|
||||
def is_top?
|
||||
self.is_top
|
||||
end
|
||||
|
||||
def sorted_tags
|
||||
#tags.order_by(I18n.locale, :asc)
|
||||
tags
|
||||
end
|
||||
|
||||
def update_avliable_language
|
||||
|
|
Reference in New Issue