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
@@ -22,7 +22,7 @@ class CkeditorPictureUploader < CarrierWave::Uploader::Base
|
|
22
22
|
# end
|
23
23
|
|
24
24
|
# Process files as they are uploaded:
|
25
|
-
# process :
|
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 :
|
35
|
+
process resize_to_fill: [118, 100]
|
36
36
|
end
|
37
37
|
|
38
38
|
version :content do
|
39
|
-
process :
|
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
|
6
|
-
<%= javascript_include_tag
|
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(:
|
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 = {:
|
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 =
|
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?(
|
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
|
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 =
|
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 :
|
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
|
-
# :
|
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', :
|
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(:
|
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, :
|
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, :
|
9
|
-
:
|
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 :
|
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, :
|
45
|
-
b.use :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
|
-
# :
|
54
|
-
# :
|
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 = { :
|
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, :
|
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 :
|
7
|
+
b.wrapper tag: 'div', class: 'controls' do |ba|
|
8
8
|
ba.use :input
|
9
|
-
ba.use :error, :
|
10
|
-
ba.use :hint, :
|
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, :
|
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 :
|
19
|
-
input.wrapper :
|
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, :
|
23
|
-
input.use :error, :
|
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, :
|
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 :
|
32
|
-
input.wrapper :
|
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, :
|
36
|
-
input.use :error, :
|
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 :
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# Disable root element in JSON by default.
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
|
3
|
-
root :
|
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 :
|
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, :
|
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, :
|
10
|
-
t.string :type, :
|
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
|
20
|
-
add_index
|
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, :
|
5
|
-
t.integer :products_count, :
|
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, :
|
7
|
-
t.boolean :is_visible, :
|
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! :
|
4
|
-
Product.create_translation_table! :
|
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, :
|
7
|
-
t.integer :rgt, :
|
8
|
-
t.integer :depth, :
|
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
|
data/spec/dummy/db/seeds.rb
CHANGED
@@ -22,7 +22,7 @@ end
|
|
22
22
|
def insert_structures
|
23
23
|
Structure.truncate!
|
24
24
|
|
25
|
-
main_page = Structure.create!({:
|
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!({:
|
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, :
|
37
|
+
parent = FactoryGirl.create(:structure_page, title: "node #{i}")
|
38
38
|
2.times do |ii|
|
39
|
-
child = FactoryGirl.create(:structure_page, :
|
39
|
+
child = FactoryGirl.create(:structure_page, title: "node #{i} - #{ii}", parent: parent)
|
40
40
|
2.times do |iii|
|
41
|
-
FactoryGirl.create(:structure_page, :
|
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 = {:
|
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', :
|
26
|
-
fill_in '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
|
-
[{
|
33
|
-
{
|
34
|
-
{
|
35
|
-
{
|
36
|
-
{
|
37
|
-
{
|
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, :
|
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({:
|
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({:
|
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({:
|
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 :
|
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 <<
|
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 :
|
45
|
+
task cucumber: 'cucumber:ok'
|
46
46
|
|
47
|
-
task :
|
47
|
+
task default: :cucumber
|
48
48
|
|
49
|
-
task :
|
50
|
-
STDERR.puts
|
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 :
|
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(
|
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
|
data/spec/factories/assets.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
#FactoryGirl.define do
|
3
|
-
# factory :asset_avatar, :
|
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, :
|
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, :
|
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, :
|
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, :
|
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, :
|
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, :
|
34
|
+
factory :asset_avatar_big, class: Avatar do
|
35
35
|
data File.open(File.expand_path('../files/silicon_valley.jpg', __FILE__))
|
36
|
-
association :assetable, :
|
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, :
|
45
|
+
association :assetable, factory: :structure
|
46
46
|
is_main true
|
47
47
|
|
48
48
|
before(:create) do |instance|
|
data/spec/factories/products.rb
CHANGED
@@ -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 :
|
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, :
|
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, :
|
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, :
|
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', :
|
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
|
45
|
+
assert_file 'config/routes.rb', /devise_for :users, ::AbAdmin::Devise\.config/, /root to:/
|
46
46
|
end
|
47
47
|
|
48
48
|
end
|