netzke-basepack 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +5 -0
- data/Rakefile +2 -5
- data/lib/netzke/basepack/border_layout_panel.rb +5 -5
- data/lib/netzke/basepack/form_panel/services.rb +18 -13
- data/lib/netzke/basepack/grid_panel/services.rb +15 -10
- data/lib/netzke/basepack/version.rb +1 -1
- data/netzke-basepack.gemspec +8 -9
- data/test/rails_app/app/components/user_grid_with_customized_form_fields.rb +18 -0
- metadata +8 -6
    
        data/CHANGELOG.rdoc
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -9,7 +9,7 @@ begin | |
| 9 9 | 
             
                gemspec.email = "sergei@playcode.nl"
         | 
| 10 10 | 
             
                gemspec.homepage = "http://netzke.org"
         | 
| 11 11 | 
             
                gemspec.authors = ["Sergei Kozlov"]
         | 
| 12 | 
            -
                gemspec.add_dependency("netzke-core", "~>0.6. | 
| 12 | 
            +
                gemspec.add_dependency("netzke-core", "~>0.6.4")
         | 
| 13 13 | 
             
                gemspec.add_dependency("meta_where", ">=0.9.3")
         | 
| 14 14 | 
             
                gemspec.add_dependency("will_paginate", "~>3.0.pre2")
         | 
| 15 15 | 
             
                gemspec.add_dependency("acts_as_list")
         | 
| @@ -17,10 +17,7 @@ begin | |
| 17 17 |  | 
| 18 18 | 
             
            ========================================================================
         | 
| 19 19 |  | 
| 20 | 
            -
                       Thanks for installing  | 
| 21 | 
            -
             | 
| 22 | 
            -
              Don't forget to run "./script/generate netzke_basepack" for each
         | 
| 23 | 
            -
              Rails app that will be using this gem.
         | 
| 20 | 
            +
                       Thanks for installing netzke-basepack!
         | 
| 24 21 |  | 
| 25 22 | 
             
              Netzke home page:     http://netzke.org
         | 
| 26 23 | 
             
              Netzke Google Groups: http://groups.google.com/group/netzke
         | 
| @@ -16,9 +16,9 @@ module Netzke | |
| 16 16 | 
             
                        updated_items.each do |item|
         | 
| 17 17 | 
             
                          region = item[:region] || components[item[:component]][:region]
         | 
| 18 18 | 
             
                          item.merge!({
         | 
| 19 | 
            -
                            :width => state["#{region}_region_width"],
         | 
| 20 | 
            -
                            :height => state["#{region}_region_height"],
         | 
| 21 | 
            -
                            :collapsed => state["#{region}_region_collapsed"]
         | 
| 19 | 
            +
                            :width => state[:"#{region}_region_width"],
         | 
| 20 | 
            +
                            :height => state[:"#{region}_region_height"],
         | 
| 21 | 
            +
                            :collapsed => state[:"#{region}_region_collapsed"]
         | 
| 22 22 | 
             
                          })
         | 
| 23 23 | 
             
                        end
         | 
| 24 24 | 
             
                      end
         | 
| @@ -83,8 +83,8 @@ module Netzke | |
| 83 83 |  | 
| 84 84 | 
             
                  endpoint :region_resized do |params|
         | 
| 85 85 | 
             
                    size_state_hash = {}
         | 
| 86 | 
            -
                    size_state_hash[:"#{params[:region]}_region_width"] = params[:width] if params[:width]
         | 
| 87 | 
            -
                    size_state_hash[:"#{params[:region]}_region_height"] = params[:height] if params[:height]
         | 
| 86 | 
            +
                    size_state_hash[:"#{params[:region]}_region_width"] = params[:width].to_i if params[:width]
         | 
| 87 | 
            +
                    size_state_hash[:"#{params[:region]}_region_height"] = params[:height].to_i if params[:height]
         | 
| 88 88 | 
             
                    update_state(size_state_hash)
         | 
| 89 89 | 
             
                  end
         | 
| 90 90 |  | 
| @@ -10,18 +10,7 @@ module Netzke | |
| 10 10 | 
             
                      # Endpoints
         | 
| 11 11 | 
             
                      #
         | 
| 12 12 | 
             
                      endpoint :netzke_submit do |params|
         | 
| 13 | 
            -
                         | 
| 14 | 
            -
                        success = create_or_update_record(data)
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                        if success
         | 
| 17 | 
            -
                          {:set_form_values => values, :set_result => "ok"}
         | 
| 18 | 
            -
                        else
         | 
| 19 | 
            -
                          # flash eventual errors
         | 
| 20 | 
            -
                          @record.errors.to_a.each do |msg|
         | 
| 21 | 
            -
                            flash :error => msg
         | 
| 22 | 
            -
                          end
         | 
| 23 | 
            -
                          {:feedback => @flash}
         | 
| 24 | 
            -
                        end
         | 
| 13 | 
            +
                        netzke_submit(params)
         | 
| 25 14 | 
             
                      end
         | 
| 26 15 |  | 
| 27 16 | 
             
                      endpoint :netzke_load do |params|
         | 
| @@ -57,6 +46,22 @@ module Netzke | |
| 57 46 | 
             
                      record && record.to_hash(fields)
         | 
| 58 47 | 
             
                    end
         | 
| 59 48 |  | 
| 49 | 
            +
                    # Implementation for the "netzke_submit" endpoint (for backward compatibility)
         | 
| 50 | 
            +
                    def netzke_submit(params)
         | 
| 51 | 
            +
                      data = ActiveSupport::JSON.decode(params[:data])
         | 
| 52 | 
            +
                      success = create_or_update_record(data)
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                      if success
         | 
| 55 | 
            +
                        {:set_form_values => values, :set_result => "ok"}
         | 
| 56 | 
            +
                      else
         | 
| 57 | 
            +
                        # flash eventual errors
         | 
| 58 | 
            +
                        @record.errors.to_a.each do |msg|
         | 
| 59 | 
            +
                          flash :error => msg
         | 
| 60 | 
            +
                        end
         | 
| 61 | 
            +
                        {:feedback => @flash}
         | 
| 62 | 
            +
                      end
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
             | 
| 60 65 | 
             
                    private
         | 
| 61 66 |  | 
| 62 67 | 
             
                      # Creates/updates a record from hash
         | 
| @@ -96,4 +101,4 @@ module Netzke | |
| 96 101 | 
             
                  end
         | 
| 97 102 | 
             
                end
         | 
| 98 103 | 
             
              end
         | 
| 99 | 
            -
            end
         | 
| 104 | 
            +
            end
         | 
| @@ -10,15 +10,8 @@ module Netzke | |
| 10 10 |  | 
| 11 11 | 
             
                    included do
         | 
| 12 12 |  | 
| 13 | 
            -
                      endpoint :get_data do  | 
| 14 | 
            -
                        params | 
| 15 | 
            -
                        if !config[:prohibit_read]
         | 
| 16 | 
            -
                          records = get_records(params)
         | 
| 17 | 
            -
                          {:data => records.map{|r| r.to_array(columns)}, :total => config[:enable_pagination] && records.total_entries}
         | 
| 18 | 
            -
                        else
         | 
| 19 | 
            -
                          flash :error => "You don't have permissions to read data"
         | 
| 20 | 
            -
                          {:feedback => @flash}
         | 
| 21 | 
            -
                        end
         | 
| 13 | 
            +
                      endpoint :get_data do |params|
         | 
| 14 | 
            +
                        get_data(params)
         | 
| 22 15 | 
             
                      end
         | 
| 23 16 |  | 
| 24 17 | 
             
                      endpoint :post_data do |params|
         | 
| @@ -153,11 +146,23 @@ module Netzke | |
| 153 146 | 
             
                    end
         | 
| 154 147 |  | 
| 155 148 | 
             
                    # When providing the edit_form component, fill in the form with the requested record
         | 
| 156 | 
            -
                    def  | 
| 149 | 
            +
                    def deliver_component_endpoint(params)
         | 
| 157 150 | 
             
                      components[:edit_form][:items].first.merge!(:record_id => params[:record_id].to_i) if params[:name] == 'edit_form'
         | 
| 158 151 | 
             
                      super
         | 
| 159 152 | 
             
                    end
         | 
| 160 153 |  | 
| 154 | 
            +
                    # Implementation for the "get_data" endpoint
         | 
| 155 | 
            +
                    def get_data(*args)
         | 
| 156 | 
            +
                      params = args.first || {} # params are optional!
         | 
| 157 | 
            +
                      if !config[:prohibit_read]
         | 
| 158 | 
            +
                        records = get_records(params)
         | 
| 159 | 
            +
                        {:data => records.map{|r| r.to_array(columns)}, :total => config[:enable_pagination] && records.total_entries}
         | 
| 160 | 
            +
                      else
         | 
| 161 | 
            +
                        flash :error => "You don't have permissions to read data"
         | 
| 162 | 
            +
                        {:feedback => @flash}
         | 
| 163 | 
            +
                      end
         | 
| 164 | 
            +
                    end
         | 
| 165 | 
            +
             | 
| 161 166 | 
             
                    protected
         | 
| 162 167 |  | 
| 163 168 | 
             
                      def get_records(params)
         | 
    
        data/netzke-basepack.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{netzke-basepack}
         | 
| 8 | 
            -
              s.version = "0.6. | 
| 8 | 
            +
              s.version = "0.6.2"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Sergei Kozlov"]
         | 
| 12 | 
            -
              s.date = %q{2010-11- | 
| 12 | 
            +
              s.date = %q{2010-11-05}
         | 
| 13 13 | 
             
              s.description = %q{A set of full-featured extendible Netzke components (such as FormPanel, GridPanel, Window, BorderLayoutPanel, etc) which can be used as building block for your RIA}
         | 
| 14 14 | 
             
              s.email = %q{sergei@playcode.nl}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -128,6 +128,7 @@ Gem::Specification.new do |s| | |
| 128 128 | 
             
                "test/rails_app/app/components/user_form.rb",
         | 
| 129 129 | 
             
                "test/rails_app/app/components/user_form_with_default_fields.rb",
         | 
| 130 130 | 
             
                "test/rails_app/app/components/user_grid.rb",
         | 
| 131 | 
            +
                "test/rails_app/app/components/user_grid_with_customized_form_fields.rb",
         | 
| 131 132 | 
             
                "test/rails_app/app/components/window_component_loader.rb",
         | 
| 132 133 | 
             
                "test/rails_app/app/controllers/application_controller.rb",
         | 
| 133 134 | 
             
                "test/rails_app/app/controllers/components_controller.rb",
         | 
| @@ -202,10 +203,7 @@ Gem::Specification.new do |s| | |
| 202 203 | 
             
              s.post_install_message = %q{
         | 
| 203 204 | 
             
            ========================================================================
         | 
| 204 205 |  | 
| 205 | 
            -
                       Thanks for installing  | 
| 206 | 
            -
             | 
| 207 | 
            -
              Don't forget to run "./script/generate netzke_basepack" for each
         | 
| 208 | 
            -
              Rails app that will be using this gem.
         | 
| 206 | 
            +
                       Thanks for installing netzke-basepack!
         | 
| 209 207 |  | 
| 210 208 | 
             
              Netzke home page:     http://netzke.org
         | 
| 211 209 | 
             
              Netzke Google Groups: http://groups.google.com/group/netzke
         | 
| @@ -238,6 +236,7 @@ Gem::Specification.new do |s| | |
| 238 236 | 
             
                "test/rails_app/app/components/user_form.rb",
         | 
| 239 237 | 
             
                "test/rails_app/app/components/user_form_with_default_fields.rb",
         | 
| 240 238 | 
             
                "test/rails_app/app/components/user_grid.rb",
         | 
| 239 | 
            +
                "test/rails_app/app/components/user_grid_with_customized_form_fields.rb",
         | 
| 241 240 | 
             
                "test/rails_app/app/components/window_component_loader.rb",
         | 
| 242 241 | 
             
                "test/rails_app/app/controllers/application_controller.rb",
         | 
| 243 242 | 
             
                "test/rails_app/app/controllers/components_controller.rb",
         | 
| @@ -290,18 +289,18 @@ Gem::Specification.new do |s| | |
| 290 289 | 
             
                s.specification_version = 3
         | 
| 291 290 |  | 
| 292 291 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 293 | 
            -
                  s.add_runtime_dependency(%q<netzke-core>, ["~> 0.6. | 
| 292 | 
            +
                  s.add_runtime_dependency(%q<netzke-core>, ["~> 0.6.4"])
         | 
| 294 293 | 
             
                  s.add_runtime_dependency(%q<meta_where>, [">= 0.9.3"])
         | 
| 295 294 | 
             
                  s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
         | 
| 296 295 | 
             
                  s.add_runtime_dependency(%q<acts_as_list>, [">= 0"])
         | 
| 297 296 | 
             
                else
         | 
| 298 | 
            -
                  s.add_dependency(%q<netzke-core>, ["~> 0.6. | 
| 297 | 
            +
                  s.add_dependency(%q<netzke-core>, ["~> 0.6.4"])
         | 
| 299 298 | 
             
                  s.add_dependency(%q<meta_where>, [">= 0.9.3"])
         | 
| 300 299 | 
             
                  s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
         | 
| 301 300 | 
             
                  s.add_dependency(%q<acts_as_list>, [">= 0"])
         | 
| 302 301 | 
             
                end
         | 
| 303 302 | 
             
              else
         | 
| 304 | 
            -
                s.add_dependency(%q<netzke-core>, ["~> 0.6. | 
| 303 | 
            +
                s.add_dependency(%q<netzke-core>, ["~> 0.6.4"])
         | 
| 305 304 | 
             
                s.add_dependency(%q<meta_where>, [">= 0.9.3"])
         | 
| 306 305 | 
             
                s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
         | 
| 307 306 | 
             
                s.add_dependency(%q<acts_as_list>, [">= 0"])
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            class UserGridWithCustomizedFormFields < Netzke::Basepack::GridPanel
         | 
| 2 | 
            +
              js_property :title, "Users"
         | 
| 3 | 
            +
              config :model => "User"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              def default_fields_for_forms
         | 
| 6 | 
            +
                [
         | 
| 7 | 
            +
                  {:xtype => 'fieldset', :title => "Basic Info", :checkboxToggle => true, :items => [
         | 
| 8 | 
            +
                    :first_name,
         | 
| 9 | 
            +
                    {:name => :last_name}
         | 
| 10 | 
            +
                  ]},
         | 
| 11 | 
            +
                  {:xtype => 'fieldset', :title => "Timestamps", :items => [
         | 
| 12 | 
            +
                    {:name => :created_at, :disabled => true},
         | 
| 13 | 
            +
                    {:name => :updated_at, :disabled => true}
         | 
| 14 | 
            +
                  ]},
         | 
| 15 | 
            +
                  :role__name
         | 
| 16 | 
            +
                ]
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 0
         | 
| 7 7 | 
             
              - 6
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.6. | 
| 8 | 
            +
              - 2
         | 
| 9 | 
            +
              version: 0.6.2
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - Sergei Kozlov
         | 
| @@ -14,7 +14,7 @@ autorequire: | |
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 16 |  | 
| 17 | 
            -
            date: 2010-11- | 
| 17 | 
            +
            date: 2010-11-05 00:00:00 +01:00
         | 
| 18 18 | 
             
            default_executable: 
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -28,8 +28,8 @@ dependencies: | |
| 28 28 | 
             
                    segments: 
         | 
| 29 29 | 
             
                    - 0
         | 
| 30 30 | 
             
                    - 6
         | 
| 31 | 
            -
                    -  | 
| 32 | 
            -
                    version: 0.6. | 
| 31 | 
            +
                    - 4
         | 
| 32 | 
            +
                    version: 0.6.4
         | 
| 33 33 | 
             
              type: :runtime
         | 
| 34 34 | 
             
              version_requirements: *id001
         | 
| 35 35 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -196,6 +196,7 @@ files: | |
| 196 196 | 
             
            - test/rails_app/app/components/user_form.rb
         | 
| 197 197 | 
             
            - test/rails_app/app/components/user_form_with_default_fields.rb
         | 
| 198 198 | 
             
            - test/rails_app/app/components/user_grid.rb
         | 
| 199 | 
            +
            - test/rails_app/app/components/user_grid_with_customized_form_fields.rb
         | 
| 199 200 | 
             
            - test/rails_app/app/components/window_component_loader.rb
         | 
| 200 201 | 
             
            - test/rails_app/app/controllers/application_controller.rb
         | 
| 201 202 | 
             
            - test/rails_app/app/controllers/components_controller.rb
         | 
| @@ -270,7 +271,7 @@ homepage: http://netzke.org | |
| 270 271 | 
             
            licenses: []
         | 
| 271 272 |  | 
| 272 273 | 
             
            post_install_message: "\n\
         | 
| 273 | 
            -
              ========================================================================\n\n           Thanks for installing  | 
| 274 | 
            +
              ========================================================================\n\n           Thanks for installing netzke-basepack!\n\n  Netzke home page:     http://netzke.org\n  Netzke Google Groups: http://groups.google.com/group/netzke\n  Netzke tutorials:     http://blog.writelesscode.com\n\n\
         | 
| 274 275 | 
             
              ========================================================================\n\n"
         | 
| 275 276 | 
             
            rdoc_options: []
         | 
| 276 277 |  | 
| @@ -320,6 +321,7 @@ test_files: | |
| 320 321 | 
             
            - test/rails_app/app/components/user_form.rb
         | 
| 321 322 | 
             
            - test/rails_app/app/components/user_form_with_default_fields.rb
         | 
| 322 323 | 
             
            - test/rails_app/app/components/user_grid.rb
         | 
| 324 | 
            +
            - test/rails_app/app/components/user_grid_with_customized_form_fields.rb
         | 
| 323 325 | 
             
            - test/rails_app/app/components/window_component_loader.rb
         | 
| 324 326 | 
             
            - test/rails_app/app/controllers/application_controller.rb
         | 
| 325 327 | 
             
            - test/rails_app/app/controllers/components_controller.rb
         |