ab_admin 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ab_admin/components/in_place_edit.js.coffee +27 -12
  3. data/app/assets/javascripts/ab_admin/components/select2_bridge.js.coffee +39 -20
  4. data/app/assets/javascripts/ab_admin/core/columns_hider.js.coffee +4 -5
  5. data/app/assets/javascripts/ab_admin/inputs/datetime_input.js.coffee +3 -3
  6. data/app/assets/stylesheets/ab_admin/bootstrap_and_overrides.css.scss +5 -1
  7. data/app/assets/stylesheets/ab_admin/components/_columns_hider.css.scss +1 -1
  8. data/app/assets/stylesheets/ab_admin/components/_form.css.scss +1 -1
  9. data/app/controllers/admin/assets_controller.rb +4 -1
  10. data/app/controllers/admin/base_controller.rb +28 -10
  11. data/app/controllers/admin/locators_controller.rb +1 -1
  12. data/app/controllers/admin/manager_controller.rb +7 -2
  13. data/app/controllers/admin/static_pages_controller.rb +4 -5
  14. data/app/controllers/admin/structures_controller.rb +1 -1
  15. data/app/views/admin/base/create.js.erb +1 -1
  16. data/app/views/admin/base/edit.js.erb +16 -10
  17. data/app/views/admin/base/index.html.slim +2 -2
  18. data/app/views/admin/base/show.js.erb +2 -2
  19. data/app/views/admin/base/update.js.erb +12 -8
  20. data/app/views/admin/manager/_form.html.slim +4 -1
  21. data/app/views/admin/manager/_table.html.slim +2 -2
  22. data/app/views/admin/shared/_flash.html.slim +1 -1
  23. data/app/views/admin/structures/_form.html.slim +1 -1
  24. data/app/views/admin/users/_table.html.slim +1 -1
  25. data/config/locales/de.yml +18 -36
  26. data/config/locales/en.yml +20 -36
  27. data/config/locales/it.yml +12 -30
  28. data/config/locales/ru.yml +4 -17
  29. data/config/locales/uk.yml +301 -0
  30. data/lib/ab_admin.rb +1 -2
  31. data/lib/ab_admin/concerns/admin_addition.rb +1 -1
  32. data/lib/ab_admin/concerns/asset_human_names.rb +9 -1
  33. data/lib/ab_admin/concerns/utilities.rb +2 -6
  34. data/lib/ab_admin/controllers/tree.rb +2 -2
  35. data/lib/ab_admin/core_ext/array.rb +6 -5
  36. data/lib/ab_admin/hooks.rb +7 -32
  37. data/lib/ab_admin/hooks/{active_model_hooks.rb → active_model_attr_accessible_few_roles.rb} +12 -4
  38. data/lib/ab_admin/hooks/{globalize_hooks.rb → globalize_locale_suffix_accessors.rb} +1 -9
  39. data/lib/ab_admin/hooks/globalize_valid_locale.rb +9 -0
  40. data/lib/ab_admin/hooks/{paginate_hooks.rb → will_paginate_id_prefetch.rb} +7 -22
  41. data/lib/ab_admin/hooks/will_paginate_no_uri.rb +19 -0
  42. data/lib/ab_admin/i18n_tools/model_translator.rb +3 -2
  43. data/lib/ab_admin/menu/base_group.rb +3 -3
  44. data/lib/ab_admin/menu/item.rb +15 -4
  45. data/lib/ab_admin/models/asset.rb +6 -0
  46. data/lib/ab_admin/models/settings.rb +6 -6
  47. data/lib/ab_admin/models/user.rb +4 -0
  48. data/lib/ab_admin/utils.rb +16 -7
  49. data/lib/ab_admin/utils/xls_document.rb +9 -1
  50. data/lib/ab_admin/version.rb +1 -1
  51. data/lib/ab_admin/views/admin_helpers.rb +15 -11
  52. data/lib/ab_admin/views/admin_navigation_helpers.rb +11 -6
  53. data/lib/ab_admin/views/form_builder.rb +5 -1
  54. data/lib/ab_admin/views/search_form_builder.rb +1 -1
  55. data/lib/generators/ab_admin/glob/glob_generator.rb +6 -3
  56. data/lib/generators/ab_admin/install/install_generator.rb +1 -1
  57. data/lib/generators/ab_admin/install/templates/config/{unicorn_config.rb → unicorn/production.rb} +6 -9
  58. data/lib/generators/ab_admin/install/templates/script/unicorn.sh +7 -6
  59. data/lib/generators/template.rb +0 -1
  60. data/lib/tasks/assets.rake +7 -1
  61. metadata +34 -61
  62. data/app/assets/stylesheets/ab_admin/components/_text_styles.css.scss +0 -47
  63. data/lib/ab_admin/views/inputs/capture_block_input.rb +0 -16
@@ -21,6 +21,6 @@ class Admin::StructuresController < Admin::BaseController
21
21
  end
22
22
 
23
23
  def settings
24
- {index_view: 'tree'}
24
+ {index_view: 'tree', default_order: 'lft'}
25
25
  end
26
26
  end
@@ -5,8 +5,8 @@
5
5
  %>
6
6
  $('#<%= form_wrap_id %>').remove();
7
7
  $('#list tbody').prepend('<%= j html %>');
8
- $('#<%= dom_id(resource, 'list') %>').addClass('success').scrollToEl();
9
8
  $(document).trigger('admin:list_init');
9
+ $('#<%= dom_id(resource, 'list') %>').addClass('success').scrollToEl();
10
10
  <% end %>
11
11
 
12
12
 
@@ -1,12 +1,18 @@
1
- <%
2
- el_id = dom_id(resource, 'list')
3
- form_wrap_id = dom_id(resource, 'list_edit')
4
- html = %[<tr id="#{form_wrap_id}" class="list_edit warning"><td>#{render('form')}</td></tr>].html_safe
5
- %>
6
- $('#<%= form_wrap_id %>').remove();
7
- $('#<%= el_id %>').after('<%= j html %>');
8
- $('#<%= form_wrap_id %> td:first').attr('colspan', $('#list tr:first th').length);
9
- $('#<%= el_id %>').scrollToEl();
10
- $('#<%= form_wrap_id %> form').trigger('admin:form_init');
1
+ <% if params[:modal] %>
2
+ var $form = $('#modal_form');
3
+ $form.html("<%= j render 'modal_form_layout' %>");
4
+ $form.find('form').trigger('admin:form_init');
5
+ <% else %>
6
+ <%
7
+ el_id = dom_id(resource, 'list')
8
+ form_wrap_id = dom_id(resource, 'list_edit')
9
+ html = %[<tr id="#{form_wrap_id}" class="list_edit warning"><td>#{render('form')}</td></tr>].html_safe
10
+ %>
11
+ $('#<%= form_wrap_id %>').remove();
12
+ $('#<%= el_id %>').after('<%= j html %>');
13
+ $('#<%= form_wrap_id %> td:first').attr('colspan', $('#list tr:first th').length);
14
+ $('#<%= form_wrap_id %> form').trigger('admin:form_init');
15
+ $('#<%= el_id %>').scrollToEl();
16
+ <% end %>
11
17
 
12
18
  <%= render 'admin/shared/flash', flash: flash %>
@@ -13,6 +13,6 @@
13
13
  a.btn.per_page data-val=c href=url_for(params.merge(per_page: c)) class=('active' if c == collection.per_page) = c
14
14
 
15
15
  - if pjax? && flash.present?
16
- - flash.each do |k, v|
17
- = javascript_tag %[flash("#{j v}", "#{k}")]
16
+ - flash.each do |type, message|
17
+ = javascript_tag %[flash("#{j message}", "#{type}")]
18
18
 
@@ -3,5 +3,5 @@
3
3
  %>
4
4
  $wrap = $('#list');
5
5
  $wrap.prepend('<%= j html %>');
6
- $('#<%= dom_id(resource, 'list') %>').scrollToEl();
7
- $(document).trigger('admin:list_init');
6
+ $(document).trigger('admin:list_init');
7
+ $('#<%= dom_id(resource, 'list') %>').scrollToEl();
@@ -1,8 +1,12 @@
1
- <%
2
- form_wrap_id = dom_id(resource, 'list_edit')
3
- html = render('table', collection: [resource]).match(/<tbody>(.*)<\/tbody>/m)[1].html_safe
4
- %>
5
- $('#<%= form_wrap_id %>').remove();
6
- $('#<%= dom_id(resource, 'list') %>').replaceWith('<%= j html %>');
7
- $('#<%= dom_id(resource, 'list') %>').addClass('success').scrollToEl();
8
- $(document).trigger('admin:list_init');
1
+ <% unless params[:modal] %>
2
+ <%
3
+ form_wrap_id = dom_id(resource, 'list_edit')
4
+ html = render('table', collection: [resource]).match(/<tbody>(.*)<\/tbody>/m)[1].html_safe
5
+ %>
6
+ $('#<%= form_wrap_id %>').remove();
7
+ $('#<%= dom_id(resource, 'list') %>').replaceWith('<%= j html %>');
8
+ $(document).trigger('admin:list_init');
9
+ $('#<%= dom_id(resource, 'list') %>').addClass('success').scrollToEl();
10
+ <% end %>
11
+
12
+ window.ab_admin_last_updated = <%= raw resource.for_input_token.to_json %>;
@@ -12,7 +12,10 @@
12
12
  - else
13
13
  = input_set node.title, node.options do
14
14
  - node.fields.each do |field|
15
- = f.render_dsl_node field
15
+ - if field.block && field.options[:as] == :capture_block
16
+ = instance_exec(f, &field.block)
17
+ - else
18
+ = f.render_dsl_node field
16
19
  - else
17
20
  = f.render_dsl_node node
18
21
 
@@ -7,7 +7,7 @@
7
7
  = batch_action_toggle
8
8
  th= list_sort_link(:id)
9
9
  - table_builder.fields.each do |field|
10
- th
10
+ th class=('hide_cell' if field.options[:hidden])
11
11
  - if field.options[:sortable] && !field.options[:image]
12
12
  - if field.options[:sortable].is_a?(TrueClass)
13
13
  = list_sort_link field.name
@@ -22,7 +22,7 @@
22
22
  - collection.each do |item|
23
23
  tr id=dom_id(item, 'list')
24
24
  = batch_action_item(item)
25
- td= id_link(item, is_edit_link)
25
+ td= id_link(item, edit: is_edit_link)
26
26
  - table_builder.fields.each do |field|
27
27
  td
28
28
  - if field.options[:editable] && field.data.is_a?(Symbol)
@@ -1,4 +1,4 @@
1
1
  - flash.each do |type, message|
2
- .alert class="alert-#{type.to_s}"
2
+ .alert class="alert-#{type}"
3
3
  a.close(data-dismiss='alert') ×
4
4
  == message
@@ -14,7 +14,7 @@
14
14
  = f.input :picture, as: :uploader
15
15
  = f.input :pictures, as: :uploader
16
16
 
17
- = input_set t('admin.keywords') do
17
+ = input_set t('admin.form.keywords') do
18
18
  = render 'admin/headers/form', f: f
19
19
 
20
20
  = f.hidden_field :fileupload_guid if f.object.new_record?
@@ -27,7 +27,7 @@ table.table.table-striped.index_table#list
27
27
  td= pretty_data item.created_at
28
28
  td.actions
29
29
  = item_index_actions(item)
30
- - if item.active_for_authentication?
30
+ - if item.active?
31
31
  = link_to t('admin.actions.suspend.link'), suspend_admin_user_path(item), method: :post, class: 'btn btn-warning'
32
32
  - else
33
33
  = link_to icon('ok', true), activate_admin_user_path(item), method: :post, class: 'btn btn-success', title: t('admin.actions.activate.link')
@@ -78,11 +78,11 @@ de:
78
78
  avatar: Picture
79
79
  batch_actions:
80
80
  status:
81
- few: '%{action} - %{count} records'
82
- many: '%{action} - %{count} records'
83
- one: '%{action} - %{count} record'
84
- other: '%{action} - %{count} records'
85
- zero: '%{action} - 0 records'
81
+ few: "%{action} - %{count} records"
82
+ many: "%{action} - %{count} records"
83
+ one: "%{action} - %{count} record"
84
+ other: "%{action} - %{count} records"
85
+ zero: "%{action} - 0 records"
86
86
  title: Action
87
87
  cache_clear: Clear cache
88
88
  cant_be_deleted: Can not delete
@@ -214,7 +214,6 @@ de:
214
214
  cancel: Cancellation
215
215
  clear: Reset
216
216
  confirm: Confirm
217
- create_product: Create a new product
218
217
  day: Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
219
218
  day_short: Sun, Mon, Tue, Wed, Thu, Fri, Sat
220
219
  delete_nested_elements: Can not delete
@@ -225,10 +224,6 @@ de:
225
224
  search: Searching ...
226
225
  value: Value
227
226
  fileupload:
228
- error: ''
229
- start: ''
230
- cancel: ''
231
- destroy: ''
232
227
  errors:
233
228
  maxFileSize: ''
234
229
  minFileSize: ''
@@ -238,21 +233,11 @@ de:
238
233
  emptyResult: ''
239
234
  attributes:
240
235
  map: Location
241
- address: Address
242
- country: Country
243
- country_id: Country
244
236
  created_at: Created at
245
237
  description: Description
246
- footmarks_count: Likes
247
238
  is_visible: Display
248
239
  name: Name
249
- parent: Parent element
250
- parent_id: Parent element
251
240
  position: Position
252
- region: Region
253
- region_id: Region
254
- reviews_count: Views
255
- synonyms: Synonyms
256
241
  title: Name
257
242
  updated_at: Updated at
258
243
  user: User
@@ -261,29 +246,26 @@ de:
261
246
  updater_id: ''
262
247
  remember_me: Remember
263
248
  password: Password
264
- slug: Alias
265
249
  attrs:
266
250
  en: Eng.
267
251
  it: Italian
268
252
  ru: Rus.
269
253
  uk: Ukr.
270
254
  de: Deutsch
271
- fr: ''
255
+ fr: Fr
256
+ es: Es
272
257
  flash:
273
258
  admin:
274
259
  actions:
275
260
  create:
276
- error: '%{resource_name} - while creating errors occurred: %{errors}'
277
- notice: '%{resource_name} was successfully created.'
261
+ error: "%{resource_name} - while creating errors occurred: %{errors}"
262
+ notice: "%{resource_name} was successfully created."
278
263
  destroy:
279
- error: '%{resource_name} - record could not be deleted.'
280
- notice: '%{resource_name} - record was successfully deleted.'
264
+ error: "%{resource_name} - record could not be deleted."
265
+ notice: "%{resource_name} - record was successfully deleted."
281
266
  update:
282
- error: '%{resource_name} - while updating errors occurred: %{errors}'
283
- notice: '%{resource_name} - record was successfully changed.'
284
- controller_name:
285
- update:
286
- success: products
267
+ error: "%{resource_name} - while updating errors occurred: %{errors}"
268
+ notice: "%{resource_name} - record was successfully changed."
287
269
  locators:
288
270
  prepared: Translations successfully prepared
289
271
  restart: Translations successfully reloaded
@@ -300,16 +282,16 @@ de:
300
282
  default_message: When you save any errors
301
283
  'no': 'No'
302
284
  required:
303
- mark: '*'
285
+ mark: "*"
304
286
  text: mandatory
305
287
  updating: Update ...
306
288
  'yes': 'Yes'
307
289
  will_paginate:
308
- page_gap: '...'
309
- pagination_info: <b>%{from}&nbsp;-&nbsp;%{to}</b> of <b>%{count}</b>
290
+ page_gap: "..."
291
+ pagination_info: "<b>%{from}&nbsp;-&nbsp;%{to}</b> of <b>%{count}</b>"
310
292
  pagination_info_empty: 0 total
311
- next_label: →
312
- previous_label: ←
293
+ next_label: ""
294
+ previous_label: ""
313
295
  errors:
314
296
  messages:
315
297
  wrong_size: is the wrong size (should be %{file_size})
@@ -79,11 +79,11 @@ en:
79
79
  batch_actions:
80
80
  title: Action
81
81
  status:
82
- zero: '%{action} - 0 records'
83
- one: '%{action} - %{count} record'
84
- few: '%{action} - %{count} records'
85
- many: '%{action} - %{count} records'
86
- other: '%{action} - %{count} records'
82
+ zero: "%{action} - 0 records"
83
+ one: "%{action} - %{count} record"
84
+ few: "%{action} - %{count} records"
85
+ many: "%{action} - %{count} records"
86
+ other: "%{action} - %{count} records"
87
87
  cache_clear: Clear cache
88
88
  cant_be_deleted: Can not delete
89
89
  choose: Select %{attr}
@@ -214,7 +214,6 @@ en:
214
214
  cancel: Cancel
215
215
  clear: Reset
216
216
  confirm: Confirm
217
- create_product: Create a new product
218
217
  day: Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
219
218
  day_short: Sun, Mon, Tue, Wed, Thu, Fri, Sat
220
219
  delete_nested_elements: Can not delete
@@ -225,10 +224,6 @@ en:
225
224
  search: Searching ...
226
225
  value: Value
227
226
  fileupload:
228
- error: Error
229
- start: Start
230
- cancel: Cancel
231
- destroy: Delete
232
227
  errors:
233
228
  maxFileSize: File is too big
234
229
  minFileSize: File is too small
@@ -238,21 +233,11 @@ en:
238
233
  emptyResult: Empty file upload result
239
234
  attributes:
240
235
  map: Location
241
- address: Address
242
- country: Country
243
- country_id: Country
244
236
  created_at: Created at
245
237
  description: Description
246
- footmarks_count: Likes
247
238
  is_visible: Display
248
239
  name: Name
249
- parent: Parent element
250
- parent_id: Parent element
251
240
  position: Position
252
- region: Region
253
- region_id: Region
254
- reviews_count: Views
255
- synonyms: Synonyms
256
241
  title: Title
257
242
  updated_at: Updated at
258
243
  user: User
@@ -261,29 +246,26 @@ en:
261
246
  updater_id: ''
262
247
  remember_me: Remember
263
248
  password: Password
264
- slug: Alias
265
249
  attrs:
266
250
  en: Eng.
267
251
  it: Italian
268
252
  ru: Rus.
269
253
  uk: Ukr.
270
254
  de: Deutsch
271
- fr: ''
255
+ fr: Fr
256
+ es: Es
272
257
  flash:
273
258
  admin:
274
259
  actions:
275
260
  create:
276
- error: '%{resource_name} - while creating errors occurred: %{errors}'
277
- notice: '%{resource_name} was successfully created.'
261
+ error: "%{resource_name} - while creating errors occurred: %{errors}"
262
+ notice: "%{resource_name} was successfully created."
278
263
  destroy:
279
- error: '%{resource_name} - record could not be deleted.'
280
- notice: '%{resource_name} - record was successfully deleted.'
264
+ error: "%{resource_name} - record could not be deleted."
265
+ notice: "%{resource_name} - record was successfully deleted."
281
266
  update:
282
- error: '%{resource_name} - while updating errors occurred: %{errors}'
283
- notice: '%{resource_name} - record was successfully changed.'
284
- controller_name:
285
- update:
286
- success: products
267
+ error: "%{resource_name} - while updating errors occurred: %{errors}"
268
+ notice: "%{resource_name} - record was successfully changed."
287
269
  locators:
288
270
  prepared: Translations successfully prepared
289
271
  restart: Translations successfully reloaded
@@ -300,16 +282,16 @@ en:
300
282
  default_message: When you save any errors
301
283
  'no': 'No'
302
284
  required:
303
- mark: '*'
285
+ mark: "*"
304
286
  text: mandatory
305
287
  updating: Update ...
306
288
  'yes': 'Yes'
307
289
  will_paginate:
308
- page_gap: '...'
309
- pagination_info: <b>%{from}&nbsp;-&nbsp;%{to}</b> of <b>%{count}</b>
290
+ page_gap: "..."
291
+ pagination_info: "<b>%{from}&nbsp;-&nbsp;%{to}</b> of <b>%{count}</b>"
310
292
  pagination_info_empty: 0 total
311
- next_label: →
312
- previous_label: ←
293
+ next_label: ""
294
+ previous_label: ""
313
295
  errors:
314
296
  messages:
315
297
  wrong_size: is the wrong size (should be %{file_size})
@@ -317,3 +299,5 @@ en:
317
299
  size_too_big: is too big (should be at most %{file_size})
318
300
  carrierwave_processing_error: Cannot resize image.
319
301
  carrierwave_integrity_error: Not an image.
302
+ unauthorized:
303
+ default: You are not authorized to access this page.
@@ -207,7 +207,6 @@ it:
207
207
  cancel: Cancellazione
208
208
  clear: Reset
209
209
  confirm: Confermare
210
- create_product: Creazione di un nuovo prodotto
211
210
  day: ''
212
211
  day_short: Dom, Lun, Mar, mer, gio, ven, sab
213
212
  delete_nested_elements: Impossibile eliminare
@@ -218,10 +217,6 @@ it:
218
217
  search: Ricerca ...
219
218
  value: Valore
220
219
  fileupload:
221
- error: ''
222
- start: ''
223
- cancel: ''
224
- destroy: ''
225
220
  errors:
226
221
  maxFileSize: ''
227
222
  minFileSize: ''
@@ -231,21 +226,11 @@ it:
231
226
  emptyResult: ''
232
227
  attributes:
233
228
  map: ''
234
- address: Indirizzo
235
- country: Paese
236
- country_id: Paese
237
229
  created_at: Data di creazione
238
230
  description: Descrizione
239
- footmarks_count: ''
240
231
  is_visible: Display
241
232
  name: Nome
242
- parent: ''
243
- parent_id: ''
244
233
  position: Posizione
245
- region: Regione
246
- region_id: Regione
247
- reviews_count: ''
248
- synonyms: Sinonimi
249
234
  title: Nome
250
235
  updated_at: Data di cambiamento
251
236
  user: Utente
@@ -254,29 +239,26 @@ it:
254
239
  updater_id: ''
255
240
  remember_me: ''
256
241
  password: ''
257
- slug: ''
258
242
  attrs:
259
243
  en: Ing.
260
244
  it: Italiana.
261
245
  ru: rus.
262
246
  uk: Ukr.
263
- de: ''
264
- fr: ''
247
+ de: De
248
+ fr: Fr
249
+ es: Es
265
250
  flash:
266
251
  admin:
267
252
  actions:
268
253
  create:
269
- error: '%{resource_name} mentre gli errori di mantenimento si è verificato.'
270
- notice: '%{resource_name} è stato creato con successo.'
254
+ error: "%{resource_name} mentre gli errori di mantenimento si è verificato."
255
+ notice: "%{resource_name} è stato creato con successo."
271
256
  destroy:
272
- error: '%{resource_name} non può essere cancellato.'
273
- notice: '%{resource_name} stato cancellato con successo.'
257
+ error: "%{resource_name} non può essere cancellato."
258
+ notice: "%{resource_name} stato cancellato con successo."
274
259
  update:
275
- error: '%{resource_name} mentre gli errori di mantenimento si è verificato.'
276
- notice: '%{resource_name} è stata modificata correttamente.'
277
- controller_name:
278
- update:
279
- success: prodotti
260
+ error: "%{resource_name} mentre gli errori di mantenimento si è verificato."
261
+ notice: "%{resource_name} è stata modificata correttamente."
280
262
  locators:
281
263
  prepared: Traduzioni con successo preparati
282
264
  restart: Traduzioni successo ricaricate
@@ -293,16 +275,16 @@ it:
293
275
  default_message: Quando si salva un errore
294
276
  'no': 'No'
295
277
  required:
296
- mark: '*'
278
+ mark: "*"
297
279
  text: obbligatorio
298
280
  updating: Aggiornamento ...
299
281
  'yes': Sì
300
282
  will_paginate:
301
- page_gap: '...'
283
+ page_gap: "..."
302
284
  pagination_info: Visualizzazione <b>%{from}&nbsp;-&nbsp;%{to}</b>di %{count} solo
303
285
  pagination_info_empty: ''
304
286
  next_label: Avanti. →
305
- previous_label: ← Precedente.
287
+ previous_label: "← Precedente."
306
288
  errors:
307
289
  messages:
308
290
  wrong_size: ''