Merge branch 'sidebar_config' into ntu
Conflicts: app/controllers/admin/object_auths_new_interface_controller.rb app/controllers/orbit_backend_controller.rb app/controllers/orbit_widget_controller.rb app/models/module_app.rb app/views/admin/page_parts/_module_widget.html.erb config/locales/zh_tw.yml lib/parsers/parser_common.rb lib/parsers/parser_front_end.rb
This commit is contained in:
commit
76296ab29b
160 files changed
+8659
-1037
No files matched your search
@@ -94,7 +94,12 @@ class Admin::DesignsController < OrbitBackendController
|
||||
|
||||
def destroy
|
||||
@design = Design.find(params[:id])
|
||||
@design.destroy
|
||||
if @site.design == @design
|
||||
flash[:error] = "Failed! You can not delete a design that used by default "
|
||||
else
|
||||
@design.destroy
|
||||
flash[:notice] = "Successfully deleted design."
|
||||
end
|
||||
redirect_to admin_designs_url
|
||||
end
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
def force_order
|
||||
authenticate_user!
|
||||
set_module_app
|
||||
setup_vars
|
||||
check_if_user_can_do_object_auth
|
||||
end
|
||||
|
||||
@@ -80,15 +81,25 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
|
||||
end
|
||||
|
||||
def setup_vars
|
||||
if request.env['HTTP_REFERER'].split('/')[4] == "object_auths"
|
||||
http_referer = request.env['HTTP_REFERER'] || ''
|
||||
if http_referer.split('/')[4] == "object_auths"
|
||||
@app_key = params[:app_key]
|
||||
else
|
||||
@app_key = request.env['HTTP_REFERER'].split('/')[4]
|
||||
@app_key = http_referer.split('/')[4]
|
||||
end
|
||||
|
||||
#@app_key = request.fullpath.split('/')[1] if(@app_key == "back_end")
|
||||
@app_key.gsub!(/[?].*/,'')
|
||||
@module_app = ModuleApp.first(conditions: {:key => @app_key} )
|
||||
if @app_key
|
||||
@app_key.gsub!(/[?].*/,'')
|
||||
@module_app = ModuleApp.first(conditions: {:key => @app_key} )
|
||||
if @module_app.nil?
|
||||
raise ObjectAuthError, 'Auth procress failed, module_app not exist '
|
||||
end
|
||||
else
|
||||
raise ObjectAuthError, 'Auth procress failed, pls redo your sop'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -37,13 +37,18 @@ class Admin::PagePartsController < ApplicationController
|
||||
# @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
|
||||
# end
|
||||
|
||||
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
|
||||
|
||||
if @module_app.widgets.any?{|b| b.class == Array}
|
||||
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
|
||||
end
|
||||
# TODO 應該要有一些東西來決定 @categories @tags
|
||||
# case @module_app.key
|
||||
# when 'announcement'
|
||||
# @categories = BulletinCategory.all
|
||||
# @tags = AnnouncementTag.all
|
||||
# when 'news'
|
||||
# @categories = NewsBulletinCategory.all
|
||||
# @tags = NewsTag.all
|
||||
# when 'gallery'
|
||||
# @albums = GalleryAlbum.all
|
||||
# when 'web_resource'
|
||||
# @categories = WebLinkCategory.all
|
||||
# @tags = WebResourceTag.all
|
||||
@@ -51,6 +56,8 @@ class Admin::PagePartsController < ApplicationController
|
||||
# @categories = ArchiveFileCategory.all
|
||||
# @tags = ArchiveTag.all
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -92,6 +99,7 @@ class Admin::PagePartsController < ApplicationController
|
||||
end
|
||||
|
||||
def reload_widgets
|
||||
@part = PagePart.find params[:part_id]
|
||||
@categories =[]
|
||||
@module_app = ModuleApp.find(params[:id])
|
||||
|
||||
@@ -103,9 +111,8 @@ class Admin::PagePartsController < ApplicationController
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
@tags = AnnouncementTag.all
|
||||
when 'news'
|
||||
@categories = NewsBulletinCategory.all
|
||||
@tags = NewsTag.all
|
||||
when 'gallery'
|
||||
@albums = GalleryAlbum.all
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
@tags = WebResourceTag.all
|
||||
@@ -114,6 +121,7 @@ class Admin::PagePartsController < ApplicationController
|
||||
@tags = ArchiveTag.all
|
||||
end
|
||||
|
||||
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option?
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
|
||||
@@ -46,12 +46,16 @@ class Admin::TagsController < OrbitBackendController
|
||||
|
||||
protected
|
||||
|
||||
def set_module_app
|
||||
@module_app ||= ModuleApp.first(:conditions => {:key => @app_title.underscore}) rescue nil
|
||||
end
|
||||
|
||||
def get_tags
|
||||
@tags = (@module_app ? @module_app.tags : Tag.all)
|
||||
end
|
||||
|
||||
def setup_vars
|
||||
@app_key = request.env['HTTP_REFERER'].split('/')[4]
|
||||
if @app_key
|
||||
@app_key.gsub!(/[?].*/, '')
|
||||
@module_app = ModuleApp.first(conditions: {:key => @app_key})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -8,6 +8,12 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
|
||||
before_filter :force_order_for_user,:except => [:index,:show]
|
||||
before_filter :set_attribute,:except => [:index,:show]
|
||||
|
||||
def setup_vars
|
||||
# @app_title ||= controller_path.split('/')[1].singularize
|
||||
# @module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
|
||||
# raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
|
||||
end
|
||||
|
||||
def index
|
||||
get_tags
|
||||
get_sub_roles
|
||||
|
||||
Reference in new issue
Block a user