rails_admin_cms 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64532329456176e9cc5b085b1a7e174d7bdcd7d5
4
- data.tar.gz: 26b4fd42b12511578a06360edec4511e0b5f54d1
3
+ metadata.gz: 1f4ab2a876fced32bee134b71d05c7f197eff9d8
4
+ data.tar.gz: 591c16de5bb08f0d191debcc2d84f16996f8c551
5
5
  SHA512:
6
- metadata.gz: 08c544696542dd45900978dc4a265c0f1568b0cbaf4a0b99c89632ec6a3609b284effe01321562536388dc8b4b3248ff242ab0f660d5abb6b1e1a3f0e42e12c9
7
- data.tar.gz: 015ff341e2aa59dc9d0fe2add4d4a538bd404db57c34cbb8f5a3aff34d62206c426a0b884cb7e11e97f4e188f0352e3a619a81c997801997471a6bb28be7d3b2
6
+ metadata.gz: 2af4b0b5c9d21228d16daedf9a139af1789dcda75211a74b68a9dc3a08bcf2c343a8276e99f9a3957543f1de50bf5f8a2959cde761515ca9dffe1ba42ab36622
7
+ data.tar.gz: 39f1f65e47c0f08cdf1d21c4f9a8c4cccbcd35f8cad20bb7b4b9ad64477fe5deba1f8e64ce862a83a81b39d32dac69018be2c76eb17bb577e89e4b2714748d8b
data/README.md CHANGED
@@ -24,7 +24,6 @@ Seamlessly adds some useful classes to the body tag within your layout in order
24
24
  * Documentation
25
25
  * Generators
26
26
  * Published Pages/Forms
27
- * Keep the Locale within the DB after form submission
28
27
  * Mailchimp integration
29
28
  * More Specs
30
29
 
@@ -9,18 +9,7 @@ module Admin
9
9
  :id
10
10
  end
11
11
 
12
- configure :structure do
13
- read_only true
14
- pretty_value do
15
- h = bindings[:view]
16
- p = ViewablePresenter.new value, h
17
- h.link_to value.name, p.__send__(:edit_path)
18
- end
19
- end
20
-
21
- edit do
22
- exclude_fields :fields, :viewable
23
- end
12
+ exclude_fields :fields, :viewable, :structure
24
13
 
25
14
  list do
26
15
  configure :id do
@@ -11,9 +11,9 @@ module Admin
11
11
 
12
12
  field :structure do
13
13
  pretty_value do
14
- h = bindings[:view]
15
- p = ViewablePresenter.new value, h
16
- h.link_to value.name, p.__send__(:edit_path)
14
+ h, name = bindings[:view], value.name
15
+ path = "#{h.dashboard_path}form~row?model_name=form~row&scope#{name}"
16
+ h.link_to name, path
17
17
  end
18
18
 
19
19
  inline_add false
@@ -2,6 +2,7 @@ module Form
2
2
  class Field < ActiveRecord::Base
3
3
  include Admin::Form::Field
4
4
 
5
+ # mapped to simple_form 'as:' option
5
6
  TYPES ||= %w[ string text email ]
6
7
 
7
8
  self.table_name_prefix = 'form_'
@@ -26,5 +26,9 @@ module Form
26
26
  values
27
27
  end
28
28
  end
29
+
30
+ def locale_enum
31
+ I18n.available_locales
32
+ end
29
33
  end
30
34
  end
@@ -36,7 +36,7 @@ module Form
36
36
  private
37
37
 
38
38
  def create_header
39
- rows.create!
39
+ rows.create!(locale: I18n.t('cms.form.header', locale: I18n.default_locale))
40
40
  end
41
41
 
42
42
  def expire_cache
data/app/models/form.rb CHANGED
@@ -6,6 +6,8 @@ module Form
6
6
 
7
7
  validates :_subtitle, invisible_captcha: true
8
8
 
9
+ before_save :set_locale
10
+
9
11
  delegate :virtual?, :has_attachments?, :has_collections?, to: :class
10
12
  end
11
13
 
@@ -40,4 +42,12 @@ module Form
40
42
  ]
41
43
  end
42
44
  end
45
+
46
+ private
47
+
48
+ def set_locale
49
+ if has_attribute?(:locale) && locale.nil?
50
+ self.locale = I18n.locale
51
+ end
52
+ end
43
53
  end
@@ -15,6 +15,7 @@ en:
15
15
  navigation: Site
16
16
  one: Form
17
17
  other: Forms
18
+ header: Columns
18
19
  locale_selector:
19
20
  language: En
20
21
  page:
@@ -15,6 +15,7 @@ fr:
15
15
  navigation: Site
16
16
  one: Formulaire
17
17
  other: Formulaires
18
+ header: Colonnes
18
19
  locale_selector:
19
20
  language: Fr
20
21
  page:
@@ -2,6 +2,7 @@ class CreateFormRow < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :form_rows do |t|
4
4
  t.references :structure, index: true
5
+ t.string :locale
5
6
 
6
7
  RailsAdminCMS::Config.custom_form_max_size.times.each do |i|
7
8
  t.text :"column_#{i}"
@@ -69,6 +69,10 @@ RailsAdmin.config do |config|
69
69
  label I18n.t('rich.file.one')
70
70
  label_plural I18n.t('rich.file.other')
71
71
 
72
+ object_label_method do
73
+ :name
74
+ end
75
+
72
76
  configure :rich_file, :jcrop
73
77
 
74
78
  list do
@@ -0,0 +1,17 @@
1
+ RailsAdminCMS.config do |config|
2
+ # Defines the base controller inherited from
3
+ # config.parent_controller = ::ApplicationController
4
+
5
+ # Defines the base mailer inherited from
6
+ # config.parent_mailer = ::ApplicationMailer
7
+
8
+ # Defines if PaperTrail support is used
9
+ # config.with_paper_trail = false
10
+
11
+ # Defines the maximum number of fields a Form defined admin side has
12
+ # * it is important to note that rake cms:adjust_max_size needs to be run if that number changes
13
+ # config.custom_form_max_size = 20
14
+
15
+ # Defines if Forms defined admin side need their body to be editable
16
+ # config.with_email_body = false
17
+ end
@@ -1,11 +1,4 @@
1
1
  module RailsAdminCMS
2
2
  class Engine < ::Rails::Engine
3
- initializer :append_migrations do |app|
4
- unless app.root.to_s.match root.to_s
5
- config.paths["db/migrate"].expanded.each do |expanded_path|
6
- app.config.paths["db/migrate"] << expanded_path
7
- end
8
- end
9
- end
10
3
  end
11
4
  end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminCMS
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,4 +1,19 @@
1
- # desc "Explaining what the task does"
2
- # task :rails_admin_cms do
3
- # # Task goes here
4
- # end
1
+ namespace :cms do
2
+ desc "Adjust custom Forms max size in the Database"
3
+ task :adjust_max_size => :environment do
4
+ columns = ::Form::Row.columns.map(&:name).grep(/^column_\d+/)
5
+
6
+ size_was = columns.size
7
+ size = RailsAdminCMS::Config.custom_form_max_size
8
+
9
+ if size < size_was
10
+ (size_was - size).times.each.with_index(1) do |_, i|
11
+ ActiveRecord::Base.connection.remove_column :form_rows, :"column_#{size_was - i}"
12
+ end
13
+ elsif size > size_was
14
+ (size - size_was).times.each.with_index(size_was) do |_, i|
15
+ ActiveRecord::Base.connection.add_column :form_rows, :"column_#{i}", :text
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,20 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrice Lebel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-04 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 4.2.0
20
23
  type: :runtime
@@ -22,120 +25,171 @@ dependencies:
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 4.2.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rails-i18n
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
31
40
  - - ">="
32
41
  - !ruby/object:Gem::Version
33
- version: '0'
42
+ version: 4.0.8
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '4.0'
38
50
  - - ">="
39
51
  - !ruby/object:Gem::Version
40
- version: '0'
52
+ version: 4.0.8
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rails_admin
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.8'
45
60
  - - ">="
46
61
  - !ruby/object:Gem::Version
47
- version: '0'
62
+ version: 0.8.1
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.8'
52
70
  - - ">="
53
71
  - !ruby/object:Gem::Version
54
- version: '0'
72
+ version: 0.8.1
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: rails_admin-i18n
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.0'
59
80
  - - ">="
60
81
  - !ruby/object:Gem::Version
61
- version: '0'
82
+ version: 0.0.9
62
83
  type: :runtime
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
65
86
  requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.0'
66
90
  - - ">="
67
91
  - !ruby/object:Gem::Version
68
- version: '0'
92
+ version: 0.0.9
69
93
  - !ruby/object:Gem::Dependency
70
94
  name: route_translator
71
95
  requirement: !ruby/object:Gem::Requirement
72
96
  requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '4.2'
73
100
  - - ">="
74
101
  - !ruby/object:Gem::Version
75
- version: '0'
102
+ version: 4.2.2
76
103
  type: :runtime
77
104
  prerelease: false
78
105
  version_requirements: !ruby/object:Gem::Requirement
79
106
  requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '4.2'
80
110
  - - ">="
81
111
  - !ruby/object:Gem::Version
82
- version: '0'
112
+ version: 4.2.2
83
113
  - !ruby/object:Gem::Dependency
84
114
  name: jquery-rails
85
115
  requirement: !ruby/object:Gem::Requirement
86
116
  requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '4.0'
87
120
  - - ">="
88
121
  - !ruby/object:Gem::Version
89
- version: '0'
122
+ version: 4.0.5
90
123
  type: :runtime
91
124
  prerelease: false
92
125
  version_requirements: !ruby/object:Gem::Requirement
93
126
  requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '4.0'
94
130
  - - ">="
95
131
  - !ruby/object:Gem::Version
96
- version: '0'
132
+ version: 4.0.5
97
133
  - !ruby/object:Gem::Dependency
98
134
  name: jquery-ui-rails
99
135
  requirement: !ruby/object:Gem::Requirement
100
136
  requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '5.0'
101
140
  - - ">="
102
141
  - !ruby/object:Gem::Version
103
- version: '0'
142
+ version: 5.0.5
104
143
  type: :runtime
105
144
  prerelease: false
106
145
  version_requirements: !ruby/object:Gem::Requirement
107
146
  requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '5.0'
108
150
  - - ">="
109
151
  - !ruby/object:Gem::Version
110
- version: '0'
152
+ version: 5.0.5
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: active_link_to
113
155
  requirement: !ruby/object:Gem::Requirement
114
156
  requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.0'
115
160
  - - ">="
116
161
  - !ruby/object:Gem::Version
117
- version: '0'
162
+ version: 1.0.3
118
163
  type: :runtime
119
164
  prerelease: false
120
165
  version_requirements: !ruby/object:Gem::Requirement
121
166
  requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: '1.0'
122
170
  - - ">="
123
171
  - !ruby/object:Gem::Version
124
- version: '0'
172
+ version: 1.0.3
125
173
  - !ruby/object:Gem::Dependency
126
174
  name: youtube_addy
127
175
  requirement: !ruby/object:Gem::Requirement
128
176
  requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '1.0'
129
180
  - - ">="
130
181
  - !ruby/object:Gem::Version
131
- version: '0'
182
+ version: 1.0.4
132
183
  type: :runtime
133
184
  prerelease: false
134
185
  version_requirements: !ruby/object:Gem::Requirement
135
186
  requirements:
187
+ - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: '1.0'
136
190
  - - ">="
137
191
  - !ruby/object:Gem::Version
138
- version: '0'
192
+ version: 1.0.4
139
193
  - !ruby/object:Gem::Dependency
140
194
  name: rich
141
195
  requirement: !ruby/object:Gem::Requirement
@@ -182,105 +236,150 @@ dependencies:
182
236
  name: simple_form
183
237
  requirement: !ruby/object:Gem::Requirement
184
238
  requirements:
239
+ - - "~>"
240
+ - !ruby/object:Gem::Version
241
+ version: '3.2'
185
242
  - - ">="
186
243
  - !ruby/object:Gem::Version
187
- version: '0'
244
+ version: 3.2.1
188
245
  type: :runtime
189
246
  prerelease: false
190
247
  version_requirements: !ruby/object:Gem::Requirement
191
248
  requirements:
249
+ - - "~>"
250
+ - !ruby/object:Gem::Version
251
+ version: '3.2'
192
252
  - - ">="
193
253
  - !ruby/object:Gem::Version
194
- version: '0'
254
+ version: 3.2.1
195
255
  - !ruby/object:Gem::Dependency
196
256
  name: active_type
197
257
  requirement: !ruby/object:Gem::Requirement
198
258
  requirements:
259
+ - - "~>"
260
+ - !ruby/object:Gem::Version
261
+ version: '0.4'
199
262
  - - ">="
200
263
  - !ruby/object:Gem::Version
201
- version: '0'
264
+ version: 0.4.3
202
265
  type: :runtime
203
266
  prerelease: false
204
267
  version_requirements: !ruby/object:Gem::Requirement
205
268
  requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: '0.4'
206
272
  - - ">="
207
273
  - !ruby/object:Gem::Version
208
- version: '0'
274
+ version: 0.4.3
209
275
  - !ruby/object:Gem::Dependency
210
276
  name: email_validator
211
277
  requirement: !ruby/object:Gem::Requirement
212
278
  requirements:
279
+ - - "~>"
280
+ - !ruby/object:Gem::Version
281
+ version: '1.6'
213
282
  - - ">="
214
283
  - !ruby/object:Gem::Version
215
- version: '0'
284
+ version: 1.6.0
216
285
  type: :runtime
217
286
  prerelease: false
218
287
  version_requirements: !ruby/object:Gem::Requirement
219
288
  requirements:
289
+ - - "~>"
290
+ - !ruby/object:Gem::Version
291
+ version: '1.6'
220
292
  - - ">="
221
293
  - !ruby/object:Gem::Version
222
- version: '0'
294
+ version: 1.6.0
223
295
  - !ruby/object:Gem::Dependency
224
296
  name: country_select
225
297
  requirement: !ruby/object:Gem::Requirement
226
298
  requirements:
299
+ - - "~>"
300
+ - !ruby/object:Gem::Version
301
+ version: '2.5'
227
302
  - - ">="
228
303
  - !ruby/object:Gem::Version
229
- version: '0'
304
+ version: 2.5.1
230
305
  type: :runtime
231
306
  prerelease: false
232
307
  version_requirements: !ruby/object:Gem::Requirement
233
308
  requirements:
309
+ - - "~>"
310
+ - !ruby/object:Gem::Version
311
+ version: '2.5'
234
312
  - - ">="
235
313
  - !ruby/object:Gem::Version
236
- version: '0'
314
+ version: 2.5.1
237
315
  - !ruby/object:Gem::Dependency
238
316
  name: i18n_country_select
239
317
  requirement: !ruby/object:Gem::Requirement
240
318
  requirements:
319
+ - - "~>"
320
+ - !ruby/object:Gem::Version
321
+ version: '1.1'
241
322
  - - ">="
242
323
  - !ruby/object:Gem::Version
243
- version: '0'
324
+ version: 1.1.5
244
325
  type: :runtime
245
326
  prerelease: false
246
327
  version_requirements: !ruby/object:Gem::Requirement
247
328
  requirements:
329
+ - - "~>"
330
+ - !ruby/object:Gem::Version
331
+ version: '1.1'
248
332
  - - ">="
249
333
  - !ruby/object:Gem::Version
250
- version: '0'
334
+ version: 1.1.5
251
335
  - !ruby/object:Gem::Dependency
252
336
  name: invisible_captcha
253
337
  requirement: !ruby/object:Gem::Requirement
254
338
  requirements:
339
+ - - "~>"
340
+ - !ruby/object:Gem::Version
341
+ version: '0.8'
255
342
  - - ">="
256
343
  - !ruby/object:Gem::Version
257
- version: '0'
344
+ version: 0.8.0
258
345
  type: :runtime
259
346
  prerelease: false
260
347
  version_requirements: !ruby/object:Gem::Requirement
261
348
  requirements:
349
+ - - "~>"
350
+ - !ruby/object:Gem::Version
351
+ version: '0.8'
262
352
  - - ">="
263
353
  - !ruby/object:Gem::Version
264
- version: '0'
354
+ version: 0.8.0
265
355
  - !ruby/object:Gem::Dependency
266
356
  name: jquery-form-validator-rails
267
357
  requirement: !ruby/object:Gem::Requirement
268
358
  requirements:
359
+ - - "~>"
360
+ - !ruby/object:Gem::Version
361
+ version: '0.0'
269
362
  - - ">="
270
363
  - !ruby/object:Gem::Version
271
- version: '0'
364
+ version: 0.0.2
272
365
  type: :runtime
273
366
  prerelease: false
274
367
  version_requirements: !ruby/object:Gem::Requirement
275
368
  requirements:
369
+ - - "~>"
370
+ - !ruby/object:Gem::Version
371
+ version: '0.0'
276
372
  - - ">="
277
373
  - !ruby/object:Gem::Version
278
- version: '0'
374
+ version: 0.0.2
279
375
  - !ruby/object:Gem::Dependency
280
376
  name: bootstrap_flash_messages
281
377
  requirement: !ruby/object:Gem::Requirement
282
378
  requirements:
283
379
  - - "~>"
380
+ - !ruby/object:Gem::Version
381
+ version: '1.0'
382
+ - - ">="
284
383
  - !ruby/object:Gem::Version
285
384
  version: 1.0.1
286
385
  type: :runtime
@@ -288,6 +387,9 @@ dependencies:
288
387
  version_requirements: !ruby/object:Gem::Requirement
289
388
  requirements:
290
389
  - - "~>"
390
+ - !ruby/object:Gem::Version
391
+ version: '1.0'
392
+ - - ">="
291
393
  - !ruby/object:Gem::Version
292
394
  version: 1.0.1
293
395
  - !ruby/object:Gem::Dependency
@@ -591,9 +693,6 @@ files:
591
693
  - db/migrate/20151226023652_create_unique_key.rb
592
694
  - db/migrate/20151226054335_create_viewable_link.rb
593
695
  - db/migrate/20151227064933_create_viewable_text.rb
594
- - db/migrate/20151227072412_create_rich_rich_images.rich.rb
595
- - db/migrate/20151227072413_add_uri_cache_to_rich_image.rich.rb
596
- - db/migrate/20151227072414_refactor_image_to_file.rich.rb
597
696
  - db/migrate/20151228231201_create_viewable_image.rb
598
697
  - db/migrate/20151230050603_create_setting.rb
599
698
  - db/migrate/20151230072904_add_cms_mail_from_and_bcc_settings.rb
@@ -622,6 +721,7 @@ files:
622
721
  - lib/generators/cms/install/templates/app/views/layouts/application.html.erb
623
722
  - lib/generators/cms/install/templates/config/application.rb
624
723
  - lib/generators/cms/install/templates/config/initializers/rails_admin.rb
724
+ - lib/generators/cms/install/templates/config/initializers/rails_admin_cms.rb
625
725
  - lib/generators/cms/install/templates/config/initializers/rich.rb
626
726
  - lib/generators/cms/install/templates/config/initializers/simple_form.rb
627
727
  - lib/generators/cms/install/templates/config/initializers/simple_form_bootstrap.rb
@@ -1,18 +0,0 @@
1
- # This migration comes from rich (originally 20111002142937)
2
- class CreateRichRichImages < ActiveRecord::Migration
3
- def change
4
- create_table :rich_rich_images do |t|
5
-
6
- t.timestamps
7
-
8
- t.string :image_file_name
9
- t.string :image_content_type
10
- t.integer :image_file_size
11
- t.datetime :image_updated_at
12
-
13
- t.string :owner_type
14
- t.integer :owner_id
15
-
16
- end
17
- end
18
- end
@@ -1,6 +0,0 @@
1
- # This migration comes from rich (originally 20111117202133)
2
- class AddUriCacheToRichImage < ActiveRecord::Migration
3
- def change
4
- add_column :rich_rich_images, :uri_cache, :text
5
- end
6
- end
@@ -1,13 +0,0 @@
1
- # This migration comes from rich (originally 20111201095829)
2
- class RefactorImageToFile < ActiveRecord::Migration
3
- def change
4
- rename_table :rich_rich_images, :rich_rich_files
5
-
6
- rename_column :rich_rich_files, :image_file_name, :rich_file_file_name
7
- rename_column :rich_rich_files, :image_content_type, :rich_file_content_type
8
- rename_column :rich_rich_files, :image_file_size, :rich_file_file_size
9
- rename_column :rich_rich_files, :image_updated_at, :rich_file_updated_at
10
-
11
- add_column :rich_rich_files, :simplified_type, :string, :default => "file"
12
- end
13
- end