adminpanel 2.2.5 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -5
- data/CONTRIBUTING.md +22 -0
- data/Gemfile +1 -6
- data/README.md +8 -13
- data/Rakefile +4 -6
- data/adminpanel.gemspec +29 -24
- data/app/assets/javascripts/{application-admin.js → adminpanel/application.js} +2 -1
- data/app/assets/javascripts/adminpanel/images_form_add_remove_fields.js.coffee +11 -0
- data/app/assets/javascripts/adminpanel/sections.js.coffee +9 -0
- data/app/assets/javascripts/adminpanel/spinner.js.coffee +3 -3
- data/app/assets/javascripts/adminpanel/tables.js +4 -3
- data/app/assets/javascripts/adminpanel/wysiwyg.js.coffee +4 -1
- data/app/assets/stylesheets/{application-admin.css → adminpanel/application.css} +2 -2
- data/app/assets/stylesheets/adminpanel/fa-hidden.css.scss +7 -0
- data/app/assets/stylesheets/adminpanel/theme.css.scss.erb +3 -27
- data/app/assets/stylesheets/adminpanel/turbolinks_progress_load.css.scss +5 -0
- data/app/controllers/adminpanel/analytics_controller.rb +3 -3
- data/app/controllers/adminpanel/application_controller.rb +5 -11
- data/app/controllers/adminpanel/auths_controller.rb +6 -0
- data/app/controllers/adminpanel/categories_controller.rb +26 -60
- data/app/controllers/adminpanel/permissions_controller.rb +1 -2
- data/app/controllers/adminpanel/roles_controller.rb +10 -0
- data/app/controllers/adminpanel/sections_controller.rb +14 -14
- data/app/controllers/adminpanel/sessions_controller.rb +4 -3
- data/app/controllers/adminpanel/users_controller.rb +2 -2
- data/app/controllers/concerns/adminpanel/analytics/twitter_analytics.rb +1 -1
- data/app/controllers/concerns/adminpanel/facebook_actions.rb +13 -12
- data/app/controllers/concerns/adminpanel/galleryzable_actions.rb +13 -9
- data/app/controllers/concerns/adminpanel/rest_actions.rb +65 -59
- data/app/controllers/concerns/adminpanel/sitemap_actions.rb +1 -1
- data/app/controllers/concerns/adminpanel/sortable_actions.rb +29 -0
- data/app/controllers/concerns/adminpanel/twitter_actions.rb +5 -5
- data/app/helpers/adminpanel/adminpanel_form_builder.rb +104 -64
- data/app/helpers/adminpanel/application_helper.rb +20 -9
- data/app/helpers/adminpanel/breadcrumbs_helper.rb +2 -2
- data/app/helpers/adminpanel/router_helper.rb +8 -4
- data/app/helpers/adminpanel/shared_pages_helper.rb +59 -11
- data/app/models/ability.rb +2 -2
- data/app/models/adminpanel/analytic.rb +3 -3
- data/app/models/adminpanel/permission.rb +19 -19
- data/app/models/adminpanel/{rol.rb → role.rb} +9 -2
- data/app/models/adminpanel/section.rb +10 -6
- data/app/models/adminpanel/{image.rb → sectionfile.rb} +1 -1
- data/app/models/adminpanel/user.rb +27 -31
- data/app/models/concerns/adminpanel/base.rb +33 -19
- data/app/models/concerns/adminpanel/galleryzation.rb +18 -5
- data/app/models/concerns/adminpanel/sitemap.rb +1 -1
- data/app/models/concerns/adminpanel/sortable.rb +69 -0
- data/app/uploaders/adminpanel/.keep +1 -0
- data/app/views/adminpanel/analytics/_fb_statistic_widget.html.erb +27 -27
- data/app/views/adminpanel/categories/_categories_table.html.erb +4 -4
- data/app/views/adminpanel/categories/_category_form.html.erb +26 -6
- data/app/views/adminpanel/categories/create.js.erb +4 -5
- data/app/views/adminpanel/categories/index.html.erb +23 -16
- data/app/views/adminpanel/categories/new.js.erb +1 -1
- data/app/views/adminpanel/form/_adminpanel_file_field.html.erb +24 -0
- data/app/views/adminpanel/form/_belongs_to.html.erb +24 -0
- data/app/views/adminpanel/form/_file_field.html.erb +4 -0
- data/app/views/adminpanel/form/_has_many.html.erb +19 -0
- data/app/views/adminpanel/form/_non_image_file_field.html.erb +4 -0
- data/app/views/{shared/_delete_icon_button.html.erb → adminpanel/icons/_delete.html.erb} +3 -1
- data/app/views/{shared/_edit_icon_button.html.erb → adminpanel/icons/_edit.html.erb} +3 -3
- data/app/views/{shared/_fb_icon_button.html.erb → adminpanel/icons/_facebook.html.erb} +6 -5
- data/app/views/adminpanel/icons/_move_to_better.html.erb +16 -0
- data/app/views/adminpanel/icons/_move_to_worst.html.erb +17 -0
- data/app/views/{shared/_show_icon_button.html.erb → adminpanel/icons/_show.html.erb} +1 -1
- data/app/views/{shared/_twitter_icon_button.html.erb → adminpanel/icons/_twitter.html.erb} +1 -1
- data/app/views/adminpanel/sections/_sections_table.html.erb +1 -1
- data/app/views/adminpanel/sections/edit.html.erb +25 -17
- data/app/views/adminpanel/sections/index.html.erb +1 -1
- data/app/views/adminpanel/sections/show.html.erb +2 -2
- data/app/views/{shared → adminpanel/shared}/_breadcrumb.html.erb +0 -0
- data/app/views/adminpanel/shared/_create_remote_resource_button.html.erb +21 -0
- data/app/views/{shared → adminpanel/shared}/_error_messages.html.erb +0 -0
- data/app/views/{shared → adminpanel/shared}/_fb_publish_modal.html.erb +2 -2
- data/app/views/adminpanel/shared/_form_fields.html.erb +21 -0
- data/app/views/adminpanel/shared/_gallery_entries.html.erb +11 -0
- data/app/views/adminpanel/shared/_image_fields.html.erb +3 -0
- data/app/views/adminpanel/shared/_index_records.html.erb +32 -0
- data/app/views/adminpanel/shared/_modal.html.erb +20 -0
- data/app/views/adminpanel/shared/_new_resource_button.html.erb +17 -0
- data/app/views/adminpanel/shared/_remote_form_fields.html.erb +28 -0
- data/app/views/{shared → adminpanel/shared}/_twitter_publish_modal.html.erb +0 -0
- data/app/views/{shared → adminpanel/shared}/create_belongs_to.js.erb +0 -0
- data/app/views/{shared → adminpanel/shared}/create_has_many.js.erb +0 -0
- data/app/views/adminpanel/shared/edit.html.erb +42 -0
- data/app/views/{shared → adminpanel/shared}/fb_choose_page.html.erb +2 -2
- data/app/views/adminpanel/shared/gallery_entries.js.erb +1 -0
- data/app/views/adminpanel/shared/index.html.erb +43 -0
- data/app/views/adminpanel/shared/index_records.js.erb +1 -0
- data/app/views/adminpanel/shared/new.html.erb +42 -0
- data/app/views/adminpanel/shared/new.js.erb +2 -0
- data/app/views/adminpanel/shared/show.html.erb +77 -0
- data/app/views/layouts/{_shim.html.erb → adminpanel/_shim.html.erb} +0 -0
- data/app/views/layouts/adminpanel/_side_menu.html.erb +32 -0
- data/app/views/layouts/{_top_bar.html.erb → adminpanel/_top_bar.html.erb} +4 -2
- data/app/views/layouts/{admin-login.html.erb → adminpanel/application-login.html.erb} +4 -4
- data/app/views/layouts/{admin.html.erb → adminpanel/application.html.erb} +8 -6
- data/config/initializers/adminpanel/clear_cache.rb +4 -0
- data/config/initializers/{pluralization_es.rb → adminpanel/pluralization_es.rb} +0 -0
- data/config/initializers/{twitter-oauth.rb → adminpanel/twitter_oauth.rb} +0 -0
- data/config/locales/en.yml +93 -59
- data/config/locales/es.yml +34 -14
- data/config/routes.rb +27 -24
- data/lib/adminpanel.rb +3 -1
- data/lib/adminpanel/engine.rb +6 -3
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/contact/contact_generator.rb +12 -0
- data/{app/models/contact.rb → lib/generators/adminpanel/contact/templates/contact_template.rb} +0 -0
- data/lib/generators/adminpanel/dump/dump_generator.rb +37 -0
- data/lib/generators/adminpanel/gallery/templates/gallery_template.rb +7 -0
- data/lib/generators/adminpanel/gallery/templates/uploader.rb +7 -9
- data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +2 -2
- data/lib/generators/adminpanel/initialize/templates/create_adminpanel_tables.rb +23 -34
- data/lib/generators/adminpanel/initialize/templates/section_uploader.rb +6 -8
- data/lib/generators/adminpanel/resource/resource_generator.rb +3 -2
- data/lib/generators/adminpanel/resource/resource_generator_helper.rb +6 -8
- data/lib/generators/adminpanel/resource/templates/adminpanel_controller_template.rb +1 -1
- data/lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb +2 -2
- data/lib/tasks/adminpanel/adminpanel.rake +11 -24
- data/lib/tasks/adminpanel/sections.rake +65 -0
- data/test/dummy/app/controllers/adminpanel/file_resources_controller.rb +12 -0
- data/test/dummy/app/controllers/adminpanel/galleries_controller.rb +4 -0
- data/test/dummy/app/controllers/adminpanel/products_controller.rb +5 -5
- data/test/dummy/app/models/adminpanel/category.rb +2 -0
- data/test/dummy/app/models/adminpanel/file_resource.rb +34 -0
- data/test/dummy/app/models/adminpanel/file_resourcefile.rb +13 -0
- data/test/dummy/app/models/adminpanel/gallery.rb +32 -0
- data/test/dummy/app/models/adminpanel/galleryfile.rb +19 -0
- data/test/dummy/app/models/adminpanel/mug.rb +14 -14
- data/test/dummy/app/models/adminpanel/photo.rb +1 -0
- data/test/dummy/app/models/adminpanel/product.rb +7 -7
- data/test/dummy/app/models/adminpanel/test_object.rb +53 -0
- data/test/dummy/app/uploader/adminpanel/file_resourcefile_uploader.rb +82 -0
- data/test/dummy/app/uploader/adminpanel/photo_uploader.rb +5 -9
- data/test/dummy/app/uploader/adminpanel/section_uploader.rb +5 -9
- data/test/dummy/config/application.rb +3 -30
- data/test/dummy/config/carrierwave.rb +1 -1
- data/test/dummy/config/environments/test.rb +10 -4
- data/test/dummy/config/initializers/adminpanel_setup.rb +5 -2
- data/test/dummy/db/schema.rb +65 -34
- data/test/dummy/test/fixtures/adminpanel/categories.yml +7 -0
- data/test/dummy/test/fixtures/adminpanel/galleryfiles.yml +18 -0
- data/test/dummy/test/fixtures/adminpanel/permissions.yml +7 -7
- data/test/dummy/test/fixtures/adminpanel/products.yml +7 -0
- data/test/dummy/test/fixtures/adminpanel/{rols.yml → roles.yml} +0 -0
- data/test/dummy/test/fixtures/adminpanel/test_objects.yml +7 -0
- data/test/dummy/test/fixtures/adminpanel/users.yml +7 -7
- data/test/dummy/test/fixtures/dog fries.png +0 -0
- data/test/features/categories/categories_index_test.rb +31 -0
- data/test/features/shared/concerns/galleryzable_test.rb +22 -0
- data/test/features/shared/concerns/sortable_test.rb +26 -0
- data/test/features/shared/form/has_many_through_non_category_modal_test.rb +1 -1
- data/test/features/shared/form/remote_resource_modal_test.rb +41 -0
- data/test/features/shared/resource/edit_test.rb +7 -6
- data/test/features/shared/resource/new_test.rb +3 -2
- data/test/features/shared/ui/max_images_gallery_test.rb +52 -0
- data/test/generators/contact_generator_test.rb +20 -0
- data/test/generators/dump_generator_test.rb +51 -0
- data/test/generators/resource_generator_test.rb +46 -1
- data/test/helpers/breadcrumbs_helper_test.rb +3 -4
- data/test/helpers/router_helper_test.rb +1 -1
- data/test/helpers/shared_pages_helper_test.rb +120 -0
- data/test/models/adminpanel/gallery_test.rb +16 -23
- data/test/models/adminpanel/user_test.rb +1 -1
- data/test/support/view_case.rb +18 -19
- data/test/tasks/adminpanel_rake_test.rb +5 -3
- data/test/test_helper.rb +2 -5
- metadata +204 -150
- data/.rspec +0 -2
- data/app/assets/javascripts/adminpanel/images_form.js +0 -23
- data/app/assets/javascripts/adminpanel/imagesloaded.js +0 -16
- data/app/controllers/adminpanel/galleries_controller.rb +0 -75
- data/app/controllers/adminpanel/rols_controller.rb +0 -10
- data/app/models/adminpanel/gallery.rb +0 -82
- data/app/uploaders/adminpanel/gallery_uploader.rb +0 -56
- data/app/views/adminpanel/galleries/_galleries_table.html.erb +0 -15
- data/app/views/adminpanel/galleries/create.html.erb +0 -2
- data/app/views/adminpanel/galleries/index.html.erb +0 -52
- data/app/views/adminpanel/galleries/move_better.js.erb +0 -1
- data/app/views/adminpanel/galleries/move_worst.js.erb +0 -1
- data/app/views/layouts/_side_menu.html.erb +0 -40
- data/app/views/shared/_create_remote_resource_button.html.erb +0 -23
- data/app/views/shared/_form_fields.html.erb +0 -63
- data/app/views/shared/_gallery_entries.html.erb +0 -11
- data/app/views/shared/_image_fields.html.erb +0 -3
- data/app/views/shared/_modal.html.erb +0 -8
- data/app/views/shared/_new_resource_button.html.erb +0 -17
- data/app/views/shared/_remote_form_fields.html.erb +0 -12
- data/app/views/shared/edit.html.erb +0 -29
- data/app/views/shared/gallery_entries.js.erb +0 -1
- data/app/views/shared/index.html.erb +0 -68
- data/app/views/shared/new.html.erb +0 -41
- data/app/views/shared/new.js.erb +0 -2
- data/app/views/shared/show.html.erb +0 -92
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/config/environments/development.rb +0 -29
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/unit/gallery_unit_test.rb +0 -21
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class TestObject < ActiveRecord::Base
|
|
3
|
+
include Adminpanel::Base
|
|
4
|
+
has_and_belongs_to_many :categories,
|
|
5
|
+
join_table: "adminpanel_test_object_category"
|
|
6
|
+
|
|
7
|
+
def self.form_attributes
|
|
8
|
+
[
|
|
9
|
+
{
|
|
10
|
+
'name' => {
|
|
11
|
+
'type' => 'text_field',
|
|
12
|
+
'label' => 'name'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
'category_ids' => {
|
|
17
|
+
'type' => 'has_many',
|
|
18
|
+
'model' => 'Adminpanel::Category',
|
|
19
|
+
'label' => 'has_many'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
'boolean' => {
|
|
24
|
+
'type' => 'boolean',
|
|
25
|
+
'label' => 'boolean'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
'text' => {
|
|
30
|
+
'type' => 'wysiwyg_field',
|
|
31
|
+
'label' => 'wysi'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
'price' => {
|
|
36
|
+
'type' => 'wysiwyg_field',
|
|
37
|
+
'label' => 'wysi'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
'quantity' => {
|
|
42
|
+
'type' => 'number_field',
|
|
43
|
+
'label' => 'wysi'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.display_name
|
|
51
|
+
'objeto'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
module Adminpanel
|
|
2
|
+
class FileResourcefileUploader < CarrierWave::Uploader::Base
|
|
3
|
+
include CarrierWave::MiniMagick
|
|
4
|
+
|
|
5
|
+
storage :file
|
|
6
|
+
|
|
7
|
+
def root
|
|
8
|
+
Rails.root.join 'public/'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def store_dir
|
|
12
|
+
"uploads/image/#{mounted_as}/#{model.id}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Process files as they are uploaded:
|
|
16
|
+
# process :resize_to_fill => [1366, 768]
|
|
17
|
+
|
|
18
|
+
# THE THUMB VERSION IS NECESSARY!!!!
|
|
19
|
+
version :thumb do
|
|
20
|
+
process :resize_to_limit => [220, 220]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# however, you can create your own versions:
|
|
24
|
+
# version :awesome do
|
|
25
|
+
# process :reside_and_pad => [120, 900]
|
|
26
|
+
# end
|
|
27
|
+
|
|
28
|
+
# resize_and_pad(width, height, background=:transparent, gravity=::Magick::CenterGravity)
|
|
29
|
+
#
|
|
30
|
+
# Resize the image to fit within the specified dimensions while retaining
|
|
31
|
+
# the original aspect ratio. If necessary, will pad the remaining area with
|
|
32
|
+
# the given color, which defaults to transparent (for gif and png, white for jpeg).
|
|
33
|
+
#
|
|
34
|
+
# width (Integer)
|
|
35
|
+
# the width to scale the image to
|
|
36
|
+
# height (Integer)
|
|
37
|
+
# the height to scale the image to
|
|
38
|
+
# background (String, :transparent)
|
|
39
|
+
# the color of the background as a hexcode, like “ff45de“
|
|
40
|
+
# gravity (Magick::GravityType)
|
|
41
|
+
# how to position the image
|
|
42
|
+
|
|
43
|
+
# resize_to_fill(width, height)
|
|
44
|
+
#
|
|
45
|
+
# Resize the image to fit within the
|
|
46
|
+
# specified dimensions while retaining the aspect ratio of the original image.
|
|
47
|
+
# If necessary, crop the image in the larger dimension.
|
|
48
|
+
#
|
|
49
|
+
# width (Integer)
|
|
50
|
+
# the width to scale the image to
|
|
51
|
+
# height (Integer)
|
|
52
|
+
# the height to scale the image to
|
|
53
|
+
|
|
54
|
+
# resize_to_fit(width, height)
|
|
55
|
+
#
|
|
56
|
+
# Resize the image to fit within the
|
|
57
|
+
# specified dimensions while retaining the original aspect ratio. The image
|
|
58
|
+
# may be shorter or narrower than specified in the smaller dimension but
|
|
59
|
+
# will not be larger than the specified values.
|
|
60
|
+
#
|
|
61
|
+
# width (Integer)
|
|
62
|
+
# the width to scale the image to
|
|
63
|
+
# height (Integer)
|
|
64
|
+
# the height to scale the image to
|
|
65
|
+
|
|
66
|
+
# resize_to_limit(width, height)
|
|
67
|
+
#
|
|
68
|
+
# Resize the image to fit within the specified dimensions while retaining
|
|
69
|
+
# the original aspect ratio. Will only resize the image if it is larger than
|
|
70
|
+
# the specified dimensions. The resulting image may be shorter or narrower
|
|
71
|
+
# than specified in the smaller dimension but will not be larger than the
|
|
72
|
+
# specified values.
|
|
73
|
+
#
|
|
74
|
+
# width (Integer)
|
|
75
|
+
# the width to scale the image to
|
|
76
|
+
# height (Integer)
|
|
77
|
+
# the height to scale the image to
|
|
78
|
+
def extension_white_list
|
|
79
|
+
%w(jpg jpeg png)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Adminpanel
|
|
2
2
|
class PhotoUploader < CarrierWave::Uploader::Base
|
|
3
|
-
include CarrierWave::
|
|
3
|
+
include CarrierWave::MiniMagick
|
|
4
4
|
|
|
5
5
|
storage :file
|
|
6
6
|
|
|
@@ -42,11 +42,9 @@ module Adminpanel
|
|
|
42
42
|
|
|
43
43
|
# resize_to_fill(width, height)
|
|
44
44
|
#
|
|
45
|
-
#
|
|
45
|
+
# Resize the image to fit within the
|
|
46
46
|
# specified dimensions while retaining the aspect ratio of the original image.
|
|
47
|
-
# If necessary, crop the image in the larger dimension
|
|
48
|
-
#
|
|
49
|
-
# See even www.imagemagick.org/RMagick/doc/image3.html#resize_to_fill
|
|
47
|
+
# If necessary, crop the image in the larger dimension.
|
|
50
48
|
#
|
|
51
49
|
# width (Integer)
|
|
52
50
|
# the width to scale the image to
|
|
@@ -55,12 +53,10 @@ module Adminpanel
|
|
|
55
53
|
|
|
56
54
|
# resize_to_fit(width, height)
|
|
57
55
|
#
|
|
58
|
-
#
|
|
56
|
+
# Resize the image to fit within the
|
|
59
57
|
# specified dimensions while retaining the original aspect ratio. The image
|
|
60
58
|
# may be shorter or narrower than specified in the smaller dimension but
|
|
61
|
-
# will not be larger than the specified values
|
|
62
|
-
#
|
|
63
|
-
# See even www.imagemagick.org/RMagick/doc/image3.html#resize_to_fit
|
|
59
|
+
# will not be larger than the specified values.
|
|
64
60
|
#
|
|
65
61
|
# width (Integer)
|
|
66
62
|
# the width to scale the image to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Adminpanel
|
|
2
2
|
class SectionUploader < CarrierWave::Uploader::Base
|
|
3
|
-
include CarrierWave::
|
|
3
|
+
include CarrierWave::MiniMagick
|
|
4
4
|
|
|
5
5
|
storage :file
|
|
6
6
|
|
|
@@ -42,11 +42,9 @@ module Adminpanel
|
|
|
42
42
|
|
|
43
43
|
# resize_to_fill(width, height)
|
|
44
44
|
#
|
|
45
|
-
#
|
|
45
|
+
# Resize the image to fit within the
|
|
46
46
|
# specified dimensions while retaining the aspect ratio of the original image.
|
|
47
|
-
# If necessary, crop the image in the larger dimension
|
|
48
|
-
#
|
|
49
|
-
# See even www.imagemagick.org/RMagick/doc/image3.html#resize_to_fill
|
|
47
|
+
# If necessary, crop the image in the larger dimension.
|
|
50
48
|
#
|
|
51
49
|
# width (Integer)
|
|
52
50
|
# the width to scale the image to
|
|
@@ -55,12 +53,10 @@ module Adminpanel
|
|
|
55
53
|
|
|
56
54
|
# resize_to_fit(width, height)
|
|
57
55
|
#
|
|
58
|
-
#
|
|
56
|
+
# Resize the image to fit within the
|
|
59
57
|
# specified dimensions while retaining the original aspect ratio. The image
|
|
60
58
|
# may be shorter or narrower than specified in the smaller dimension but
|
|
61
|
-
# will not be larger than the specified values
|
|
62
|
-
#
|
|
63
|
-
# See even www.imagemagick.org/RMagick/doc/image3.html#resize_to_fit
|
|
59
|
+
# will not be larger than the specified values.
|
|
64
60
|
#
|
|
65
61
|
# width (Integer)
|
|
66
62
|
# the width to scale the image to
|
|
@@ -3,6 +3,7 @@ require File.expand_path('../boot', __FILE__)
|
|
|
3
3
|
require 'rails/all'
|
|
4
4
|
|
|
5
5
|
Bundler.require(*Rails.groups)
|
|
6
|
+
|
|
6
7
|
require 'adminpanel'
|
|
7
8
|
|
|
8
9
|
module Dummy
|
|
@@ -11,16 +12,6 @@ module Dummy
|
|
|
11
12
|
# Application configuration should go into files in config/initializers
|
|
12
13
|
# -- all .rb files in that directory are automatically loaded.
|
|
13
14
|
|
|
14
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
|
15
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
|
16
|
-
|
|
17
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
18
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
19
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
20
|
-
|
|
21
|
-
# Activate observers that should always be running.
|
|
22
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
23
|
-
|
|
24
15
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
25
16
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
26
17
|
# config.time_zone = 'Central Time (US & Canada)'
|
|
@@ -28,26 +19,8 @@ module Dummy
|
|
|
28
19
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
29
20
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
30
21
|
config.i18n.default_locale = :es
|
|
31
|
-
I18n.config.enforce_available_locales = true
|
|
32
|
-
|
|
33
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
|
34
|
-
config.encoding = "utf-8"
|
|
35
|
-
|
|
36
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
|
37
|
-
config.filter_parameters += [:password]
|
|
38
|
-
|
|
39
|
-
# Enable escaping HTML in JSON.
|
|
40
|
-
config.active_support.escape_html_entities_in_json = true
|
|
41
|
-
|
|
42
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
|
43
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
44
|
-
# like if you have constraints or database-specific column types
|
|
45
|
-
# config.active_record.schema_format = :sql
|
|
46
|
-
|
|
47
|
-
# Enable the asset pipeline
|
|
48
|
-
config.assets.enabled = true
|
|
49
22
|
|
|
50
|
-
#
|
|
51
|
-
config.
|
|
23
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
|
24
|
+
config.active_record.raise_in_transactional_callbacks = true
|
|
52
25
|
end
|
|
53
26
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Rails.application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
|
@@ -14,7 +14,7 @@ Dummy::Application.configure do
|
|
|
14
14
|
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
16
|
config.serve_static_assets = true
|
|
17
|
-
config.static_cache_control =
|
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
|
18
18
|
|
|
19
19
|
# Show full error reports and disable caching.
|
|
20
20
|
config.consider_all_requests_local = true
|
|
@@ -23,14 +23,20 @@ Dummy::Application.configure do
|
|
|
23
23
|
# Raise exceptions instead of rendering exception templates.
|
|
24
24
|
config.action_dispatch.show_exceptions = false
|
|
25
25
|
|
|
26
|
-
#
|
|
27
|
-
config.action_controller.allow_forgery_protection =
|
|
26
|
+
# Disable request forgery protection in test environment.
|
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
|
28
28
|
|
|
29
29
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
30
30
|
# The :test delivery method accumulates sent emails in the
|
|
31
31
|
# ActionMailer::Base.deliveries array.
|
|
32
32
|
config.action_mailer.delivery_method = :test
|
|
33
33
|
|
|
34
|
+
# Randomize the order test cases are executed
|
|
35
|
+
config.active_support.test_order = :random
|
|
36
|
+
|
|
34
37
|
# Print deprecation notices to the stderr.
|
|
35
38
|
config.active_support.deprecation = :stderr
|
|
39
|
+
|
|
40
|
+
# Raises error for missing translations
|
|
41
|
+
# config.action_view.raise_on_missing_translations = true
|
|
36
42
|
end
|
|
@@ -14,12 +14,15 @@ Adminpanel.setup do |config|
|
|
|
14
14
|
config.displayable_resources = [
|
|
15
15
|
:departments,
|
|
16
16
|
:analytics,
|
|
17
|
-
:galleries,
|
|
18
17
|
:sections,
|
|
19
18
|
:categories,
|
|
19
|
+
:roles,
|
|
20
|
+
:permissions,
|
|
20
21
|
:products,
|
|
22
|
+
:galleries, # sortable
|
|
21
23
|
:users,
|
|
22
24
|
:mugs,
|
|
23
|
-
:salesmen
|
|
25
|
+
:salesmen,
|
|
26
|
+
:file_resources
|
|
24
27
|
]
|
|
25
28
|
end
|
data/test/dummy/db/schema.rb
CHANGED
|
@@ -16,98 +16,129 @@ ActiveRecord::Schema.define do
|
|
|
16
16
|
t.string :email
|
|
17
17
|
t.string :password_digest
|
|
18
18
|
t.string :remember_token
|
|
19
|
-
t.integer :
|
|
20
|
-
t.datetime :created_at, :
|
|
21
|
-
t.datetime :updated_at, :
|
|
19
|
+
t.integer :role_id
|
|
20
|
+
t.datetime :created_at, null: false
|
|
21
|
+
t.datetime :updated_at, null: false
|
|
22
22
|
end
|
|
23
23
|
create_table :adminpanel_galleries do |t|
|
|
24
24
|
t.string :file
|
|
25
25
|
t.integer :position
|
|
26
|
-
t.datetime :created_at, :
|
|
27
|
-
t.datetime :updated_at, :
|
|
26
|
+
t.datetime :created_at, null: false
|
|
27
|
+
t.datetime :updated_at, null: false
|
|
28
28
|
end
|
|
29
|
-
create_table :
|
|
29
|
+
create_table :adminpanel_galleryfiles do |t|
|
|
30
|
+
t.string :file
|
|
31
|
+
t.integer :position
|
|
32
|
+
t.integer :gallery_id
|
|
33
|
+
t.datetime :created_at, null: false
|
|
34
|
+
t.datetime :updated_at, null: false
|
|
35
|
+
end
|
|
36
|
+
create_table :adminpanel_sectionfiles do |t|
|
|
30
37
|
t.string :file
|
|
31
38
|
t.string :section_id
|
|
32
|
-
t.datetime :created_at, :
|
|
33
|
-
t.datetime :updated_at, :
|
|
39
|
+
t.datetime :created_at, null: false
|
|
40
|
+
t.datetime :updated_at, null: false
|
|
34
41
|
end
|
|
35
42
|
create_table :adminpanel_products do |t|
|
|
36
43
|
t.string :price
|
|
37
44
|
t.string :name
|
|
38
45
|
t.text :description
|
|
39
|
-
t.datetime :created_at, :
|
|
40
|
-
t.datetime :updated_at, :
|
|
46
|
+
t.datetime :created_at, null: false
|
|
47
|
+
t.datetime :updated_at, null: false
|
|
41
48
|
end
|
|
42
49
|
create_table :adminpanel_photos do |t|
|
|
43
50
|
t.string :file
|
|
44
51
|
t.text :product_id
|
|
45
|
-
t.datetime :created_at, :
|
|
46
|
-
t.datetime :updated_at, :
|
|
52
|
+
t.datetime :created_at, null: false
|
|
53
|
+
t.datetime :updated_at, null: false
|
|
47
54
|
end
|
|
48
55
|
create_table :adminpanel_categories do |t|
|
|
49
56
|
t.string :name
|
|
50
57
|
t.string :model
|
|
51
|
-
t.datetime :created_at, :
|
|
52
|
-
t.datetime :updated_at, :
|
|
58
|
+
t.datetime :created_at, null: false
|
|
59
|
+
t.datetime :updated_at, null: false
|
|
53
60
|
end
|
|
54
61
|
create_table :adminpanel_auths do |t|
|
|
55
62
|
t.string :name
|
|
56
63
|
t.string :key
|
|
57
64
|
t.string :value
|
|
58
|
-
t.datetime :created_at, :
|
|
59
|
-
t.datetime :updated_at, :
|
|
65
|
+
t.datetime :created_at, null: false
|
|
66
|
+
t.datetime :updated_at, null: false
|
|
60
67
|
end
|
|
61
68
|
create_table :adminpanel_categorizations do |t|
|
|
62
69
|
t.integer :product_id
|
|
63
70
|
t.integer :category_id
|
|
64
|
-
t.datetime :created_at, :
|
|
65
|
-
t.datetime :updated_at, :
|
|
71
|
+
t.datetime :created_at, null: false
|
|
72
|
+
t.datetime :updated_at, null: false
|
|
66
73
|
end
|
|
67
74
|
create_table :adminpanel_items do |t|
|
|
68
75
|
t.integer :product_id
|
|
69
76
|
t.integer :deparment_id
|
|
70
|
-
t.datetime :created_at, :
|
|
71
|
-
t.datetime :updated_at, :
|
|
77
|
+
t.datetime :created_at, null: false
|
|
78
|
+
t.datetime :updated_at, null: false
|
|
72
79
|
end
|
|
73
80
|
create_table :adminpanel_departments do |t|
|
|
74
81
|
t.integer :category_id
|
|
75
82
|
t.integer :name
|
|
76
|
-
t.datetime :created_at, :
|
|
77
|
-
t.datetime :updated_at, :
|
|
83
|
+
t.datetime :created_at, null: false
|
|
84
|
+
t.datetime :updated_at, null: false
|
|
78
85
|
end
|
|
79
|
-
create_table :
|
|
86
|
+
create_table :adminpanel_roles do |t|
|
|
80
87
|
t.string :name
|
|
81
|
-
t.datetime :created_at, :
|
|
82
|
-
t.datetime :updated_at, :
|
|
88
|
+
t.datetime :created_at, null: false
|
|
89
|
+
t.datetime :updated_at, null: false
|
|
83
90
|
end
|
|
84
91
|
create_table :adminpanel_permissions do |t|
|
|
85
|
-
t.integer :
|
|
92
|
+
t.integer :role_id
|
|
86
93
|
t.integer :action
|
|
87
94
|
t.string :resource
|
|
88
|
-
t.datetime :created_at, :
|
|
89
|
-
t.datetime :updated_at, :
|
|
95
|
+
t.datetime :created_at, null: false
|
|
96
|
+
t.datetime :updated_at, null: false
|
|
90
97
|
end
|
|
91
98
|
create_table :adminpanel_mugs do |t|
|
|
92
99
|
t.string :name
|
|
93
100
|
t.integer :number
|
|
94
|
-
t.datetime :created_at, :
|
|
95
|
-
t.datetime :updated_at, :
|
|
101
|
+
t.datetime :created_at, null: false
|
|
102
|
+
t.datetime :updated_at, null: false
|
|
96
103
|
end
|
|
97
104
|
create_table :adminpanel_salesmen do |t|
|
|
98
105
|
t.string :name
|
|
99
106
|
t.integer :product_id
|
|
100
|
-
t.datetime :created_at, :
|
|
101
|
-
t.datetime :updated_at, :
|
|
107
|
+
t.datetime :created_at, null: false
|
|
108
|
+
t.datetime :updated_at, null: false
|
|
102
109
|
end
|
|
103
110
|
create_table :adminpanel_sections do |t|
|
|
104
111
|
t.string :name
|
|
105
112
|
t.text :description
|
|
106
113
|
t.string :key
|
|
107
114
|
t.boolean :has_image
|
|
115
|
+
t.integer :max_images, default: 0
|
|
108
116
|
t.string :page
|
|
109
|
-
t.datetime :created_at, :
|
|
110
|
-
t.datetime :updated_at, :
|
|
117
|
+
t.datetime :created_at, null: false
|
|
118
|
+
t.datetime :updated_at, null: false
|
|
119
|
+
t.boolean :has_description
|
|
120
|
+
end
|
|
121
|
+
create_table :adminpanel_test_objects do |t|
|
|
122
|
+
t.boolean :boolean
|
|
123
|
+
t.string :name
|
|
124
|
+
t.text :text
|
|
125
|
+
t.integer :quantity
|
|
126
|
+
t.float :price
|
|
127
|
+
t.datetime :created_at, null: false
|
|
128
|
+
t.datetime :updated_at, null: false
|
|
111
129
|
t.boolean :has_description
|
|
112
130
|
end
|
|
131
|
+
create_table :adminpanel_test_object_category do |t|
|
|
132
|
+
t.integer :test_object_id
|
|
133
|
+
t.integer :category_id
|
|
134
|
+
end
|
|
135
|
+
create_table :adminpanel_file_resourcefiles do |t|
|
|
136
|
+
t.integer :file_resource_id
|
|
137
|
+
t.string :file
|
|
138
|
+
end
|
|
139
|
+
create_table :adminpanel_file_resources do |t|
|
|
140
|
+
t.string :name
|
|
141
|
+
t.datetime :created_at
|
|
142
|
+
t.datetime :updated_at
|
|
143
|
+
end
|
|
113
144
|
end
|