gallery options
This commit is contained in:
1 parent
2a122c7f5c
commit
baf1240b76
15 files changed
+66
-17
No files matched your search
@@ -1,3 +1,7 @@
|
||||
function get_part_id(){
|
||||
return $(".edit_page_part").attr("action").split('/').pop();
|
||||
}
|
||||
|
||||
$("div.editable").live("mouseenter mouseleave", function (event) {
|
||||
$(this).children('.edit_link').toggle();
|
||||
});
|
||||
@@ -21,11 +25,11 @@ $("#page_module_app_id").live('change', function() {
|
||||
});
|
||||
|
||||
$("#module_app_list select").live('change', function() {
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets');
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets?part_id=' + get_part_id());
|
||||
});
|
||||
|
||||
$("#widget_list select").live('change', function() {
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val());
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val() + '&part_id=' + get_part_id());
|
||||
});
|
||||
|
||||
$("#tag_list select").live('change', function() {
|
||||
|
||||
@@ -90,6 +90,7 @@ class Admin::PagePartsController < ApplicationController
|
||||
end
|
||||
|
||||
def reload_widgets
|
||||
@part = PagePart.find params[:part_id]
|
||||
@categories =[]
|
||||
@module_app = ModuleApp.find(params[:id])
|
||||
|
||||
@@ -112,6 +113,7 @@ class Admin::PagePartsController < ApplicationController
|
||||
@tags = ArchiveTag.all
|
||||
end
|
||||
|
||||
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option?
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
class OrbitWidgetController< OrbitFrontendComponentController
|
||||
before_filter :get_wiget_options
|
||||
|
||||
def get_wiget_options
|
||||
@wiget_options = {}
|
||||
if params[:widget_options]
|
||||
@wiget_options = (eval('{'+ params[:widget_options] +'}') rescue {})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -12,12 +12,13 @@ class ModuleApp
|
||||
field :update_info
|
||||
field :create_date
|
||||
field :enable_frontend, type: Boolean, :default => true
|
||||
|
||||
|
||||
field :app_pages ,type: Array
|
||||
# field :widgets ,type: Array
|
||||
field :widgets ,type: Hash
|
||||
field :widget_fields ,type: Array
|
||||
|
||||
field :widget_options,type:Hash
|
||||
field :widget_options_fields_i18n,type:Hash
|
||||
has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app
|
||||
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
|
||||
|
||||
@@ -79,6 +80,14 @@ class ModuleApp
|
||||
end
|
||||
end
|
||||
|
||||
def needs_to_widget_option?
|
||||
if self.widget_options
|
||||
self.widget_options.has_key? widgets.first
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
|
||||
@@ -14,6 +14,7 @@ class PagePart
|
||||
|
||||
field :widget_style
|
||||
field :widget_field , :type => Array
|
||||
field :widget_options ,:type=>Hash
|
||||
field :widget_data_count
|
||||
|
||||
belongs_to :page
|
||||
@@ -22,6 +23,11 @@ class PagePart
|
||||
before_save :delete_empty_widget_field
|
||||
after_save :update_parent
|
||||
|
||||
def widget_options_uri
|
||||
self.widget_options.map{|t| "#{t[0]}: #{t[1]}"}.join(',') rescue ''
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def delete_empty_widget_field
|
||||
@@ -35,4 +41,5 @@ class PagePart
|
||||
self.page.save
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -46,7 +46,6 @@
|
||||
<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %>
|
||||
</span>
|
||||
|
||||
<div id="widget_data_count">
|
||||
<%= f.label :widget_data_count %>
|
||||
<%= f.text_field :widget_data_count %>
|
||||
</div>
|
||||
<span id="widget_options">
|
||||
<%= render 'widget_options' %>
|
||||
</span>
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
<% if (@module_app && @module_app.widget_fields) %>
|
||||
|
||||
<%= label_tag('widget_field') %>
|
||||
@@ -9,4 +8,6 @@
|
||||
<%= select_tag "page_part[widget_field_type][]", options_for_select(LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][1] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %> <br />
|
||||
<% end %>
|
||||
|
||||
<%= label_tag :widget_data_count %>
|
||||
<%= text_field_tag :widget_data_count,@part.widget_data_count %>
|
||||
<% end %>
|
||||
@@ -2,4 +2,6 @@ $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.coll
|
||||
$('#widget_style_list').html("<%= escape_javascript(select 'page_part', 'widget_style', @module_app.widgets[@widget_path]) if !@widget_path.blank? %>");
|
||||
$('#widget_field').html("<%= j render 'widget_fields' %>");
|
||||
$('#widget_category').html("<%= j render 'widget_categories' %>");
|
||||
$('#widget_tag').html("<%= j render 'widget_tags' %>");
|
||||
$('#widget_tag').html("<%= j render 'widget_tags' %>");
|
||||
|
||||
$("#widget_options").html("<%= j render 'widget_options'%>");
|
||||
Reference in new issue
Block a user