Merge commit 'fc702a6210d901cd3beea220e72f71a3b7f7d41e' into sidebar_config
Conflicts: app/controllers/admin/page_parts_controller.rb app/controllers/default_widget_controller.rb app/uploaders/gprs_uploader.rb app/uploaders/location_uploader.rb app/views/admin/page_parts/_module_widget.html.erb app/views/admin/page_parts/reload_widget_styles.js.erb app/views/admin/page_parts/reload_widgets.js.erb app/views/layouts/_side_bar_content.html.erb config/locales/zh_tw.yml lib/parsers/parser_front_end.rb vendor/built_in_modules/announcement/init.rb vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb vendor/built_in_modules/location/README.rdoc vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js vendor/built_in_modules/location/app/assets/javascripts/panel/location/back_end/locations.js vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css vendor/built_in_modules/location/app/assets/stylesheets/panel/location/back_end/locations.css vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb vendor/built_in_modules/location/app/models/location.rb vendor/built_in_modules/location/app/uploaders/locations_uploader.rb vendor/built_in_modules/location/app/views/panel/location/back_end/locations/index.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb vendor/built_in_modules/location/config/routes.rb vendor/built_in_modules/location/lib/location.rb vendor/built_in_modules/location/location.gemspec vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb vendor/built_in_modules/location/test/functional/panel/location/back_end/locations_controller_test.rb
This commit is contained in:
commit
bfaa22052f
248 files changed
+6732
-2502
No files matched your search
@@ -40,9 +40,10 @@ class Admin::InfosController < ApplicationController
|
||||
@attribute.update_attributes(params[:info])
|
||||
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.html { redirect_to(edit_admin_info_path(params[:id])) }
|
||||
format.js { render 'admin/attributes/toggle_enable' }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
@@ -3,38 +3,12 @@ class Admin::ModuleAppsController < ApplicationController
|
||||
before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ]
|
||||
|
||||
layout "new_admin"
|
||||
|
||||
helper Admin::PagePartsHelper
|
||||
def index
|
||||
@module_apps = ModuleApp.all.entries
|
||||
end
|
||||
|
||||
|
||||
def reload_frontend_pages
|
||||
@categories =[]
|
||||
@module_app = ModuleApp.find(params[:id])
|
||||
|
||||
@frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? )
|
||||
|
||||
@frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? )
|
||||
|
||||
case @module_app.key
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
@tags = AnnouncementTag.all
|
||||
when 'news'
|
||||
@categories = NewsBulletinCategory.all
|
||||
@tags = NewsTag.all
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
@tags = WebResourceTag.all
|
||||
when 'archive'
|
||||
@categories = ArchiveFileCategory.all
|
||||
@tags = ArchiveTag.all
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
end
|
||||
|
||||
def module_auth_proc
|
||||
@module_app = ModuleApp.find(params[:id])
|
||||
@@ -136,7 +110,6 @@ class Admin::ModuleAppsController < ApplicationController
|
||||
end
|
||||
#user is not permited to do that
|
||||
flash[:notice] = t('app_auth.operation_not_permitted')
|
||||
render :nothing => true, :status => 403
|
||||
end
|
||||
|
||||
render :nothing => true,:status => 403
|
||||
end
|
||||
end
|
||||
@@ -25,7 +25,8 @@ class Admin::PagePartsController < ApplicationController
|
||||
def edit
|
||||
@part = PagePart.find(params[:id])
|
||||
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
|
||||
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
|
||||
@module_app = @part.module_app ? @part.module_app : nil
|
||||
@user_choose = @part.widget_path
|
||||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
|
||||
@@ -37,11 +38,12 @@ 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]
|
||||
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
|
||||
|
||||
if @module_app.widgets.any?{|b| b.class == Array}
|
||||
if @module_app && @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'
|
||||
@@ -55,7 +57,7 @@ class Admin::PagePartsController < ApplicationController
|
||||
# when 'archive'
|
||||
# @categories = ArchiveFileCategory.all
|
||||
# @tags = ArchiveTag.all
|
||||
# end
|
||||
# end if @module_app
|
||||
|
||||
|
||||
end
|
||||
@@ -69,6 +71,11 @@ class Admin::PagePartsController < ApplicationController
|
||||
|
||||
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
|
||||
params[:page_part][:widget_field_type] = nil
|
||||
|
||||
if params[:page_part][:module_app].blank?
|
||||
params[:page_part][:module_app] = nil
|
||||
params[:page_part][:kind] = nil
|
||||
end
|
||||
|
||||
if @part.update_attributes(params[:page_part])
|
||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||
@@ -99,13 +106,13 @@ class Admin::PagePartsController < ApplicationController
|
||||
end
|
||||
|
||||
def reload_widgets
|
||||
@part = PagePart.find params[:part_id]
|
||||
@part = PagePart.find params[:id]
|
||||
@categories =[]
|
||||
@module_app = ModuleApp.find(params[:id])
|
||||
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
||||
|
||||
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? )
|
||||
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
|
||||
|
||||
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil?
|
||||
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
|
||||
|
||||
case @module_app.key
|
||||
when 'announcement'
|
||||
@@ -113,15 +120,16 @@ class Admin::PagePartsController < ApplicationController
|
||||
@tags = AnnouncementTag.all
|
||||
when 'gallery'
|
||||
@albums = GalleryAlbum.all
|
||||
@tags = []
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
@tags = WebResourceTag.all
|
||||
when 'archive'
|
||||
@categories = ArchiveFileCategory.all
|
||||
@tags = ArchiveTag.all
|
||||
end
|
||||
end if @module_app
|
||||
|
||||
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option?
|
||||
@part.widget_path = @module_app.widgets.first if( @module_app && @module_app.needs_to_widget_option?)
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
@@ -129,8 +137,11 @@ class Admin::PagePartsController < ApplicationController
|
||||
|
||||
def reload_widget_styles
|
||||
@module_app = ModuleApp.find(params[:module_app_id])
|
||||
style_ary = @module_app.get_widget_style[params[:id]]
|
||||
@widget_style = style_ary[:style] unless style_ary.nil?
|
||||
|
||||
@part = PagePart.find params[:id]
|
||||
@user_choose =@widget_path= params[:frontend]
|
||||
@widget_style = @module_app.widgets[@widget_path]
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Admin::PagesController < Admin::ItemsController
|
||||
|
||||
helper Admin::PagePartsHelper
|
||||
def show
|
||||
@item = Page.find(params[:id])
|
||||
respond_to do |format|
|
||||
@@ -19,15 +19,21 @@ class Admin::PagesController < Admin::ItemsController
|
||||
end
|
||||
|
||||
def edit
|
||||
@item = Page.find(params[:id])
|
||||
@item = @page =Page.find(params[:id])
|
||||
@user_choose = @item.app_frontend_url
|
||||
@apps = ModuleApp.excludes(app_pages: nil).entries
|
||||
|
||||
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
|
||||
|
||||
@designs = Design.all.entries
|
||||
@design = @item.design ? @item.design : @designs.first
|
||||
@app_frontend_urls = @item.module_app.app_pages if @item.module_app
|
||||
|
||||
|
||||
if @item.module_app
|
||||
@app_frontend_urls = @item.module_app.app_pages
|
||||
@app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
|
||||
end
|
||||
|
||||
|
||||
if @item.module_app
|
||||
@module_app = @item.module_app
|
||||
|
||||
@@ -84,13 +90,13 @@ class Admin::PagesController < Admin::ItemsController
|
||||
def update
|
||||
@item = Page.find(params[:id])
|
||||
|
||||
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
|
||||
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
|
||||
end
|
||||
|
||||
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
|
||||
params[:page][:frontend_field_type] = nil
|
||||
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
|
||||
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
|
||||
end
|
||||
|
||||
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
|
||||
params[:page][:frontend_field_type] = nil
|
||||
|
||||
if @item.update_attributes(params[:page])
|
||||
flash[:notice] = t('update.success.page')
|
||||
respond_to do |format|
|
||||
@@ -123,7 +129,44 @@ class Admin::PagesController < Admin::ItemsController
|
||||
format.js { @item = @item.parent }
|
||||
end
|
||||
end
|
||||
|
||||
def reload_front_end_setting
|
||||
@page = Page.find params[:id]
|
||||
@module_app = ModuleApp.find params[:module_app_id]
|
||||
@chosen_frontend = @user_choose = params[:frontend]
|
||||
end
|
||||
|
||||
def reload_frontend_pages
|
||||
@page = Page.find params[:id] rescue nil
|
||||
# @categories =[]
|
||||
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
||||
|
||||
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages
|
||||
@app_frontend_urls << 'default_widget' if(@module_app && @module_app.has_default_widget?)
|
||||
|
||||
|
||||
case (@module_app.nil? ? nil : @module_app.key )
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
@tags = AnnouncementTag.all
|
||||
when 'news'
|
||||
@categories = NewsBulletinCategory.all
|
||||
@tags = NewsTag.all
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
@tags = WebResourceTag.all
|
||||
when 'archive'
|
||||
@categories = ArchiveFileCategory.all
|
||||
@tags = ArchiveTag.all
|
||||
else
|
||||
@categories = []
|
||||
@tags = []
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
end
|
||||
|
||||
def reload_themes
|
||||
@design = Design.find(params[:id])
|
||||
@themes = @design.themes
|
||||
|
||||
@@ -3,7 +3,7 @@ class Admin::RolesController < ApplicationController
|
||||
layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit, :role_field, :sub_role, :add_sub_role, :edit_sub_role, :sub_role_field]
|
||||
helper Admin::AttributeValuesViewHelper
|
||||
|
||||
def index
|
||||
@@ -13,11 +13,98 @@ class Admin::RolesController < ApplicationController
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def role_field
|
||||
|
||||
@field_name = 'role'
|
||||
|
||||
@attribute = Role.find(params[:role_id])
|
||||
|
||||
end
|
||||
|
||||
def sub_role
|
||||
|
||||
@attribute = Role.find(params[:role_id])
|
||||
@attribute_fields_upper_object = @attribute.sub_roles
|
||||
|
||||
|
||||
end
|
||||
|
||||
def add_sub_role
|
||||
|
||||
@attribute = Role.find(params[:role_id])
|
||||
# @sub_attribute = Role.find(params[:role_id])
|
||||
|
||||
@sub_attribute = SubRole.new
|
||||
@sub_attribute.role_id = params[:role_id]
|
||||
|
||||
end
|
||||
|
||||
def edit_sub_role
|
||||
|
||||
@sub_attribute = SubRole.find(params[:role_id])
|
||||
|
||||
@attribute = Role.find(@sub_attribute.role_id)
|
||||
|
||||
@sub_attribute.role_id = @sub_attribute.role_id
|
||||
|
||||
end
|
||||
|
||||
def sub_role_field
|
||||
|
||||
@field_name = 'sub_role'
|
||||
|
||||
@sub_attribute = SubRole.find(params[:role_id])
|
||||
|
||||
@attribute = Role.find(@sub_attribute.role_id)
|
||||
|
||||
end
|
||||
|
||||
def add_attribute_field
|
||||
|
||||
if params[:sub_role]
|
||||
|
||||
@field_name = 'sub_role'
|
||||
|
||||
attribute = SubRole.find(params[:sub_role][:id]) rescue nil
|
||||
@attribute_field_counter = attribute.attribute_fields.count
|
||||
@attribute_field = attribute.attribute_fields.build
|
||||
@attribute_field.save
|
||||
|
||||
@attribute_field[:af_count] = @attribute_field_counter
|
||||
|
||||
@attribute = SubRole.find(params[:sub_role][:id])
|
||||
|
||||
else
|
||||
|
||||
@field_name = 'role'
|
||||
|
||||
attribute = Role.find(params[:role_id]) rescue nil
|
||||
@attribute_field_counter = attribute.attribute_fields.count
|
||||
@attribute_field = attribute.attribute_fields.build
|
||||
@attribute_field.save
|
||||
|
||||
@attribute_field[:af_count] = @attribute_field_counter
|
||||
|
||||
@attribute = Role.find(params[:role_id])
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render 'add_attribute_field' }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@attribute = Role.new
|
||||
render :template => 'admin/attributes/new'
|
||||
|
||||
if !params[:parent_id]
|
||||
render :template => 'admin/attributes/new'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@@ -27,24 +114,75 @@ class Admin::RolesController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@attribute = Role.new(params[:role])
|
||||
@attribute.save
|
||||
redirect_to :action => :index
|
||||
|
||||
if params[:sub_role]
|
||||
|
||||
@sub_role = SubRole.new(params[:sub_role])
|
||||
|
||||
# @sub_role.role_id = params[:id]
|
||||
|
||||
respond_to do |format|
|
||||
if @sub_role.save
|
||||
format.html { redirect_to(admin_role_sub_role_url(params[:sub_role][:role_id])) }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@attribute = Role.new(params[:role])
|
||||
@attribute.save
|
||||
redirect_to :action => :index
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.update_attributes(params[:role])
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/attributes/toggle_enable' }
|
||||
|
||||
if params[:sub_role]
|
||||
|
||||
@sub_role = SubRole.find(params[:sub_role][:id])
|
||||
@sub_role.update_attributes(params[:sub_role])
|
||||
@sub_role.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) }
|
||||
format.js { render 'toggle_enable' }
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.update_attributes(params[:role])
|
||||
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/attributes/toggle_enable' }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.destroy
|
||||
redirect_to :action => :index
|
||||
|
||||
if params[:sub_role]
|
||||
|
||||
@sub_role = SubRole.find(params[:sub_role][:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @sub_role.destroy
|
||||
format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.destroy
|
||||
redirect_to :action => :index
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class Admin::SubRolesController < RolesController
|
||||
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user