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
@@ -4,8 +4,8 @@ html id="controller_#{controller_name}"
4
4
  meta charset='utf-8'
5
5
  meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'
6
6
  meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"
7
- title= @page_title || 'Simple Admin'
8
- = stylesheet_link_tag 'ab_admin/application', :media => 'all'
7
+ title= @page_title || 'Ab Admin'
8
+ = stylesheet_link_tag 'ab_admin/application', media: 'all'
9
9
  script(src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
10
10
  script(src='//ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js')
11
11
  script(src='//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0.beta6/handlebars.min.js')
@@ -20,7 +20,7 @@ html id="controller_#{controller_name}"
20
20
  #main role="main"
21
21
  .container-fluid
22
22
  #wrap.row-fluid
23
- = render('admin/shared/flash', :flash => flash) if flash
23
+ = render('admin/shared/flash', flash: flash) if flash
24
24
  .wrap_content
25
25
  .clearfix[data-pjax-container=true class=layout_css]= yield
26
26
  - if collection_action? && settings[:search]
@@ -5,11 +5,11 @@ html id="controller_#{controller_name}"
5
5
  meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'
6
6
  meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"
7
7
  title= @page_title || 'Ab Admin'
8
- = stylesheet_link_tag 'ab_admin/devise', :media => 'all'
8
+ = stylesheet_link_tag 'ab_admin/devise', media: 'all'
9
9
  script(src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
10
10
  = javascript_include_tag 'bootstrap'
11
11
  = csrf_meta_tags
12
12
  body.container
13
- = render('admin/shared/flash', :flash => flash) if flash
13
+ = render('admin/shared/flash', flash: flash) if flash
14
14
  = yield
15
15
 
@@ -247,6 +247,7 @@ ru:
247
247
  user_id: "Пользователь"
248
248
  remember_me: "Запомнить"
249
249
  password: "Пароль"
250
+ slug: "Алиас"
250
251
  attrs:
251
252
  en: "анг."
252
253
  it: "итал."
data/config/routes.rb CHANGED
@@ -1,30 +1,30 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  namespace :admin do
4
- root :to => 'dashboards#index'
5
- get 'dashboards', :as => 'dashboards'
4
+ root to: 'dashboards#index'
5
+ get 'dashboards', as: 'dashboards'
6
6
 
7
7
  resources :structures do
8
- post :rebuild, :on => :collection
8
+ post :rebuild, on: :collection
9
9
  resource :static_page
10
10
  end
11
11
 
12
12
  resources :users do
13
- post :batch, :on => :collection
14
- post :activate, :suspend, :send_welcome, :on => :member
13
+ post :batch, on: :collection
14
+ post :activate, :suspend, on: :member
15
15
  end
16
16
 
17
- resources :assets, :only => [:create, :destroy] do
18
- post :rotate, :main, :crop, :on => :member
19
- post :sort, :on => :collection
17
+ resources :assets, only: [:create, :destroy] do
18
+ post :rotate, :main, :crop, on: :member
19
+ post :sort, on: :collection
20
20
  end
21
21
 
22
- resource :settings, :only => [:edit, :update] do
23
- post :cache_clear, :on => :collection
22
+ resource :settings, only: [:edit, :update] do
23
+ post :cache_clear, on: :collection
24
24
  end
25
25
 
26
26
  resource :locators do
27
- post :prepare, :reload, :on => :collection
27
+ post :prepare, :reload, on: :collection
28
28
  end
29
29
 
30
30
  resources :admin_comments
@@ -32,22 +32,22 @@ Rails.application.routes.draw do
32
32
  post 'translate' => AbAdmin::I18nTools::TranslateApp
33
33
 
34
34
  controller 'manager' do
35
- scope '(/:parent_resource/:parent_id)/:model_name' do
36
- get '/new', :to => :new, :as => 'new'
37
- post '/batch', :to => :batch, :as => 'batch'
38
- post '/rebuild', :to => :rebuild, :as => 'rebuild'
39
- match '/custom_action', :to => :custom_action, :as => 'collection_action'
35
+ scope '(/:parent_resource/:parent_resource_id)/:model_name' do
36
+ get '/new', to: :new, as: 'new'
37
+ post '/batch', to: :batch, as: 'batch'
38
+ post '/rebuild', to: :rebuild, as: 'rebuild'
39
+ match '/custom_action', to: :custom_action, as: 'collection_action'
40
40
 
41
41
  scope ':id' do
42
- get '/edit', :to => :edit, :as => 'edit'
43
- match '/custom_action', :to => :custom_action, :as => 'member_action'
44
- get '/', :to => :show, :as => 'show'
45
- put '/', :to => :update, :as => 'update'
46
- delete '/', :to => :destroy, :as => 'destroy'
42
+ get '/edit', to: :edit, as: 'edit'
43
+ match '/custom_action', to: :custom_action, as: 'member_action'
44
+ get '/', to: :show, as: 'show'
45
+ put '/', to: :update, as: 'update'
46
+ delete '/', to: :destroy, as: 'destroy'
47
47
  end
48
48
 
49
- get '/', :to => :index, :as => 'index'
50
- post '/', :to => :create, :as => 'create'
49
+ get '/', to: :index, as: 'index'
50
+ post '/', to: :create, as: 'create'
51
51
  end
52
52
  end
53
53
 
@@ -2,9 +2,9 @@ class CreateUsers < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table(:users) do |t|
4
4
  t.string :login
5
- t.integer :user_role_id, :limit => 1, :default => 1
6
- t.integer :trust_state, :limit => 1, :default => 1
7
- t.integer :gender, :limit => 1, :default => 1
5
+ t.integer :user_role_id, limit: 1, default: 1
6
+ t.integer :trust_state, limit: 1, default: 1
7
+ t.integer :gender, limit: 1, default: 1
8
8
  t.string :first_name
9
9
  t.string :last_name
10
10
  t.string :patronymic
@@ -15,12 +15,12 @@ class CreateUsers < ActiveRecord::Migration
15
15
  t.date :birthday
16
16
 
17
17
  t.string :time_zone
18
- t.string :locale, :limit => 10
19
- t.string :bg_color, :default => 'ffffff'
18
+ t.string :locale, limit: 10
19
+ t.string :bg_color, default: 'ffffff'
20
20
 
21
21
  ## Database authenticatable
22
22
  t.string :email
23
- t.string :encrypted_password, :null => false, :default => ""
23
+ t.string :encrypted_password, null: false, default: ''
24
24
 
25
25
  ## Recoverable
26
26
  t.string :reset_password_token
@@ -30,7 +30,7 @@ class CreateUsers < ActiveRecord::Migration
30
30
  t.datetime :remember_created_at
31
31
 
32
32
  ## Trackable
33
- t.integer :sign_in_count, :default => 0
33
+ t.integer :sign_in_count, default: 0
34
34
  t.datetime :current_sign_in_at
35
35
  t.datetime :last_sign_in_at
36
36
  t.string :current_sign_in_ip
@@ -46,7 +46,7 @@ class CreateUsers < ActiveRecord::Migration
46
46
  t.string :unconfirmed_email # Only if using reconfirmable
47
47
 
48
48
  ## Lockable
49
- t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
49
+ t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
50
50
  t.string :unlock_token # Only if unlock strategy is :email or :both
51
51
  t.datetime :locked_at
52
52
 
@@ -56,9 +56,9 @@ class CreateUsers < ActiveRecord::Migration
56
56
  t.timestamps
57
57
  end
58
58
 
59
- add_index :users, :email, :unique => true
60
- add_index :users, :reset_password_token, :unique => true
61
- add_index :users, :confirmation_token, :unique => true
59
+ add_index :users, :email, unique: true
60
+ add_index :users, :reset_password_token, unique: true
61
+ add_index :users, :confirmation_token, unique: true
62
62
  end
63
63
 
64
64
  def self.down
@@ -1,23 +1,23 @@
1
1
  class CreateAssets < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :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
- t.integer :assetable_id, :null => false
9
- t.string :assetable_type, :limit => 30, :null => false
10
- t.string :type, :limit => 30
11
- t.string :guid, :limit => 10
8
+ t.integer :assetable_id, null: false
9
+ t.string :assetable_type, limit: 30, null: false
10
+ t.string :type, limit: 30
11
+ t.string :guid, limit: 10
12
12
 
13
- t.integer :locale, :limit => 1, :default => 0
13
+ t.integer :locale, limit: 1, default: 0
14
14
  t.integer :user_id
15
- t.integer :sort_order, :default => 0
15
+ t.integer :sort_order, default: 0
16
16
 
17
17
  t.integer :width
18
18
  t.integer :height
19
19
 
20
- t.boolean :is_main, :default => false, :null => false
20
+ t.boolean :is_main, default: false, null: false
21
21
  t.string :original_name
22
22
 
23
23
  t.timestamps
@@ -1,13 +1,13 @@
1
1
  class CreateHeaders < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :headers do |t|
4
- t.string :headerable_type, :limit => 30, :null => false
5
- t.integer :headerable_id, :null => false
4
+ t.string :headerable_type, limit: 30, null: false
5
+ t.integer :headerable_id, null: false
6
6
 
7
7
  t.timestamps
8
8
  end
9
9
 
10
- add_index :headers, [:headerable_type, :headerable_id], :unique => true
10
+ add_index :headers, [:headerable_type, :headerable_id], unique: true
11
11
  end
12
12
 
13
13
  def self.down
@@ -1,9 +1,9 @@
1
1
  class CreateStaticPages < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :static_pages do |t|
4
- t.integer :structure_id, :null => false
4
+ t.integer :structure_id, null: false
5
5
  t.references :user
6
- t.boolean :is_visible, :default => true, :null => false
6
+ t.boolean :is_visible, default: true, null: false
7
7
 
8
8
  t.timestamps
9
9
  end
@@ -1,22 +1,22 @@
1
1
  class CreateStructures < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :structures do |t|
4
- t.string :slug, :null => false
5
- t.integer :kind, :limit => 1, :default => 1
6
- t.integer :position, :limit => 2, :default => 1
4
+ t.string :slug, null: false
5
+ t.integer :kind, limit: 1, default: 1
6
+ t.integer :position, limit: 2, default: 1
7
7
  t.references :user
8
- t.boolean :is_visible, :default => true, :null => false
8
+ t.boolean :is_visible, default: true, null: false
9
9
 
10
10
  t.integer :parent_id
11
- t.integer :lft, :default => 0
12
- t.integer :rgt, :default => 0
13
- t.integer :depth, :default => 0
11
+ t.integer :lft, default: 0
12
+ t.integer :rgt, default: 0
13
+ t.integer :depth, default: 0
14
14
 
15
15
  t.timestamps
16
16
  end
17
17
 
18
18
  add_index :structures, :user_id
19
- add_index :structures, [:slug, :kind], :unique => true
19
+ add_index :structures, [:slug, :kind], unique: true
20
20
  add_index :structures, :parent_id
21
21
  add_index :structures, [:lft, :rgt]
22
22
  end
@@ -1,8 +1,8 @@
1
1
  class BaseTranslations < ActiveRecord::Migration
2
2
  def self.up
3
- StaticPage.create_translation_table! :title => :string, :content => :text
4
- Header.create_translation_table! :title => :string, :keywords => :string, :description => :text
5
- Structure.create_translation_table! :title => :string, :redirect_url => :string
3
+ StaticPage.create_translation_table! title: :string, content: :text
4
+ Header.create_translation_table! title: :string, keywords: :string, description: :text
5
+ Structure.create_translation_table! title: :string, redirect_url: :string
6
6
  end
7
7
 
8
8
  def self.down
@@ -2,10 +2,10 @@ class CreateAdminComments < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :admin_comments do |t|
4
4
  t.integer :user_id
5
- t.integer :author_id, :null => false
5
+ t.integer :author_id, null: false
6
6
  t.string :author_name
7
- t.integer :resource_id, :null => false
8
- t.string :resource_type, :limit => 30, :null => false
7
+ t.integer :resource_id, null: false
8
+ t.string :resource_type, limit: 30, null: false
9
9
  t.text :body
10
10
 
11
11
  t.timestamps
@@ -54,7 +54,7 @@ Feature: Actions items
54
54
  Given a configuration of:
55
55
  """
56
56
  class AbAdminProduct < AbAdmin::AbstractResource
57
- action_item :except => :edit, :if => proc { params[:id].present? } do
57
+ action_item except: :edit, if: proc { params[:id].present? } do
58
58
  link_to 'Secret link', '/'
59
59
  end
60
60
  end
@@ -9,7 +9,7 @@ Feature: Admin comments
9
9
  Given a configuration of:
10
10
  """
11
11
  class AbAdminProduct < AbAdmin::AbstractResource
12
- settings :comments => true
12
+ settings comments: true
13
13
  end
14
14
  """
15
15
  And I am on the edit admin product page
@@ -21,7 +21,7 @@ Feature: Admin comments
21
21
  Given a configuration of:
22
22
  """
23
23
  class AbAdminProduct < AbAdmin::AbstractResource
24
- settings :comments => true
24
+ settings comments: true
25
25
  end
26
26
  """
27
27
  And comment "Hello" exists
@@ -57,7 +57,7 @@ Feature: Batch actions
57
57
  Given a configuration of:
58
58
  """
59
59
  class AbAdminProduct < AbAdmin::AbstractResource
60
- batch_action :un_publish!, :title => 'Deativate', :confirm => 'Un Publish?'
60
+ batch_action :un_publish!, title: 'Deativate', confirm: 'Un Publish?'
61
61
  end
62
62
  """
63
63
  And I am on the admin products page
@@ -40,5 +40,5 @@ Feature: Configuring resource options
40
40
  Examples:
41
41
  | config |
42
42
  | :index |
43
- | :except => :new |
44
- | :except => [:new] |
43
+ | except: :new |
44
+ | except: [:new] |
@@ -10,10 +10,10 @@ Feature: Custom actions
10
10
  """
11
11
  class AbAdminProduct < AbAdmin::AbstractResource
12
12
  action_item do
13
- link_to 'Custom action', action_item_admin_path(:custom), :method => :post
13
+ link_to 'Custom action', action_item_admin_path(:custom), method: :post
14
14
  end
15
15
 
16
- member_action :custom, :method => :post do
16
+ member_action :custom, method: :post do
17
17
  flash[:notice] = 'Custom action done!'
18
18
  redirect_to resource_path
19
19
  end
@@ -32,7 +32,7 @@ Feature: Custom actions
32
32
  link_to 'Custom action', action_item_admin_path(:custom)
33
33
  end
34
34
 
35
- member_action :custom, :method => :post do
35
+ member_action :custom, method: :post do
36
36
  flash[:notice] = 'Custom action done!'
37
37
  redirect_to resource_path
38
38
  end
@@ -46,10 +46,10 @@ Feature: Custom actions
46
46
  """
47
47
  class AbAdminProduct < AbAdmin::AbstractResource
48
48
  action_item do
49
- link_to 'Custom collection action', action_item_admin_path(:custom_collection), :method => :post
49
+ link_to 'Custom collection action', action_item_admin_path(:custom_collection), method: :post
50
50
  end
51
51
 
52
- collection_action :custom_collection, :method => :post do
52
+ collection_action :custom_collection, method: :post do
53
53
  flash[:notice] = 'Custom collection action done!'
54
54
  redirect_to collection_path
55
55
  end
@@ -14,7 +14,7 @@ Feature: Form
14
14
  field :price
15
15
  end
16
16
  field :is_visible
17
- field :collection, :as => :association
17
+ field :collection, as: :association
18
18
  locale_tabs do
19
19
  field :name
20
20
  field :description
@@ -43,7 +43,7 @@ Feature: Form
43
43
  """
44
44
  = admin_form_for @product do |f|
45
45
  = input_set 'My custom fields' do
46
- = f.input :sku, :label => 'Identifier'
46
+ = f.input :sku, label: 'Identifier'
47
47
 
48
48
  = f.save_buttons
49
49
  """
@@ -57,14 +57,14 @@ Feature: Form
57
57
  Given a configuration of:
58
58
  """
59
59
  class AbAdminProduct < AbAdmin::AbstractResource
60
- form :partial => 'admin/products/form_custom'
60
+ form partial: 'admin/products/form_custom'
61
61
  end
62
62
  """
63
63
  And "app/views/admin/products/_form_custom.html.slim" contains:
64
64
  """
65
65
  = admin_form_for @product do |f|
66
66
  = input_set 'My custom fields' do
67
- = f.input :sku, :label => 'Identifier'
67
+ = f.input :sku, label: 'Identifier'
68
68
 
69
69
  = f.save_buttons
70
70
  """
@@ -8,7 +8,7 @@ Feature: In place edit
8
8
  """
9
9
  class AbAdminProduct < AbAdmin::AbstractResource
10
10
  table do
11
- field :sku, :editable => true
11
+ field :sku, editable: true
12
12
  field :name
13
13
  field :created_at
14
14
  end
@@ -7,7 +7,7 @@ Feature: Editing records in the list
7
7
  And a configuration of:
8
8
  """
9
9
  class AbAdminProduct < AbAdmin::AbstractResource
10
- settings :list_edit => true
10
+ settings list_edit: true
11
11
  end
12
12
  """
13
13
  And I am on the admin products page
@@ -32,7 +32,7 @@ Feature: Resource action items
32
32
  """
33
33
  class AbAdminProduct < AbAdmin::AbstractResource
34
34
  resource_action_item do
35
- link_to icon('arrow-down'), '/', :title => 'Custom'
35
+ link_to icon('arrow-down'), '/', title: 'Custom'
36
36
  end
37
37
  end
38
38
  """
@@ -55,15 +55,15 @@ Feature: Table index view
55
55
  Examples:
56
56
  | column | config | ordering |
57
57
  | Sku | :sku | sku |
58
- | Name | :name, :sortable => :id | id |
59
- | Name | :name, :sortable => {:column => :price, :default_order => 'desc'} | price desc |
58
+ | Name | :name, sortable: :id | id |
59
+ | Name | :name, sortable: {column: :price, default_order: 'desc'} | price desc |
60
60
 
61
61
  Scenario: Disabled sortable column
62
62
  Given a configuration of:
63
63
  """
64
64
  class AbAdminProduct < AbAdmin::AbstractResource
65
65
  table do
66
- field :created_at, :sortable => false
66
+ field :created_at, sortable: false
67
67
  end
68
68
  end
69
69
  """
@@ -16,7 +16,7 @@ Feature: Sortable tree index view
16
16
  Given a configuration of:
17
17
  """
18
18
  class AbAdminCatalogue < AbAdmin::AbstractResource
19
- settings :index_view => 'tree'
19
+ settings index_view: 'tree'
20
20
  end
21
21
  """
22
22
  And I am on the admin catalogues page
@@ -26,10 +26,10 @@ Feature: Sortable tree index view
26
26
  Given a configuration of:
27
27
  """
28
28
  class AbAdminCatalogue < AbAdmin::AbstractResource
29
- settings :index_view => 'tree'
29
+ settings index_view: 'tree'
30
30
 
31
31
  tree do |node|
32
- link_to "Custom node title", root_path, :class => 'tree-item_link'
32
+ link_to "Custom node title", root_path, class: 'tree-item_link'
33
33
  end
34
34
  end
35
35
  """
@@ -16,7 +16,7 @@ Feature: Locale files editor
16
16
 
17
17
  Scenario: Locale file editing
18
18
  Then I follow "en.test.yml"
19
- And I fill in "locale_site_title" with "Great app"
19
+ And I fill in "locale_hash_site_title" with "Great app"
20
20
  And press "Save"
21
21
  When "config/locales/en.test.yml" should contain:
22
22
  """
@@ -12,12 +12,12 @@ Feature: Admin menu
12
12
  model User
13
13
  group :system do
14
14
  model Structure
15
- model Settings, :url => edit_admin_settings_path
15
+ model Settings, url: edit_admin_settings_path
16
16
  end
17
- group 'Moderator', :if => proc { moderator? } do
17
+ group 'Moderator', if: proc { moderator? } do
18
18
  link 'for moderator', 'dummy_path'
19
19
  end
20
- group 'Admin', :if => :admin? do
20
+ group 'Admin', if: :admin? do
21
21
  link :for_admin, 'dummy_path'
22
22
  end
23
23
  end
@@ -1,13 +1,13 @@
1
1
  Then /^I should see an action item to "([^"]*)"$/ do |link|
2
- page.should have_css('.resource_actions a', :text => link)
2
+ page.should have_css('.resource_actions a', text: link)
3
3
  end
4
4
 
5
5
  Then /^I should not see an action item to "([^"]*)"$/ do |link|
6
- page.should_not have_css('.resource_actions a', :text => link)
6
+ page.should_not have_css('.resource_actions a', text: link)
7
7
  end
8
8
 
9
9
  Then /^I should see action items:$/ do |table|
10
10
  table.raw.first.each do |link|
11
- page.should have_css('.resource_actions a', :text => link)
11
+ page.should have_css('.resource_actions a', text: link)
12
12
  end
13
13
  end
@@ -6,7 +6,7 @@ Then /^I should see "(.*?)" comment with author$/ do |comment|
6
6
  end
7
7
 
8
8
  Given /^comment "(.*?)" exists$/ do |comment|
9
- AdminComment.create(:resource_id => @product.id, :resource_type => 'Product', :body => comment) do |c|
9
+ AdminComment.create(resource_id: @product.id, resource_type: 'Product', body: comment) do |c|
10
10
  c.author = @me
11
11
  end
12
12
  end
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  When /^I choose batch action "(.*?)"$/ do |action|
16
16
  find('.batch_actions .dropdown-toggle').click
17
- find('.dropdown-menu a', :text => action).click
17
+ find('.dropdown-menu a', text: action).click
18
18
  end
19
19
 
20
20
  Then /^I should see (\d+) item in the list$/ do |n|
@@ -1,6 +1,6 @@
1
1
  Given /^collection "(.*?)" with (\d+) products$/ do |collection, num|
2
- @collection = FactoryGirl.create(:collection, :name => collection)
3
- num.times { FactoryGirl.create(:product, :collection => @collection) }
2
+ @collection = FactoryGirl.create(:collection, name: collection)
3
+ num.times { FactoryGirl.create(:product, collection: @collection) }
4
4
  end
5
5
 
6
6
  Then /^I should see (\d+) products$/ do |num|
@@ -1,5 +1,5 @@
1
1
  Given /^a product with sku "(.*?)"$/ do |sku|
2
- @product = FactoryGirl.create(:product, :sku => sku)
2
+ @product = FactoryGirl.create(:product, sku: sku)
3
3
  end
4
4
 
5
5
  Given /^products? exists with attributes:$/ do |products|
@@ -26,8 +26,8 @@ Then /^I should see pretty formatted products$/ do
26
26
  within '#list' do
27
27
  page.should have_content(product.sku)
28
28
  page.should have_content(product.price)
29
- page.should have_content(I18n.l(product.created_at, :format => :long))
30
- page.should have_css('span.badge', :text => '+')
29
+ page.should have_content(I18n.l(product.created_at, format: :long))
30
+ page.should have_css('span.badge', text: '+')
31
31
  page.should have_link(product.collection.name)
32
32
  page.should have_css("img[src='#{product.picture.url(:thumb)}']")
33
33
  end
@@ -1,8 +1,8 @@
1
1
  Given /^catalogues tree exists:$/ do |table|
2
2
  @tree = table.hashes
3
3
  @tree.each do |attrs|
4
- parent = Catalogue.where(:name => attrs['parent_name']).first
5
- FactoryGirl.create(:catalogue, :name => attrs['title'], :parent => parent)
4
+ parent = Catalogue.where(name: attrs['parent_name']).first
5
+ FactoryGirl.create(:catalogue, name: attrs['title'], parent: parent)
6
6
  end
7
7
  end
8
8
 
@@ -11,7 +11,7 @@ Then /^I should see \w+ tree$/ do
11
11
  @tree.each do |attrs|
12
12
  page.should have_link(attrs['title'])
13
13
  if attrs['parent_name'].present?
14
- find_link(attrs['title']).first(:xpath, './/../../../../div/a', :text => attrs['parent_name']).should_not be_nil
14
+ find_link(attrs['title']).first(:xpath, './/../../../../div/a', text: attrs['parent_name']).should_not be_nil
15
15
  end
16
16
  end
17
17
  end
@@ -3,11 +3,11 @@ Given /^a menu configuration of:$/ do |config|
3
3
  end
4
4
 
5
5
  Then /^I should see menu item for "(.*?)" with path "(.*?)"$/ do |name, path|
6
- page.should have_css("header.navbar li a[href='#{path}']", :text => name)
6
+ page.should have_css("header.navbar li a[href='#{path}']", text: name)
7
7
  end
8
8
 
9
9
  Then /^I should see group "(.*?)" with menu item for "(.*?)"$/ do |group, name|
10
- page.should have_css('header.navbar li.dropdown a', :text => group)
11
- page.should have_css('header.navbar ul.dropdown-menu a', :text => name)
10
+ page.should have_css('header.navbar li.dropdown a', text: group)
11
+ page.should have_css('header.navbar ul.dropdown-menu a', text: name)
12
12
  end
13
13
 
@@ -2,6 +2,6 @@ Given /^structures tree exists:$/ do |table|
2
2
  @tree = table.hashes
3
3
  @tree.each do |attrs|
4
4
  parent = Structure.joins(:translations).where("structure_translations.title='#{attrs['parent_name']}'").first
5
- FactoryGirl.create(:structure_page, :title => attrs['title'], :parent => parent)
5
+ FactoryGirl.create(:structure_page, title: attrs['title'], parent: parent)
6
6
  end
7
7
  end