Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated ruby 1.9 hash syntax

  • Loading branch information...
commit 85e43e0ff957e54a6318b5ff26b43aa1ccf47cc4 1 parent 952b37b
@justanshulsharma justanshulsharma authored
Showing with 321 additions and 321 deletions.
  1. +1 −1  app/controllers/rails_admin/main_controller.rb
  2. +1 −1  app/helpers/rails_admin/application_helper.rb
  3. +1 −1  app/views/kaminari/twitter-bootstrap/_gap.html.haml
  4. +1 −1  app/views/kaminari/twitter-bootstrap/_next_page.html.haml
  5. +2 −2 app/views/kaminari/twitter-bootstrap/_page.html.haml
  6. +1 −1  app/views/kaminari/twitter-bootstrap/_prev_page.html.haml
  7. +3 −3 app/views/layouts/rails_admin/_secondary_navigation.html.haml
  8. +7 −7 app/views/layouts/rails_admin/application.html.haml
  9. +2 −2 app/views/layouts/rails_admin/pjax.html.haml
  10. +1 −1  app/views/rails_admin/main/_dashboard_history.html.haml
  11. +3 −3 app/views/rails_admin/main/_delete_notice.html.haml
  12. +5 −5 app/views/rails_admin/main/_form_ck_editor.html.haml
  13. +5 −5 app/views/rails_admin/main/_form_code_mirror.html.haml
  14. +1 −1  app/views/rails_admin/main/_form_colorpicker.html.haml
  15. +1 −1  app/views/rails_admin/main/_form_datetime.html.haml
  16. +12 −12 app/views/rails_admin/main/_form_enumeration.html.haml
  17. +1 −1  app/views/rails_admin/main/_form_field.html.haml
  18. +4 −4 app/views/rails_admin/main/_form_file_upload.html.haml
  19. +17 −17 app/views/rails_admin/main/_form_filtering_multiselect.html.haml
  20. +8 −8 app/views/rails_admin/main/_form_filtering_select.html.haml
  21. +5 −5 app/views/rails_admin/main/_form_nested_many.html.haml
  22. +5 −5 app/views/rails_admin/main/_form_nested_one.html.haml
  23. +2 −2 app/views/rails_admin/main/_form_polymorphic_association.html.haml
  24. +1 −1  app/views/rails_admin/main/_form_text.html.haml
  25. +4 −4 app/views/rails_admin/main/_form_wysihtml5.html.haml
  26. +5 −5 app/views/rails_admin/main/_submit_buttons.html.haml
  27. +5 −5 app/views/rails_admin/main/bulk_delete.html.haml
  28. +6 −6 app/views/rails_admin/main/dashboard.html.haml
  29. +7 −7 app/views/rails_admin/main/delete.html.haml
  30. +2 −2 app/views/rails_admin/main/edit.html.haml
  31. +31 −31 app/views/rails_admin/main/export.html.haml
  32. +13 −13 app/views/rails_admin/main/history.html.haml
  33. +27 −27 app/views/rails_admin/main/index.html.haml
  34. +2 −2 app/views/rails_admin/main/new.html.haml
  35. +3 −3 app/views/rails_admin/main/show.html.haml
  36. +1 −1  lib/generators/rails_admin/install_generator.rb
  37. +3 −3 lib/rails_admin/adapters/active_record.rb
  38. +5 −5 lib/rails_admin/adapters/mongoid.rb
  39. +1 −1  lib/rails_admin/config.rb
  40. +1 −1  lib/rails_admin/config/fields/base.rb
  41. +2 −2 spec/dummy_app/app/active_record/carrierwave_uploader.rb
  42. +2 −2 spec/dummy_app/app/mongoid/carrierwave_uploader.rb
  43. +1 −1  spec/dummy_app/app/mongoid/field_test.rb
  44. +10 −10 spec/dummy_app/app/mongoid/user.rb
  45. +1 −1  spec/dummy_app/app/views/layouts/application.html.erb
  46. +4 −4 spec/dummy_app/config/initializers/devise.rb
  47. +1 −1  spec/dummy_app/config/routes.rb
  48. +1 −1  spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb
  49. +2 −2 spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb
  50. +1 −1  spec/integration/basic/export/rails_admin_basic_export_spec.rb
  51. +2 −2 spec/rails_admin/adapters/active_record_spec.rb
  52. +84 −84 spec/rails_admin/adapters/mongoid_spec.rb
  53. +1 −1  spec/rails_admin/config/fields/base_spec.rb
  54. +3 −3 spec/rails_admin/config_spec.rb
View
2  app/controllers/rails_admin/main_controller.rb
@@ -15,7 +15,7 @@ class MainController < RailsAdmin::ApplicationController
def #{action.action_name}
action = RailsAdmin::Config::Actions.find('#{action.action_name}'.to_sym)
@authorization_adapter.try(:authorize, action.authorization_key, @abstract_model, @object)
- @action = action.with({:controller => self, :abstract_model => @abstract_model, :object => @object})
+ @action = action.with({controller: self, abstract_model: @abstract_model, object: @object})
@page_name = wording_for(:title)
instance_eval &@action.controller
View
2  app/helpers/rails_admin/application_helper.rb
@@ -131,7 +131,7 @@ def bulk_menu(abstract_model = @abstract_model)
actions = actions(:bulkable, abstract_model)
return '' if actions.empty?
content_tag :li, class: 'dropdown', style: 'float:right' do
- content_tag(:a, :class => 'dropdown-toggle', :'data-toggle' => 'dropdown', :href => '#') { t('admin.misc.bulk_menu_title').html_safe + '<b class="caret"></b>'.html_safe } +
+ content_tag(:a, class: 'dropdown-toggle', :'data-toggle' => 'dropdown', href: '#') { t('admin.misc.bulk_menu_title').html_safe + '<b class="caret"></b>'.html_safe } +
content_tag(:ul, class: 'dropdown-menu', style: 'left:auto; right:0;') do
actions.collect do |action|
content_tag :li do
View
2  app/views/kaminari/twitter-bootstrap/_gap.html.haml
@@ -1,2 +1,2 @@
%li.disabled
- %a{:href => '#'}= raw(t 'admin.pagination.truncate')
+ %a{href: '#'}= raw(t 'admin.pagination.truncate')
View
2  app/views/kaminari/twitter-bootstrap/_next_page.html.haml
@@ -1,4 +1,4 @@
- if current_page.last?
%li.next.disabled= link_to raw(t 'admin.pagination.next'), '#'
- else
- %li.next= link_to raw(t 'admin.pagination.next'), url, :class => (remote ? 'pjax' : '')
+ %li.next= link_to raw(t 'admin.pagination.next'), url, class: (remote ? 'pjax' : '')
View
4 app/views/kaminari/twitter-bootstrap/_page.html.haml
@@ -1,4 +1,4 @@
- if page.current?
- %li.active= link_to page, url, :class => (remote ? 'pjax' : '')
+ %li.active= link_to page, url, class: (remote ? 'pjax' : '')
- else
- %li= link_to page, url, :class => (remote ? 'pjax' : '')
+ %li= link_to page, url, class: (remote ? 'pjax' : '')
View
2  app/views/kaminari/twitter-bootstrap/_prev_page.html.haml
@@ -1,4 +1,4 @@
- if current_page.first?
%li.prev.disabled= link_to raw(t 'admin.pagination.previous'), '#'
- else
- %li.prev= link_to raw(t 'admin.pagination.previous'), url, :class => (remote ? 'pjax' : '')
+ %li.prev= link_to raw(t 'admin.pagination.previous'), url, class: (remote ? 'pjax' : '')
View
6 app/views/layouts/rails_admin/_secondary_navigation.html.haml
@@ -1,12 +1,12 @@
%ul.nav.pull-right.root_links
- actions(:root).each do |action|
- %li{:class => "#{action.action_name}_root_link"}= link_to wording_for(:menu, action), { :action => action.action_name, :controller => 'rails_admin/main' }, :class => "pjax"
+ %li{class: "#{action.action_name}_root_link"}= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: "pjax"
- if main_app_root_path = (main_app.root_path rescue false)
%li= link_to t('admin.home.name').capitalize, main_app_root_path
- if _current_user
- if user_link = edit_user_link
%li= user_link
- if logout_path.present?
- %li= link_to content_tag('span', t('admin.misc.log_out'), :class => 'label label-important'), logout_path, :method => Devise.sign_out_via
+ %li= link_to content_tag('span', t('admin.misc.log_out'), class: 'label label-important'), logout_path, method: Devise.sign_out_via
- if _current_user.respond_to?(:email) && _current_user.email.present?
- %li= image_tag "#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", :style => 'padding-top:5px'
+ %li= image_tag "#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", style: 'padding-top:5px'
View
14 app/views/layouts/rails_admin/application.html.haml
@@ -1,24 +1,24 @@
!!! 5
%html
%head
- %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
- %meta{:content => "NONE,NOARCHIVE", :name => "robots"}
+ %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
+ %meta{content: "NONE,NOARCHIVE", name: "robots"}
= csrf_meta_tag
- = stylesheet_link_tag "rails_admin/rails_admin.css", :media => :all
+ = stylesheet_link_tag "rails_admin/rails_admin.css", media: :all
= javascript_include_tag "rails_admin/rails_admin.js"
-# Initialize JS simple i18n
:javascript
RailsAdmin.I18n.init(JSON.parse("#{j I18n.t("admin.js").to_json}"))
%body.rails_admin
- #loading.label.label-warning{:style => 'display:none; position:fixed; right:20px; bottom:20px; z-index:100000'}= t('admin.loading')
+ #loading.label.label-warning{style: 'display:none; position:fixed; right:20px; bottom:20px; z-index:100000'}= t('admin.loading')
.navbar.navbar-fixed-top
.navbar-inner
.container-fluid
- %a.brand.pjax{:href => dashboard_path}
+ %a.brand.pjax{href: dashboard_path}
= _get_plugin_name[0] || 'Rails'
%small= _get_plugin_name[1] || 'Admin'
.nav-collapse
- = render :partial => 'layouts/rails_admin/secondary_navigation'
+ = render partial: 'layouts/rails_admin/secondary_navigation'
.container-fluid
.row-fluid
.span3
@@ -27,4 +27,4 @@
%ul.nav.nav-list= static_navigation
.span9
.row-fluid
- .content{:'data-pjax-container' => true}= render :template => 'layouts/rails_admin/pjax'
+ .content{:'data-pjax-container' => true}= render template: 'layouts/rails_admin/pjax'
View
4 app/views/layouts/rails_admin/pjax.html.haml
@@ -6,8 +6,8 @@
.page-header
%h1= @page_name
- flash && flash.each do |key, value|
- .alert{:class => "alert-#{key}"}
- %a.close{:href => '#', :'data-dismiss' => "alert"}×
+ .alert{class: "alert-#{key}"}
+ %a.close{href: '#', :'data-dismiss' => "alert"}×
= value
= breadcrumb
%ul.nav.nav-tabs
View
2  app/views/rails_admin/main/_dashboard_history.html.haml
@@ -12,7 +12,7 @@
- if o = abstract_model.try(:get, t.item)
- label = o.send(abstract_model.config.object_label_method)
- if show_action = action(:show, abstract_model, o)
- %td= link_to(label, url_for(:action => show_action.action_name, :model_name => abstract_model.to_param, :id => o.id), :class => 'pjax')
+ %td= link_to(label, url_for(action: show_action.action_name, model_name: abstract_model.to_param, id: o.id), class: 'pjax')
- else
%td= label
- else
View
6 app/views/rails_admin/main/_delete_notice.html.haml
@@ -1,10 +1,10 @@
- object = delete_notice
-%li{:style => 'display:block; margin-top:10px'}
+%li{style: 'display:block; margin-top:10px'}
%span.label= @abstract_model.pretty_name
- wording = object.send(@model_config.object_label_method)
- if show_action = action(:show, @abstract_model, object)
- = link_to(wording, url_for(:action => show_action.action_name, :model_name => @abstract_model.to_param, :id => object.id), :class => 'pjax')
+ = link_to(wording, url_for(action: show_action.action_name, model_name: @abstract_model.to_param, id: object.id), class: 'pjax')
- else
= wording
%ul
@@ -14,6 +14,6 @@
= @abstract_model.model.human_attribute_name association[:name]
- wording = child.send(child_config.object_label_method)
- if child.id && (show_action = action(:show, child_config.abstract_model, child))
- = link_to(wording, url_for(:action => show_action.action_name, :model_name => child_config.abstract_model.to_param, :id => child.id), :class => 'pjax')
+ = link_to(wording, url_for(action: show_action.action_name, model_name: child_config.abstract_model.to_param, id: child.id), class: 'pjax')
- else
= wording
View
10 app/views/rails_admin/main/_form_ck_editor.html.haml
@@ -1,10 +1,10 @@
:ruby
js_data = {
- :jspath => field.location ? field.location : field.base_location + "ckeditor.js",
- :base_location => field.base_location,
- :options => {
- :customConfig => field.config_js ? field.config_js : field.base_location + "config.js"
+ jspath: field.location ? field.location : field.base_location + "ckeditor.js",
+ base_location: field.base_location,
+ options: {
+ customConfig: field.config_js ? field.config_js : field.base_location + "config.js"
}
}
-= form.text_area field.method_name, field.html_attributes.reverse_merge(:data => { :richtext => 'ckeditor', :options => js_data.to_json }).reverse_merge({ :value => field.form_value })
+= form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'ckeditor', options: js_data.to_json }).reverse_merge({ value: field.form_value })
View
10 app/views/rails_admin/main/_form_code_mirror.html.haml
@@ -1,9 +1,9 @@
:ruby
js_data = {
- :csspath => field.css_location,
- :jspath => field.js_location,
- :options => field.config,
- :locations => field.assets
+ csspath: field.css_location,
+ jspath: field.js_location,
+ options: field.config,
+ locations: field.assets
}
-= form.text_area field.method_name, field.html_attributes.reverse_merge(:data => { :richtext => 'codemirror', :options => js_data.to_json }).reverse_merge({ :value => field.form_value })
+= form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'codemirror', options: js_data.to_json }).reverse_merge({ value: field.form_value })
View
2  app/views/rails_admin/main/_form_colorpicker.html.haml
@@ -1 +1 @@
-= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({:value => field.form_value, :style => "background-color: #{field.color}", :data => {:color => true}})
+= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({value: field.form_value, style: "background-color: #{field.color}", data: {color: true}})
View
2  app/views/rails_admin/main/_form_datetime.html.haml
@@ -1 +1 @@
-= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ :value => field.form_value }).reverse_merge({ :data => { :datetimepicker => true, :options => field.js_plugin_options.to_json } })
+= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value }).reverse_merge({ data: { datetimepicker: true, options: field.js_plugin_options.to_json } })
View
24 app/views/rails_admin/main/_form_enumeration.html.haml
@@ -1,18 +1,18 @@
- unless field.multiple?
- = form.select field.method_name, field.enum, { :include_blank => true }.reverse_merge({ :selected => field.form_value }), field.html_attributes.reverse_merge({ :data => { :enumeration => true }, :placeholder => t('admin.misc.search') })
+ = form.select field.method_name, field.enum, { include_blank: true }.reverse_merge({ selected: field.form_value }), field.html_attributes.reverse_merge({ data: { enumeration: true }, placeholder: t('admin.misc.search') })
- else
:ruby
js_data = {
- :xhr => false,
- :sortable => false,
- :cacheAll => true,
- :regional => {
- :chooseAll => t("admin.misc.chose_all"),
- :chosen => t("admin.misc.chosen", :name => config.label_plural),
- :clearAll => t("admin.misc.clear_all"),
- :search => t("admin.misc.search"),
- :up => t("admin.misc.up"),
- :down => t("admin.misc.down")
+ xhr: false,
+ sortable: false,
+ cacheAll: true,
+ regional: {
+ chooseAll: t("admin.misc.chose_all"),
+ chosen: t("admin.misc.chosen", name: config.label_plural),
+ clearAll: t("admin.misc.clear_all"),
+ search: t("admin.misc.search"),
+ up: t("admin.misc.up"),
+ down: t("admin.misc.down")
}
}
- = form.select field.method_name, field.enum, { :selected => field.form_value, :object => form.object }, field.html_attributes.reverse_merge({:data => { :filteringmultiselect => true, :options => js_data.to_json }, :multiple => true})
+ = form.select field.method_name, field.enum, { selected: field.form_value, object: form.object }, field.html_attributes.reverse_merge({data: { filteringmultiselect: true, options: js_data.to_json }, multiple: true})
View
2  app/views/rails_admin/main/_form_field.html.haml
@@ -1 +1 @@
-= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ :value => field.form_value, :checked => field.form_value.in?([true, '1'])})
+= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value, checked: field.form_value.in?([true, '1'])})
View
8 app/views/rails_admin/main/_form_file_upload.html.haml
@@ -1,13 +1,13 @@
- file = form.object.send(field.method_name).presence
-.toggle{:style => ('display:none;' if file && field.delete_method && form.object.send(field.delete_method) == '1')}
+.toggle{style: ('display:none;' if file && field.delete_method && form.object.send(field.delete_method) == '1')}
- if value = field.pretty_value
= value
- = form.file_field(field.name, field.html_attributes.reverse_merge({ :data => { :fileupload => true }}))
+ = form.file_field(field.name, field.html_attributes.reverse_merge({ data: { fileupload: true }}))
- if field.optional? && field.errors.blank? && file && field.delete_method
- %a.btn.btn-info{:href => '#', :'data-toggle' => 'button', :onclick => "$(this).siblings('[type=checkbox]').click(); $(this).siblings('.toggle').toggle('slow'); jQuery(this).toggleClass('btn-danger btn-info'); return false"}
+ %a.btn.btn-info{href: '#', :'data-toggle' => 'button', onclick: "$(this).siblings('[type=checkbox]').click(); $(this).siblings('.toggle').toggle('slow'); jQuery(this).toggleClass('btn-danger btn-info'); return false"}
%i.icon-white.icon-trash
= I18n.t('admin.actions.delete.menu').capitalize + " #{field.label.downcase}"
- = form.check_box(field.delete_method, :style => 'display:none;' )
+ = form.check_box(field.delete_method, style: 'display:none;' )
- if field.cache_method
= form.hidden_field(field.cache_method)
View
34 app/views/rails_admin/main/_form_filtering_multiselect.html.haml
@@ -22,26 +22,26 @@
end
js_data = {
- :xhr => xhr,
- :'edit-url' => (authorized?(:edit, config.abstract_model) ? edit_path(:model_name => config.abstract_model.to_param, :id => '__ID__') : ''),
- :remote_source => index_path(config.abstract_model, :source_object_id => form.object.id, :source_abstract_model => source_abstract_model.to_param, :associated_collection => field.name, :current_action => current_action, :compact => true),
- :sortable => !!field.orderable,
- :cacheAll => !!field.associated_collection_cache_all,
- :regional => {
- :chooseAll => t("admin.misc.chose_all"),
- :chosen => t("admin.misc.chosen", :name => config.label_plural),
- :clearAll => t("admin.misc.clear_all"),
- :search => t("admin.misc.search"),
- :up => t("admin.misc.up"),
- :down => t("admin.misc.down")
+ xhr: xhr,
+ :'edit-url' => (authorized?(:edit, config.abstract_model) ? edit_path(model_name: config.abstract_model.to_param, id: '__ID__') : ''),
+ remote_source: index_path(config.abstract_model, source_object_id: form.object.id, source_abstract_model: source_abstract_model.to_param, associated_collection: field.name, current_action: current_action, compact: true),
+ sortable: !!field.orderable,
+ cacheAll: !!field.associated_collection_cache_all,
+ regional: {
+ chooseAll: t("admin.misc.chose_all"),
+ chosen: t("admin.misc.chosen", name: config.label_plural),
+ clearAll: t("admin.misc.clear_all"),
+ search: t("admin.misc.search"),
+ up: t("admin.misc.up"),
+ down: t("admin.misc.down")
}
}
-%input{:name => form.dom_name(field), :type => "hidden", :value => ""}
+%input{name: form.dom_name(field), type: "hidden", value: ""}
- selected_ids = (hdv = field.form_default_value).nil? ? selected_ids : hdv
-= form.select field.method_name, collection, { :selected => selected_ids, :object => form.object }, field.html_attributes.reverse_merge({:data => { :filteringmultiselect => true, :options => js_data.to_json }, :multiple => true})
+= form.select field.method_name, collection, { selected: selected_ids, object: form.object }, field.html_attributes.reverse_merge({data: { filteringmultiselect: true, options: js_data.to_json }, multiple: true})
- if authorized?(:new, config.abstract_model) && field.inline_add
- - path_hash = { :model_name => config.abstract_model.to_param, :modal => true }
- - path_hash.merge!({ :associations => { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
- = link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', :data => { :link => new_path(path_hash) }, :class => "create btn btn-info", :style => 'margin-left:10px'
+ - path_hash = { model_name: config.abstract_model.to_param, modal: true }
+ - path_hash.merge!({ associations: { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
+ = link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', data: { link: new_path(path_hash) }, class: "create btn btn-info", style: 'margin-left:10px'
View
16 app/views/rails_admin/main/_form_filtering_select.html.haml
@@ -14,24 +14,24 @@
current_action = params[:action].in?(['create', 'new']) ? 'create' : 'update'
- edit_url = authorized?(:edit, config.abstract_model) ? edit_path(:model_name => config.abstract_model.to_param, :modal => true, :id => '__ID__') : ''
+ edit_url = authorized?(:edit, config.abstract_model) ? edit_path(model_name: config.abstract_model.to_param, modal: true, id: '__ID__') : ''
xhr = !field.associated_collection_cache_all
collection = xhr ? [[selected_name, selected_id]] : controller.list_entries(config, :index, field.associated_collection_scope, false).map { |o| [o.send(field.associated_object_label_method), o.send(field.associated_primary_key)] }
js_data = {
- :xhr => xhr,
- :remote_source => index_path(config.abstract_model.to_param, :source_object_id => form.object.id, :source_abstract_model => source_abstract_model.to_param, :associated_collection => field.name, :current_action => current_action, :compact => true)
+ xhr: xhr,
+ remote_source: index_path(config.abstract_model.to_param, source_object_id: form.object.id, source_abstract_model: source_abstract_model.to_param, associated_collection: field.name, current_action: current_action, compact: true)
}
- selected_id = (hdv = field.form_default_value).nil? ? selected_id : hdv
-= form.select field.method_name, collection, { :selected => selected_id, :include_blank => true }, field.html_attributes.reverse_merge({ :data => { :filteringselect => true, :options => js_data.to_json }, :placeholder => t('admin.misc.search') })
+= form.select field.method_name, collection, { selected: selected_id, include_blank: true }, field.html_attributes.reverse_merge({ data: { filteringselect: true, options: js_data.to_json }, placeholder: t('admin.misc.search') })
- if authorized?(:new, config.abstract_model) && field.inline_add
- - path_hash = { :model_name => config.abstract_model.to_param, :modal => true }
- - path_hash.merge!({ :associations => { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
- = link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', :data => { :link => new_path(path_hash) }, :class => "btn btn-info create", :style => 'margin-left:10px'
+ - path_hash = { model_name: config.abstract_model.to_param, modal: true }
+ - path_hash.merge!({ associations: { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
+ = link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', data: { link: new_path(path_hash) }, class: "btn btn-info create", style: 'margin-left:10px'
- if edit_url.present? && field.inline_edit
- = link_to "<i class=\"icon-pencil icon-white\"></i> ".html_safe + wording_for(:link, :edit, config.abstract_model), '#', :data => { :link => edit_url }, :class => "btn btn-info update #{field.value.nil? && 'disabled'}", :style => 'margin-left:10px'
+ = link_to "<i class=\"icon-pencil icon-white\"></i> ".html_safe + wording_for(:link, :edit, config.abstract_model), '#', data: { link: edit_url }, class: "btn btn-info update #{field.value.nil? && 'disabled'}", style: 'margin-left:10px'
View
10 app/views/rails_admin/main/_form_nested_many.html.haml
@@ -1,14 +1,14 @@
-.controls{:data => { :nestedmany => true }}
+.controls{data: { nestedmany: true }}
.btn-group
- %a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content, #{form.jquery_namespace(field)} > .controls > .nav", :class => (field.active? ? 'active' : '')}
+ %a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content, #{form.jquery_namespace(field)} > .controls > .nav", class: (field.active? ? 'active' : '')}
%i.icon-white
- unless field.nested_form[:update_only] || !field.inline_add
- = form.link_to_add "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".html_safe, field.name, { :class => 'btn btn-info' }
+ = form.link_to_add "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".html_safe, field.name, { class: 'btn btn-info' }
= form.errors_for(field)
= form.help_for(field)
- %ul.nav.nav-tabs{ :style => 'margin-top:5px' }
+ %ul.nav.nav-tabs{ style: 'margin-top:5px' }
.tab-content
= form.fields_for field.name do |nested_form|
- if field.nested_form[:allow_destroy] || nested_form.options[:child_index] == "new_#{field.name}"
= nested_form.link_to_remove '<span class="btn btn-small btn-danger"><i class="icon-trash icon-white"></i></span>'.html_safe
- = nested_form.generate({:action => :nested, :model_config => field.associated_model_config, :nested_in => field.name })
+ = nested_form.generate({action: :nested, model_config: field.associated_model_config, nested_in: field.name })
View
10 app/views/rails_admin/main/_form_nested_one.html.haml
@@ -1,12 +1,12 @@
-.controls{:data => { :nestedone => true }}
- %ul.nav{:style => 'margin-bottom:0px; display:none'}
+.controls{data: { nestedone: true }}
+ %ul.nav{style: 'margin-bottom:0px; display:none'}
.btn-group
- %a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content", :class => (field.active? ? 'active' : '') }
+ %a.btn.btn-info.toggler{:'data-toggle' => "button", :'data-target' => "#{form.jquery_namespace(field)} > .tab-content", class: (field.active? ? 'active' : '') }
%i.icon-white
- unless field.nested_form[:update_only] || !field.inline_add
= form.link_to_add "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".html_safe,
field.name,
- { :class => 'btn btn-info', :'data-add-label' => "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".gsub("\n", "") }
+ { class: 'btn btn-info', :'data-add-label' => "<i class=\"icon-plus icon-white\"></i> #{wording_for(:link, :new, field.associated_model_config.abstract_model)}".gsub("\n", "") }
= form.errors_for(field)
= form.help_for(field)
@@ -14,4 +14,4 @@
= form.fields_for field.name do |nested_form|
- if field.nested_form[:allow_destroy]
= nested_form.link_to_remove '<span class="btn btn-small btn-danger"><i class="icon-trash icon-white"></i></span>'.html_safe
- = nested_form.generate({:action => :nested, :model_config => field.associated_model_config, :nested_in => field.name })
+ = nested_form.generate({action: :nested, model_config: field.associated_model_config, nested_in: field.name })
View
4 app/views/rails_admin/main/_form_polymorphic_association.html.haml
@@ -6,5 +6,5 @@
selected = field.bindings[:object].send(field.association[:name])
column_type_dom_id = form.dom_id(field).sub(field.method_name.to_s, type_column)
-= form.select type_column, type_collection, {:include_blank => true, :selected => selected_type}, :id => column_type_dom_id, :data => { :polymorphic => true, :urls => field.polymorphic_type_urls.to_json }
-= form.select field.method_name, collection, {:include_blank => true, :selected => selected.try(:id)}, :style => "margin-left:10px;"
+= form.select type_column, type_collection, {include_blank: true, selected: selected_type}, id: column_type_dom_id, data: { polymorphic: true, urls: field.polymorphic_type_urls.to_json }
+= form.select field.method_name, collection, {include_blank: true, selected: selected.try(:id)}, style: "margin-left:10px;"
View
2  app/views/rails_admin/main/_form_text.html.haml
@@ -1 +1 @@
-= form.text_area field.method_name, field.html_attributes.reverse_merge(:data => { :richtext => false, :options => {}.to_json }).reverse_merge({ :value => field.form_value })
+= form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: false, options: {}.to_json }).reverse_merge({ value: field.form_value })
View
8 app/views/rails_admin/main/_form_wysihtml5.html.haml
@@ -1,8 +1,8 @@
:ruby
js_data = {
- :csspath => field.css_location,
- :jspath => field.js_location,
- :config_options => field.config_options.to_json
+ csspath: field.css_location,
+ jspath: field.js_location,
+ config_options: field.config_options.to_json
}
-= form.text_area field.method_name, field.html_attributes.reverse_merge(:data => { :richtext => 'bootstrap-wysihtml5', :options => js_data.to_json }).reverse_merge({ :value => field.form_value })
+= form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'bootstrap-wysihtml5', options: js_data.to_json }).reverse_merge({ value: field.form_value })
View
10 app/views/rails_admin/main/_submit_buttons.html.haml
@@ -1,15 +1,15 @@
-%input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
+%input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
.form-actions
- %button.btn.btn-primary{:type => "submit", :name => "_save", :'data-disable-with' => t("admin.form.save")}
+ %button.btn.btn-primary{type: "submit", name: "_save", :'data-disable-with' => t("admin.form.save")}
%i.icon-white.icon-ok
= t("admin.form.save")
%span.extra_buttons
- if authorized? :new, @abstract_model
- %button.btn.btn-info{:type => "submit", :name => "_add_another", :'data-disable-with' => t("admin.form.save_and_add_another")}
+ %button.btn.btn-info{type: "submit", name: "_add_another", :'data-disable-with' => t("admin.form.save_and_add_another")}
= t("admin.form.save_and_add_another")
- if authorized? :edit, @abstract_model
- %button.btn.btn-info{:type => "submit", :name => "_add_edit", :'data-disable-with' => t("admin.form.save_and_edit")}
+ %button.btn.btn-info{type: "submit", name: "_add_edit", :'data-disable-with' => t("admin.form.save_and_edit")}
= t("admin.form.save_and_edit")
- %button.btn{:type => "submit", :name => "_continue", :'data-disable-with' => t("admin.form.cancel")}
+ %button.btn{type: "submit", name: "_continue", :'data-disable-with' => t("admin.form.cancel")}
%i.icon-remove
= t("admin.form.cancel")
View
10 app/views/rails_admin/main/bulk_delete.html.haml
@@ -1,11 +1,11 @@
%h4= I18n.t('admin.form.bulk_delete')
-%ul= render :partial => "delete_notice", :collection => @objects
-= form_tag bulk_delete_path(:model_name => @abstract_model.to_param, :bulk_ids => @objects.map(&:id)), :method => :delete do
+%ul= render partial: "delete_notice", collection: @objects
+= form_tag bulk_delete_path(model_name: @abstract_model.to_param, bulk_ids: @objects.map(&:id)), method: :delete do
.form-actions
- %input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
- %button.btn.btn-danger{:type => "submit", :'data-disable-with' => t("admin.form.confirmation")}
+ %input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
+ %button.btn.btn-danger{type: "submit", :'data-disable-with' => t("admin.form.confirmation")}
%i.icon-white.icon-ok
= t("admin.form.confirmation")
- %button.btn{:type => "submit", :name => "_continue", :'data-disable-with' => t("admin.form.cancel")}
+ %button.btn{type: "submit", name: "_continue", :'data-disable-with' => t("admin.form.cancel")}
%i.icon-remove
= t("admin.form.cancel")
View
12 app/views/rails_admin/main/dashboard.html.haml
@@ -9,13 +9,13 @@
%tbody
- @abstract_models.each do |abstract_model|
- if authorized? :index, abstract_model
- - index_path = index_path(:model_name => abstract_model.to_param)
+ - index_path = index_path(model_name: abstract_model.to_param)
- row_class = "#{cycle("odd", "even")}#{" link" if index_path} #{abstract_model.param_key}_links"
- %tr{:class => row_class, :"data-link" => index_path}
+ %tr{class: row_class, :"data-link" => index_path}
- last_used = @most_recent_changes[abstract_model.pretty_name]
- active = last_used.try(:today?)
%td
- %span.show= link_to abstract_model.config.label_plural, index_path, :class => 'pjax'
+ %span.show= link_to abstract_model.config.label_plural, index_path, class: 'pjax'
%td
- if last_used
= time_ago_in_words last_used
@@ -23,8 +23,8 @@
%td
- count = @count[abstract_model.pretty_name]
- percent = count > 0 ? (@max <= 1 ? count : ((Math.log(count+1) * 100.0) / Math.log(@max+1)).to_i) : -1
- .progress{:style => "margin-bottom:0px", :class => "progress-#{get_indicator(percent)} #{active && 'active progress-striped'}" }
- .bar.animate-width-to{:'data-animate-length' => ([1.0, percent].max.to_i * 20), :'data-animate-width-to' => "#{[2.0, percent].max.to_i}%", :style => "width:2%"}
+ .progress{style: "margin-bottom:0px", class: "progress-#{get_indicator(percent)} #{active && 'active progress-striped'}" }
+ .bar.animate-width-to{:'data-animate-length' => ([1.0, percent].max.to_i * 20), :'data-animate-width-to' => "#{[2.0, percent].max.to_i}%", style: "width:2%"}
= @count[abstract_model.pretty_name]
%td.links
%ul.inline= menu_for :collection, abstract_model, nil, true
@@ -32,4 +32,4 @@
#block-tables.block
.content
%h2= t("admin.actions.history_index.menu")
- = render :partial => 'rails_admin/main/dashboard_history'
+ = render partial: 'rails_admin/main/dashboard_history'
View
14 app/views/rails_admin/main/delete.html.haml
@@ -1,18 +1,18 @@
%h4
- = t("admin.form.are_you_sure_you_want_to_delete_the_object", :model_name => @abstract_model.pretty_name.downcase)
+ = t("admin.form.are_you_sure_you_want_to_delete_the_object", model_name: @abstract_model.pretty_name.downcase)
&ldquo;
- %strong>= @model_config.with(:object => @object).object_label
+ %strong>= @model_config.with(object: @object).object_label
\&rdquo;
%span>
= t("admin.form.all_of_the_following_related_items_will_be_deleted")
-%ul= render :partial => "delete_notice", :object => @object
-= form_for(@object, :url => delete_path(:model_name => @abstract_model.to_param, :id => @object.id), :html => {:method => "delete"}) do
- %input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
+%ul= render partial: "delete_notice", object: @object
+= form_for(@object, url: delete_path(model_name: @abstract_model.to_param, id: @object.id), html: {method: "delete"}) do
+ %input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
.form-actions
- %button.btn.btn-danger{:type => "submit", :'data-disable-with' => t("admin.form.confirmation")}
+ %button.btn.btn-danger{type: "submit", :'data-disable-with' => t("admin.form.confirmation")}
%i.icon-white.icon-ok
= t("admin.form.confirmation")
- %button.btn{:type => "submit", :name => "_continue", :'data-disable-with' => t("admin.form.cancel")}
+ %button.btn{type: "submit", name: "_continue", :'data-disable-with' => t("admin.form.cancel")}
%i.icon-remove
= t("admin.form.cancel")
View
4 app/views/rails_admin/main/edit.html.haml
@@ -1,2 +1,2 @@
-= rails_admin_form_for @object, :url => edit_path(@abstract_model, @object.id), :as => @abstract_model.param_key, :html => { :method => "put", :multipart => true, :class => "form-horizontal denser", :data => { :title => @page_name } } do |form|
- = form.generate :action => :update
+= rails_admin_form_for @object, url: edit_path(@abstract_model, @object.id), as: @abstract_model.param_key, html: { method: "put", multipart: true, class: "form-horizontal denser", data: { title: @page_name } } do |form|
+ = form.generate action: :update
View
62 app/views/rails_admin/main/export.html.haml
@@ -1,80 +1,80 @@
- params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token)
-- visible_fields = @model_config.export.with(:view => self, :object => @abstract_model.model.new, :controller => self.controller).visible_fields
+- visible_fields = @model_config.export.with(view: self, object: @abstract_model.model.new, controller: self.controller).visible_fields
-= form_tag export_path(params.merge(:all => true)), :method => 'post', :class => 'form-horizontal denser' do
+= form_tag export_path(params.merge(all: true)), method: 'post', class: 'form-horizontal denser' do
- %input{:name => "send_data", :type => "hidden", :value => "true"}/
- %fieldset{:id => 'fields_to_export'}
+ %input{name: "send_data", type: "hidden", value: "true"}/
+ %fieldset{id: 'fields_to_export'}
%div.control-group
%div.controls
- %label.checkbox{:for => 'check_all'}
+ %label.checkbox{for: 'check_all'}
= t('admin.export.select_all_fields')
- = check_box_tag 'all', 'all', true, { :id => 'check_all' }
+ = check_box_tag 'all', 'all', true, { id: 'check_all' }
%legend
%i.icon-chevron-down
= t('admin.export.select')
.control-group
- %label.control-label{:rel => 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from', :name => @model_config.label_plural.downcase)
+ %label.control-label{rel: 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), onclick: 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from', name: @model_config.label_plural.downcase)
.controls
- visible_fields.select{ |f| !f.association? || f.association[:polymorphic] }.each do |field|
- list = field.virtual? ? 'methods' : 'only'
- if field.association? && field.association[:polymorphic]
- %label.checkbox{:for => "schema_#{list}_#{field.method_name}"}
- = check_box_tag "schema[#{list}][]", field.method_name, true, { :id => "schema_#{list}_#{field.method_name}" }
+ %label.checkbox{for: "schema_#{list}_#{field.method_name}"}
+ = check_box_tag "schema[#{list}][]", field.method_name, true, { id: "schema_#{list}_#{field.method_name}" }
= field.label + " [id]"
- polymorphic_type_column_name = @abstract_model.properties.find {|p| field.association[:foreign_type] == p[:name] }[:name]
- %label.checkbox{:for => "schema_#{list}_#{polymorphic_type_column_name}"}
- = check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { :id => "schema_#{list}_#{polymorphic_type_column_name}" }
+ %label.checkbox{for: "schema_#{list}_#{polymorphic_type_column_name}"}
+ = check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { id: "schema_#{list}_#{polymorphic_type_column_name}" }
= field.label + " [type]"
- else
- %label.checkbox{:for => "schema_#{list}_#{field.name}"}
- = check_box_tag "schema[#{list}][]", field.name, true, { :id => "schema_#{list}_#{field.name}" }
+ %label.checkbox{for: "schema_#{list}_#{field.name}"}
+ = check_box_tag "schema[#{list}][]", field.name, true, { id: "schema_#{list}_#{field.name}" }
= field.label
- visible_fields.select{ |f| f.association? && !f.association[:polymorphic] }.each do |field|
- - fields = field.associated_model_config.export.with(:controller => self.controller, :view => self, :object => (associated_model = field.associated_model_config.abstract_model.model).new).visible_fields.select{ |f| !f.association? }
+ - fields = field.associated_model_config.export.with(controller: self.controller, view: self, object: (associated_model = field.associated_model_config.abstract_model.model).new).visible_fields.select{ |f| !f.association? }
.control-group
- %label.control-label{:rel => 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from_associated', :name => field.label.downcase)
+ %label.control-label{rel: 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), onclick: 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from_associated', name: field.label.downcase)
.controls
- fields.each do |associated_model_field|
- list = associated_model_field.virtual? ? 'methods' : 'only'
- %label.checkbox{:for => "schema_include_#{field.name}_#{list}_#{associated_model_field.name}"}
- = check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { :id => "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" }
+ %label.checkbox{for: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}"}
+ = check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { id: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" }
= associated_model_field.label
%fieldset
%legend
%i.icon-chevron-down
- = t('admin.export.options_for', :name => 'csv')
+ = t('admin.export.options_for', name: 'csv')
.control-group
- guessed_encoding = (Rails.configuration.database_configuration[Rails.env]['encoding'].presence rescue 'UTF-8') || 'UTF-8'
- %label.control-label{:for => "csv_options_encoding_to"}= t('admin.export.csv.encoding_to')
+ %label.control-label{for: "csv_options_encoding_to"}= t('admin.export.csv.encoding_to')
.controls
-# from http://books.google.com/support/partner/bin/answer.py?answer=30990 :
= select_tag 'csv_options[encoding_to]', options_for_select(["", "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE", "UTF-7", "ISO-8859-1", "ISO-8859-15", "IBM-850", "MacRoman", "Windows-1252", "ISO-8859-3", "IBM-852", "ISO-8859-2", "MacCE", "Windows-1250", "IBM-855", "ISO-8859-5", "ISO-IR-111", "KOI8-R", "MacCyrillic", "Windows-1251", "CP-866", "KOI-U", "MacUkranian", "GB2312", "GBK", "GB18030", "HZ", "ISO-2022-CN", "Big5", "Big5-HKSCS", "EUC-TW", "EUC-JP", "ISO-2022-JP", "Shift_JIS", "EUC-KR", "UHC", "JOHAB", "ISO-2022-KR"])
- %p.help-block= t('admin.export.csv.encoding_to_help', :name => guessed_encoding)
+ %p.help-block= t('admin.export.csv.encoding_to_help', name: guessed_encoding)
.control-group
- %label.control-label{:for => "csv_options_skip_header"}= t('admin.export.csv.skip_header')
+ %label.control-label{for: "csv_options_skip_header"}= t('admin.export.csv.skip_header')
.controls
= check_box_tag 'csv_options[skip_header]', 'true'
%p.help-block= t('admin.export.csv.skip_header_help')
.control-group
- %label.control-label{:for => "csv_options_generator_col_sep"}= t('admin.export.csv.col_sep')
+ %label.control-label{for: "csv_options_generator_col_sep"}= t('admin.export.csv.col_sep')
.controls
= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" })
- %p.help-block= t('admin.export.csv.col_sep_help', :value => t('admin.export.csv.default_col_sep'))
+ %p.help-block= t('admin.export.csv.col_sep_help', value: t('admin.export.csv.default_col_sep'))
.form-actions
- %input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)}
- %button.btn.btn-primary{:type => "submit", :name => 'csv'}
+ %input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
+ %button.btn.btn-primary{type: "submit", name: 'csv'}
%i.icon-white.icon-ok
- = t("admin.export.confirmation", :name => 'csv')
- %button.btn.btn-info{:type => "submit", :name => 'json'}
- = t("admin.export.confirmation", :name => 'json')
- %button.btn.btn-info{:type => "submit", :name => 'xml'}
- = t("admin.export.confirmation", :name => 'xml')
- %button.btn{:type => "submit", :name => "_continue"}
+ = t("admin.export.confirmation", name: 'csv')
+ %button.btn.btn-info{type: "submit", name: 'json'}
+ = t("admin.export.confirmation", name: 'json')
+ %button.btn.btn-info{type: "submit", name: 'xml'}
+ = t("admin.export.confirmation", name: 'xml')
+ %button.btn{type: "submit", name: "_continue"}
%i.icon-remove
= t("admin.form.cancel")
View
26 app/views/rails_admin/main/history.html.haml
@@ -5,38 +5,38 @@
- sort_reverse = params[:sort_reverse]
- path_method = params[:id] ? "history_show_path" : "history_index_path"
-= form_tag("", :method => "get", :class => "search pjax-form form-inline") do
+= form_tag("", method: "get", class: "search pjax-form form-inline") do
.well
- %input{:name => "query", :type => "search", :value => query, :placeholder => "#{t("admin.misc.filter")}", :class => 'input-small'}
- %button.btn.btn-primary{:type => "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
+ %input{name: "query", type: "search", value: query, placeholder: "#{t("admin.misc.filter")}", class: 'input-small'}
+ %button.btn.btn-primary{type: "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
%i.icon-white.icon-refresh
= t("admin.misc.refresh")
%table#history.table.table-striped.table-condensed
%thead
%tr
- columns = []
- - columns << { :property_name => "created_at", :css_class => "created_at",:link_text => t('admin.table_headers.created_at') }
- - columns << { :property_name => "username", :css_class => "username", :link_text => t('admin.table_headers.username') }
- - columns << { :property_name => "item", :css_class => "item", :link_text => t('admin.table_headers.item') } if @general
- - columns << { :property_name => "message", :css_class => "message", :link_text => t('admin.table_headers.message') }
+ - columns << { property_name: "created_at", css_class: "created_at",link_text: t('admin.table_headers.created_at') }
+ - columns << { property_name: "username", css_class: "username", link_text: t('admin.table_headers.username') }
+ - columns << { property_name: "item", css_class: "item", link_text: t('admin.table_headers.item') } if @general
+ - columns << { property_name: "message", css_class: "message", link_text: t('admin.table_headers.message') }
- columns.each do |column|
- property_name = column[:property_name]
- selected = (sort == property_name)
- sort_direction = (sort_reverse ? "headerSortUp" : "headerSortDown" if selected)
- - sort_location = send(path_method, params.except("sort_reverse").merge(:model_name => @abstract_model.to_param, :sort => property_name).merge(selected && sort_reverse != "true" ? {:sort_reverse => "true"} : {}))
- %th{:class => "header pjax #{column[:css_class]} #{sort_direction if selected}", :'data-href' => sort_location}= column[:link_text]
+ - sort_location = send(path_method, params.except("sort_reverse").merge(model_name: @abstract_model.to_param, sort: property_name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {}))
+ %th{class: "header pjax #{column[:css_class]} #{sort_direction if selected}", :'data-href' => sort_location}= column[:link_text]
%tbody
- @history.each_with_index do |object, index|
%tr
- unless object.created_at.nil?
- %td= l(object.created_at, :format => :long, :default => l(object.created_at, :format => :long, :locale => :en))
+ %td= l(object.created_at, format: :long, default: l(object.created_at, format: :long, locale: :en))
%td= object.username
- if @general
- if o = @abstract_model.get(object.item)
- label = o.send(@abstract_model.config.object_label_method)
- if show_action = action(:show, @abstract_model, o)
- %td= link_to(label, url_for(:action => show_action.action_name, :model_name => @abstract_model.to_param, :id => o.id), :class => 'pjax')
+ %td= link_to(label, url_for(action: show_action.action_name, model_name: @abstract_model.to_param, id: o.id), class: 'pjax')
- else
%td= label
- else
@@ -44,6 +44,6 @@
%td= object.message.in?(['delete', 'new']) ? t("admin.actions.#{object.message}.done").capitalize : object.message
- unless params[:all] || !@history.respond_to?(:current_page)
- = paginate(@history, :theme => 'twitter-bootstrap', :remote => true)
- = link_to(t("admin.misc.show_all"), send(path_method, params.merge(:all => true)), :class => "show-all btn pjax") unless (tc = @history.total_count) <= @history.size || tc > 100
+ = paginate(@history, theme: 'twitter-bootstrap', remote: true)
+ = link_to(t("admin.misc.show_all"), send(path_method, params.merge(all: true)), class: "show-all btn pjax") unless (tc = @history.total_count) <= @history.size || tc > 100
View
54 app/views/rails_admin/main/index.html.haml
@@ -8,10 +8,10 @@
sort = params[:sort]
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
- export_action = RailsAdmin::Config::Actions.find(:export, { :controller => self.controller, :abstract_model => @abstract_model })
+ export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
- properties = @model_config.list.with(:controller => self.controller, :view => self, :object => @abstract_model.model.new).visible_fields
+ properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).visible_fields
# columns paginate
@filterable_fields = @model_config.list.fields.select(&:filterable?)
sets = get_column_sets(properties)
@@ -39,7 +39,7 @@
field = @filterable_fields.find{ |field| field.name == filter_name.to_sym }
field_options = case field.type
when :enum
- options_for_select(field.with(:object => @abstract_model.model.new).enum, filter_hash['v'])
+ options_for_select(field.with(object: @abstract_model.model.new).enum, filter_hash['v'])
else
''
end
@@ -52,26 +52,26 @@
= content_for :contextual_tabs do
= bulk_menu
- if @filterable_fields.present?
- %li.dropdown{:style => 'float:right'}
- %a.dropdown-toggle{:href => '#', :'data-toggle' => "dropdown"}
+ %li.dropdown{style: 'float:right'}
+ %a.dropdown-toggle{href: '#', :'data-toggle' => "dropdown"}
= t('admin.misc.add_filter')
%b.caret
- %ul.dropdown-menu#filters{:style => 'left:auto; right:0;'}
+ %ul.dropdown-menu#filters{style: 'left:auto; right:0;'}
- @filterable_fields.each do |field|
- field_options = case field.type
- when :enum
- - options_for_select(field.with(:object => @abstract_model.model.new).enum)
+ - options_for_select(field.with(object: @abstract_model.model.new).enum)
- else
- ''
%li
- %a{:href => '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => ""}= field.label
+ %a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => ""}= field.label
#list
%script
jQuery(function($) {
$.filters.options.regional = {
datePicker: {
- dateFormat: #{raw I18n.t("admin.misc.filter_date_format", :default => I18n.t("admin.misc.filter_date_format", :locale => :en)).to_json},
+ dateFormat: #{raw I18n.t("admin.misc.filter_date_format", default: I18n.t("admin.misc.filter_date_format", locale: :en)).to_json},
dayNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.day_names.to_json},
dayNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
dayNamesMin: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
@@ -88,60 +88,60 @@
- properties.select{ |p| p.column_width.present? }.each do |property|
= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
= "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
- = form_tag(index_path(params.except(*%w[page f query])), :method => :get, :class => "pjax-form form-inline") do
+ = form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
.well
%span#filters_box
- %hr.filters_box{:style => "display:#{@ordered_filters.empty? ? 'none' : 'block'}"}
- %input.input-small{:name => "query", :type => "search", :value => query, :placeholder => t("admin.misc.filter")}
- %button.btn.btn-primary{:type => "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
+ %hr.filters_box{style: "display:#{@ordered_filters.empty? ? 'none' : 'block'}"}
+ %input.input-small{name: "query", type: "search", value: query, placeholder: t("admin.misc.filter")}
+ %button.btn.btn-primary{type: "submit", :'data-disable-with' => "<i class='icon-white icon-refresh'></i> ".html_safe + t("admin.misc.refresh")}
%i.icon-white.icon-refresh
= t("admin.misc.refresh")
- if export_action
- %span{:style => 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), :class => 'btn btn-info'
+ %span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
- unless @model_config.list.scopes.empty?
%ul.nav.nav-tabs#scope_selector
- @model_config.list.scopes.each_with_index do |scope, index|
- scope = '_all' if scope.nil?
%li{class: "#{'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0)}"}
- %a{href: index_path(params.merge(:scope => scope, :page => nil))}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", :default => I18n.t("admin.scopes.#{scope}", :default => scope.to_s.titleize))
+ %a{href: index_path(params.merge(scope: scope, page: nil))}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
- = form_tag bulk_action_path(:model_name => @abstract_model.to_param), :method => :post, :id => "bulk_form", :class => "form" do
+ = form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: "form" do
= hidden_field_tag :bulk_action
%table.table.table-condensed.table-striped
%thead
%tr
%th.shrink
- %input.toggle{:type => "checkbox"}
+ %input.toggle{type: "checkbox"}
- if other_left
%th.other.left.shrink= "..."
- properties.each do |property|
- selected = (sort == property.name.to_s)
- if property.sortable
- - sort_location = index_path params.except('sort_reverse').except('page').merge(:sort => property.name).merge(selected && sort_reverse != "true" ? {:sort_reverse => "true"} : {})
+ - sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})
- sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected)
- %th{:class => "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), :rel => "tooltip", :title => "#{property.hint}"}= property.label
+ %th{class: "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), rel: "tooltip", title: "#{property.hint}"}= property.label
- if other_right
%th.other.right.shrink= "..."
%th.last.shrink
%tbody
- @objects.each do |object|
- %tr{:class => "#{@abstract_model.param_key}_row"}
+ %tr{class: "#{@abstract_model.param_key}_row"}
%td
= check_box_tag "bulk_ids[]", object.id, false
- - if @other_left_link ||= other_left && index_path(params.except('set').merge(params[:set].to_i != 1 ? {:set => (params[:set].to_i - 1)} : {}))
- %td.other.left= link_to "...", @other_left_link, :class => 'pjax'
+ - if @other_left_link ||= other_left && index_path(params.except('set').merge(params[:set].to_i != 1 ? {set: (params[:set].to_i - 1)} : {}))
+ %td.other.left= link_to "...", @other_left_link, class: 'pjax'
- properties.map{ |property| property.bind(:object, object) }.each do |property|
- value = property.pretty_value
- %td{:class => "#{property.css_class} #{property.type_css_class}", :title => strip_tags(value.to_s)}= value
- - if @other_right_link ||= other_right && index_path(params.merge(:set => (params[:set].to_i + 1)))
- %td.other.right= link_to "...", @other_right_link, :class => 'pjax'
+ %td{class: "#{property.css_class} #{property.type_css_class}", title: strip_tags(value.to_s)}= value
+ - if @other_right_link ||= other_right && index_path(params.merge(set: (params[:set].to_i + 1)))
+ %td.other.right= link_to "...", @other_right_link, class: 'pjax'
%td.last.links
%ul.inline= menu_for :member, @abstract_model, object, true
- if @objects.respond_to?(:total_count)
- total_count = @objects.total_count.to_i
- = paginate(@objects, :theme => 'twitter-bootstrap', :remote => true)
- = link_to(t("admin.misc.show_all"), index_path(params.merge(:all => true)), :class => "show-all btn clearfix pjax") unless total_count > 100 || total_count <= @objects.to_a.size
+ = paginate(@objects, theme: 'twitter-bootstrap', remote: true)
+ = link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn clearfix pjax") unless total_count > 100 || total_count <= @objects.to_a.size
.clearfix.total-count= "#{total_count} #{@model_config.pluralize(total_count).downcase}"
- else
.clearfix.total-count= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}"
View
4 app/views/rails_admin/main/new.html.haml
@@ -1,2 +1,2 @@
-= rails_admin_form_for @object, :url => new_path(:model_name => @abstract_model.to_param), :as => @abstract_model.param_key, :html => { :multipart => true, :class => "form-horizontal denser", :data => { :title => @page_name } } do |form|
- = form.generate :action => :create
+= rails_admin_form_for @object, url: new_path(model_name: @abstract_model.to_param), as: @abstract_model.param_key, html: { multipart: true, class: "form-horizontal denser", data: { title: @page_name } } do |form|
+ = form.generate action: :create
View
6 app/views/rails_admin/main/show.html.haml
@@ -1,5 +1,5 @@
-- @model_config.show.with(:object => @object, :view => self, :controller => self.controller).visible_groups.each do |fieldset|
- - unless (fields = fieldset.with(:object => @object, :view => self, :controller => self.controller).visible_fields).empty?
+- @model_config.show.with(object: @object, view: self, controller: self.controller).visible_groups.each do |fieldset|
+ - unless (fields = fieldset.with(object: @object, view: self, controller: self.controller).visible_fields).empty?
- if !(values = fields.map{ |f| f.value.presence }).compact.empty? || !RailsAdmin::config.compact_show_view
.fieldset
%h4
@@ -10,7 +10,7 @@
- fields.each_with_index do |field, index|
- unless values[index].nil? && RailsAdmin::config.compact_show_view
%dt
- %span.label.label-info{:class => "#{field.type_css_class} #{field.css_class}"}
+ %span.label.label-info{class: "#{field.type_css_class} #{field.css_class}"}
= field.label
%dd.well
= field.pretty_value
View
2  lib/generators/rails_admin/install_generator.rb
@@ -11,7 +11,7 @@ class InstallGenerator < Rails::Generators::Base
def install
namespace = ask_for('Where do you want to mount rails_admin?', 'admin', _namespace)
- route("mount RailsAdmin::Engine => '/#{namespace}', :as => 'rails_admin'")
+ route("mount RailsAdmin:Engine: '/#{namespace}', as: 'rails_admin'")
template 'initializer.erb', 'config/initializers/rails_admin.rb'
end
end
View
6 lib/rails_admin/adapters/active_record.rb
@@ -61,9 +61,9 @@ def properties
end
columns.collect do |property|
{
- :name => property.name.to_sym,
- :pretty_name => property.name.to_s.tr('_', ' ').capitalize,
- :length => property.limit,
+ name: property.name.to_sym,
+ pretty_name: property.name.to_s.tr('_', ' ').capitalize,
+ length: property.limit,
:nullable? => property.null,
:serial? => property.primary,
}.merge(type_lookup(property))
View
10 lib/rails_admin/adapters/mongoid.rb
@@ -68,9 +68,9 @@ def properties
fields = model.fields.reject { |name, field| DISABLED_COLUMN_TYPES.include?(field.type.to_s) }
fields.collect do |name, field|
{
- :name => field.name.to_sym,
- :length => nil,
- :pretty_name => field.name.to_s.gsub('_', ' ').strip.capitalize,
+ name: field.name.to_sym,
+ length: nil,
+ pretty_name: field.name.to_s.gsub('_', ' ').strip.capitalize,
:nullable? => true,
:serial? => false,
}.merge(type_lookup(name, field))
@@ -163,8 +163,8 @@ def type_lookup(name, field)
'BigDecimal' => {type: :decimal},
'Mongoid::Boolean' => {type: :boolean},
'Boolean' => {type: :boolean},
- 'BSON::ObjectId' => {:type => :bson_object_id, :serial? => (name == primary_key)},
- 'Moped::BSON::ObjectId' => {:type => :bson_object_id, :serial? => (name == primary_key)},
+ 'BSON::ObjectId' => {type: :bson_object_id, :serial? => (name == primary_key)},
+ 'Moped::BSON::ObjectId' => {type: :bson_object_id, :serial? => (name == primary_key)},
'Date' => {type: :date},
'DateTime' => {type: :datetime},
'ActiveSupport::TimeWithZone' => {type: :datetime},
View
2  lib/rails_admin/config.rb
@@ -84,7 +84,7 @@ class << self
# @example Custom Warden
# RailsAdmin.config do |config|
# config.authenticate_with do
- # warden.authenticate! :scope => :paranoid
+ # warden.authenticate! scope: :paranoid
# end
# end
#
View
2  lib/rails_admin/config/fields/base.rb
@@ -69,7 +69,7 @@ def virtual?
false
end
- # list of columns I should search for that field [{ :column => 'table_name.column', :type => field.type }, {..}]
+ # list of columns I should search for that field [{ column: 'table_name.column', type: field.type }, {..}]
register_instance_option :searchable_columns do
@searchable_columns ||= case searchable
when true
View
4 spec/dummy_app/app/active_record/carrierwave_uploader.rb
@@ -26,7 +26,7 @@ def store_dir
# end
# Process files as they are uploaded:
- # process :scale => [200, 300]
+ # process scale: [200, 300]
#
# def scale(width, height)
# # do something
@@ -34,7 +34,7 @@ def store_dir
# Create different versions of your uploaded files:
# version :thumb do
- # process :scale => [50, 50]
+ # process scale: [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
View
4 spec/dummy_app/app/mongoid/carrierwave_uploader.rb
@@ -26,7 +26,7 @@ def store_dir
# end
# Process files as they are uploaded:
- # process :scale => [200, 300]
+ # process scale: [200, 300]
#
# def scale(width, height)
# # do something
@@ -34,7 +34,7 @@ def store_dir
# Create different versions of your uploaded files:
# version :thumb do
- # process :scale => [50, 50]
+ # process scale: [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
View
2  spec/dummy_app/app/mongoid/field_test.rb
@@ -36,7 +36,7 @@ class FieldTest
has_many :nested_field_tests, dependent: :destroy, inverse_of: :field_test, autosave: true
accepts_nested_attributes_for :nested_field_tests, allow_destroy: true
- # on creation, comment is not saved without :autosave => true
+ # on creation, comment is not saved without autosave: true
has_one :comment, as: :commentable, autosave: true
accepts_nested_attributes_for :comment, allow_destroy: true
View
20 spec/dummy_app/app/mongoid/user.rb
@@ -25,24 +25,24 @@ class User
field :last_sign_in_ip, type: String
## Encryptable
- # field :password_salt, :type => String
+ # field :password_salt, type: String
## Confirmable
- # field :confirmation_token, :type => String
- # field :confirmed_at, :type => Time
- # field :confirmation_sent_at, :type => Time
- # field :unconfirmed_email, :type => String # Only if using reconfirmable
+ # field :confirmation_token, type: String
+ # field :confirmed_at, type: Time
+ # field :confirmation_sent_at, type: Time
+ # field :unconfirmed_email, type: String # Only if using reconfirmable
## Lockable
- # field :failed_attempts, :type => Integer # Only if lock strategy is :failed_attempts
- # field :unlock_token, :type => String # Only if unlock strategy is :email or :both
- # field :locked_at, :type => Time
+ # field :failed_attempts, type: Integer # Only if lock strategy is :failed_attempts
+ # field :unlock_token, type: String # Only if unlock strategy is :email or :both
+ # field :locked_at, type: Time
# Token authenticatable
- # field :authentication_token, :type => String
+ # field :authentication_token, type: String
## Invitable
- # field :invitation_token, :type => String
+ # field :invitation_token, type: String
include Mongoid::Timestamps
View
2  spec/dummy_app/app/views/layouts/application.html.erb
@@ -2,7 +2,7 @@
<html>
<head>
<title>DummyApp</title>
- <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
View
8 spec/dummy_app/config/initializers/devise.rb
@@ -79,7 +79,7 @@
# :http_auth and :token_auth by adding those symbols to the array below.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
- # passing :skip => :sessions to `devise_for` in your config/routes.rb
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
@@ -133,7 +133,7 @@
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
- # :secure => true in order to force SSL only cookies.
+ # secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
@@ -231,7 +231,7 @@
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
@@ -239,7 +239,7 @@
#
# config.warden do |manager|
# manager.intercept_401 = false
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
View
2  spec/dummy_app/config/routes.rb
@@ -3,7 +3,7 @@
resources :players, only: [:show]
devise_for :users
- mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
+ mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
root to: 'rails_admin/main#dashboard'
# https://github.com/sferik/rails_admin/issues/362
get ':controller(/:action(/:id(.:format)))'
View
2  spec/dummy_app/db/migrate/00000000000006_devise_create_users.rb
@@ -29,7 +29,7 @@ def self.up
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
- # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
+ # t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
View
4 spec/integration/basic/bulk_destroy/rails_admin_basic_bulk_destroy_spec.rb
@@ -15,7 +15,7 @@
# requests via visit) or B) just uses Rack::Test (and doesn't use capybara for browser
# interaction like click_button).
page.driver.browser.reset_host!
- page.driver.browser.process :post, bulk_action_path(:bulk_action => 'bulk_delete', :model_name => 'player', :bulk_ids => @delete_ids, '_method' => 'post')
+ page.driver.browser.process :post, bulk_action_path(bulk_action: 'bulk_delete', model_name: 'player', bulk_ids: @delete_ids, '_method' => 'post')
click_button "Yes, I'm sure"
end
@@ -42,7 +42,7 @@
# requests via visit) or B) just uses Rack::Test (and doesn't use capybara for browser
# interaction like click_button).
page.driver.browser.reset_host!
- page.driver.browser.process :post, bulk_action_path(:bulk_action => 'bulk_delete', :model_name => 'player', :bulk_ids => @delete_ids, '_method' => 'post')
+ page.driver.browser.process :post, bulk_action_path(bulk_action: 'bulk_delete', model_name: 'player', bulk_ids: @delete_ids, '_method' => 'post')
click_button 'Cancel'
end
View
2  spec/integration/basic/export/rails_admin_basic_export_spec.rb
@@ -96,7 +96,7 @@
end
end
- describe 'POST /admin/players/export :format => :csv' do
+ describe 'POST /admin/players/export format: :csv' do
it 'exports with modified schema' do
page.driver.post(export_path(model_name: 'player', schema: @non_default_schema, csv: true, all: true, csv_options: {generator: {col_sep: ','}}))
csv = CSV.parse page.driver.response.body
View
4 spec/rails_admin/adapters/active_record_spec.rb
@@ -163,11 +163,11 @@ class ARComment < ActiveRecord::Base
describe '#properties' do
it 'returns parameters of string-type field' do
- expect(RailsAdmin::AbstractModel.new('Player').properties.select { |f| f[:name] == :name }).to eq([{:name => :name, :pretty_name => 'Name', :type => :string, :length => 100, :nullable? => false, :serial? => false}])
+ expect(RailsAdmin::AbstractModel.new('Player').properties.select { |f| f[:name] == :name }).to eq([{name: :name, pretty_name: 'Name', type: :string, length: 100, :nullable? => false, :serial? => false}])
end
it 'maps serialized attribute to :serialized field type' do
- expect(RailsAdmin::AbstractModel.new('User').properties.detect { |f| f[:name] == :roles }).to eq(:name => :roles, :pretty_name => 'Roles', :length => 255, :nullable? => true, :serial? => false, :type => :serialized)
+ expect(RailsAdmin::AbstractModel.new('User').properties.detect { |f| f[:name] == :roles }).to eq(name: :roles, pretty_name: 'Roles', length: 255, :nullable? => true, :serial? => false, type: :serialized)
end
end
View
168 spec/rails_admin/adapters/mongoid_spec.rb
@@ -289,132 +289,132 @@ class MongoEmbedsChild < MongoEmbedsParent; end
it 'maps Mongoid column types to RA types' do
properties = %w(_id array_field big_decimal_field boolean_field bson_object_id_field bson_binary_field date_field datetime_field time_with_zone_field default_field float_field hash_field integer_field name object_field range_field short_text string_field subject symbol_field text_field time_field title)
expect(@abstract_model.properties.select { |p| properties.include? p[:name].to_s }).to match_array [
- {:name => :_id,
- :pretty_name => 'Id',
+ {name: :_id,
+ pretty_name: 'Id',
:nullable? => true,
:serial? => true,
- :type => :bson_object_id,
- :length => nil},
- {:name => :array_field,
- :pretty_name => 'Array field',
+ type: :bson_object_id,
+ length: nil},
+ {name: :array_field,
+ pretty_name: 'Array field',
:nullable? => true,
:serial? => false,
- :type => :serialized,
- :length => nil},
- {:name => :big_decimal_field,
- :pretty_name => 'Big decimal field',
+ type: :serialized,
+ length: nil},
+ {name: :big_decimal_field,
+ pretty_name: 'Big decimal field',
:nullable? => true,
:serial? => false,
- :type => :decimal,
- :length => nil},
- {:name => :boolean_field,
- :pretty_name => 'Boolean field',
+ type: :decimal,
+ length: nil},
+ {name: :boolean_field,
+ pretty_name: 'Boolean field',
:nullable? => true,
:serial? => false,
- :type => :boolean,
- :length => nil},
- {:name => :bson_object_id_field,
- :pretty_name => 'Bson object id field',
+ type: :boolean,
+ length: nil},
+ {name: :bson_object_id_field,
+ pretty_name: 'Bson object id field',
:nullable? => true,
:serial? => false,
- :type => :bson_object_id,
- :length => nil},
- {:name => :date_field,
- :pretty_name => 'Date field',
+ type: :bson_object_id,
+ length: nil},
+ {name: :date_field,
+ pretty_name: 'Date field',
:nullable? => true,
:serial? => false,
- :type => :date,
- :length => nil},
- {:name => :datetime_field,
- :pretty_name => 'Datetime field',
+ type: :date,
+ length: nil},
+ {name: :datetime_field,
+ pretty_name: 'Datetime field',
:nullable? => true,
:serial? => false,
- :type => :datetime,
- :length => nil},
- {:name => :time_with_zone_field,
- :pretty_name => 'Time with zone field',
+ type: :datetime,
+ length: nil},
+ {name: :time_with_zone_field,
+ pretty_name: 'Time with zone field',
:nullable? => true,
:serial? => false,
- :type => :datetime,
- :length => nil},
- {:name => :default_field,
- :pretty_name => 'Default field',
+ type: :datetime,
+ length: nil},
+ {name: :default_field,
+ pretty_name: 'Default field',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255},
- {:name => :float_field,
- :pretty_name => 'Float field',
+ type: :string,
+ length: 255},
+ {name: :float_field,
+ pretty_name: 'Float field',
:nullable? => true,
:serial? => false,
- :type => :float,
- :length => nil},
- {:name => :hash_field,
- :pretty_name => 'Hash field',
+ type: :float,
+ length: nil},
+ {name: :hash_field,
+ pretty_name: 'Hash field',
:nullable? => true,
:serial? => false,
- :type => :serialized,
- :length => nil},
- {:name => :integer_field,
- :pretty_name => 'Integer field',
+ type: :serialized,
+ length: nil},
+ {name: :integer_field,
+ pretty_name: 'Integer field',
:nullable? => true,
:serial? => false,
- :type => :integer,
- :length => nil},
- {:name => :name,
- :pretty_name => 'Name',
+ type: :integer,
+ length: nil},
+ {name: :name,
+ pretty_name: 'Name',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255},
- {:name => :object_field,
- :pretty_name => 'Object field',
+ type: :string,
+ length: 255},
+ {name: :object_field,
+ pretty_name: 'Object field',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255},
- {:name => :short_text,
- :pretty_name => 'Short text',
+ type: :string,
+ length: 255},
+ {name: :short_text,
+ pretty_name: 'Short text',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255},
- {:name => :string_field,
- :pretty_name => 'String field',
+ type: :string,
+ length: 255},
+ {name: :string_field,
+ pretty_name: 'String field',
:nullable? => true,
:serial? => false,
- :type => :text,
- :length => nil},
- {:name => :subject,
- :pretty_name => 'Subject',
+ type: :text,
+ length: nil},
+ {name: :subject,
+ pretty_name: 'Subject',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255},
- {:name => :symbol_field,
- :pretty_name => 'Symbol field',
+ type: :string,
+ length: 255},
+ {name: :symbol_field,
+ pretty_name: 'Symbol field',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255},
- {:name => :text_field,
- :pretty_name => 'Text field',
+ type: :string,
+ length: 255},
+ {name: :text_field,
+ pretty_name: 'Text field',
:nullable? => true,
:serial? => false,
- :type => :text,
- :length => nil},
- {:name => :time_field,
- :pretty_name => 'Time field',
+ type: :text,
+ length: nil},
+ {name: :time_field,
+ pretty_name: 'Time field',
:nullable? => true,
:serial? => false,
- :type => :datetime,
- :length => nil},
- {:name => :title,
- :pretty_name => 'Title',
+ type: :datetime,
+ length: nil},
+ {name: :title,
+ pretty_name: 'Title',
:nullable? => true,
:serial? => false,
- :type => :string,
- :length => 255}
+ type: :string,
+ length: 255}
]
end
View
2  spec/rails_admin/config/fields/base_spec.rb
@@ -3,7 +3,7 @@
describe RailsAdmin::Config::Fields::Base do
describe '#required' do
- it 'reads the :on => :create/:update validate option' do
+ it 'reads the on: :create/:update validate option' do
RailsAdmin.config Ball do
field 'color'
end
View
6 spec/rails_admin/config_spec.rb
@@ -234,7 +234,7 @@ class Version; end
end
end
- expect(RailsAdmin.config.visible_models(controller: double(:_current_user => double(role: :admin), :authorized? => true)).collect(&:abstract_model).collect(&:model)).to match_array [Fan, Comment]
+ expect(RailsAdmin.config.visible_models(controller: double(_current_user: double(role: :admin), :authorized? => true)).collect(&:abstract_model).collect(&:model)).to match_array [Fan, Comment]
end
it 'hides unallowed models' do
@@ -250,7 +250,7 @@ class Version; end
config.included_models = [FieldTest, Comment, Embed]
end
- expect(RailsAdmin.config.visible_models(controller: double(:_current_user => double(role: :admin), :authorized? => true)).collect(&:abstract_model).collect(&:model)).to match_array [FieldTest, Comment]
+ expect(RailsAdmin.config.visible_models(controller: double(_current_user: double(role: :admin), :authorized? => true)).collect(&:abstract_model).collect(&:model)).to match_array [FieldTest, Comment]
end
it 'basically does not contain embedded model except model using recursively_embeds_many or recursively_embeds_one', mongoid: true do
@@ -265,7 +265,7 @@ class RecursivelyEmbedsMany
RailsAdmin.config do |config|
config.included_models = [FieldTest, Comment, Embed, RecursivelyEmbedsMany, RecursivelyEmbedsOne]
end
- expect(RailsAdmin.config.visible_models(controller: double(:_current_user => double(role: :admin), :authorized? => true)).collect(&:abstract_model).collect(&:model)).to match_array [FieldTest, Comment, RecursivelyEmbedsMany, RecursivelyEmbedsOne]
+ expect(RailsAdmin.config.visible_models(controller: double(_current_user: double(role: :admin), :authorized? => true)).collect(&:abstract_model).collect(&:model)).to match_array [FieldTest, Comment, RecursivelyEmbedsMany, RecursivelyEmbedsOne]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.