first version of app config and modified inits.
This commit is contained in:
1 parent
bfaa22052f
commit
71d5abae2e
36 files changed
+377
-264
No files matched your search
@@ -29,37 +29,24 @@ class Admin::PagePartsController < ApplicationController
|
||||
@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]
|
||||
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil?
|
||||
|
||||
@categories = @module_app.get_registration.get_categories
|
||||
@tags = @module_app.get_registration.get_tags
|
||||
# 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
|
||||
|
||||
if @module_app
|
||||
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
|
||||
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? or @module_app.nil?
|
||||
end
|
||||
|
||||
|
||||
unless @module_app.nil?
|
||||
@categories = @module_app.get_categories
|
||||
@tags = @module_app.get_tags
|
||||
end
|
||||
|
||||
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
|
||||
|
||||
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'
|
||||
# @categories = BulletinCategory.all
|
||||
# @tags = AnnouncementTag.all
|
||||
# when 'gallery'
|
||||
# @albums = GalleryAlbum.all
|
||||
# when 'web_resource'
|
||||
# @categories = WebLinkCategory.all
|
||||
# @tags = WebResourceTag.all
|
||||
# when 'archive'
|
||||
# @categories = ArchiveFileCategory.all
|
||||
# @tags = ArchiveTag.all
|
||||
# end if @module_app
|
||||
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -107,29 +94,13 @@ class Admin::PagePartsController < ApplicationController
|
||||
|
||||
def reload_widgets
|
||||
@part = PagePart.find params[:id]
|
||||
@categories =[]
|
||||
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
|
||||
|
||||
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
|
||||
|
||||
@categories =@module_app ? @module_app.get_categories : []
|
||||
@tags =@module_app ? @module_app.get_tags : []
|
||||
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
|
||||
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
|
||||
|
||||
case @module_app.key
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
@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 if @module_app
|
||||
|
||||
@part.widget_path = @module_app.widgets.first if( @module_app && @module_app.needs_to_widget_option?)
|
||||
@part.widget_path = @module_app.widgets.first if( @module_app)
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
|
||||
@@ -29,8 +29,8 @@ helper Admin::PagePartsHelper
|
||||
@design = @item.design ? @item.design : @designs.first
|
||||
|
||||
if @item.module_app
|
||||
@app_frontend_urls = @item.module_app.app_pages
|
||||
@app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
|
||||
@app_frontend_urls = @item.module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
|
||||
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?
|
||||
end
|
||||
|
||||
|
||||
@@ -140,11 +140,9 @@ helper Admin::PagePartsHelper
|
||||
@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?)
|
||||
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
|
||||
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?)
|
||||
|
||||
|
||||
case (@module_app.nil? ? nil : @module_app.key )
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
|
||||
Reference in new issue
Block a user