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.
- data/Gemfile +6 -6
- data/Guardfile +6 -6
- data/README.md +5 -5
- data/app/assets/images/admin/Jcrop.gif +0 -0
- data/app/assets/javascripts/ab_admin/components/admin_assets.js.coffee +20 -19
- data/app/assets/javascripts/ab_admin/components/croppable_image.js.coffee +22 -38
- data/app/assets/javascripts/ab_admin/components/gmaps.js.coffee +2 -2
- data/app/assets/javascripts/ab_admin/core/ui_utils.js.coffee +6 -2
- data/app/assets/stylesheets/ab_admin/components/_base.css.scss +17 -1
- data/app/assets/stylesheets/ab_admin/components/_form.css.scss +1 -1
- data/app/assets/stylesheets/ab_admin/main.css.scss +1 -0
- data/app/controllers/admin/assets_controller.rb +10 -10
- data/app/controllers/admin/base_controller.rb +39 -37
- data/app/controllers/admin/locators_controller.rb +5 -4
- data/app/controllers/admin/manager_controller.rb +11 -10
- data/app/controllers/admin/settings_controller.rb +4 -3
- data/app/controllers/admin/static_pages_controller.rb +1 -1
- data/app/controllers/admin/structures_controller.rb +2 -2
- data/app/views/ab_admin/devise/passwords/edit.html.slim +5 -5
- data/app/views/ab_admin/devise/passwords/new.html.slim +3 -3
- data/app/views/ab_admin/devise/sessions/new.html.slim +5 -5
- data/app/views/admin/admin_comments/_comment.html.slim +3 -3
- data/app/views/admin/admin_comments/_comments.html.slim +2 -2
- data/app/views/admin/admin_comments/_form.html.slim +5 -5
- data/app/views/admin/admin_comments/create.js.erb +1 -1
- data/app/views/admin/base/_form.html.slim +1 -1
- data/app/views/admin/base/_search_layout.html.slim +4 -4
- data/app/views/admin/base/_tree.html.slim +1 -1
- data/app/views/admin/base/create.js.erb +1 -1
- data/app/views/admin/base/index.html.slim +3 -3
- data/app/views/admin/base/update.js.erb +1 -1
- data/app/views/admin/dashboards/index.html.slim +15 -1
- data/app/views/admin/fileupload/_asset.html.slim +1 -1
- data/app/views/admin/fileupload/_container.html.slim +2 -2
- data/app/views/admin/fileupload/_file.html.slim +1 -1
- data/app/views/admin/fileupload/_tmpl.html.slim +1 -1
- data/app/views/admin/headers/_form.html.slim +3 -3
- data/app/views/admin/locators/edit.html.slim +4 -4
- data/app/views/admin/locators/show.html.slim +3 -3
- data/app/views/admin/manager/_form.html.slim +2 -1
- data/app/views/admin/manager/_table.html.slim +6 -3
- data/app/views/admin/settings/_form.html.slim +8 -8
- data/app/views/admin/shared/_batch_actions.html.slim +1 -1
- data/app/views/admin/static_pages/_form.html.slim +3 -3
- data/app/views/admin/structures/_form.html.slim +7 -7
- data/app/views/admin/users/_form.html.slim +9 -9
- data/app/views/admin/users/_search_form.html.slim +4 -4
- data/app/views/admin/users/_table.html.slim +3 -3
- data/app/views/layouts/admin/_footer.html.slim +4 -0
- data/app/views/layouts/admin/_navigation.html.slim +2 -2
- data/app/views/layouts/admin/application.html.slim +3 -3
- data/app/views/layouts/admin/devise.html.slim +2 -2
- data/config/locales/ru.yml +1 -0
- data/config/routes.rb +23 -23
- data/db/migrate/20130101000001_create_users.rb +11 -11
- data/db/migrate/20130101000003_create_assets.rb +8 -8
- data/db/migrate/20130101000004_create_headers.rb +3 -3
- data/db/migrate/20130101000005_create_static_pages.rb +2 -2
- data/db/migrate/20130101000006_create_structures.rb +8 -8
- data/db/migrate/20130101000007_base_translations.rb +3 -3
- data/db/migrate/20130101000008_create_admin_comments.rb +3 -3
- data/features/dsl/action_items.feature +1 -1
- data/features/dsl/admin_comments.feature +2 -2
- data/features/dsl/batch_actions.feature +1 -1
- data/features/dsl/config.feature +2 -2
- data/features/dsl/custom_actions.feature +5 -5
- data/features/dsl/form.feature +4 -4
- data/features/dsl/in_place_edit.feature +1 -1
- data/features/dsl/list_edit.feature +1 -1
- data/features/dsl/resource_action_items.feature +1 -1
- data/features/dsl/table.feature +3 -3
- data/features/dsl/tree.feature +3 -3
- data/features/locators.feature +1 -1
- data/features/menu.feature +3 -3
- data/features/step_definitions/dsl/action_items_steps.rb +3 -3
- data/features/step_definitions/dsl/admin_comments_steps.rb +1 -1
- data/features/step_definitions/dsl/batch_actions_steps.rb +1 -1
- data/features/step_definitions/dsl/parent_resource_steps.rb +2 -2
- data/features/step_definitions/dsl/table_steps.rb +3 -3
- data/features/step_definitions/dsl/tree_steps.rb +3 -3
- data/features/step_definitions/menu_steps.rb +3 -3
- data/features/step_definitions/structure_steps.rb +1 -1
- data/features/step_definitions/user_steps.rb +7 -7
- data/features/step_definitions/web_steps/browsing_steps.rb +2 -2
- data/features/step_definitions/web_steps/form_steps.rb +7 -7
- data/features/support/selectors.rb +5 -5
- data/features/support/tolerance_for_selenium_sync_issues.rb +1 -1
- data/lib/ab_admin/abstract_resource.rb +3 -3
- data/lib/ab_admin/carrierwave/base_uploader.rb +7 -7
- data/lib/ab_admin/carrierwave/file_size_validator.rb +4 -4
- data/lib/ab_admin/carrierwave/glue.rb +1 -1
- data/lib/ab_admin/concerns/admin_addition.rb +17 -13
- data/lib/ab_admin/concerns/headerable.rb +2 -2
- data/lib/ab_admin/concerns/nested_set.rb +23 -1
- data/lib/ab_admin/concerns/reloadable.rb +56 -0
- data/lib/ab_admin/concerns/utilities.rb +3 -3
- data/lib/ab_admin/concerns/validations.rb +2 -2
- data/lib/ab_admin/config/base.rb +5 -5
- data/lib/ab_admin/config/optional_display.rb +4 -4
- data/lib/ab_admin/controllers/callbacks.rb +1 -1
- data/lib/ab_admin/controllers/can_can_manager_resource.rb +1 -1
- data/lib/ab_admin/controllers/head_options.rb +5 -9
- data/lib/ab_admin/controllers/tree.rb +2 -2
- data/lib/ab_admin/core_ext/other.rb +2 -2
- data/lib/ab_admin/core_ext/string.rb +2 -2
- data/lib/ab_admin/devise.rb +3 -3
- data/lib/ab_admin/engine.rb +1 -1
- data/lib/ab_admin/hooks/paginate_hooks.rb +2 -2
- data/lib/ab_admin/hooks/simple_form_hooks.rb +2 -2
- data/lib/ab_admin/i18n_tools/google_translate.rb +5 -5
- data/lib/ab_admin/i18n_tools/model_translator.rb +7 -7
- data/lib/ab_admin/i18n_tools/translate_app.rb +1 -1
- data/lib/ab_admin/menu_builder.rb +3 -3
- data/lib/ab_admin/models/asset.rb +14 -6
- data/lib/ab_admin/models/attachment_file.rb +2 -2
- data/lib/ab_admin/models/header.rb +1 -1
- data/lib/ab_admin/models/locator.rb +3 -3
- data/lib/ab_admin/models/structure.rb +8 -8
- data/lib/ab_admin/models/type_model.rb +3 -3
- data/lib/ab_admin/models/user.rb +7 -7
- data/lib/ab_admin/utils/csv_document.rb +2 -2
- data/lib/ab_admin/utils/logger.rb +1 -1
- data/lib/ab_admin/utils/xls_document.rb +4 -4
- data/lib/ab_admin/utils.rb +11 -11
- data/lib/ab_admin/version.rb +1 -1
- data/lib/ab_admin/views/admin_helpers.rb +13 -13
- data/lib/ab_admin/views/admin_navigation_helpers.rb +26 -26
- data/lib/ab_admin/views/form_builder.rb +36 -22
- data/lib/ab_admin/views/helpers.rb +6 -6
- data/lib/ab_admin/views/inputs/ckeditor_input.rb +1 -1
- data/lib/ab_admin/views/inputs/color_input.rb +1 -1
- data/lib/ab_admin/views/inputs/date_time_input.rb +7 -7
- data/lib/ab_admin/views/manager_helpers.rb +3 -3
- data/lib/ab_admin/views/search_form_builder.rb +18 -18
- data/lib/ab_admin/views/url_for_routes.rb +4 -4
- data/lib/ab_admin.rb +1 -2
- data/lib/generators/ab_admin/glob/glob_generator.rb +1 -1
- data/lib/generators/ab_admin/install/install_generator.rb +2 -2
- data/lib/generators/ab_admin/install/templates/config/admin_menu.rb +2 -0
- data/lib/generators/ab_admin/install/templates/config/seeds.rb +1 -1
- data/lib/generators/ab_admin/install/templates/config/unicorn_config.rb +3 -3
- data/lib/generators/ab_admin/install/templates/helpers/admin/structures_helper.rb +2 -2
- data/lib/generators/ab_admin/install/templates/models/ability.rb +4 -4
- data/lib/generators/ab_admin/install/templates/models/admin_comment.rb +4 -4
- data/lib/generators/ab_admin/install/templates/models/asset.rb +2 -1
- data/lib/generators/ab_admin/install/templates/models/attachment_file.rb +1 -1
- data/lib/generators/ab_admin/install/templates/models/avatar.rb +2 -2
- data/lib/generators/ab_admin/install/templates/models/locator.rb +3 -0
- data/lib/generators/ab_admin/install/templates/models/picture.rb +2 -2
- data/lib/generators/ab_admin/install/templates/models/settings.rb +3 -0
- data/lib/generators/ab_admin/install/templates/models/static_page.rb +3 -3
- data/lib/generators/ab_admin/install/templates/models/structure.rb +2 -2
- data/lib/generators/ab_admin/install/templates/models/user.rb +2 -2
- data/lib/generators/ab_admin/install/templates/spec/spec_helper.rb +2 -2
- data/lib/generators/ab_admin/install/templates/spec/support/shared_connection.rb +1 -1
- data/lib/generators/ab_admin/install/templates/uploaders/avatar_uploader.rb +2 -2
- data/lib/generators/ab_admin/install/templates/uploaders/picture_uploader.rb +4 -3
- data/lib/generators/ab_admin/model/model_generator.rb +4 -2
- data/lib/generators/ab_admin/model/templates/resource.erb +6 -6
- data/lib/generators/ab_admin/resource/resource_generator.rb +9 -9
- data/lib/generators/ab_admin/resource/templates/_form.haml.erb +10 -14
- data/lib/generators/ab_admin/resource/templates/_form.slim.erb +11 -11
- data/lib/generators/ab_admin/resource/templates/_search_form.haml.erb +1 -1
- data/lib/generators/ab_admin/resource/templates/_search_form.slim.erb +1 -1
- data/lib/generators/ab_admin/resource/templates/controller.erb +1 -1
- data/lib/generators/template.rb +8 -8
- data/lib/tasks/assets.rake +5 -5
- data/lib/tasks/cache.rake +1 -1
- data/lib/tasks/i18n.rake +1 -1
- data/spec/ab_admin_spec.rb +3 -3
- data/spec/dummy/app/models/ab_admin/ab_admin_catalogue.rb +1 -1
- data/spec/dummy/app/models/ab_admin/ab_admin_collection.rb +6 -6
- data/spec/dummy/app/models/ab_admin/ab_admin_product.rb +14 -14
- data/spec/dummy/app/models/admin_menu.rb +2 -2
- data/spec/dummy/app/models/ckeditor/asset.rb +1 -1
- data/spec/dummy/app/models/ckeditor/attachment_file.rb +1 -1
- data/spec/dummy/app/models/ckeditor/picture.rb +1 -1
- data/spec/dummy/app/models/collection.rb +5 -5
- data/spec/dummy/app/models/product.rb +5 -5
- data/spec/dummy/app/uploaders/ckeditor_attachment_file_uploader.rb +1 -1
- data/spec/dummy/app/uploaders/ckeditor_picture_uploader.rb +3 -3
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/config/application.rb +2 -2
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/config/initializers/ckeditor.rb +2 -2
- data/spec/dummy/config/initializers/devise.rb +5 -5
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/initializers/simple_form.rb +8 -8
- data/spec/dummy/config/initializers/simple_form_bootstrap.rb +14 -14
- data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/spec/dummy/config/routes.rb +2 -2
- data/spec/dummy/db/migrate/20130129151853_create_ckeditor_assets.rb +5 -5
- data/spec/dummy/db/migrate/20130130161853_create_collections.rb +2 -2
- data/spec/dummy/db/migrate/20130130162046_create_products.rb +2 -2
- data/spec/dummy/db/migrate/20130130175446_create_globalize_collection_product.rb +2 -2
- data/spec/dummy/db/migrate/20130207224516_create_catalogues.rb +3 -3
- data/spec/dummy/db/migrate/20130209223506_add_lat_lon_zoom_to_products.rb +1 -1
- data/spec/dummy/db/seeds.rb +5 -5
- data/spec/dummy/lib/capybara_irb.rb +10 -10
- data/spec/dummy/lib/tasks/cucumber.rake +10 -10
- data/spec/dummy/lib/templates/slim/scaffold/_form.html.slim +2 -2
- data/spec/factories/assets.rb +9 -9
- data/spec/factories/catalogues.rb +1 -1
- data/spec/factories/collections.rb +1 -1
- data/spec/factories/products.rb +2 -2
- data/spec/factories/structures.rb +2 -2
- data/spec/generators/ckeditor_assets_generator_spec.rb +1 -1
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/generators/model_generator_spec.rb +2 -2
- data/spec/generators/resource_generator_spec.rb +1 -1
- data/spec/models/avatar_spec.rb +1 -1
- data/spec/models/picture_uploader_spec.rb +1 -1
- data/spec/models/structure_spec.rb +2 -2
- data/spec/models/user_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- data/spec/support/shared_connection.rb +1 -1
- data/vendor/assets/javascripts/ab_admin/jquery.Jcrop.js +1083 -0
- data/vendor/assets/stylesheets/ab_admin/jquery.Jcrop.min.css.scss +28 -0
- metadata +8 -6
- data/lib/ab_admin/views/inputs/association_input.rb +0 -13
- 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 || '
|
8
|
-
= stylesheet_link_tag 'ab_admin/application', :
|
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', :
|
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', :
|
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', :
|
13
|
+
= render('admin/shared/flash', flash: flash) if flash
|
14
14
|
= yield
|
15
15
|
|
data/config/locales/ru.yml
CHANGED
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 :
|
5
|
-
get 'dashboards', :
|
4
|
+
root to: 'dashboards#index'
|
5
|
+
get 'dashboards', as: 'dashboards'
|
6
6
|
|
7
7
|
resources :structures do
|
8
|
-
post :rebuild, :
|
8
|
+
post :rebuild, on: :collection
|
9
9
|
resource :static_page
|
10
10
|
end
|
11
11
|
|
12
12
|
resources :users do
|
13
|
-
post :batch, :
|
14
|
-
post :activate, :suspend, :
|
13
|
+
post :batch, on: :collection
|
14
|
+
post :activate, :suspend, on: :member
|
15
15
|
end
|
16
16
|
|
17
|
-
resources :assets, :
|
18
|
-
post :rotate, :main, :crop, :
|
19
|
-
post :sort, :
|
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, :
|
23
|
-
post :cache_clear, :
|
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, :
|
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/:
|
36
|
-
get '/new', :
|
37
|
-
post '/batch', :
|
38
|
-
post '/rebuild', :
|
39
|
-
match '/custom_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', :
|
43
|
-
match '/custom_action', :
|
44
|
-
get '/', :
|
45
|
-
put '/', :
|
46
|
-
delete '/', :
|
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 '/', :
|
50
|
-
post '/', :
|
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, :
|
6
|
-
t.integer :trust_state, :
|
7
|
-
t.integer :gender, :
|
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, :
|
19
|
-
t.string :bg_color, :
|
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, :
|
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, :
|
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, :
|
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, :
|
60
|
-
add_index :users, :reset_password_token, :
|
61
|
-
add_index :users, :confirmation_token, :
|
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, :
|
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, :
|
9
|
-
t.string :assetable_type, :
|
10
|
-
t.string :type, :
|
11
|
-
t.string :guid, :
|
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, :
|
13
|
+
t.integer :locale, limit: 1, default: 0
|
14
14
|
t.integer :user_id
|
15
|
-
t.integer :sort_order, :
|
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, :
|
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, :
|
5
|
-
t.integer :headerable_id, :
|
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], :
|
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, :
|
4
|
+
t.integer :structure_id, null: false
|
5
5
|
t.references :user
|
6
|
-
t.boolean :is_visible, :
|
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, :
|
5
|
-
t.integer :kind, :
|
6
|
-
t.integer :position, :
|
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, :
|
8
|
+
t.boolean :is_visible, default: true, null: false
|
9
9
|
|
10
10
|
t.integer :parent_id
|
11
|
-
t.integer :lft, :
|
12
|
-
t.integer :rgt, :
|
13
|
-
t.integer :depth, :
|
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], :
|
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! :
|
4
|
-
Header.create_translation_table! :
|
5
|
-
Structure.create_translation_table! :
|
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, :
|
5
|
+
t.integer :author_id, null: false
|
6
6
|
t.string :author_name
|
7
|
-
t.integer :resource_id, :
|
8
|
-
t.string :resource_type, :
|
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 :
|
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 :
|
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 :
|
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!, :
|
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
|
data/features/dsl/config.feature
CHANGED
@@ -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), :
|
13
|
+
link_to 'Custom action', action_item_admin_path(:custom), method: :post
|
14
14
|
end
|
15
15
|
|
16
|
-
member_action :custom, :
|
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, :
|
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), :
|
49
|
+
link_to 'Custom collection action', action_item_admin_path(:custom_collection), method: :post
|
50
50
|
end
|
51
51
|
|
52
|
-
collection_action :custom_collection, :
|
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
|
data/features/dsl/form.feature
CHANGED
@@ -14,7 +14,7 @@ Feature: Form
|
|
14
14
|
field :price
|
15
15
|
end
|
16
16
|
field :is_visible
|
17
|
-
field :collection, :
|
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, :
|
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 :
|
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, :
|
67
|
+
= f.input :sku, label: 'Identifier'
|
68
68
|
|
69
69
|
= f.save_buttons
|
70
70
|
"""
|
data/features/dsl/table.feature
CHANGED
@@ -55,15 +55,15 @@ Feature: Table index view
|
|
55
55
|
Examples:
|
56
56
|
| column | config | ordering |
|
57
57
|
| Sku | :sku | sku |
|
58
|
-
| Name | :name, :
|
59
|
-
| Name | :name, :
|
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, :
|
66
|
+
field :created_at, sortable: false
|
67
67
|
end
|
68
68
|
end
|
69
69
|
"""
|
data/features/dsl/tree.feature
CHANGED
@@ -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 :
|
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 :
|
29
|
+
settings index_view: 'tree'
|
30
30
|
|
31
31
|
tree do |node|
|
32
|
-
link_to "Custom node title", root_path, :
|
32
|
+
link_to "Custom node title", root_path, class: 'tree-item_link'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
"""
|
data/features/locators.feature
CHANGED
@@ -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 "
|
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
|
"""
|
data/features/menu.feature
CHANGED
@@ -12,12 +12,12 @@ Feature: Admin menu
|
|
12
12
|
model User
|
13
13
|
group :system do
|
14
14
|
model Structure
|
15
|
-
model Settings, :
|
15
|
+
model Settings, url: edit_admin_settings_path
|
16
16
|
end
|
17
|
-
group 'Moderator', :
|
17
|
+
group 'Moderator', if: proc { moderator? } do
|
18
18
|
link 'for moderator', 'dummy_path'
|
19
19
|
end
|
20
|
-
group 'Admin', :
|
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', :
|
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', :
|
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', :
|
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(:
|
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', :
|
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, :
|
3
|
-
num.times { FactoryGirl.create(:product, :
|
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, :
|
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, :
|
30
|
-
page.should have_css('span.badge', :
|
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(:
|
5
|
-
FactoryGirl.create(:catalogue, :
|
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', :
|
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}']", :
|
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', :
|
11
|
-
page.should have_css('header.navbar ul.dropdown-menu a', :
|
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, :
|
5
|
+
FactoryGirl.create(:structure_page, title: attrs['title'], parent: parent)
|
6
6
|
end
|
7
7
|
end
|