netzke-basepack 0.9.0.rc1 → 0.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c90d8002f07f239a7c21fbaece95d28b626a11a3
4
- data.tar.gz: 528ac9f660584658074cf09640bd9b650854bd7d
3
+ metadata.gz: 7efff735638e53b2d16a815c6d2c34e7e0cb12ae
4
+ data.tar.gz: 4472d0094ce1ab7692814140edcba271fedee812
5
5
  SHA512:
6
- metadata.gz: c041285c3001a8077d7e49f02f4fc75043d89938e42d2fab180f886b04ff65fe16f85e948677bd847eb18f2f90414fb7b6e6e25090d074b1e937bb19e9f21623
7
- data.tar.gz: 97c07cf67984943c5e29e06b27040506a1c8811370b84d8e2cbb6bc5ad579abc3555ad4135498c05f2d12a1d1739b6523c9c581842c2d97c5e69648a6a580920
6
+ metadata.gz: b02239f65587e5c3ea3209ba9d17f4f0072048e4009d613c7d49f2282383dbc6df793f6f812c80ac9a4408c1c6dd4e66fb65ea384bfdc456eef8cb259221a93a
7
+ data.tar.gz: f46a8460b5e5fa9dd86fb3c04a4cc4f5dbcd07dfcad77d7184e1f76ea240d7f00b92e2b022535734c41471844bf0de4dbfd738cc56bb979dd8e14c9d2dac6829
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- # 0.9.0 - WIP
1
+ # 0.9.0 - 2014-02-08
2
2
  * new
3
3
  * GridLiveSearch plugin - implements flexible "live" search on any grid
4
4
  * Implement multi-sorting support in grids
data/Gemfile CHANGED
@@ -2,12 +2,9 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- # use unreleased version of netzke-core
6
- gem 'netzke-core', github: 'netzke/netzke-core'
7
- gem 'netzke-testing'
5
+ # unreleased version of netzke-core
6
+ # gem 'netzke-core', github: 'netzke/netzke-core'
8
7
 
9
- # for local testing
10
- # gem 'netzke-testing', path: '~/code/netzke/netzke-testing'
11
8
  # gem 'netzke-core', path: '~/code/netzke/netzke-core'
12
9
 
13
10
  gem 'carrierwave'
@@ -24,4 +21,5 @@ end
24
21
 
25
22
  group :test, :development do
26
23
  gem 'pry-rails'
24
+ gem 'netzke-testing'
27
25
  end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Netzke Basepack [![Gem Version](https://badge.fury.io/rb/netzke-basepack.png)](http://badge.fury.io/rb/netzke-basepack) [![Build Status](https://travis-ci.org/netzke/netzke-basepack.png?branch=master)](https://travis-ci.org/netzke/netzke-basepack) [![Code Climate](https://codeclimate.com/github/netzke/netzke-basepack.png)](https://codeclimate.com/github/netzke/netzke-basepack)
1
+ # Netzke Basepack [![Gem Version](https://badge.fury.io/rb/netzke-basepack.png)](http://badge.fury.io/rb/netzke-basepack) [![Build Status](https://travis-ci.org/netzke/netzke-basepack.png?branch=0-9)](https://travis-ci.org/netzke/netzke-basepack) [![Code Climate](https://codeclimate.com/github/netzke/netzke-basepack.png)](https://codeclimate.com/github/netzke/netzke-basepack)
2
2
 
3
3
  [RDocs](http://rdoc.info/github/netzke/netzke-basepack)
4
4
 
@@ -23,7 +23,7 @@ enhancing any grid with live search functionality
23
23
 
24
24
  ## Requirements
25
25
 
26
- * Ruby ~> 1.9.2
26
+ * Ruby >= 1.9.3
27
27
  * Rails ~> 3.2.0
28
28
  * Ext JS ~> 4.2.0
29
29
 
@@ -35,7 +35,7 @@ In your Gemfile:
35
35
 
36
36
  For the "edge" stuff, instruct bundler to get the gem straight from GitHub:
37
37
 
38
- gem 'netzke-basepack', git: "netzke/netzke-basepack"
38
+ gem 'netzke-basepack', github: "netzke/netzke-basepack"
39
39
 
40
40
  ## Basic usage
41
41
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require "bundler/gem_tasks"
3
3
  require "./lib/netzke/basepack/version"
4
4
 
5
5
  YARD::Rake::YardocTask.new do |t|
6
- t.options = ['--title', "Netzke Basepack #{Netzke::Basepack::Version::STRING}"]
6
+ t.options = ['--title', "Netzke Basepack #{Netzke::Basepack::VERSION}"]
7
7
  end
8
8
 
9
9
  namespace :yard do
@@ -238,6 +238,10 @@ module Netzke::Basepack::DataAdapters
238
238
  else
239
239
  r.send("#{assoc.options[:foreign_key] || assoc.name.to_s.foreign_key}")
240
240
  end
241
+ # the composite_primary_keys gem produces [Key1,Key2...] and [Value1,Value2...]
242
+ # on primary_key and id requests. Basepack::AttrConfig converts the keys-array to an String.
243
+ elsif r.class.primary_key.try(:to_s) == a[:name]
244
+ r.id # return 'val1,val2...' on 'key1,key2...' composite_primary_keys
241
245
  end
242
246
 
243
247
  # a work-around for to_json not taking the current timezone into account when serializing ActiveSupport::TimeWithZone
@@ -375,15 +375,7 @@ module Netzke
375
375
  delegates_to_dsl :model
376
376
 
377
377
  def configure(c)
378
- # Defaults. The nil? checks are needed because these can be already set in a subclass
379
- c.enable_edit_in_form = self.class.edit_in_form_available if c.enable_edit_in_form.nil?
380
- c.enable_edit_inline = self.class.edit_inline_available if c.enable_edit_inline.nil?
381
- c.enable_extended_search = self.class.advanced_search_available if c.enable_extended_search.nil?
382
- c.enable_column_filters = self.class.column_filters_available if c.enable_column_filters.nil?
383
- c.enable_pagination = true if c.enable_pagination.nil?
384
- c.rows_per_page = 30 if c.rows_per_page.nil?
385
- c.tools = %w{ refresh } if c.tools.nil?
386
-
378
+ set_defaults(c)
387
379
  super
388
380
  end
389
381
 
@@ -522,7 +514,25 @@ module Netzke
522
514
  c.fields = attributes_for_search
523
515
  end
524
516
 
525
- protected
517
+ protected
518
+
519
+ # Override from Base. Ensures the model is provided.
520
+ def validate_config(c)
521
+ raise ArgumentError, "Grid requires a model" if c.model.nil?
522
+ end
523
+
524
+ private
525
+
526
+ def set_defaults(c)
527
+ # The nil? checks are needed because these can be already set in a subclass
528
+ c.enable_edit_in_form = self.class.edit_in_form_available if c.enable_edit_in_form.nil?
529
+ c.enable_edit_inline = self.class.edit_inline_available if c.enable_edit_inline.nil?
530
+ c.enable_extended_search = self.class.advanced_search_available if c.enable_extended_search.nil?
531
+ c.enable_column_filters = self.class.column_filters_available if c.enable_column_filters.nil?
532
+ c.enable_pagination = true if c.enable_pagination.nil?
533
+ c.rows_per_page = 30 if c.rows_per_page.nil?
534
+ c.tools = %w{ refresh } if c.tools.nil?
535
+ end
526
536
 
527
537
  def preconfigure_record_window(c)
528
538
  c.klass = RecordFormWindow
@@ -23,7 +23,7 @@ module Netzke
23
23
 
24
24
  feedback = errors
25
25
  if destroyed_ids.present?
26
- feedback << I18n.t('netzke.basepack.grid.deleted_n_records', :n => destroyed_ids.size)
26
+ feedback << I18n.t('netzke.basepack.grid.deleted_n_records', :count => destroyed_ids.size)
27
27
  on_data_changed
28
28
  end
29
29
  this.netzke_feedback(feedback)
@@ -69,7 +69,7 @@ module Netzke
69
69
  params[:filters] = normalize_filters(params[:filters]) if params[:filters]
70
70
  params[:query] = normalize_query(params[:query]) if params[:query].present?
71
71
  if config[:enable_pagination]
72
- params[:limit] = config[:rows_per_page]
72
+ params[:limit] = config[:rows_per_page]
73
73
  else
74
74
  params.delete(:limit)
75
75
  end
@@ -4,7 +4,7 @@ module Netzke
4
4
  # attribute, and assign the search operator. The grid will be updated on changing those fields, to reflect the
5
5
  # query.
6
6
  #
7
- # See GridWithLiveSearch for a usage example.
7
+ # See Grid::LiveSearch in spec/rails_app for a usage example.
8
8
  #
9
9
  # == Configuration:
10
10
  #
@@ -1,12 +1,5 @@
1
1
  module Netzke
2
2
  module Basepack
3
- module Version
4
- MAJOR = 0
5
- MINOR = 9
6
- PATCH = 0
7
- PRE = 'rc1'
8
-
9
- STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
10
- end
3
+ VERSION = "0.9.0"
11
4
  end
12
5
  end
data/locales/de.yml CHANGED
@@ -5,20 +5,29 @@ de:
5
5
  actions:
6
6
  add:
7
7
  text: Hinzufügen
8
+ tooltip: Hinzufügen
8
9
  edit:
9
10
  text: Bearbeiten
11
+ tooltip: Bearbeiten
10
12
  del:
11
13
  text: Löschen
14
+ tooltip: Löschen
12
15
  apply:
13
16
  text: Anwenden
17
+ tooltip: Anwenden
14
18
  add_in_form:
15
19
  text: extern Hinzufügen
20
+ tooltip: extern Hinzufügen
16
21
  edit_in_form:
17
22
  text: extern Bearbeiten
23
+ tooltip: extern Bearbeiten
18
24
  search:
19
25
  text: Suche
26
+ tooltip: Suche
20
27
 
21
- deleted_n_records: "Deleted %{n} record(s)"
28
+ deleted_n_records:
29
+ one: "1 Datensatz wurde gelöscht"
30
+ other: "%{count} Datensätze wurden gelöscht"
22
31
  cannot_delete: "Du hast keine Berechtigung die Daten zu löschen"
23
32
  confirmation: Bestätigung
24
33
  are_you_sure: Bist du sicher?
data/locales/en.yml CHANGED
@@ -19,7 +19,9 @@ en:
19
19
  search:
20
20
  text: Search
21
21
 
22
- deleted_n_records: "Deleted %{n} record(s)"
22
+ deleted_n_records:
23
+ one: "Deleted 1 record"
24
+ other: "Deleted %{count} records"
23
25
  cannot_create: "You don't have permissions to create data"
24
26
  cannot_read: "You don't have permissions to read data"
25
27
  cannot_update: "You don't have permissions to update data"
data/locales/es.yml CHANGED
@@ -19,7 +19,9 @@ es:
19
19
  search:
20
20
  text: Buscar
21
21
 
22
- deleted_n_records: "Se han eliminado %{n} registro(s)"
22
+ deleted_n_records:
23
+ one: "Se ha eliminado 1 registro"
24
+ other: "Se han eliminado %{count} registro(s)"
23
25
  cannot_delete: "Usted no tiene permiso para borrar los datos"
24
26
  confirmation: Confirmación
25
27
  are_you_sure: ¿Está seguro?
data/locales/nl.yml CHANGED
@@ -19,7 +19,9 @@ nl:
19
19
  search:
20
20
  text: Zoeken
21
21
 
22
- deleted_n_records: "%{n} objecten verwijderd"
22
+ deleted_n_records:
23
+ one: "1 object verwijderd"
24
+ other: "%{count} objecten verwijderd"
23
25
  cannot_delete: "Je hebt geen toestemming om data te verwijderen"
24
26
  confirmation: Bevestiging
25
27
  are_you_sure: Weet je het zeker?
data/locales/ru.yml CHANGED
@@ -19,7 +19,9 @@ ru:
19
19
  search:
20
20
  text: Искать
21
21
 
22
- deleted_n_records: "Записей удалено: %{n}"
22
+ deleted_n_records:
23
+ one: "1 запись удалена"
24
+ other: "Записей удалено: %{count}"
23
25
  cannot_delete: "У вас недостаточно прав для удаления"
24
26
  confirmation: Подтверждение
25
27
  are_you_sure: Вы уверены?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-basepack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.rc1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Gorin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-01 00:00:00.000000000 Z
11
+ date: 2014-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netzke-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.0.rc1
19
+ version: 0.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.0.rc1
26
+ version: 0.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: A set of feature-rich extendible Netzke components (such as Form, Grid,
98
112
  Window, TabPanel, etc) and component extensions which can be used as building blocks
99
113
  for your RIA
@@ -147,9 +161,7 @@ files:
147
161
  - lib/netzke/basepack/search_panel/javascripts/search_panel.js
148
162
  - lib/netzke/basepack/search_panel.rb
149
163
  - lib/netzke/basepack/search_window.rb
150
- - lib/netzke/basepack/simple_app/javascripts/simple_app.js
151
164
  - lib/netzke/basepack/simple_app/javascripts/statusbar_ext.js
152
- - lib/netzke/basepack/simple_app.rb
153
165
  - lib/netzke/basepack/tab_panel/javascripts/tab_panel.js
154
166
  - lib/netzke/basepack/tab_panel.rb
155
167
  - lib/netzke/basepack/version.rb
@@ -1,101 +0,0 @@
1
- module Netzke
2
- module Basepack
3
- # Basis for a Ext.container.Viewport-based one-page application.
4
- #
5
- # == Features:
6
- # * dynamic loading of components
7
- # * browser history support (press the "Back"-button to go to the previously loaded component)
8
- # * AJAX activity indicator
9
- #
10
- # == Extending SimpleApp
11
- # You may want to extend SimpleApp to provide a custom layout. Make sure you create three regions with predefined itemId's that will be used by SimpleApp. You can use the following methods defined by SimpleApp: main_panel_config, status_bar_config, and menu_bar_config, e.g.:
12
- #
13
- # class MySimpleApp < Netzke::Basepack::SimpleApp
14
- #
15
- # def configuration
16
- # super.merge(
17
- # :items => [my_custom_navigation_config, main_panel_config, menu_bar_config, status_bar_config]
18
- # )
19
- # end
20
- #
21
- # def my_custom_navigation_config
22
- # {
23
- # :item_id => 'navigation',
24
- # :region => :east,
25
- # :width => 200
26
- # }
27
- # end
28
- #
29
- # ...
30
- # end
31
- #
32
- # The JS side of the component will have those regions referenced as this.mainPanel, this.statusBar, and this.menuBar.
33
- class SimpleApp < Base
34
- js_configure do |c|
35
- c.extend = "Ext.container.Viewport"
36
- c.layout = :border
37
- c.require Netzke::Core.ext_path.join("examples", "ux/statusbar/StatusBar.js"), :statusbar_ext
38
- c.mixin
39
- end
40
-
41
- def configure(c)
42
- super
43
- c.items = [main_panel_config, menu_bar_config, status_bar_config]
44
- end
45
-
46
- # In Ext 4.1 calling `render` on a viewport causes an error
47
- def js_component_render
48
- ""
49
- end
50
-
51
- # Override for custom menu
52
- def menu
53
- []
54
- end
55
-
56
- # Config for the main panel, which will contain dynamically loaded components.
57
- def main_panel_config(overrides = {})
58
- {
59
- :itemId => 'main_panel',
60
- :region => 'center',
61
- :layout => 'fit'
62
- }.merge(overrides)
63
- end
64
-
65
- # Config for the status bar
66
- def status_bar_config(overrides = {})
67
- {
68
- :itemId => 'status_bar',
69
- :xtype => 'statusbar',
70
- :region => 'south',
71
- :height => 22,
72
- :statusAlign => 'right',
73
- :busyText => 'Busy...',
74
- :default_text => "Ready",
75
- :default_icon_cls => ""
76
- }.merge(overrides)
77
- end
78
-
79
- # Config for the menu bar
80
- def menu_bar_config(overrides = {})
81
- {
82
- :itemId => 'menu_bar',
83
- :xtype => 'toolbar',
84
- :region => 'north',
85
- :height => 28,
86
- :items => menu
87
- }.merge(overrides)
88
- end
89
-
90
- # Html required for Ext.History to work
91
- def js_component_html
92
- super << %Q{
93
- <form id="history-form" class="x-hidden">
94
- <input type="hidden" id="x-history-field" />
95
- <iframe id="x-history-frame"></iframe>
96
- </form>
97
- }
98
- end
99
- end
100
- end
101
- end
@@ -1,58 +0,0 @@
1
- {
2
- initComponent: function(){
3
- this.callParent();
4
-
5
- this.mainPanel = this.down('panel[itemId="main_panel"]');
6
- this.menuBar = this.down('container[itemId="menu_bar"]');
7
- var statusBar = this.statusBar = this.down('container[itemId="status_bar"]');
8
-
9
- Ext.util.History.on('change', this.processHistory, this);
10
-
11
- // Setting the "busy" indicator for Ajax requests
12
- Ext.Ajax.on('beforerequest', function(){ statusBar.showBusy(); });
13
- Ext.Ajax.on('requestcomplete', function(){ statusBar.hideBusy(); });
14
- Ext.Ajax.on('requestexception', function(){ statusBar.hideBusy(); });
15
-
16
- // Initialize history
17
- Ext.util.History.init();
18
- },
19
-
20
- afterRender: function(){
21
- this.callParent();
22
-
23
- // If we are given a token, load the corresponding component, otherwise load the last loaded component
24
- var currentToken = Ext.util.History.getToken();
25
- if (currentToken != "") {
26
- this.processHistory(currentToken);
27
- } else {
28
- var lastLoaded = this.initialConfig.componentToLoad; // passed from the server
29
- if (lastLoaded) Ext.util.History.add(lastLoaded);
30
- }
31
- },
32
-
33
- processHistory: function(token){
34
- if (token){
35
- this.mainPanel.removeAll();
36
- this.netzkeLoadComponent(token, {container: this.mainPanel});
37
- } else {
38
- this.mainPanel.removeAll();
39
- }
40
- },
41
-
42
- // instantiateComponent: function(config){
43
- // this.mainPanel.instantiateChild(config);
44
- // },
45
-
46
- appLoadComponent: function(name){
47
- Ext.util.History.add(name);
48
- },
49
-
50
- netzkeLoadComponentByAction: function(action){
51
- var componentName = action.component || action.name;
52
- if (componentName) this.appLoadComponent(componentName);
53
- },
54
-
55
- onToggleConfigMode: function(params){
56
- this.toggleConfigMode();
57
- }
58
- }