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