ab_admin 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. data/Gemfile +6 -6
  2. data/Guardfile +6 -6
  3. data/README.md +5 -5
  4. data/app/assets/images/admin/Jcrop.gif +0 -0
  5. data/app/assets/javascripts/ab_admin/components/admin_assets.js.coffee +20 -19
  6. data/app/assets/javascripts/ab_admin/components/croppable_image.js.coffee +22 -38
  7. data/app/assets/javascripts/ab_admin/components/gmaps.js.coffee +2 -2
  8. data/app/assets/javascripts/ab_admin/core/ui_utils.js.coffee +6 -2
  9. data/app/assets/stylesheets/ab_admin/components/_base.css.scss +17 -1
  10. data/app/assets/stylesheets/ab_admin/components/_form.css.scss +1 -1
  11. data/app/assets/stylesheets/ab_admin/main.css.scss +1 -0
  12. data/app/controllers/admin/assets_controller.rb +10 -10
  13. data/app/controllers/admin/base_controller.rb +39 -37
  14. data/app/controllers/admin/locators_controller.rb +5 -4
  15. data/app/controllers/admin/manager_controller.rb +11 -10
  16. data/app/controllers/admin/settings_controller.rb +4 -3
  17. data/app/controllers/admin/static_pages_controller.rb +1 -1
  18. data/app/controllers/admin/structures_controller.rb +2 -2
  19. data/app/views/ab_admin/devise/passwords/edit.html.slim +5 -5
  20. data/app/views/ab_admin/devise/passwords/new.html.slim +3 -3
  21. data/app/views/ab_admin/devise/sessions/new.html.slim +5 -5
  22. data/app/views/admin/admin_comments/_comment.html.slim +3 -3
  23. data/app/views/admin/admin_comments/_comments.html.slim +2 -2
  24. data/app/views/admin/admin_comments/_form.html.slim +5 -5
  25. data/app/views/admin/admin_comments/create.js.erb +1 -1
  26. data/app/views/admin/base/_form.html.slim +1 -1
  27. data/app/views/admin/base/_search_layout.html.slim +4 -4
  28. data/app/views/admin/base/_tree.html.slim +1 -1
  29. data/app/views/admin/base/create.js.erb +1 -1
  30. data/app/views/admin/base/index.html.slim +3 -3
  31. data/app/views/admin/base/update.js.erb +1 -1
  32. data/app/views/admin/dashboards/index.html.slim +15 -1
  33. data/app/views/admin/fileupload/_asset.html.slim +1 -1
  34. data/app/views/admin/fileupload/_container.html.slim +2 -2
  35. data/app/views/admin/fileupload/_file.html.slim +1 -1
  36. data/app/views/admin/fileupload/_tmpl.html.slim +1 -1
  37. data/app/views/admin/headers/_form.html.slim +3 -3
  38. data/app/views/admin/locators/edit.html.slim +4 -4
  39. data/app/views/admin/locators/show.html.slim +3 -3
  40. data/app/views/admin/manager/_form.html.slim +2 -1
  41. data/app/views/admin/manager/_table.html.slim +6 -3
  42. data/app/views/admin/settings/_form.html.slim +8 -8
  43. data/app/views/admin/shared/_batch_actions.html.slim +1 -1
  44. data/app/views/admin/static_pages/_form.html.slim +3 -3
  45. data/app/views/admin/structures/_form.html.slim +7 -7
  46. data/app/views/admin/users/_form.html.slim +9 -9
  47. data/app/views/admin/users/_search_form.html.slim +4 -4
  48. data/app/views/admin/users/_table.html.slim +3 -3
  49. data/app/views/layouts/admin/_footer.html.slim +4 -0
  50. data/app/views/layouts/admin/_navigation.html.slim +2 -2
  51. data/app/views/layouts/admin/application.html.slim +3 -3
  52. data/app/views/layouts/admin/devise.html.slim +2 -2
  53. data/config/locales/ru.yml +1 -0
  54. data/config/routes.rb +23 -23
  55. data/db/migrate/20130101000001_create_users.rb +11 -11
  56. data/db/migrate/20130101000003_create_assets.rb +8 -8
  57. data/db/migrate/20130101000004_create_headers.rb +3 -3
  58. data/db/migrate/20130101000005_create_static_pages.rb +2 -2
  59. data/db/migrate/20130101000006_create_structures.rb +8 -8
  60. data/db/migrate/20130101000007_base_translations.rb +3 -3
  61. data/db/migrate/20130101000008_create_admin_comments.rb +3 -3
  62. data/features/dsl/action_items.feature +1 -1
  63. data/features/dsl/admin_comments.feature +2 -2
  64. data/features/dsl/batch_actions.feature +1 -1
  65. data/features/dsl/config.feature +2 -2
  66. data/features/dsl/custom_actions.feature +5 -5
  67. data/features/dsl/form.feature +4 -4
  68. data/features/dsl/in_place_edit.feature +1 -1
  69. data/features/dsl/list_edit.feature +1 -1
  70. data/features/dsl/resource_action_items.feature +1 -1
  71. data/features/dsl/table.feature +3 -3
  72. data/features/dsl/tree.feature +3 -3
  73. data/features/locators.feature +1 -1
  74. data/features/menu.feature +3 -3
  75. data/features/step_definitions/dsl/action_items_steps.rb +3 -3
  76. data/features/step_definitions/dsl/admin_comments_steps.rb +1 -1
  77. data/features/step_definitions/dsl/batch_actions_steps.rb +1 -1
  78. data/features/step_definitions/dsl/parent_resource_steps.rb +2 -2
  79. data/features/step_definitions/dsl/table_steps.rb +3 -3
  80. data/features/step_definitions/dsl/tree_steps.rb +3 -3
  81. data/features/step_definitions/menu_steps.rb +3 -3
  82. data/features/step_definitions/structure_steps.rb +1 -1
  83. data/features/step_definitions/user_steps.rb +7 -7
  84. data/features/step_definitions/web_steps/browsing_steps.rb +2 -2
  85. data/features/step_definitions/web_steps/form_steps.rb +7 -7
  86. data/features/support/selectors.rb +5 -5
  87. data/features/support/tolerance_for_selenium_sync_issues.rb +1 -1
  88. data/lib/ab_admin/abstract_resource.rb +3 -3
  89. data/lib/ab_admin/carrierwave/base_uploader.rb +7 -7
  90. data/lib/ab_admin/carrierwave/file_size_validator.rb +4 -4
  91. data/lib/ab_admin/carrierwave/glue.rb +1 -1
  92. data/lib/ab_admin/concerns/admin_addition.rb +17 -13
  93. data/lib/ab_admin/concerns/headerable.rb +2 -2
  94. data/lib/ab_admin/concerns/nested_set.rb +23 -1
  95. data/lib/ab_admin/concerns/reloadable.rb +56 -0
  96. data/lib/ab_admin/concerns/utilities.rb +3 -3
  97. data/lib/ab_admin/concerns/validations.rb +2 -2
  98. data/lib/ab_admin/config/base.rb +5 -5
  99. data/lib/ab_admin/config/optional_display.rb +4 -4
  100. data/lib/ab_admin/controllers/callbacks.rb +1 -1
  101. data/lib/ab_admin/controllers/can_can_manager_resource.rb +1 -1
  102. data/lib/ab_admin/controllers/head_options.rb +5 -9
  103. data/lib/ab_admin/controllers/tree.rb +2 -2
  104. data/lib/ab_admin/core_ext/other.rb +2 -2
  105. data/lib/ab_admin/core_ext/string.rb +2 -2
  106. data/lib/ab_admin/devise.rb +3 -3
  107. data/lib/ab_admin/engine.rb +1 -1
  108. data/lib/ab_admin/hooks/paginate_hooks.rb +2 -2
  109. data/lib/ab_admin/hooks/simple_form_hooks.rb +2 -2
  110. data/lib/ab_admin/i18n_tools/google_translate.rb +5 -5
  111. data/lib/ab_admin/i18n_tools/model_translator.rb +7 -7
  112. data/lib/ab_admin/i18n_tools/translate_app.rb +1 -1
  113. data/lib/ab_admin/menu_builder.rb +3 -3
  114. data/lib/ab_admin/models/asset.rb +14 -6
  115. data/lib/ab_admin/models/attachment_file.rb +2 -2
  116. data/lib/ab_admin/models/header.rb +1 -1
  117. data/lib/ab_admin/models/locator.rb +3 -3
  118. data/lib/ab_admin/models/structure.rb +8 -8
  119. data/lib/ab_admin/models/type_model.rb +3 -3
  120. data/lib/ab_admin/models/user.rb +7 -7
  121. data/lib/ab_admin/utils/csv_document.rb +2 -2
  122. data/lib/ab_admin/utils/logger.rb +1 -1
  123. data/lib/ab_admin/utils/xls_document.rb +4 -4
  124. data/lib/ab_admin/utils.rb +11 -11
  125. data/lib/ab_admin/version.rb +1 -1
  126. data/lib/ab_admin/views/admin_helpers.rb +13 -13
  127. data/lib/ab_admin/views/admin_navigation_helpers.rb +26 -26
  128. data/lib/ab_admin/views/form_builder.rb +36 -22
  129. data/lib/ab_admin/views/helpers.rb +6 -6
  130. data/lib/ab_admin/views/inputs/ckeditor_input.rb +1 -1
  131. data/lib/ab_admin/views/inputs/color_input.rb +1 -1
  132. data/lib/ab_admin/views/inputs/date_time_input.rb +7 -7
  133. data/lib/ab_admin/views/manager_helpers.rb +3 -3
  134. data/lib/ab_admin/views/search_form_builder.rb +18 -18
  135. data/lib/ab_admin/views/url_for_routes.rb +4 -4
  136. data/lib/ab_admin.rb +1 -2
  137. data/lib/generators/ab_admin/glob/glob_generator.rb +1 -1
  138. data/lib/generators/ab_admin/install/install_generator.rb +2 -2
  139. data/lib/generators/ab_admin/install/templates/config/admin_menu.rb +2 -0
  140. data/lib/generators/ab_admin/install/templates/config/seeds.rb +1 -1
  141. data/lib/generators/ab_admin/install/templates/config/unicorn_config.rb +3 -3
  142. data/lib/generators/ab_admin/install/templates/helpers/admin/structures_helper.rb +2 -2
  143. data/lib/generators/ab_admin/install/templates/models/ability.rb +4 -4
  144. data/lib/generators/ab_admin/install/templates/models/admin_comment.rb +4 -4
  145. data/lib/generators/ab_admin/install/templates/models/asset.rb +2 -1
  146. data/lib/generators/ab_admin/install/templates/models/attachment_file.rb +1 -1
  147. data/lib/generators/ab_admin/install/templates/models/avatar.rb +2 -2
  148. data/lib/generators/ab_admin/install/templates/models/locator.rb +3 -0
  149. data/lib/generators/ab_admin/install/templates/models/picture.rb +2 -2
  150. data/lib/generators/ab_admin/install/templates/models/settings.rb +3 -0
  151. data/lib/generators/ab_admin/install/templates/models/static_page.rb +3 -3
  152. data/lib/generators/ab_admin/install/templates/models/structure.rb +2 -2
  153. data/lib/generators/ab_admin/install/templates/models/user.rb +2 -2
  154. data/lib/generators/ab_admin/install/templates/spec/spec_helper.rb +2 -2
  155. data/lib/generators/ab_admin/install/templates/spec/support/shared_connection.rb +1 -1
  156. data/lib/generators/ab_admin/install/templates/uploaders/avatar_uploader.rb +2 -2
  157. data/lib/generators/ab_admin/install/templates/uploaders/picture_uploader.rb +4 -3
  158. data/lib/generators/ab_admin/model/model_generator.rb +4 -2
  159. data/lib/generators/ab_admin/model/templates/resource.erb +6 -6
  160. data/lib/generators/ab_admin/resource/resource_generator.rb +9 -9
  161. data/lib/generators/ab_admin/resource/templates/_form.haml.erb +10 -14
  162. data/lib/generators/ab_admin/resource/templates/_form.slim.erb +11 -11
  163. data/lib/generators/ab_admin/resource/templates/_search_form.haml.erb +1 -1
  164. data/lib/generators/ab_admin/resource/templates/_search_form.slim.erb +1 -1
  165. data/lib/generators/ab_admin/resource/templates/controller.erb +1 -1
  166. data/lib/generators/template.rb +8 -8
  167. data/lib/tasks/assets.rake +5 -5
  168. data/lib/tasks/cache.rake +1 -1
  169. data/lib/tasks/i18n.rake +1 -1
  170. data/spec/ab_admin_spec.rb +3 -3
  171. data/spec/dummy/app/models/ab_admin/ab_admin_catalogue.rb +1 -1
  172. data/spec/dummy/app/models/ab_admin/ab_admin_collection.rb +6 -6
  173. data/spec/dummy/app/models/ab_admin/ab_admin_product.rb +14 -14
  174. data/spec/dummy/app/models/admin_menu.rb +2 -2
  175. data/spec/dummy/app/models/ckeditor/asset.rb +1 -1
  176. data/spec/dummy/app/models/ckeditor/attachment_file.rb +1 -1
  177. data/spec/dummy/app/models/ckeditor/picture.rb +1 -1
  178. data/spec/dummy/app/models/collection.rb +5 -5
  179. data/spec/dummy/app/models/product.rb +5 -5
  180. data/spec/dummy/app/uploaders/ckeditor_attachment_file_uploader.rb +1 -1
  181. data/spec/dummy/app/uploaders/ckeditor_picture_uploader.rb +3 -3
  182. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  183. data/spec/dummy/config/application.rb +2 -2
  184. data/spec/dummy/config/environments/test.rb +1 -1
  185. data/spec/dummy/config/initializers/ckeditor.rb +2 -2
  186. data/spec/dummy/config/initializers/devise.rb +5 -5
  187. data/spec/dummy/config/initializers/session_store.rb +1 -1
  188. data/spec/dummy/config/initializers/simple_form.rb +8 -8
  189. data/spec/dummy/config/initializers/simple_form_bootstrap.rb +14 -14
  190. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
  191. data/spec/dummy/config/routes.rb +2 -2
  192. data/spec/dummy/db/migrate/20130129151853_create_ckeditor_assets.rb +5 -5
  193. data/spec/dummy/db/migrate/20130130161853_create_collections.rb +2 -2
  194. data/spec/dummy/db/migrate/20130130162046_create_products.rb +2 -2
  195. data/spec/dummy/db/migrate/20130130175446_create_globalize_collection_product.rb +2 -2
  196. data/spec/dummy/db/migrate/20130207224516_create_catalogues.rb +3 -3
  197. data/spec/dummy/db/migrate/20130209223506_add_lat_lon_zoom_to_products.rb +1 -1
  198. data/spec/dummy/db/seeds.rb +5 -5
  199. data/spec/dummy/lib/capybara_irb.rb +10 -10
  200. data/spec/dummy/lib/tasks/cucumber.rake +10 -10
  201. data/spec/dummy/lib/templates/slim/scaffold/_form.html.slim +2 -2
  202. data/spec/factories/assets.rb +9 -9
  203. data/spec/factories/catalogues.rb +1 -1
  204. data/spec/factories/collections.rb +1 -1
  205. data/spec/factories/products.rb +2 -2
  206. data/spec/factories/structures.rb +2 -2
  207. data/spec/generators/ckeditor_assets_generator_spec.rb +1 -1
  208. data/spec/generators/install_generator_spec.rb +1 -1
  209. data/spec/generators/model_generator_spec.rb +2 -2
  210. data/spec/generators/resource_generator_spec.rb +1 -1
  211. data/spec/models/avatar_spec.rb +1 -1
  212. data/spec/models/picture_uploader_spec.rb +1 -1
  213. data/spec/models/structure_spec.rb +2 -2
  214. data/spec/models/user_spec.rb +1 -1
  215. data/spec/spec_helper.rb +3 -3
  216. data/spec/support/shared_connection.rb +1 -1
  217. data/vendor/assets/javascripts/ab_admin/jquery.Jcrop.js +1083 -0
  218. data/vendor/assets/stylesheets/ab_admin/jquery.Jcrop.min.css.scss +28 -0
  219. metadata +8 -6
  220. data/lib/ab_admin/views/inputs/association_input.rb +0 -13
  221. data/lib/ab_admin/views/inputs/tree_select_input.rb +0 -16
@@ -22,7 +22,7 @@ class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
22
22
  # end
23
23
 
24
24
  # Process files as they are uploaded:
25
- # process :scale => [200, 300]
25
+ # process scale: [200, 300]
26
26
  #
27
27
  # def scale(width, height)
28
28
  # # do something
@@ -22,7 +22,7 @@ class CkeditorPictureUploader < CarrierWave::Uploader::Base
22
22
  # end
23
23
 
24
24
  # Process files as they are uploaded:
25
- # process :scale => [200, 300]
25
+ # process scale: [200, 300]
26
26
  #
27
27
  # def scale(width, height)
28
28
  # # do something
@@ -32,11 +32,11 @@ class CkeditorPictureUploader < CarrierWave::Uploader::Base
32
32
 
33
33
  # Create different versions of your uploaded files:
34
34
  version :thumb do
35
- process :resize_to_fill => [118, 100]
35
+ process resize_to_fill: [118, 100]
36
36
  end
37
37
 
38
38
  version :content do
39
- process :resize_to_limit => [800, 800]
39
+ process resize_to_limit: [800, 800]
40
40
  end
41
41
 
42
42
  # Add a white list of extensions which are allowed to be uploaded.
@@ -2,8 +2,8 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
5
+ <%= stylesheet_link_tag 'application', media: 'all' %>
6
+ <%= javascript_include_tag 'application' %>
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
@@ -10,7 +10,7 @@ require 'sprockets/railtie'
10
10
 
11
11
  if defined?(Bundler)
12
12
  # If you precompile assets before deploying to production, use this line
13
- Bundler.require(*Rails.groups(:assets => %w(development test)))
13
+ Bundler.require(*Rails.groups(assets: %w(development test)))
14
14
  # If you want your assets lazily compiled in production, use this line
15
15
  # Bundler.require(:default, :assets, Rails.env)
16
16
  end
@@ -76,7 +76,7 @@ module Dummy
76
76
  dirs = %W(#{base_dir}/controllers/admin #{base_dir}/helpers/admin)
77
77
  config.eager_load_paths += dirs
78
78
 
79
- config.action_mailer.default_url_options = {:host => 'localhost:3000'}
79
+ config.action_mailer.default_url_options = {host: 'localhost:3000'}
80
80
 
81
81
  end
82
82
  end
@@ -9,7 +9,7 @@ Dummy::Application.configure do
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
11
  config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
12
+ config.static_cache_control = 'public, max-age=3600'
13
13
 
14
14
  # Log error messages when you accidentally call methods on nil
15
15
  config.whiny_nils = true
@@ -1,11 +1,11 @@
1
1
  # Use this hook to configure ckeditor
2
- if Object.const_defined?("Ckeditor")
2
+ if Object.const_defined?('Ckeditor')
3
3
  Ckeditor.setup do |config|
4
4
  # ==> ORM configuration
5
5
  # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
6
6
  # :mongoid (bson_ext recommended) by default. Other ORMs may be
7
7
  # available as additional gems.
8
- require "ckeditor/orm/active_record"
8
+ require 'ckeditor/orm/active_record'
9
9
 
10
10
  # Allowed image file types for upload.
11
11
  # Set to nil or [] (empty array) for all file types
@@ -4,7 +4,7 @@ Devise.setup do |config|
4
4
  # ==> Mailer Configuration
5
5
  # Configure the e-mail address which will be shown in Devise::Mailer,
6
6
  # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
- config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
7
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
8
8
 
9
9
  # Configure the class responsible to send e-mails.
10
10
  # config.mailer = "Devise::Mailer"
@@ -69,7 +69,7 @@ Devise.setup do |config|
69
69
  # :http_auth and :token_auth by adding those symbols to the array below.
70
70
  # Notice that if you are skipping storage for all authentication paths, you
71
71
  # may want to disable generating routes to Devise's sessions controller by
72
- # passing :skip => :sessions to `devise_for` in your config/routes.rb
72
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
73
73
  config.skip_session_storage = [:http_auth]
74
74
 
75
75
  # ==> Configuration for :database_authenticatable
@@ -109,7 +109,7 @@ Devise.setup do |config|
109
109
  # config.extend_remember_period = false
110
110
 
111
111
  # Options to be passed to the created cookie. For instance, you can set
112
- # :secure => true in order to force SSL only cookies.
112
+ # secure: true in order to force SSL only cookies.
113
113
  # config.rememberable_options = {}
114
114
 
115
115
  # ==> Configuration for :validatable
@@ -205,7 +205,7 @@ Devise.setup do |config|
205
205
  # ==> OmniAuth
206
206
  # Add a new OmniAuth provider. Check the wiki for more information on setting
207
207
  # up on your models and hooks.
208
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
208
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
209
209
 
210
210
  # ==> Warden configuration
211
211
  # If you want to use other strategies, that are not supported by Devise, or
@@ -213,7 +213,7 @@ Devise.setup do |config|
213
213
  #
214
214
  # config.warden do |manager|
215
215
  # manager.intercept_401 = false
216
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
216
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
217
217
  # end
218
218
 
219
219
  # ==> Mountable engine configurations
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'#, :secret => 'change_me'
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'#, secret: 'change_me'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -5,8 +5,8 @@ SimpleForm.setup do |config|
5
5
  # wrapper, change the order or even add your own to the
6
6
  # stack. The options given below are used to wrap the
7
7
  # whole input.
8
- config.wrappers :default, :class => :input,
9
- :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
8
+ config.wrappers :default, class: :input,
9
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
10
  ## Extensions enabled by default
11
11
  # Any of these extensions can be disabled for a
12
12
  # given input by passing: `f.input EXTENSION_NAME => false`.
@@ -18,7 +18,7 @@ SimpleForm.setup do |config|
18
18
  b.use :html5
19
19
 
20
20
  # Calculates placeholders automatically from I18n
21
- # You can also pass a string as f.input :placeholder => "Placeholder"
21
+ # You can also pass a string as f.input placeholder: "Placeholder"
22
22
  b.use :placeholder
23
23
 
24
24
  ## Optional extensions
@@ -41,8 +41,8 @@ SimpleForm.setup do |config|
41
41
 
42
42
  ## Inputs
43
43
  b.use :label_input
44
- b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
45
- b.use :error, :wrap_with => { :tag => :span, :class => :error }
44
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
45
+ b.use :error, wrap_with: { tag: :span, class: :error }
46
46
  end
47
47
 
48
48
  # The default wrapper to be used by the FormBuilder.
@@ -50,8 +50,8 @@ SimpleForm.setup do |config|
50
50
 
51
51
  # Define the way to render check boxes / radio buttons with labels.
52
52
  # Defaults to :nested for bootstrap config.
53
- # :inline => input + label
54
- # :nested => label > input
53
+ # inline: input + label
54
+ # nested: label > input
55
55
  config.boolean_style = :nested
56
56
 
57
57
  # Default class for buttons
@@ -120,7 +120,7 @@ SimpleForm.setup do |config|
120
120
 
121
121
  # Custom wrappers for input types. This should be a hash containing an input
122
122
  # type as key and the wrapper that will be used for all inputs with specified type.
123
- # config.wrapper_mappings = { :string => :prepend }
123
+ # config.wrapper_mappings = { string: :prepend }
124
124
 
125
125
  # Default priority for time_zone inputs.
126
126
  # config.time_zone_priority = nil
@@ -1,39 +1,39 @@
1
1
  # Use this setup block to configure all options available in SimpleForm.
2
2
  SimpleForm.setup do |config|
3
- config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
3
+ config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
4
4
  b.use :html5
5
5
  b.use :placeholder
6
6
  b.use :label
7
- b.wrapper :tag => 'div', :class => 'controls' do |ba|
7
+ b.wrapper tag: 'div', class: 'controls' do |ba|
8
8
  ba.use :input
9
- ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
10
- ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
9
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
10
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
11
11
  end
12
12
  end
13
13
 
14
- config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
14
+ config.wrappers :prepend, tag: 'div', class: 'control-group', error_class: 'error' do |b|
15
15
  b.use :html5
16
16
  b.use :placeholder
17
17
  b.use :label
18
- b.wrapper :tag => 'div', :class => 'controls' do |input|
19
- input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
18
+ b.wrapper tag: 'div', class: 'controls' do |input|
19
+ input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
20
20
  prepend.use :input
21
21
  end
22
- input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
23
- input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
22
+ input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
23
+ input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
24
24
  end
25
25
  end
26
26
 
27
- config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
27
+ config.wrappers :append, tag: 'div', class: 'control-group', error_class: 'error' do |b|
28
28
  b.use :html5
29
29
  b.use :placeholder
30
30
  b.use :label
31
- b.wrapper :tag => 'div', :class => 'controls' do |input|
32
- input.wrapper :tag => 'div', :class => 'input-append' do |append|
31
+ b.wrapper tag: 'div', class: 'controls' do |input|
32
+ input.wrapper tag: 'div', class: 'input-append' do |append|
33
33
  append.use :input
34
34
  end
35
- input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
36
- input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
35
+ input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
36
+ input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
37
37
  end
38
38
  end
39
39
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters :format => [:json]
8
+ wrap_parameters format: [:json]
9
9
  end
10
10
 
11
11
  # Disable root element in JSON by default.
@@ -1,13 +1,13 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
- root :to => 'welcome#index'
3
+ root to: 'welcome#index'
4
4
 
5
5
  resources :products
6
6
 
7
7
  devise_for :users, ::AbAdmin::Devise.config
8
8
 
9
9
  namespace :admin do
10
- root :to => 'dashboards#index'
10
+ root to: 'dashboards#index'
11
11
  end
12
12
 
13
13
  mount Ckeditor::Engine => '/ckeditor'
@@ -1,13 +1,13 @@
1
1
  class CreateCkeditorAssets < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :ckeditor_assets do |t|
4
- t.string :data_file_name, :null => false
4
+ t.string :data_file_name, null: false
5
5
  t.string :data_content_type
6
6
  t.integer :data_file_size
7
7
 
8
8
  t.integer :assetable_id
9
- t.string :assetable_type, :limit => 30
10
- t.string :type, :limit => 30
9
+ t.string :assetable_type, limit: 30
10
+ t.string :type, limit: 30
11
11
 
12
12
  # Uncomment it to save images dimensions, if your need it
13
13
  t.integer :width
@@ -16,8 +16,8 @@ class CreateCkeditorAssets < ActiveRecord::Migration
16
16
  t.timestamps
17
17
  end
18
18
 
19
- add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
20
- add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
19
+ add_index 'ckeditor_assets', ['assetable_type', 'type', 'assetable_id'], name: 'idx_ckeditor_assetable_type'
20
+ add_index 'ckeditor_assets', ['assetable_type', 'assetable_id'], name: 'idx_ckeditor_assetable'
21
21
  end
22
22
 
23
23
  def self.down
@@ -1,8 +1,8 @@
1
1
  class CreateCollections < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :collections do |t|
4
- t.boolean :is_visible, :default => true, :null => false
5
- t.integer :products_count, :default => 0
4
+ t.boolean :is_visible, default: true, null: false
5
+ t.integer :products_count, default: 0
6
6
 
7
7
  t.timestamps
8
8
  end
@@ -3,8 +3,8 @@ class CreateProducts < ActiveRecord::Migration
3
3
  create_table :products do |t|
4
4
  t.references :collection
5
5
  t.string :sku
6
- t.string :price, :default => 0
7
- t.boolean :is_visible, :default => true, :null => false
6
+ t.string :price, default: 0
7
+ t.boolean :is_visible, default: true, null: false
8
8
 
9
9
  t.timestamps
10
10
  end
@@ -1,7 +1,7 @@
1
1
  class CreateGlobalizeCollectionProduct < ActiveRecord::Migration
2
2
  def up
3
- Collection.create_translation_table! :name => :string, :description => :text
4
- Product.create_translation_table! :name => :string, :description => :text
3
+ Collection.create_translation_table! name: :string, description: :text
4
+ Product.create_translation_table! name: :string, description: :text
5
5
  end
6
6
 
7
7
  def down
@@ -3,9 +3,9 @@ class CreateCatalogues < ActiveRecord::Migration
3
3
  create_table :catalogues do |t|
4
4
  t.string :name
5
5
  t.integer :parent_id
6
- t.integer :lft, :default => 0
7
- t.integer :rgt, :default => 0
8
- t.integer :depth, :default => 0
6
+ t.integer :lft, default: 0
7
+ t.integer :rgt, default: 0
8
+ t.integer :depth, default: 0
9
9
 
10
10
  t.timestamps
11
11
  end
@@ -2,6 +2,6 @@ class AddLatLonZoomToProducts < ActiveRecord::Migration
2
2
  def change
3
3
  add_column :products, :lat, :float
4
4
  add_column :products, :lon, :float
5
- add_column :products, :zoom, :integer, :default => 14
5
+ add_column :products, :zoom, :integer, default: 14
6
6
  end
7
7
  end
@@ -22,7 +22,7 @@ end
22
22
  def insert_structures
23
23
  Structure.truncate!
24
24
 
25
- main_page = Structure.create!({:title => 'Главная страница', :slug => 'main-page', :structure_type => StructureType.main, :parent => nil}, :as => :admin)
25
+ main_page = Structure.create!({title: 'Главная страница', slug: 'main-page', structure_type: StructureType.main, parent: nil}, as: :admin)
26
26
  end
27
27
 
28
28
  insert_user
@@ -32,13 +32,13 @@ Dir[File.join(Rails.root.join('../factories'), '*.rb')].each { |f| load f }
32
32
  def test_structure
33
33
  Structure.truncate!
34
34
 
35
- main_page = Structure.create!({:title => 'Главная страница', :slug => 'main-page', :structure_type => StructureType.main, :parent => nil}, :as => :admin)
35
+ main_page = Structure.create!({title: 'Главная страница', slug: 'main-page', structure_type: StructureType.main, parent: nil}, as: :admin)
36
36
  3.times do |i|
37
- parent = FactoryGirl.create(:structure_page, :title => "node #{i}")
37
+ parent = FactoryGirl.create(:structure_page, title: "node #{i}")
38
38
  2.times do |ii|
39
- child = FactoryGirl.create(:structure_page, :title => "node #{i} - #{ii}", :parent => parent)
39
+ child = FactoryGirl.create(:structure_page, title: "node #{i} - #{ii}", parent: parent)
40
40
  2.times do |iii|
41
- FactoryGirl.create(:structure_page, :title => "node #{i} - #{ii} - #{iii}", :parent => child)
41
+ FactoryGirl.create(:structure_page, title: "node #{i} - #{ii} - #{iii}", parent: child)
42
42
  end
43
43
  end
44
44
  end
@@ -19,24 +19,24 @@ FactoryGirl.find_definitions
19
19
  Dir[File.join(Rails.root.join('../factories'), '*.rb')].each { |f| load f }
20
20
 
21
21
  def login_as_admin
22
- user = {:email => 'test@example.com', :password => '123456'}
22
+ user = {email: 'test@example.com', password: '123456'}
23
23
  @me = User.find_by_email('test@example.com') || FactoryGirl.create(:admin_user, user)
24
24
  visit '/users/sign_in'
25
- fill_in 'Email', :with => user[:email]
26
- fill_in 'Password', :with => user[:password]
25
+ fill_in 'Email', with: user[:email]
26
+ fill_in 'Password', with: user[:password]
27
27
  click_button 'Sign in'
28
28
  #login_as(@me)
29
29
  end
30
30
 
31
31
  def build_structures
32
- [{"title" => "node-1", "parent_name" => ""},
33
- {"title" => "node-1-1", "parent_name" => "node-1"},
34
- {"title" => "node-1-2", "parent_name" => "node-1"},
35
- {"title" => "node-2", "parent_name" => ""},
36
- {"title" => "node-2-1", "parent_name" => "node-2"},
37
- {"title" => "node-2-1-1", "parent_name" => "node-2-1"}].each do |attrs|
32
+ [{'title' => 'node-1', 'parent_name' => ''},
33
+ {'title' => 'node-1-1', 'parent_name' => 'node-1'},
34
+ {'title' => 'node-1-2', 'parent_name' => 'node-1'},
35
+ {'title' => 'node-2', 'parent_name' => ''},
36
+ {'title' => 'node-2-1', 'parent_name' => 'node-2'},
37
+ {'title' => 'node-2-1-1', 'parent_name' => 'node-2-1'}].each do |attrs|
38
38
  parent = Structure.joins(:translations).where("structure_translations.title='#{attrs['parent_name']}'").first
39
- FactoryGirl.create(:structure_page, :title => attrs['title'], :parent => parent)
39
+ FactoryGirl.create(:structure_page, title: attrs['title'], parent: parent)
40
40
  end
41
41
  visit '/admin/structures'
42
42
  end
@@ -14,47 +14,47 @@ begin
14
14
  require 'cucumber/rake/task'
15
15
 
16
16
  namespace :cucumber do
17
- Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
17
+ Cucumber::Rake::Task.new({ok: 'db:test:prepare'}, 'Run features that should pass') do |t|
18
18
  t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
19
  t.fork = true # You may get faster startup if you set this to false
20
20
  t.profile = 'default'
21
21
  end
22
22
 
23
- Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
23
+ Cucumber::Rake::Task.new({wip: 'db:test:prepare'}, 'Run features that are being worked on') do |t|
24
24
  t.binary = vendored_cucumber_bin
25
25
  t.fork = true # You may get faster startup if you set this to false
26
26
  t.profile = 'wip'
27
27
  end
28
28
 
29
- Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
29
+ Cucumber::Rake::Task.new({rerun: 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
30
  t.binary = vendored_cucumber_bin
31
31
  t.fork = true # You may get faster startup if you set this to false
32
32
  t.profile = 'rerun'
33
33
  end
34
34
 
35
35
  desc 'Run all features'
36
- task :all => [:ok, :wip]
36
+ task all: [:ok, :wip]
37
37
 
38
38
  task :statsetup do
39
39
  require 'rails/code_statistics'
40
40
  ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
- ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
41
+ ::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features')
42
42
  end
43
43
  end
44
44
  desc 'Alias for cucumber:ok'
45
- task :cucumber => 'cucumber:ok'
45
+ task cucumber: 'cucumber:ok'
46
46
 
47
- task :default => :cucumber
47
+ task default: :cucumber
48
48
 
49
- task :features => :cucumber do
50
- STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
49
+ task features: :cucumber do
50
+ STDERR.puts '*** The \'features\' task is deprecated. See rake -T cucumber ***'
51
51
  end
52
52
 
53
53
  # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
54
54
  task 'db:test:prepare' do
55
55
  end
56
56
 
57
- task :stats => 'cucumber:statsetup'
57
+ task stats: 'cucumber:statsetup'
58
58
  rescue LoadError
59
59
  desc 'cucumber rake task not available (cucumber not installed)'
60
60
  task :cucumber do
@@ -1,9 +1,9 @@
1
- = simple_form_for(@<%= singular_table_name %>) do |f|
1
+ = simple_form_for(@<' singular_table_name %>) do |f|'
2
2
  = f.error_notification
3
3
 
4
4
  .form-inputs
5
5
  <%- attributes.each do |attribute| -%>
6
- = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
6
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name ''
7
7
  <%- end -%>
8
8
 
9
9
  .form-actions
@@ -1,18 +1,18 @@
1
1
  # encoding: utf-8
2
2
  #FactoryGirl.define do
3
- # factory :asset_avatar, :class => Avatar do |a|
3
+ # factory :asset_avatar, class: Avatar do |a|
4
4
  # #include ActionDispatch::TestProcess
5
5
  # a.data File.open('spec/factories/files/rails.png')
6
- # a.association :assetable, :factory => :default_user
6
+ # a.association :assetable, factory: :default_user
7
7
  #
8
8
  # before(:create) do |instance|
9
9
  # instance.data_content_type ||= 'image/png'
10
10
  # end
11
11
  # end
12
12
  #
13
- # factory :asset_avatar_big, :class => Avatar do |a|
13
+ # factory :asset_avatar_big, class: Avatar do |a|
14
14
  # a.data File.open('spec/factories/files/silicon_valley.jpg')
15
- # a.association :assetable, :factory => :default_user
15
+ # a.association :assetable, factory: :default_user
16
16
  #
17
17
  # before(:create) do |instance|
18
18
  # instance.data_content_type ||= 'image/jpg'
@@ -21,19 +21,19 @@
21
21
  #end
22
22
  # encoding: utf-8
23
23
  FactoryGirl.define do
24
- factory :asset_avatar, :class => Avatar do
24
+ factory :asset_avatar, class: Avatar do
25
25
  #include ActionDispatch::TestProcess
26
26
  data File.open(File.expand_path('../files/rails.png', __FILE__))
27
- association :assetable, :factory => :default_user
27
+ association :assetable, factory: :default_user
28
28
 
29
29
  before(:create) do |instance|
30
30
  instance.data_content_type ||= 'image/png'
31
31
  end
32
32
  end
33
33
 
34
- factory :asset_avatar_big, :class => Avatar do
34
+ factory :asset_avatar_big, class: Avatar do
35
35
  data File.open(File.expand_path('../files/silicon_valley.jpg', __FILE__))
36
- association :assetable, :factory => :default_user
36
+ association :assetable, factory: :default_user
37
37
 
38
38
  before(:create) do |instance|
39
39
  instance.data_content_type ||= 'image/jpg'
@@ -42,7 +42,7 @@ FactoryGirl.define do
42
42
 
43
43
  factory :picture do
44
44
  data File.open(File.expand_path('../files/rails.png', __FILE__))
45
- association :assetable, :factory => :structure
45
+ association :assetable, factory: :structure
46
46
  is_main true
47
47
 
48
48
  before(:create) do |instance|
@@ -2,6 +2,6 @@
2
2
 
3
3
  FactoryGirl.define do
4
4
  factory :catalogue do
5
- name "MyString"
5
+ name 'MyString'
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@
2
2
  FactoryGirl.define do
3
3
  factory :collection do
4
4
  name 'Expensive collection'
5
- description Forgery::LoremIpsum.paragraph :html => true
5
+ description Forgery::LoremIpsum.paragraph html: true
6
6
  is_visible true
7
7
  end
8
8
  end
@@ -4,13 +4,13 @@ FactoryGirl.define do
4
4
  sku 'dc1/234'
5
5
  price 123
6
6
  name 'Table'
7
- description Forgery::LoremIpsum.paragraph :html => true
7
+ description Forgery::LoremIpsum.paragraph html: true
8
8
  is_visible true
9
9
 
10
10
  factory :full_product do
11
11
  association :collection
12
12
  after(:build) do |product|
13
- product.picture = create(:picture, :assetable => product)
13
+ product.picture = create(:picture, assetable: product)
14
14
  end
15
15
  end
16
16
  end
@@ -1,13 +1,13 @@
1
1
  # encoding: utf-8
2
2
  FactoryGirl.define do
3
- factory :structure_page, :class => Structure do
3
+ factory :structure_page, class: Structure do
4
4
  title 'Structure'
5
5
  structure_type StructureType.static_page
6
6
  position_type PositionType.menu
7
7
  is_visible true
8
8
  end
9
9
 
10
- factory :structure_main, :class => Structure do
10
+ factory :structure_main, class: Structure do
11
11
  title 'Main page'
12
12
  slug 'main-page'
13
13
  structure_type StructureType.main
@@ -11,7 +11,7 @@ describe AbAdmin::Generators::CkeditorAssetsGenerator do
11
11
  run_generator
12
12
  end
13
13
 
14
- it 'creates a admin resource', :focus => true, :slow => true do
14
+ it 'creates a admin resource', focus: true, slow: true do
15
15
  assert_directory 'public/javascripts/ckeditor'
16
16
  assert_file 'public/javascripts/ckeditor/init.js', /CKEDITOR/
17
17
  end
@@ -42,7 +42,7 @@ describe AbAdmin::Generators::InstallGenerator do
42
42
  end
43
43
 
44
44
  it 'should add_routes' do
45
- assert_file 'config/routes.rb', /devise_for :users, ::AbAdmin::Devise\.config/, /root :to/
45
+ assert_file 'config/routes.rb', /devise_for :users, ::AbAdmin::Devise\.config/, /root to:/
46
46
  end
47
47
 
48
48
  end