New UI changes(tags, categories, authorisations, module index…)

To run:
  - ruby lib/remove_old_tags.rb DB_NAME
  - rake new_ui:migrate_tags
  - rake new_ui:migrate_categories['APP_KEY,''MODEL_NAME'] (check new_ui.rake for more details)
This commit is contained in:
chris committed 2013-07-02 16:46:44 +08:00
1 parent 07b3857465
commit 856898016b
1495 files changed
+52132 -9876

No files matched your search

@@ -1,8 +0,0 @@
class Panel::Faq::BackEnd::TagsController < Admin::TagsController
def initialize
super
@app_title = 'faq'
end
end
-10
View File
@@ -1,10 +0,0 @@
class FaqTag < Tag
has_and_belongs_to_many :qas
def get_visible_links(sort = :title)
self.qas.where(:is_hidden => false).desc(:is_top, sort)
end
end
+4 -27
View File
@@ -4,25 +4,16 @@ class Qa
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) }
include OrbitModel::LanguageRestrict
include OrbitModel::Status
include OrbitTag::Taggable
field :title, localize: true
field :answer, localize: true
#has_and_belongs_to_many :tags, :class_name => "FaqTag"
field :create_user_id
field :update_user_id
field :is_top, :type => Boolean, :default => false
field :is_hot, :type => Boolean, :default => false
field :is_hidden, :type => Boolean, :default => false
scope :can_display,where(is_hidden: false)
has_many :qa_links, :autosave => true, :dependent => :destroy
has_many :qa_files, :autosave => true, :dependent => :destroy
@@ -32,7 +23,7 @@ class Qa
belongs_to :qa_category
before_save :update_avliable_language, :clean_values
before_save :clean_values
validates :title, :at_least_one => true
@@ -58,20 +49,6 @@ class Qa
end
def is_top?
self.is_top
end
def update_avliable_language
VALID_LOCALES.each do |locale|
if (title_translations[locale].blank? rescue true)
self["available_for_#{locale}".to_sym] = false
else
self["available_for_#{locale}".to_sym] = true
end
end
end
protected
def qa_category_with_title
+4 -2
View File
@@ -39,6 +39,8 @@ module Faq
# end
end
taggable
side_bar do
head_label_i18n 'faq.faq',:icon_class=>"icons-help"
available_for [:admin,:guest,:manager,:sub_manager]
@@ -66,9 +68,9 @@ module Faq
:available_for => [:manager]
context_link 'tags',
:link_path=>"admin_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Faq'}))" ,
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Faq'}))" ,
:priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index},
:active_for_tag => 'Faq',
:available_for => [:manager]
end
end