solved conflicts
This commit is contained in:
		
							parent
							
								
									e7bffe4c0f
								
							
						
					
					
						commit
						0781779ac0
					
				|  | @ -1,5 +1,10 @@ | |||
| function get_part_id(){ | ||||
| 	return $(".edit_page_part,.edit_page").attr("action").split('/').pop(); | ||||
| function append_id(){ | ||||
| 	if ($("#object_id").length == 1) { | ||||
| 		return "&id="+$("#object_id").val(); | ||||
| 	} | ||||
| 	else{ | ||||
| 		return ''; | ||||
| 	}; | ||||
| } | ||||
| 
 | ||||
| $("div.editable").live("mouseenter mouseleave", function (event) { | ||||
|  | @ -7,37 +12,24 @@ $("div.editable").live("mouseenter mouseleave", function (event) { | |||
| }); | ||||
| 
 | ||||
| $("#page_design").live('change', function() { | ||||
| 	$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes'); | ||||
| 	$.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id()); | ||||
| }); | ||||
| 
 | ||||
| // $("#page_module_app_id").live('change', function() { | ||||
| // 	var app_id = $(this).val(); | ||||
| // 	if(app_id!=''){ | ||||
| // 		$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_after_module_changed',function(data, textStatus){ | ||||
| // 			if(textStatus == 'success'){ | ||||
| // 				$(this).after(data); | ||||
| // 			} | ||||
| // 		}); | ||||
| // 	} | ||||
| // 	else{ | ||||
| // 		$("#app_page_url").children().remove(); | ||||
| // 	} | ||||
| // }); | ||||
| 
 | ||||
| $("#module_app_list select").live('change', function() { | ||||
| 	$.getScript($(this).attr('rel')  + '?module_app_id='+$(this).val()); //?part_id=' + get_part_id()); | ||||
| 	$.getScript($(this).attr('rel')  + '?module_app_id='+$(this).val() + append_id());  | ||||
| }); | ||||
| 
 | ||||
| $("#widget_list select,#frontend_list select").live('change', function() { | ||||
| 	$.getScript($(this).attr('rel')  +'?frontend=' +   $(this).val()  + '&module_app_id=' + $("#module_app_list select").val() );//+ '&part_id=' + get_part_id()); | ||||
| 	$.getScript($(this).attr('rel')  +'?frontend=' +   $(this).val()  + '&module_app_id=' + $("#module_app_list select").val() + append_id() ); | ||||
| }); | ||||
| 
 | ||||
| $("#tag_list select").live('change', function() { | ||||
| 	$.getScript($(this).attr('rel') + '?type=' + $(this).val()); | ||||
| 	$.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id() ); | ||||
| }); | ||||
| 
 | ||||
| $("select.widget_field_select").live('change', function() { | ||||
| 	$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val()); | ||||
| 	$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() ); | ||||
| }); | ||||
| 
 | ||||
| $('.part_kind').live('click', function() { | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| class Admin::PagePartsController < OrbitBackendController | ||||
| 
 | ||||
|   include Admin::FrontendWidgetInterface | ||||
|   layout "site_editor" | ||||
|    | ||||
|   before_filter :authenticate_user! | ||||
|   before_filter :is_admin? | ||||
|   before_filter :set_current_item | ||||
|  | @ -18,59 +17,75 @@ class Admin::PagePartsController < OrbitBackendController | |||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def new | ||||
|     | ||||
|   end | ||||
| 
 | ||||
|   def edit | ||||
|     @part = PagePart.find(params[:id]) | ||||
|     @module_apps = ModuleApp.where(:key.in=>OrbitApp::Module::WidgetUtility.all.keys).order_by(:title, :asc) | ||||
|     @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 | ||||
| 
 | ||||
|     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 | ||||
|      | ||||
|     @module_apps = ModuleApp.for_widget_select | ||||
|     @categories = nil | ||||
|     @tags = nil | ||||
|     @page_frontend_data_counts = nil | ||||
|     # @frontend_styles = nil | ||||
| 
 | ||||
|     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 | ||||
|     @selected={ | ||||
|       :module_app=> @part.module_app ? @part.module_app : nil, | ||||
|       :app_frontend_url=> @part.widget_path, #@module_apps.first | ||||
|       :category=>nil, #fetch by method: get_categories_and_tags | ||||
|       :tag=>nil, #fetch by method: get_categories_and_tags | ||||
|       :page_frontend_data_count=>nil, | ||||
|       :frontend_style => nil, | ||||
|       :widget_path=> nil | ||||
|     } | ||||
| 
 | ||||
|     @selected[:widget_path] = @part.widget_path ? @part.widget_path : (@selected[:module_app].widgets.keys[0] rescue nil) | ||||
|     get_categories_and_tags | ||||
|     get_frontend_data_count | ||||
|     @app_frontend_urls = get_app_frontend_urls | ||||
|   end | ||||
| 
 | ||||
|   def create | ||||
|   def reload_widgets | ||||
|     @part = PagePart.find params[:id] | ||||
|     @selected={ | ||||
|       :module_app=> ModuleApp.find(params["module_app_id"]) | ||||
|     } | ||||
|     get_categories_and_tags | ||||
|     get_frontend_data_count | ||||
|    @selected[:app_frontend_url] = @selected[:module_app].has_default_widget? ?  'default_widget' :  @selected[:module_app].widget_options.first.name | ||||
|   end | ||||
| 
 | ||||
|    | ||||
|   def reload_widget_styles | ||||
|       @part = PagePart.find(params[:id]) | ||||
|       @selected={ | ||||
|       :module_app=> ModuleApp.find(params["module_app_id"]), | ||||
|       :app_frontend_url=> params["frontend"], #@module_apps.first | ||||
|       :category=>nil, #fetch by method: get_categories_and_tags | ||||
|       :tag=>nil, #fetch by method: get_categories_and_tags | ||||
|       :page_frontend_data_count=>nil, | ||||
|       :frontend_style => nil, | ||||
|       :widget_path=> nil | ||||
|     } | ||||
|     get_categories_and_tags | ||||
|     get_frontend_data_count | ||||
|   end | ||||
| 
 | ||||
|   def reload_widget_field | ||||
|     @index = params[:field_seri].to_i | ||||
|     @part = PagePart.find(params[:id]) | ||||
|     @selected = { | ||||
|       :module_app=> ModuleApp.find(params["module_app_id"]), | ||||
|       :default_widget_field=>params[:widget_field_value] | ||||
|     } | ||||
|   end | ||||
| 
 | ||||
|   def update | ||||
| 
 | ||||
|     @part = PagePart.find(params[:id]) | ||||
| 
 | ||||
|     # params[:page_part][:widget_field_type] = nil | ||||
|     # params[:page_part][:widget_field_is_link]  = nil | ||||
| 
 | ||||
|     if params[:page_part][:module_app].blank? | ||||
|       params[:page_part][:module_app] = nil | ||||
|     end | ||||
| 
 | ||||
|     if params[:page_part][:tag].nil? ||  params[:page_part][:tag].include?("nil") | ||||
|       params[:page_part][:tag] = [] | ||||
|     end | ||||
| 
 | ||||
|     if params[:page_part][:category].nil? ||  params[:page_part][:category].include?("nil") | ||||
|       params[:page_part][:category] = [] | ||||
|     end | ||||
|     clean_tags_and_category_params | ||||
| 
 | ||||
|     # params[:page_part][:widget_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page_part][:widget_field].blank? | ||||
|     if @part.update_attributes(params[:page_part]) | ||||
|  | @ -101,41 +116,6 @@ class Admin::PagePartsController < OrbitBackendController | |||
|     redirect_to admin_items_url( :parent_id => @item.parent_id ) | ||||
|   end | ||||
|    | ||||
|   def reload_widget_field | ||||
|     @index = params[:field_seri].to_i | ||||
|     @part = PagePart.find params[:id] | ||||
|     @choosen_field = params[:widget_field_value] | ||||
|     @module_app = @part.module_app | ||||
|     @module_app = ModuleApp.find params[:module_app_id] if @module_app.nil? | ||||
|   end | ||||
| 
 | ||||
|   def reload_widgets | ||||
|     @part = PagePart.find params[:id] | ||||
|     @module_app = ModuleApp.find(params[:module_app_id]) rescue nil | ||||
|     @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? ) | ||||
| 
 | ||||
|     @part.widget_path = @module_app.widgets.first if( @module_app) | ||||
|     respond_to do |format| | ||||
|       format.js  {} | ||||
|     end | ||||
|   end | ||||
|    | ||||
|   def reload_widget_styles | ||||
|     @module_app = ModuleApp.find(params[:module_app_id]) | ||||
| 
 | ||||
|     @part = PagePart.find params[:id] | ||||
|     @user_choose =@widget_path= params[:frontend] | ||||
|     @widget_style =  @module_app.widgets[@widget_path] | ||||
| 
 | ||||
| 
 | ||||
|     respond_to do |format| | ||||
|       format.js  {} | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def reload_r_tag_options | ||||
|     @part = PagePart.find params[:id] | ||||
|     @r_tag = params[:type] | ||||
|  | @ -146,6 +126,11 @@ class Admin::PagePartsController < OrbitBackendController | |||
|   end | ||||
| 
 | ||||
|   protected | ||||
|   def get_app_frontend_urls | ||||
|     @selected[:module_app] ? @selected[:module_app].widgets.collect{|k,v| [I18n.t(v["i18n"]),k]}  : [] | ||||
|     #   has_old_value =  @selected[:module_app].app_pages[@selected[:app_frontend_url]] | ||||
|     #   @frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil) | ||||
|   end | ||||
| 
 | ||||
|   def set_children_sub_menu(part) | ||||
|     part.page.children.each do |child| | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| class Admin::PagesController < Admin::ItemsController | ||||
| helper Admin::PagePartsHelper | ||||
| include Admin::FrontendWidgetInterface | ||||
|   def show | ||||
|     @item = Page.find(params[:id]) | ||||
|     respond_to do |format| | ||||
|  | @ -13,40 +14,123 @@ helper Admin::PagePartsHelper | |||
|   def new | ||||
|     @item = Page.new | ||||
|     @item.parent = Item.find(params[:parent_id]) rescue nil | ||||
|     @apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys) | ||||
|     @module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc) | ||||
|     # @apps = ModuleApp.for_frontend_select | ||||
| 
 | ||||
|     @designs = Design.all.entries | ||||
|     @design = Design.first | ||||
|     @themes = Design.first.themes | ||||
|     @module_apps = ModuleApp.for_frontend_select | ||||
|     @app_frontend_urls = nil | ||||
|     @categories = nil | ||||
|     @tags = nil | ||||
|     @page_frontend_data_counts = nil | ||||
|     @frontend_styles = nil | ||||
|     @selected={ | ||||
|       :design => @designs.first, | ||||
|       :theme=> @themes.first, | ||||
|       :module_app=>nil,#@module_apps.first | ||||
|       :app_frontend_url=> nil, #@module_apps.first | ||||
|       :category=>nil, | ||||
|       :tag=>nil, | ||||
|       :page_frontend_data_count=>nil, | ||||
|       :frontend_style => nil | ||||
|     } | ||||
|   end | ||||
| 
 | ||||
|   def edit | ||||
|     @item = Page.find(params[:id]) | ||||
|     @user_choose =  @item.app_frontend_url | ||||
|     @apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys) | ||||
|     @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 | ||||
|     @themes = @item.design ? @item.design.themes : @designs.first.themes | ||||
|     @module_apps = ModuleApp.for_frontend_select | ||||
|     @categories = nil | ||||
|     @tags = nil | ||||
|     @page_frontend_data_counts = nil | ||||
|     @frontend_styles = nil | ||||
| 
 | ||||
|     if @item.module_app | ||||
|       @app_frontend_urls = [] | ||||
|       setup_app_frontend_and_style | ||||
|       @app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?  | ||||
|     @selected={ | ||||
|       :design => @item.design || @designs.first, | ||||
|       :theme=> @item.theme, | ||||
|       :module_app=>@item.module_app,#@module_apps.first | ||||
|       :app_frontend_url=> @item.app_frontend_url, #@module_apps.first | ||||
|       :category=>nil, #fetch by method: get_categories_and_tags | ||||
|       :tag=>nil, #fetch by method: get_categories_and_tags | ||||
|       :page_frontend_data_count=>nil, | ||||
|       :frontend_style => nil | ||||
|     } | ||||
|     @app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil | ||||
|     get_categories_and_tags | ||||
|     get_frontend_data_count | ||||
|   end | ||||
| 
 | ||||
|       @module_app = @item.module_app | ||||
|       @frontend_path = @item.app_frontend_url | ||||
| 	   | ||||
| 	 if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array} | ||||
|         @frontend_style =  @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank? | ||||
|   	 end | ||||
|       get_categories_and_tags | ||||
| 
 | ||||
|     else | ||||
|       @module_app = @module_apps[0] | ||||
|   def reload_themes | ||||
|     design = Design.find(params[:design_id]) | ||||
|     @themes = design.themes | ||||
|     respond_to do |format| | ||||
|       format.js  {} | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def reload_frontend_pages | ||||
|     @item = Page.find(params[:id]) rescue Page.new  | ||||
|         @selected={ | ||||
|       :design => nil, | ||||
|       :theme=> nil, | ||||
|       :module_app=>(ModuleApp.find(params[:module_app_id]) rescue nil), | ||||
|       :app_frontend_url=> @item.app_frontend_url || 'default_widget', #@module_apps.first | ||||
|       :category=>nil, #fetch by method: get_categories_and_tags | ||||
|       :tag=>nil, #fetch by method: get_categories_and_tags | ||||
|       :page_frontend_data_count=>nil, | ||||
|       :frontend_style => nil | ||||
|     } | ||||
|     @app_frontend_urls = @selected[:module_app] ? select_array_for_app_frontend_urls(@selected[:module_app].app_pages) : nil | ||||
| 
 | ||||
|     get_categories_and_tags | ||||
|     get_frontend_data_count | ||||
|     get_frontend_styles | ||||
| 
 | ||||
|     respond_to do |format| | ||||
|       format.js  {} | ||||
|     end | ||||
|   end | ||||
|    | ||||
| 
 | ||||
|   def reload_front_end_setting | ||||
|     @item = Page.find(params[:id]) rescue Page.new  | ||||
|      | ||||
|     @categories = nil | ||||
|     @tags = nil | ||||
|     @page_frontend_data_counts = nil | ||||
| 
 | ||||
|     @selected={ | ||||
|       # :design => @item.design || @designs.first, | ||||
|       # :theme=> @item.theme, | ||||
|       :module_app=>ModuleApp.find(params[:module_app_id]), | ||||
|       :app_frontend_url=>  params[:frontend] , | ||||
|       :category=>nil, #fetch by method: get_categories_and_tags | ||||
|       :tag=>nil, #fetch by method: get_categories_and_tags | ||||
|       :page_frontend_data_count=>nil, | ||||
|       :frontend_style => nil | ||||
|     } | ||||
|     @app_frontend_urls = @selected[:module_app].nil? ? nil :  @selected[:module_app].app_pages.each{|name,data| [I18n.t(data["i18n"]),name]} | ||||
|     @frontend_styles = @selected[:module_app].app_pages[params["frontend"]]["style"] rescue nil | ||||
| 
 | ||||
|   end   | ||||
| 
 | ||||
| 
 | ||||
|   def reload_widget_field | ||||
|     @index = params[:field_seri].to_i | ||||
|     @item = Page.find(params[:id]) rescue Page.new  | ||||
|     @selected = { | ||||
|       :module_app=> (@item.module_app || ModuleApp.find(params[:module_app_id]) ), | ||||
|       :default_widget_field=>params[:widget_field_value] | ||||
|     } | ||||
|     # @choosen_field = params[:widget_field_value] | ||||
|     # @module_app = @item.module_app | ||||
|     # @module_app = ModuleApp.find params[:module_app_id] if @module_app.nil? | ||||
|   end | ||||
| 
 | ||||
|   def create | ||||
|     clean_tags_and_category_params | ||||
|     @item = Page.new(params[:page]) | ||||
| 	 | ||||
| 	if @item.module_app && @item.module_app.key == 'page_content' | ||||
|  | @ -63,7 +147,6 @@ helper Admin::PagePartsHelper | |||
|       end | ||||
|     else | ||||
|       flash.now[:error] = t('create.error.page') | ||||
|       @apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys) | ||||
|       @designs = Design.all.entries | ||||
|       @design = Design.first | ||||
|       render :action => "new" | ||||
|  | @ -71,27 +154,12 @@ helper Admin::PagePartsHelper | |||
|   end | ||||
| 
 | ||||
|   def update | ||||
|     clean_tags_and_category_params | ||||
|     @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], params[:page][:frontend_field_is_link] ) if params[:page][:frontend_field] | ||||
|       | ||||
|     # params[:page][:frontend_field_type] = nil | ||||
|     # params[:page][:frontend_field_is_link] = nil | ||||
| 
 | ||||
|     if params[:page][:tag].nil? || params[:page][:tag].include?("nil") | ||||
|       params[:page][:tag] = [] | ||||
|     end | ||||
| 
 | ||||
|     if params[:page][:category].nil? || params[:page][:category].include?("nil") | ||||
|       params[:page][:category] = [] | ||||
|     end | ||||
| 
 | ||||
|     # params[:page][:frontend_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page][:frontend_field].blank? | ||||
| 
 | ||||
| 
 | ||||
|     if @item.update_attributes(params[:page]) | ||||
|       flash[:notice] = t('update.success.page') | ||||
|  | @ -126,65 +194,10 @@ helper Admin::PagePartsHelper | |||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def reload_front_end_setting | ||||
|     @item = Page.find params[:id] rescue nil | ||||
|     @module_app = ModuleApp.find params[:module_app_id] | ||||
|     @user_choose = params[:frontend] #choosen frontend | ||||
|   protected | ||||
| 
 | ||||
|     @app_frontend_urls = @module_app.nil? ? nil :  @module_app.app_pages.each{|name,data| [I18n.t(data["i18n"]),name]} | ||||
|     @frontend_styles = @module_app.app_pages[params["frontend"]]["style"] rescue nil | ||||
|     # =======     | ||||
|     #     @chosen_frontend = @user_choose = params[:frontend] | ||||
|     # >>>>>>> Stashed changes | ||||
|   end   | ||||
| 
 | ||||
|   def get_categories_and_tags | ||||
|     unless @module_app.nil? | ||||
|       @categories = @module_app.get_categories  | ||||
|       @tags = @module_app.get_tags | ||||
|     end | ||||
|   def get_frontend_styles | ||||
|     has_old_value =  @selected[:module_app].app_pages[@selected[:app_frontend_url]] | ||||
|     @frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil) | ||||
|   end | ||||
| 
 | ||||
|   def setup_app_frontend_and_style | ||||
|     if @module_app.nil? | ||||
|       @item.module_app.app_pages.each{|name,data| @app_frontend_urls << [I18n.t(data["i18n"]),name]} | ||||
|       @frontend_styles = @item.module_app.app_pages[@item.frontend_style]["style"] if @frontend_styles.nil? && @item && @item.module_app.app_pages[@item.frontend_style] | ||||
|       @frontend_styles = @item.module_app.app_pages.first[1]["style"] if @frontend_styles.nil? && @item | ||||
|     else | ||||
|       @module_app.app_pages.each{|name,data| @app_frontend_urls << [I18n.t(data["i18n"]),name]} | ||||
|       @frontend_styles = @module_app.app_pages[params["frontend"]]["style"] rescue nil | ||||
|       @frontend_styles = @module_app.app_pages.first[1]["style"] if @frontend_styles.nil? | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def reload_frontend_pages | ||||
|     @item = Page.find params[:id] rescue nil | ||||
|     @module_app = ModuleApp.find(params[:module_app_id]) rescue nil | ||||
|     @app_frontend_urls = [] | ||||
|     setup_app_frontend_and_style | ||||
|     @app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?) | ||||
| 
 | ||||
|     get_categories_and_tags | ||||
| 
 | ||||
|     respond_to do |format| | ||||
|       format.js  {} | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def reload_themes | ||||
|     @design = Design.find(params[:id]) | ||||
|     @themes = @design.themes | ||||
|     respond_to do |format| | ||||
|       format.js  {} | ||||
|     end | ||||
|   end | ||||
|    | ||||
|   def reload_widget_field | ||||
|     @index = params[:field_seri].to_i | ||||
|     @item = params.has_key?(:id) ? Page.find(params[:id] ) : Page.new | ||||
|     @choosen_field = params[:widget_field_value] | ||||
|     @module_app = @page.module_app | ||||
|     @module_app = ModuleApp.find params[:module_app_id] if @module_app.nil? | ||||
|   end | ||||
| 
 | ||||
| end | ||||
|  |  | |||
|  | @ -48,11 +48,18 @@ class DefaultWidgetController< OrbitWidgetController | |||
|       @widget_image_field = @default_widget["image"] || @default_widget[:image] | ||||
|       case @page_part | ||||
|       when Page | ||||
|         @fields = @page_part.frontend_field | ||||
|         @frontend_field_names = @page_part.frontend_field_name | ||||
|         @frontend_classes = @page_part.frontend_class | ||||
|         @frontend_sat_to_links = @page_part.frontend_sat_to_link | ||||
| 
 | ||||
|         @data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3) | ||||
|         @paginate = true | ||||
|         @page_id = @page_part.id | ||||
|       when PagePart | ||||
|         @frontend_field_names = @page_part.widget_field_name | ||||
|         @frontend_classes = @page_part.widget_class | ||||
|         @frontend_sat_to_links = @page_part.widget_sat_to_link | ||||
| 
 | ||||
|         @fields = @page_part.widget_field | ||||
|         @data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3) | ||||
|       end | ||||
|  |  | |||
|  | @ -0,0 +1,59 @@ | |||
| module Admin::FrontendWidgetInterface | ||||
| 
 | ||||
| protected | ||||
|   def get_categories_and_tags | ||||
|     unless @selected[:module_app].nil? | ||||
|       @categories = @selected[:module_app].get_categories  | ||||
|       @tags = @selected[:module_app].get_tags | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def get_frontend_data_count | ||||
|     local_item = set_local_item | ||||
|     @page_frontend_data_counts = @selected[:module_app].get_registration.get_data_count rescue [] | ||||
|     @selected[:page_frontend_data_count] = case local_item | ||||
|       when  PagePart | ||||
|         local_item.widget_data_count | ||||
|       when  Page | ||||
|         local_item.frontend_data_count | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def clean_tags_and_category_params | ||||
|     field_name = set_field_name | ||||
| 
 | ||||
|     if self.class==Admin::PagePartsController and params[field_name][:module_app].blank? | ||||
|       params[field_name][:module_app] = nil | ||||
|     end | ||||
|     if params[field_name][:tag].nil? || params[:page][:tag].include?("nil") | ||||
|       params[field_name][:tag] = [] | ||||
|     end | ||||
| 
 | ||||
|     if params[field_name][:category].nil? || params[:page][:category].include?("nil") | ||||
|       params[field_name][:category] = [] | ||||
|     end        | ||||
|   end  #of clean_tags_and_category_params | ||||
| 
 | ||||
|   def set_local_item | ||||
|     local_item = @part  | ||||
|     local_item = @item if local_item.nil? && @item | ||||
|     local_item | ||||
|   end | ||||
| 
 | ||||
|   def set_field_name | ||||
|     case self.class.to_s | ||||
|     when "Admin::PagesController" | ||||
|        return "page" | ||||
|     when "Admin::PagePartsController" | ||||
|       return  "page_part" | ||||
|     end # of  case | ||||
|   end | ||||
| 
 | ||||
|   def select_array_for_app_frontend_urls(hash) | ||||
|     ary =  hash.collect{|name,data| [I18n.t(data["i18n"]),name]} | ||||
|     ary << [I18n.t('default_widget.name'),'default_widget'] if @selected[:module_app] and @selected[:module_app].has_default_widget?  | ||||
|     ary | ||||
|   end | ||||
| 
 | ||||
| 
 | ||||
| end | ||||
|  | @ -1,7 +1,8 @@ | |||
| module Admin::PagePartsHelper | ||||
|   include Admin::FrontendWidgetInterface | ||||
| 
 | ||||
|   def support_link | ||||
|     url_method = @module_app.get_default_widget[:url_method] | ||||
|     url_method = @selected[:module_app].get_default_widget[:url_method] | ||||
|     unless url_method.nil? | ||||
|       res = "Link:" | ||||
|       res << select_tag( "page_part[widget_field_is_link][]", options_for_select([["NotLink",false],["Link1",url_method]])) | ||||
|  | @ -9,10 +10,8 @@ module Admin::PagePartsHelper | |||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def get_widget_field_rel(local_item=nil) | ||||
|     local_item = @part if local_item.nil? && @part | ||||
|     local_item = @item if local_item.nil? && @item | ||||
|     case local_item | ||||
|   def get_widget_field_rel | ||||
|     case set_local_item | ||||
|     when Page | ||||
|       reload_after_list_changed_admin_pages_path | ||||
|     when PagePart   | ||||
|  | @ -35,7 +34,7 @@ module Admin::PagePartsHelper | |||
|     unless field_is_checked.nil? and assign_field_name_value.nil? | ||||
|       origin_field = nil | ||||
| 
 | ||||
|       origin_field = @module_app.widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first | ||||
|       origin_field = @selected[:module_app].widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first | ||||
| 
 | ||||
|       if  origin_field and origin_field[2]==:link #choosen_field_is_link | ||||
| 
 | ||||
|  | @ -51,11 +50,10 @@ module Admin::PagePartsHelper | |||
|   end | ||||
| 
 | ||||
|   def widget_field_options(i,local_item=nil) | ||||
|     local_item = @part if local_item.nil? && @part | ||||
|     local_item = @item if local_item.nil? && @item | ||||
|     local_item = set_local_item | ||||
| 
 | ||||
|     options = @module_app.widget_fields.collect do |widget_field|  | ||||
|       label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}") | ||||
|     options = @selected[:module_app].widget_fields.collect do |widget_field|  | ||||
|       label = I18n.t("#{@selected[:module_app].key}.default_widget.#{widget_field[0]}") | ||||
|       [label, widget_field[0]]  | ||||
|     end | ||||
|     case local_item | ||||
|  | @ -66,11 +64,9 @@ module Admin::PagePartsHelper | |||
|     end | ||||
|   end | ||||
| 
 | ||||
|   def widget_fiield_class_options(i,local_item=nil) | ||||
|   def widget_field_class_options(i,local_item=nil) | ||||
|     options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]} | ||||
|     local_item = @part if local_item.nil? && @part | ||||
|     local_item = @item if local_item.nil? && @item | ||||
| 
 | ||||
|     local_item = set_local_item | ||||
|     case local_item | ||||
|     when Page | ||||
|       options_for_select(options, (local_item.frontend_class[i] if (local_item) )) | ||||
|  | @ -115,12 +111,8 @@ module Admin::PagePartsHelper | |||
|   end | ||||
| 
 | ||||
|   def nil_checkbox_button(part,tag_or_cate) | ||||
|     field_name = case part | ||||
|     when PagePart | ||||
|       'page_part' | ||||
|     when Page | ||||
|       'page' | ||||
|     end | ||||
|     field_name = set_field_name | ||||
| 
 | ||||
|     content_tag :label,:class=>"radio inline" do  | ||||
|       op = check_box_tag("#{field_name}[#{tag_or_cate}][]", 'nil' , eval("#{tag_or_cate}_checked_value(part,'')"),:class=>'select_all') | ||||
|       op << I18n.t("default_widget.no_value") | ||||
|  | @ -128,12 +120,8 @@ module Admin::PagePartsHelper | |||
|   end | ||||
| 
 | ||||
|   def nil_radio_button(part,tag_or_cate) | ||||
|     field_name = case part | ||||
|     when PagePart | ||||
|       'page_part' | ||||
|     when Page | ||||
|       'page' | ||||
|     end | ||||
|     field_name = set_field_name | ||||
| 
 | ||||
|     content_tag :label,:class=>"radio inline" do  | ||||
|       op = radio_button(field_name, tag_or_cate, '' , :checked => eval("#{tag_or_cate}_checked_value(part,'')")) | ||||
|       op << I18n.t("default_widget.no_value") | ||||
|  | @ -141,7 +129,7 @@ module Admin::PagePartsHelper | |||
|   end | ||||
| 
 | ||||
|   def show_default_widget_setting_panel | ||||
|       @module_app && @module_app.has_default_widget? && (!@user_choose.nil? && @user_choose== 'default_widget') #&& @part.widget_path == 'default_widget'  | ||||
|       @selected[:module_app] && @selected[:module_app].has_default_widget? && (@selected[:app_frontend_url]== 'default_widget') | ||||
|   end | ||||
| 
 | ||||
|   def show_custom_widget_setting_panel | ||||
|  |  | |||
|  | @ -19,11 +19,10 @@ class ModuleApp | |||
|     self[:widgets] = reg.get_widgets | ||||
|   end | ||||
| 
 | ||||
|      | ||||
|   # def app_pages | ||||
|   #   get_registration.get_app_pages | ||||
|   # end | ||||
| 
 | ||||
|   scope :for_frontend_select,where(:key.in => OrbitApp::Module::FrontendUtility.all.keys).excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc) | ||||
|   scope :for_widget_select,where(:key.in=>OrbitApp::Module::WidgetUtility.all.keys).order_by(:title, :asc) | ||||
|   scope :standard_sorting ,order_by(:title, :asc) | ||||
| 
 | ||||
|   def enable_frontend? | ||||
|     self[:enable_frontend] | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ class Page < Item | |||
|    | ||||
|   field :content, localize: true | ||||
|   field :app_frontend_url | ||||
|   field :theme_id, :type => BSON::ObjectId, :default => nil | ||||
|   # field :theme_id, :type => BSON::ObjectId, :default => nil | ||||
|   field :category,type: Array, :default => [] | ||||
|   field :tag, type: Array,:default => [] | ||||
|   field :view_count, :type => Integer, :default => 0 | ||||
|  | @ -21,7 +21,8 @@ class Page < Item | |||
|   field :frontend_sat_to_link , :type => Array,:default => [] | ||||
| 
 | ||||
|   field :frontend_data_count | ||||
|    | ||||
| 
 | ||||
|   belongs_to :theme   | ||||
|   belongs_to :design | ||||
|   belongs_to :module_app | ||||
|   has_many :page_parts, :dependent => :destroy | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| <%= f.select :module_app_id, @apps.collect { |t| [t.module_name, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path }  %> | ||||
| <%= f.select :module_app_id, @module_apps.collect { |t| [t.module_name, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path }  %> | ||||
|  |  | |||
|  | @ -3,14 +3,14 @@ | |||
|     <%= t("default_widget.select_widget_style") %> | ||||
|   </label> | ||||
|   <div class="controls well"> | ||||
|     <% if @module_app.nil? || @module_app.widgets.nil? ||  (@module_app.widgets[@widget_path].blank? rescue true) %> | ||||
|     <% if @selected[:module_app].nil? || @selected[:module_app].widgets.nil? ||  (@selected[:module_app].widgets[@selected[:app_frontend_url]].blank? rescue true) || @selected[:module_app].widgets[@selected[:app_frontend_url]]["style"].nil? %> | ||||
|       <%= t("default_widget.no_support_setting")%> | ||||
|     <%else%> | ||||
|       <%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]["style"]) %> | ||||
|       <%= select('page_part', 'widget_style', @selected[:module_app].widgets[@selected[:app_frontend_url]]["style"]) %> | ||||
|     <% end %> | ||||
|   </div> | ||||
| </div> | ||||
|   <% if(@module_app && @module_app.widget_options(@widget_path)) %> | ||||
|   <% if(@selected[:module_app] && @selected[:module_app].widget_options(@selected[:app_frontend_url])) %> | ||||
|     <div class="style_switch  control-group"> | ||||
|       <label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label> | ||||
|       <div class="controls well" > | ||||
|  |  | |||
|  | @ -27,14 +27,14 @@ | |||
|         <span class="span5"></span> | ||||
|     </div> | ||||
| 
 | ||||
| <% @module_app.widget_fields.each_with_index do |widget_field, i| %> | ||||
| <% @selected[:module_app].widget_fields.each_with_index do |widget_field, i| %> | ||||
|     <div class="rows clear"> | ||||
|                         <span class="span4"> | ||||
|                             <%= i+1 %> | ||||
|           <%= select_tag  "#{object_name}[#{field_name}][][field_name]", widget_field_options(i), :include_blank => true ,:class=>'widget_field_select',:field_seri => i ,:id=>"#{object_name}_#{field_name}_#{i}",:rel=>reload_rel%> | ||||
|                         </span> | ||||
|                         <span class="span3"> | ||||
|           <%= select_tag "#{object_name}[#{field_name}][][class]", widget_fiield_class_options(i), :include_blank => true %> <br /> | ||||
|           <%= select_tag "#{object_name}[#{field_name}][][class]", widget_field_class_options(i), :include_blank => true %> <br /> | ||||
|                         </span> | ||||
|                         <span class="span5 link_switch_holder"> | ||||
|                           <%= link_to_field_switch(i,object_name,field_name) %> | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| </label> | ||||
| <div class="controls well"> | ||||
|     <ul class="clear"> | ||||
|         <% if @module_app.get_default_widget["enabled_styles"].include?("typeA") %> | ||||
|         <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeA") %> | ||||
|           <li> | ||||
|               <label class="radio style_radio"> | ||||
|                 <%= radio_button_tag field_name,"typeA",style_checked_value(object,"typeA") %> | ||||
|  | @ -23,7 +23,7 @@ | |||
| 
 | ||||
|           </li> | ||||
|         <% end %> | ||||
|         <% if @module_app.get_default_widget["enabled_styles"].include?("typeB_style2") %> | ||||
|         <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style2") %> | ||||
|           <li> | ||||
|               <label class="radio style_radio"> | ||||
|                 <%= radio_button_tag field_name,"typeB_style2",style_checked_value(object,"typeB_style2") %> | ||||
|  | @ -33,7 +33,7 @@ | |||
|               </label> | ||||
|           </li> | ||||
|         <% end %> | ||||
|         <% if @module_app.get_default_widget["enabled_styles"].include?("typeB_style3") %> | ||||
|         <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style3") %> | ||||
|           <li> | ||||
|               <label class="radio style_radio"> | ||||
|                 <%= radio_button_tag field_name,"typeB_style3",style_checked_value(object,"typeB_style3") %> | ||||
|  | @ -43,7 +43,7 @@ | |||
|               </label> | ||||
|           </li> | ||||
|         <% end %> | ||||
|         <% if @module_app.get_default_widget["enabled_styles"].include?("typeB_style4") %> | ||||
|         <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style4") %> | ||||
|           <li> | ||||
|               <label class="radio style_radio"> | ||||
|                 <%= radio_button_tag field_name,"typeB_style4",style_checked_value(object,"typeB_style4") %> | ||||
|  | @ -53,7 +53,7 @@ | |||
|               </label> | ||||
|           </li> | ||||
|         <% end %> | ||||
|         <% if @module_app.get_default_widget["enabled_styles"].include?("typeC") %> | ||||
|         <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeC") %> | ||||
|           <li> | ||||
|               <label class="radio style_radio"> | ||||
|                 <%= radio_button_tag field_name,"typeC",style_checked_value(object,"typeC") %> | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
|             <%= t "default_widget.select_module_app" %> | ||||
|         </label> | ||||
|         <div class="controls">   | ||||
|         <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel =>  reload_after_module_changed_admin_page_part_path,:id=>"page_module_app_id"} %> | ||||
|         <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@selected[:module_app].id rescue nil)), {:include_blank => true }, {:rel =>  reload_after_module_changed_admin_page_part_path,:id=>"page_module_app_id"} %> | ||||
|         </div> | ||||
|     </div> | ||||
|      | ||||
|  | @ -26,7 +26,8 @@ | |||
|             <%= t "default_widget.select_widget_path" %> | ||||
|         </label> | ||||
|         <div class="controls">   | ||||
|         <%= f.select :widget_path, @module_app ? @module_app.widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} : [], {}, { :selected => @part.widget_path, :rel => get_widget_field_rel } %> | ||||
|             <%#= @module_app ? @module_app.widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} %> | ||||
|         <%= f.select :widget_path,  @app_frontend_urls , {}, { :selected => @selected[:app_frontend_url], :rel => get_widget_field_rel } %> | ||||
|         </div> | ||||
|     </div> | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,7 @@ | |||
|       <% @module_app.widget_options(@widget_path).get_options.each do |key,settings| %> | ||||
| <% if   (not(@selected[:module_app].widget_options(@selected[:app_frontend_url]).blank?) and @selected[:app_frontend_url]!='default_widget')%> | ||||
|    | ||||
| 
 | ||||
|       <%  @selected[:module_app].widget_options(@selected[:app_frontend_url]).get_options.each do |key,settings| %> | ||||
|       <% options = settings[:opts] %> | ||||
|       <%= label_tag(t(settings[:label_i18n]))%> | ||||
|         <% case  options%> | ||||
|  | @ -12,3 +15,4 @@ | |||
|    | ||||
|       <% end %> | ||||
| 
 | ||||
| <% end %> | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| $("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page_part','widget_field',nil,@choosen_field) %>"); | ||||
| $("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page_part','widget_field',nil,@selected[:default_widget_field]) %>"); | ||||
|  | @ -1,5 +1,5 @@ | |||
| <% if  @module_app%> | ||||
|   $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| [I18n.t(v['i18n']),k]},@part.widget_path) %>"); | ||||
| <% if  @selected[:module_app]%> | ||||
|   $('#widget_list select').html("<%= j options_for_select(@selected[:module_app].widgets.collect{|k,v| [I18n.t(v['i18n']),k]},@part.widget_path) %>"); | ||||
|   $("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part}  %>"); | ||||
|   $("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part}  %>"); | ||||
|   $("#data_count").html("<%= j render :partial => 'admin/pages/data_count_field',:locals=>{:field_name=>'page_part[widget_data_count]',:field_value=>@part.widget_data_count }  %>"); | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|   </label> | ||||
|   <div class="controls well"> | ||||
|   	<% if @frontend_styles%> | ||||
|   	  <%= select('page', 'frontend_style', @frontend_styles) %> | ||||
|   	  <%= select('page', 'frontend_style', @frontend_styles,{:selected => @selected[:frontend_style]}) %> | ||||
|   	<% else %> | ||||
|       <%= t("default_widget.no_support_setting")%> | ||||
|     <% end %> | ||||
|  |  | |||
|  | @ -2,5 +2,5 @@ | |||
|       <%= t("default_widget.widget_data_count") %> | ||||
|   </label> | ||||
|   <div class="controls">   | ||||
|       <%= select_tag(field_name,options_for_select((@module_app.get_registration.get_data_count rescue []),field_value  ))  %> | ||||
|       <%= select_tag(field_name,options_for_select(@page_frontend_data_counts||[],field_value  ))  %> | ||||
|   </div> | ||||
|  | @ -1,13 +1,13 @@ | |||
| <%= f.error_messages %> | ||||
| <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> | ||||
| 
 | ||||
| <%= f.hidden_field :id, :value => (@item.id),:id=>"object_id" %> | ||||
| <div class="control-group"> | ||||
| 	<%= f.label :name, '*'+t(:name), :class => 'control-label' %> | ||||
| 	  | ||||
| 	 | ||||
| 	<div class="controls"> | ||||
| 		<%= f.text_field :name, :class => 'text input-xlarge' %> | ||||
| 		<span class="help-inline">請輸入數字或英文,不可使用空白</span> | ||||
| 		<span class="help-inline"><%= I18n.t("front_page.name_field_helper") %></span> | ||||
| 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||
| 	</div> | ||||
| </div> | ||||
|  | @ -27,14 +27,14 @@ | |||
| <div class="control-group"> | ||||
| 	<%= f.label :name, t(:template_name), :class => 'control-label' %> | ||||
| 	<div class="controls"> | ||||
| 		<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => reload_themes_admin_pages_path} %> | ||||
| 		<%= f.collection_select :design, @designs, :id, :title, {:selected => (@selected[:design].id rescue nil) }, {:rel => reload_themes_admin_pages_path} %> | ||||
| 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||
| 	</div> | ||||
| </div> | ||||
| <div class="control-group"> | ||||
| 	<%= f.label :name, t(:theme), :class => 'control-label' %> | ||||
| 	<div class="controls"> | ||||
| 		<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %> | ||||
| 		<%= f.select :theme_id, @themes.collect { |t| [t.name.capitalize, t.id] }, {:include_blank => true, :selected=>(@selected[:theme].id rescue nil) } %> | ||||
| 		<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> | ||||
| 	</div> | ||||
| </div> | ||||
|  | @ -42,14 +42,14 @@ | |||
| <div class="control-group" id="module_app_list"> | ||||
| 	<%= f.label '',t("default_widget.select_module_app"), :class => 'control-label' %> | ||||
| 	<div class="controls"> | ||||
|         	<%= f.select :module_app_id, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel =>  reload_after_module_changed_admin_pages_path,:id=>"page_module_app_id"} %> | ||||
|         	<%= f.select :module_app_id, options_from_collection_for_select(@module_apps, :id, :module_name, :selected =>(@selected[:module_app].id rescue nil)), {:include_blank => true }, {:rel =>  reload_after_module_changed_admin_pages_path,:id=>"page_module_app_id"} %> | ||||
| 	</div> | ||||
| </div> | ||||
| 
 | ||||
| <div  class="control-group" id="frontend_list"> | ||||
| 	<%= f.label '', t("front_page.select_app_url"), :class => 'control-label' %> | ||||
| 	<div class="controls" id="app_page_url"> | ||||
| 		<%= select('page','app_frontend_url', @app_frontend_urls || [],{}, {:selected => (@item.app_frontend_url || 'default_widget'),:rel => reload_after_list_changed_admin_pages_path}) rescue ''%> | ||||
| 		<%= select('page','app_frontend_url', @app_frontend_urls || [], {:selected => @selected[:app_frontend_url],:rel => reload_after_list_changed_admin_pages_path}) rescue ''%> | ||||
| 	</div> | ||||
| </div> | ||||
| 
 | ||||
|  | @ -67,7 +67,7 @@ | |||
| </div> | ||||
| 
 | ||||
| <div  class="control-group" id='data_count'> | ||||
| 	<%= render :partial=>'data_count_field',:locals=>{:field_name=>"page[frontend_data_count]",:field_value=>@item.frontend_data_count} %> | ||||
| 	<%= render :partial=>'data_count_field',:locals=>{:field_name=>"page[frontend_data_count]",:field_value=>@selected[:page_frontend_data_count]} %> | ||||
| </div> | ||||
| 
 | ||||
| <div class="control-group"> | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| 		<% @module_app.widget_fields.each_with_index do |frontend_field, i| %> | ||||
| 			<%= i+1 %> | ||||
| 			<%= select_tag "page[frontend_field][]",widget_field_options(i,@item) , :include_blank => true %> | ||||
| 			<%= select_tag "page[frontend_field_type][]", widget_fiield_class_options(i,@item), :include_blank => true %> <br /> | ||||
| 			<%= select_tag "page[frontend_field_type][]", widget_field_class_options(i,@item), :include_blank => true %> <br /> | ||||
| 		<% end %>			 | ||||
| 	<% end %>	 | ||||
| 	 | ||||
|  |  | |||
|  | @ -1,16 +1,16 @@ | |||
| <% if @module_app %> | ||||
| <% if @selected[:module_app] %> | ||||
|   $('#app_page_category').html("<%= j render :partial => 'admin/page_parts/widget_data_source_category' ,:locals=>{:object=>@item}%>"); | ||||
|   $('#app_page_tag').html("<%=  j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@item} %>"); | ||||
|   $("#data_count").html("<%= j render :partial => 'admin/pages/data_count_field',:locals=>{:field_name=>'page[frontend_data_count]',:field_value=>(@item.frontend_data_count rescue nil)} %>"); | ||||
|    | ||||
|   <% if !@module_app.app_pages.blank? or @module_app.has_default_widget? %> | ||||
|     $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, (@item.app_frontend_url || 'default_widget')),{},{:rel => reload_after_list_changed_admin_pages_path}) %>"); | ||||
|   <% if !@selected[:module_app].app_pages.blank? or @selected[:module_app].has_default_widget? %> | ||||
|     $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, @selected[:app_frontend_url]),{},{:rel => reload_after_list_changed_admin_pages_path}) %>"); | ||||
|     <% else %> | ||||
|     $('#app_page_url').html("<div class='well'><%= t('default_widget.no_support_setting')%></div>"); | ||||
|   <% end %> | ||||
| 
 | ||||
|   <% if  @app_frontend_urls.first =='default_widget' %> | ||||
|       $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>"); | ||||
|       $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @selected[:module_app].widgets[@selected[:app_frontend_url]]) %>"); | ||||
|     <% else %> | ||||
|       $('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>"); | ||||
|   <% end %> | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| $("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page','frontend_field',nil,@choosen_field) %>"); | ||||
| $("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page','frontend_field',nil,@selected[:default_widget_field]) %>"); | ||||
|  | @ -3,15 +3,15 @@ | |||
|     <table class="default_widget_tb" border="0" cellpadding="0" cellspacing="0" > | ||||
|     <thead> | ||||
|       <tr> | ||||
|         <% @fields.each do |field|%> | ||||
|           <th><%= content_tag(:span,get_field_header(field[0]),:class=>field[1])%></th> | ||||
|         <% @frontend_field_names.each_with_index do |field,index|%> | ||||
|           <%= content_tag(:th,content_tag(:span,get_field_header(field),:class=>@frontend_classes[index]))unless field.blank?%> | ||||
|         <% end %> | ||||
|       </tr> | ||||
|     </thead> | ||||
|       <% @data.each do |row_data| %> | ||||
|         <tr> | ||||
|           <% @fields.each do |field|%> | ||||
|             <td><%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%></td> | ||||
|           <% @frontend_field_names.each_with_index do |field,index|%> | ||||
|               <%= content_tag(:td,content_tag(:span,link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]))unless field.blank?%> | ||||
|           <% end %> | ||||
|         </tr> | ||||
|       <% end %> | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
|           <%= image_tag row_data.send(@widget_image_field)%> | ||||
|         </div> | ||||
|         <div class="wrap"> | ||||
|           <% @fields.each do |field|%> | ||||
|               <%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%> | ||||
|           <% @frontend_field_names.each_with_index do |field,index|%> | ||||
|               <%= content_tag(:span,link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]) unless field.blank?%> | ||||
|           <% end %> | ||||
|         </div> | ||||
|       <% end %> | ||||
|  |  | |||
|  | @ -5,8 +5,8 @@ | |||
|   <ul class="default_widget_list"> | ||||
|     <% @data.each do |row_data| %> | ||||
|       <%= content_tag(:li) do %> | ||||
|         <% @fields.each do |field|%> | ||||
|             <%= content_tag(:span, link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%> | ||||
|         <% @frontend_field_names.each_with_index do |field,index|%> | ||||
|             <%= content_tag(:span, link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]) unless field.blank?%> | ||||
|         <% end %> | ||||
|       <% end %> | ||||
|     <% end %> | ||||
|  |  | |||
|  | @ -209,6 +209,7 @@ en: | |||
|   forgot_password: Forgot your password? | ||||
|   frequency: Frequency | ||||
|   front_page: | ||||
|     name_field_helper: Can not be blank | ||||
|     select_app_url:  | ||||
|     is_published:  | ||||
|     menu_enable_lang:  | ||||
|  |  | |||
|  | @ -209,6 +209,7 @@ zh_tw: | |||
|   forgot_password: 忘記密碼? | ||||
|   frequency: 頻率 | ||||
|   front_page: | ||||
|     name_field_helper: 請輸入數字或英文,不可使用空白 | ||||
|     select_app_url: 模組前台樣式 | ||||
|     is_published: 是否公開 | ||||
|     menu_enable_lang: 選單啓用語系 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| defaults: &defaults | ||||
|   host: 192.168.1.105 | ||||
|   host: localhost | ||||
|   # slaves: | ||||
|   #   - host: slave1.local | ||||
|   port: 27017 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue