fix widget field reload
This commit is contained in:
		
							parent
							
								
									0be1c45c81
								
							
						
					
					
						commit
						5f832a17d4
					
				| 
						 | 
				
			
			@ -43,7 +43,7 @@ $("#tag_list select").live('change', function() {
 | 
			
		|||
});
 | 
			
		||||
 | 
			
		||||
$("select.widget_field_select").live('change', function() {
 | 
			
		||||
	$.getScript(get_object_path() + '/reload_after_widget_field_changed?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri'));
 | 
			
		||||
	$.getScript(get_object_path() + '/reload_after_widget_field_changed?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());
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$('.part_kind').live('click', function() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,6 +108,7 @@ class Admin::PagePartsController < ApplicationController
 | 
			
		|||
    @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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -180,4 +180,12 @@ helper Admin::PagePartsHelper
 | 
			
		|||
    end
 | 
			
		||||
  end
 | 
			
		||||
  
 | 
			
		||||
  def reload_widget_field
 | 
			
		||||
    @index = params[:field_seri].to_i
 | 
			
		||||
    @page = Page.find params[:id]
 | 
			
		||||
    @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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
  <label for="<%= field_name %>" class="control-label">
 | 
			
		||||
      <%= t("default_widget.widget_data_count") %>
 | 
			
		||||
  </label>
 | 
			
		||||
  <div class="controls">  
 | 
			
		||||
      <%= select_tag(field_name,options_for_select(@module_app.get_registration.get_data_count,field_value )) %>
 | 
			
		||||
  </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page','frontend_field',nil,@choosen_field) %>");
 | 
			
		||||
| 
						 | 
				
			
			@ -90,6 +90,7 @@ Orbit::Application.routes.draw do
 | 
			
		|||
        get 'reload_themes'
 | 
			
		||||
        get 'reload_after_module_changed',:action=>'reload_frontend_pages'
 | 
			
		||||
        get 'reload_after_list_changed',:action=> 'reload_front_end_setting'
 | 
			
		||||
        get 'reload_after_widget_field_changed',:action=> 'reload_widget_field'
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
module DefaultWidgetTagHelper
 | 
			
		||||
  include Renderer
 | 
			
		||||
  include AdminHelper
 | 
			
		||||
 | 
			
		||||
  def link_to_more_tag(req,params)
 | 
			
		||||
    @request = req
 | 
			
		||||
    @params =params
 | 
			
		||||
      content_tag :div,:class=> 'more' do 
 | 
			
		||||
  	 link_to I18n.t(@more_link[:label_i18n]),eval(@more_link[:path_method])
 | 
			
		||||
      end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ module OrbitApp
 | 
			
		|||
            @side_bar = nil
 | 
			
		||||
            @front_end_app_pages = nil
 | 
			
		||||
            @module_label = 'rulingcom.errors.init.module_app_noname'
 | 
			
		||||
            @data_count = 1..3 # as default
 | 
			
		||||
            @data_count = 1..15 # as default
 | 
			
		||||
            block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
 | 
			
		||||
            setup_module_app
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -208,6 +208,7 @@ namespace :migrate do
 | 
			
		|||
        pp.save
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  task :clean_parts => :environment do
 | 
			
		||||
    PagePart.where(widget_style: /\d/, kind: 'module_widget').each{|part| part.update_attributes({kind: 'text', widget_style: nil, widget_field: nil})}
 | 
			
		||||
| 
						 | 
				
			
			@ -231,7 +232,6 @@ namespace :migrate do
 | 
			
		|||
    Page.all.each do |page| 
 | 
			
		||||
      page.save
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue