puffer 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/Gemfile +3 -1
  2. data/Gemfile.lock +45 -41
  3. data/README.md +2 -5
  4. data/VERSION +1 -1
  5. data/app/assets/stylesheets/puffer/application.css +1 -0
  6. data/app/assets/stylesheets/puffer/puffer_tree.css +65 -0
  7. data/{lib → app/controllers}/puffer/base.rb +3 -1
  8. data/app/controllers/puffer/{dashboard.rb → dashboard_base.rb} +1 -1
  9. data/app/controllers/puffer/dashboard_controller.rb +4 -0
  10. data/app/controllers/puffer/{sessions.rb → sessions_base.rb} +2 -2
  11. data/{lib/generators/puffer/install/templates → app/controllers/puffer}/sessions_controller.rb +2 -1
  12. data/app/controllers/puffer/tree_base.rb +50 -0
  13. data/app/helpers/puffer_helper.rb +2 -6
  14. data/app/helpers/puffer_tree_helper.rb +15 -0
  15. data/app/views/layouts/puffer.html.erb +54 -71
  16. data/app/views/layouts/puffer_base.html.erb +28 -0
  17. data/app/views/layouts/puffer_dashboard.html.erb +15 -32
  18. data/app/views/layouts/puffer_sessions.html.erb +7 -24
  19. data/app/views/puffer/base/index.html.erb +0 -1
  20. data/app/views/puffer/{dashboard → dashboard_base}/index.html.erb +0 -0
  21. data/app/views/puffer/{sessions → sessions_base}/new.html.erb +0 -0
  22. data/app/views/puffer/tree_base/_record.html.erb +27 -0
  23. data/app/views/puffer/tree_base/toggle.js.erb +6 -0
  24. data/app/views/puffer/tree_base/tree.html.erb +9 -0
  25. data/config/puffer_routes.rb +8 -0
  26. data/lib/puffer/controller/dsl.rb +11 -4
  27. data/lib/puffer/engine.rb +4 -0
  28. data/lib/puffer/extensions/controller.rb +0 -1
  29. data/lib/puffer/extensions/form.rb +1 -6
  30. data/lib/puffer/extensions/mapper.rb +7 -0
  31. data/lib/puffer/field.rb +87 -0
  32. data/lib/puffer/{fields.rb → field_set.rb} +2 -2
  33. data/lib/puffer.rb +2 -0
  34. data/puffer.gemspec +29 -22
  35. data/spec/dummy/app/controllers/admin/categories_controller.rb +4 -1
  36. data/spec/dummy/app/controllers/admin/posts_controller.rb +0 -2
  37. data/spec/dummy/app/controllers/puffer/sessions_controller.rb +1 -1
  38. data/spec/dummy/app/models/category.rb +2 -0
  39. data/spec/dummy/config/application.rb +1 -0
  40. data/spec/dummy/config/routes.rb +0 -7
  41. data/spec/dummy/db/migrate/{20100930132559_create_admin_users.rb → 20100930132559_create_users.rb} +1 -1
  42. data/spec/dummy/db/migrate/{20100930132656_create_admin_posts.rb → 20100930132656_create_posts.rb} +1 -1
  43. data/spec/dummy/db/migrate/{20100930132726_create_admin_categories.rb → 20100930132726_create_categories.rb} +6 -1
  44. data/spec/dummy/db/schema.rb +87 -0
  45. data/spec/dummy/db/seeds.rb +27 -0
  46. data/spec/lib/fields_spec.rb +13 -13
  47. metadata +62 -47
  48. data/config/routes.rb +0 -0
  49. data/lib/generators/puffer/install/USAGE +0 -6
  50. data/lib/generators/puffer/install/install_generator.rb +0 -13
  51. data/lib/generators/puffer/install/templates/dashboard_controller.rb +0 -3
  52. data/lib/puffer/controller/mapping.rb +0 -37
  53. data/lib/puffer/fields/field.rb +0 -89
  54. data/spec/dummy/app/controllers/puffer/dashboard_controller.rb +0 -3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puffer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,23 +9,23 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-27 00:00:00.000000000 +04:00
12
+ date: 2011-08-01 00:00:00.000000000 +04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &15513080 !ruby/object:Gem::Requirement
17
+ requirement: &27285900 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: 3.1.0.rc4
22
+ version: 3.1.0.rc5
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *15513080
25
+ version_requirements: *27285900
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: kaminari
28
- requirement: &15511080 !ruby/object:Gem::Requirement
28
+ requirement: &27284380 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *15511080
36
+ version_requirements: *27284380
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: apotomo
39
- requirement: &15509600 !ruby/object:Gem::Requirement
39
+ requirement: &27282900 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *15509600
47
+ version_requirements: *27282900
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sqlite3
50
- requirement: &15507500 !ruby/object:Gem::Requirement
50
+ requirement: &27281500 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *15507500
58
+ version_requirements: *27281500
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rspec-rails
61
- requirement: &15501960 !ruby/object:Gem::Requirement
61
+ requirement: &27280620 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *15501960
69
+ version_requirements: *27280620
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: capybara
72
- requirement: &15500360 !ruby/object:Gem::Requirement
72
+ requirement: &27279960 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *15500360
80
+ version_requirements: *27279960
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: database_cleaner
83
- requirement: &15498440 !ruby/object:Gem::Requirement
83
+ requirement: &27279220 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *15498440
91
+ version_requirements: *27279220
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: guard
94
- requirement: &15495820 !ruby/object:Gem::Requirement
94
+ requirement: &27278500 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *15495820
102
+ version_requirements: *27278500
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: libnotify
105
- requirement: &15415380 !ruby/object:Gem::Requirement
105
+ requirement: &27241400 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *15415380
113
+ version_requirements: *27241400
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: guard-rspec
116
- requirement: &15411800 !ruby/object:Gem::Requirement
116
+ requirement: &27240660 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *15411800
124
+ version_requirements: *27240660
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: forgery
127
- requirement: &15352100 !ruby/object:Gem::Requirement
127
+ requirement: &27240100 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *15352100
135
+ version_requirements: *27240100
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: fabrication
138
- requirement: &15348820 !ruby/object:Gem::Requirement
138
+ requirement: &27239340 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: '0'
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *15348820
146
+ version_requirements: *27239340
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: jeweler
149
- requirement: &15347080 !ruby/object:Gem::Requirement
149
+ requirement: &27238520 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,7 +154,18 @@ dependencies:
154
154
  version: '0'
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *15347080
157
+ version_requirements: *27238520
158
+ - !ruby/object:Gem::Dependency
159
+ name: nested_set
160
+ requirement: &27237840 !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: *27237840
158
169
  description: In Soviet Russia puffer admins you
159
170
  email: kinwizard@gmail.com
160
171
  executables: []
@@ -179,11 +190,18 @@ files:
179
190
  - app/assets/javascripts/puffer/right.js
180
191
  - app/assets/stylesheets/puffer/application.css
181
192
  - app/assets/stylesheets/puffer/puffer.css
193
+ - app/assets/stylesheets/puffer/puffer_tree.css
182
194
  - app/assets/stylesheets/puffer/reset.css
183
- - app/controllers/puffer/dashboard.rb
184
- - app/controllers/puffer/sessions.rb
195
+ - app/controllers/puffer/base.rb
196
+ - app/controllers/puffer/dashboard_base.rb
197
+ - app/controllers/puffer/dashboard_controller.rb
198
+ - app/controllers/puffer/sessions_base.rb
199
+ - app/controllers/puffer/sessions_controller.rb
200
+ - app/controllers/puffer/tree_base.rb
185
201
  - app/helpers/puffer_helper.rb
202
+ - app/helpers/puffer_tree_helper.rb
186
203
  - app/views/layouts/puffer.html.erb
204
+ - app/views/layouts/puffer_base.html.erb
187
205
  - app/views/layouts/puffer_dashboard.html.erb
188
206
  - app/views/layouts/puffer_sessions.html.erb
189
207
  - app/views/puffer/base/_form.html.erb
@@ -195,25 +213,22 @@ files:
195
213
  - app/views/puffer/base/index.html.erb
196
214
  - app/views/puffer/base/new.html.erb
197
215
  - app/views/puffer/base/show.html.erb
198
- - app/views/puffer/dashboard/index.html.erb
199
- - app/views/puffer/sessions/new.html.erb
216
+ - app/views/puffer/dashboard_base/index.html.erb
217
+ - app/views/puffer/sessions_base/new.html.erb
218
+ - app/views/puffer/tree_base/_record.html.erb
219
+ - app/views/puffer/tree_base/toggle.js.erb
220
+ - app/views/puffer/tree_base/tree.html.erb
200
221
  - config/locales/puffer.yml
201
- - config/routes.rb
222
+ - config/puffer_routes.rb
202
223
  - lib/generators/puffer/controller/USAGE
203
224
  - lib/generators/puffer/controller/controller_generator.rb
204
225
  - lib/generators/puffer/controller/templates/controller.rb
205
- - lib/generators/puffer/install/USAGE
206
- - lib/generators/puffer/install/install_generator.rb
207
- - lib/generators/puffer/install/templates/dashboard_controller.rb
208
- - lib/generators/puffer/install/templates/sessions_controller.rb
209
226
  - lib/puffer.rb
210
- - lib/puffer/base.rb
211
227
  - lib/puffer/controller/actions.rb
212
228
  - lib/puffer/controller/config.rb
213
229
  - lib/puffer/controller/dsl.rb
214
230
  - lib/puffer/controller/generated.rb
215
231
  - lib/puffer/controller/helpers.rb
216
- - lib/puffer/controller/mapping.rb
217
232
  - lib/puffer/controller/mutate.rb
218
233
  - lib/puffer/customs.rb
219
234
  - lib/puffer/engine.rb
@@ -222,8 +237,8 @@ files:
222
237
  - lib/puffer/extensions/core.rb
223
238
  - lib/puffer/extensions/form.rb
224
239
  - lib/puffer/extensions/mapper.rb
225
- - lib/puffer/fields.rb
226
- - lib/puffer/fields/field.rb
240
+ - lib/puffer/field.rb
241
+ - lib/puffer/field_set.rb
227
242
  - lib/puffer/inputs/association.rb
228
243
  - lib/puffer/inputs/base.rb
229
244
  - lib/puffer/inputs/boolean.rb
@@ -250,7 +265,6 @@ files:
250
265
  - spec/dummy/app/controllers/admin/tags_controller.rb
251
266
  - spec/dummy/app/controllers/admin/users_controller.rb
252
267
  - spec/dummy/app/controllers/application_controller.rb
253
- - spec/dummy/app/controllers/puffer/dashboard_controller.rb
254
268
  - spec/dummy/app/controllers/puffer/sessions_controller.rb
255
269
  - spec/dummy/app/helpers/application_helper.rb
256
270
  - spec/dummy/app/models/category.rb
@@ -279,15 +293,16 @@ files:
279
293
  - spec/dummy/config/initializers/wrap_parameters.rb
280
294
  - spec/dummy/config/locales/en.yml
281
295
  - spec/dummy/config/routes.rb
282
- - spec/dummy/db/migrate/20100930132559_create_admin_users.rb
283
- - spec/dummy/db/migrate/20100930132656_create_admin_posts.rb
284
- - spec/dummy/db/migrate/20100930132726_create_admin_categories.rb
296
+ - spec/dummy/db/migrate/20100930132559_create_users.rb
297
+ - spec/dummy/db/migrate/20100930132656_create_posts.rb
298
+ - spec/dummy/db/migrate/20100930132726_create_categories.rb
285
299
  - spec/dummy/db/migrate/20100930132837_create_post_categories.rb
286
300
  - spec/dummy/db/migrate/20100930133425_create_admin_profiles.rb
287
301
  - spec/dummy/db/migrate/20101011155830_create_tags.rb
288
302
  - spec/dummy/db/migrate/20101011160326_create_taggings.rb
289
303
  - spec/dummy/db/migrate/20110107082706_create_friendships.rb
290
304
  - spec/dummy/db/migrate/20110301072545_create_news.rb
305
+ - spec/dummy/db/schema.rb
291
306
  - spec/dummy/db/seeds.rb
292
307
  - spec/dummy/public/404.html
293
308
  - spec/dummy/public/422.html
@@ -324,7 +339,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
324
339
  version: '0'
325
340
  segments:
326
341
  - 0
327
- hash: 2855436306931094877
342
+ hash: -221820518765370178
328
343
  required_rubygems_version: !ruby/object:Gem::Requirement
329
344
  none: false
330
345
  requirements:
data/config/routes.rb DELETED
File without changes
@@ -1,6 +0,0 @@
1
- Description:
2
- Copy puffer files to your application
3
-
4
- Example:
5
- rails generate puffer:install
6
-
@@ -1,13 +0,0 @@
1
- class Puffer::InstallGenerator < Rails::Generators::Base
2
- source_root File.expand_path('../templates', __FILE__)
3
-
4
- def generate_puffer_controllers
5
- copy_file 'sessions_controller.rb', 'app/controllers/puffer/sessions_controller.rb'
6
- copy_file 'dashboard_controller.rb', 'app/controllers/puffer/dashboard_controller.rb'
7
- end
8
-
9
- def generate_routes
10
- route "namespace :puffer do\n root :to => 'dashboard#index'\n resource :session\n end"
11
- end
12
-
13
- end
@@ -1,3 +0,0 @@
1
- class Puffer::DashboardController < Puffer::Dashboard
2
-
3
- end
@@ -1,37 +0,0 @@
1
- module Puffer
2
- module Controller
3
- module Mapping
4
-
5
- def self.included base
6
- base.class_eval do
7
- extend ClassMethods
8
- end
9
- end
10
-
11
- module ClassMethods
12
-
13
- def index_fields
14
- _index_fields
15
- end
16
-
17
- def show_fields
18
- _show_fields.presence || _index_fields
19
- end
20
-
21
- def form_fields
22
- _form_fields
23
- end
24
-
25
- def create_fields
26
- _create_fields.presence || _form_fields
27
- end
28
-
29
- def update_fields
30
- _update_fields.presence || _form_fields
31
- end
32
-
33
- end
34
-
35
- end
36
- end
37
- end
@@ -1,89 +0,0 @@
1
- module Puffer
2
- class Fields
3
- class Field
4
-
5
- attr_accessor :resource, :field_name, :options, :fields
6
-
7
- def initialize field_name, *resource_and_options, &block
8
- @field_name = field_name.to_s
9
- @options = resource_and_options.extract_options!
10
- @resource = resource_and_options.first
11
- @fields = Puffer::Fields.new
12
- block.bind(self).call if block
13
- end
14
-
15
- def field name, options = {}, &block
16
- @fields.field(name, swallow_nil{reflection.klass}, options, &block)
17
- end
18
-
19
- def native?
20
- model == resource
21
- end
22
-
23
- def name
24
- @name ||= field_name.split('.').last
25
- end
26
-
27
- def path
28
- @path ||= field_name.split('.')[0..-2].join('.')
29
- end
30
-
31
- def human
32
- @human ||= model && model.human_attribute_name(name)
33
- end
34
-
35
- def order
36
- @order ||= options[:order] || query_column
37
- end
38
-
39
- def type
40
- @type ||= options[:type] ? options[:type].to_sym : (Puffer::Customs.type_for(self) || (column ? column.type : :string))
41
- end
42
-
43
- def to_s
44
- field_name
45
- end
46
-
47
- def reflection
48
- @reflection ||= model && model.reflect_on_association(name.to_sym)
49
- end
50
-
51
- def collection?
52
- [:has_many, :has_and_belongs_to_many].include? type
53
- end
54
-
55
- def input_options
56
- options[:html] || {}
57
- end
58
-
59
- def input builder
60
- Puffer::Customs.input_for(self).render builder, self
61
- end
62
-
63
- def model
64
- @model ||= begin
65
- associations = field_name.split('.')
66
- associations.pop
67
- temp = resource
68
- while temp.reflect_on_association(association = swallow_nil{associations.shift.to_sym}) do
69
- temp = temp.reflect_on_association(association).klass
70
- end
71
- temp
72
- end if resource
73
- end
74
-
75
- def association_columns
76
- @association_columns ||= fields
77
- end
78
-
79
- def column
80
- @column ||= model && model.columns_hash[name]
81
- end
82
-
83
- def query_column
84
- "#{model.table_name}.#{name}" if column
85
- end
86
-
87
- end
88
- end
89
- end
@@ -1,3 +0,0 @@
1
- class Puffer::DashboardController < Puffer::Dashboard
2
-
3
- end