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:
1 parent
07b3857465
commit
856898016b
1495 files changed
+52132
-9876
No files matched your search
@@ -8,7 +8,7 @@ module ContextLinkRenderer
|
||||
@params = params
|
||||
@current_user = current_user
|
||||
if display?
|
||||
content_tag :li, link_to((I18n.t(@label_i18n) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, eval(@path)), :class => (active? ? 'active' : nil)
|
||||
content_tag :li, link_to(content_tag(:span, I18n.t(@label_i18n)), eval(@path)), :class => (active? ? 'active' : nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,10 +9,14 @@ module Renderer
|
||||
protected
|
||||
def active_for_app_auth?
|
||||
module_app = get_module_app
|
||||
if module_app.nil?
|
||||
false
|
||||
if controller.eql?('admin/module_apps_new_interface')
|
||||
if module_app.nil?
|
||||
false
|
||||
else
|
||||
module_app.id.to_s == @params[:module_app_id] ? true : false
|
||||
end
|
||||
else
|
||||
module_app.id.to_s == @params[:module_app_id] ? true : false
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,6 +32,32 @@ protected
|
||||
end
|
||||
end
|
||||
|
||||
def active_for_category?
|
||||
module_app = get_module_app
|
||||
if controller.eql?('admin/categories')
|
||||
if module_app.nil?
|
||||
false
|
||||
else
|
||||
module_app.id.to_s == @params[:module_app_id] ? true : false
|
||||
end
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def active_for_tag?
|
||||
module_app = get_module_app
|
||||
if controller.eql?('admin/module_tags')
|
||||
if module_app.nil?
|
||||
false
|
||||
else
|
||||
module_app.id.to_s == @params[:module_app_id] ? true : false
|
||||
end
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def current_user
|
||||
current_or_guest_user
|
||||
end
|
||||
|
||||
@@ -1,21 +1,39 @@
|
||||
module SideBarRenderer
|
||||
include Renderer
|
||||
include AdminHelper
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
def render(request,params,user,current_module_app)
|
||||
@belong_module_app = get_module_app
|
||||
@current_module_app = current_module_app
|
||||
@request = request
|
||||
@params = params
|
||||
@current_user = user
|
||||
if display?
|
||||
content_tag :div, class: "sub-nav-block #{@icon_class}" do
|
||||
concat content_tag :h4, I18n.t(@head_label)
|
||||
concat (content_tag :ul, class: "nav nav-list" do
|
||||
@context_links.sort_by {| obj | obj.priority}.map{ |link|
|
||||
link.render(request, params, @current_module_app, @current_user, @belong_module_app)
|
||||
}.join.html_safe
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_head(request, params, user, current_module_app)
|
||||
@belong_module_app = get_module_app
|
||||
@current_module_app = current_module_app
|
||||
@request = request
|
||||
@params = params
|
||||
@current_user = user
|
||||
if display?
|
||||
content_tag :li, :class => (module_sidebar_active? ? 'active' : nil) do
|
||||
buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link))
|
||||
buf << content_tag( :ul, :class => ("nav nav-list active") )do # visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory"))
|
||||
@context_links.sort_by! {| obj | obj.priority}.collect do |link|
|
||||
link.render(request,params,@current_module_app,@current_user,@belong_module_app)
|
||||
end.join.html_safe
|
||||
end
|
||||
content_tag :li, class: (module_sidebar_active? ? 'active' : nil) do
|
||||
link_to eval(@head_link) do
|
||||
content_tag :span do
|
||||
content_tag(:i, nil, class: @icon_class)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -35,7 +53,7 @@ module SideBarRenderer
|
||||
end
|
||||
|
||||
def module_sidebar_active?
|
||||
active_for_controller? or active_for_app_auth? or active_for_ob_auths?
|
||||
active_for_controller? or active_for_app_auth? or active_for_ob_auths?or active_for_category? or active_for_tag?
|
||||
end
|
||||
|
||||
def active_for_controller?
|
||||
|
||||
@@ -37,7 +37,9 @@ module OrbitApp
|
||||
@front_end_app_pages = nil
|
||||
@module_label = 'rulingcom.errors.init.module_app_noname'
|
||||
@data_count = 1..15 # as default
|
||||
@has_category = nil
|
||||
@has_tag = nil
|
||||
@is_authorizable = nil
|
||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||
setup_module_app
|
||||
end
|
||||
@@ -92,6 +94,10 @@ module OrbitApp
|
||||
@data_count
|
||||
end
|
||||
|
||||
def get_icon_class
|
||||
@side_bar.get_icon_class
|
||||
end
|
||||
|
||||
def get_widget_by_path(path)
|
||||
if @widget_set
|
||||
@widget_set.find_by_path(path)
|
||||
@@ -112,14 +118,6 @@ module OrbitApp
|
||||
@widget_set.nil? ? {} : @widget_set.to_module_app_format
|
||||
end
|
||||
|
||||
def get_categories
|
||||
@widget_set.get_categories rescue []
|
||||
end
|
||||
|
||||
def get_tags
|
||||
@widget_set.get_tags rescue []
|
||||
end
|
||||
|
||||
def front_end(&block) #setter for front_end from init
|
||||
@front_end_app_pages = FrontendUtility::AppPageSet.new(@name,@key,&block)
|
||||
end
|
||||
@@ -145,14 +143,30 @@ module OrbitApp
|
||||
define_method(field){|var| instance_variable_set( "@" + field, var)}
|
||||
end
|
||||
|
||||
def authorizable
|
||||
@is_authorizable = true
|
||||
end
|
||||
|
||||
def categorizable
|
||||
@has_category = true
|
||||
end
|
||||
|
||||
def taggable
|
||||
@has_tag = true
|
||||
end
|
||||
|
||||
def get_has_category
|
||||
@has_category.nil? ? false : true
|
||||
end
|
||||
|
||||
def get_has_tags
|
||||
@has_tag.nil? ? false : true
|
||||
end
|
||||
|
||||
def get_is_authorizable
|
||||
@is_authorizable.nil? ? false : true
|
||||
end
|
||||
|
||||
end # of class DataSheet
|
||||
|
||||
end
|
||||
|
||||
@@ -48,6 +48,7 @@ module OrbitApp
|
||||
@active_for_controllers = []
|
||||
@active_for_object_auth = []
|
||||
@active_for_app_auth = []
|
||||
@active_for_tag = []
|
||||
@head_link = ""
|
||||
@app_base_path = ''
|
||||
@module_app_key = key
|
||||
@@ -63,11 +64,19 @@ module OrbitApp
|
||||
def get_sidebar_order!
|
||||
@sidebar_order = (get_module_app.sidebar_order rescue 0)
|
||||
end
|
||||
|
||||
def get_icon_class
|
||||
@icon_class
|
||||
end
|
||||
|
||||
def get_module_app
|
||||
@get_module_app.call
|
||||
end
|
||||
|
||||
def get_module_app_key
|
||||
@module_app_key
|
||||
end
|
||||
|
||||
def head_label_i18n(var,options ={})
|
||||
@head_label = var
|
||||
@icon_class = options[:icon_class]
|
||||
@@ -139,6 +148,8 @@ module OrbitApp
|
||||
@active_for_action = options[:active_for_action] || []
|
||||
@active_for_object_auth = options[:active_for_object_auth] || []
|
||||
@active_for_app_auth = options[:active_for_app_auth] || []
|
||||
@active_for_category = options[:active_for_category] || []
|
||||
@active_for_tag = options[:active_for_tag] || []
|
||||
@module_app_key = options[:module_app_key]
|
||||
@get_module_app = options[:get_module_app]
|
||||
end
|
||||
@@ -169,7 +180,9 @@ module OrbitApp
|
||||
for_action = @active_for_action.blank? ? false : active_for_action?
|
||||
for_app_auth = @active_for_app_auth.blank? ? false : active_for_app_auth?
|
||||
for_ob_auth = @active_for_object_auth.blank? ? false : active_for_ob_auths?
|
||||
for_action || for_app_auth || for_ob_auth
|
||||
for_category = @active_for_category.blank? ? false : active_for_category?
|
||||
for_tag = @active_for_tag.blank? ? false : active_for_tag?
|
||||
for_action || for_app_auth || for_ob_auth || for_tag
|
||||
end
|
||||
|
||||
def active_for_action?
|
||||
|
||||
Reference in new issue
Block a user