Class: Widgets::Scaffold::Base
- Inherits:
-
ErpApp::Widgets::Base
- Object
- ErpApp::Widgets::Base
- Widgets::Scaffold::Base
- Defined in:
- app/widgets/scaffold/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
- #index ⇒ Object
-
#locate ⇒ Object
should not be modified modify at your own risk.
- #setup ⇒ Object
- #setup_active_ext_core ⇒ Object
Class Method Details
.title ⇒ Object
77 78 79 |
# File 'app/widgets/scaffold/base.rb', line 77 def title "CompassAE Scaffold" end |
.widget_name ⇒ Object
81 82 83 |
# File 'app/widgets/scaffold/base.rb', line 81 def File.basename(File.dirname(__FILE__)) end |
Instance Method Details
#data ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/widgets/scaffold/base.rb', line 33 def data active_ext_core = setup_active_ext_core json_text = nil if request.get? json_text = ActiveExt::ExtHelpers::DataHelper.build_json_data(active_ext_core, :limit => params[:limit], :offset => params[:start]) elsif request.post? json_text = ActiveExt::ExtHelpers::DataHelper.create_record(active_ext_core, :data => params[:data]) elsif request.put? json_text = ActiveExt::ExtHelpers::DataHelper.update_record(active_ext_core, :data => params[:data], :id => params[:data][:id]) elsif request.delete? json_text = ActiveExt::ExtHelpers::DataHelper.delete_record(active_ext_core, :data => params[:data], :id => params[:data][:id]) end render :inline => json_text end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/widgets/scaffold/base.rb', line 4 def index @model_name = params[:model_name] @title = params[:grid][:title] || params[:model].pluralize @width = params[:grid][:width] || '100%' @height = params[:grid][:height] || 500 @page = params[:grid][:page] || true @page_size = params[:grid][:page_size] || 10 @display_msg = params[:grid][:display_msg] || 'Displaying {0} - {1} of {2}' @empty_msg = params[:grid][:empty_msg] || 'Empty' @editable = params[:editable] || false render :view => :index end |
#locate ⇒ Object
should not be modified modify at your own risk
72 73 74 |
# File 'app/widgets/scaffold/base.rb', line 72 def locate File.dirname(__FILE__) end |
#setup ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/widgets/scaffold/base.rb', line 18 def setup active_ext_core = setup_active_ext_core columns, fields, validations = ActiveExt::ExtHelpers::TableBuilder.generate_columns_and_fields(active_ext_core) result = { :success => true, :use_ext_forms => active_ext_core.[:use_ext_forms].nil? ? false : active_ext_core.[:use_ext_forms], :inline_edit => active_ext_core.[:inline_edit].nil? ? false : active_ext_core.[:inline_edit], :columns => columns, :fields => fields, :validations => validations } render :inline => result.to_json end |
#setup_active_ext_core ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/widgets/scaffold/base.rb', line 51 def setup_active_ext_core model_id = session[:widgets][self.uuid][:model].pluralize.singularize = { :inline_edit => true, :use_ext_forms => false, :ignore_associations => true, :show_id => true, :show_timestamps => true, :only => nil } #merge in passed widget options .each do |key, value| [key] = session[:widgets][self.uuid][key] unless session[:widgets][self.uuid][key].blank? end ActiveExt::Core.new(model_id,) end |