adminpanel 2.4.3 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/README.md +16 -16
  4. data/adminpanel.gemspec +9 -8
  5. data/app/assets/javascripts/adminpanel/application.js +4 -0
  6. data/app/assets/javascripts/adminpanel/bootstrap-wysihtml5.js +2 -4
  7. data/app/assets/javascripts/adminpanel/sortable.js.coffee +27 -0
  8. data/app/assets/stylesheets/adminpanel/application.css +1 -0
  9. data/app/assets/stylesheets/adminpanel/sortable.css.scss.erb +13 -0
  10. data/app/controllers/adminpanel/application_controller.rb +0 -1
  11. data/app/controllers/adminpanel/sessions_controller.rb +5 -2
  12. data/app/controllers/concerns/adminpanel/rest_actions.rb +24 -22
  13. data/app/controllers/concerns/adminpanel/sortable_actions.rb +3 -20
  14. data/app/helpers/adminpanel/breadcrumbs_helper.rb +6 -5
  15. data/app/helpers/adminpanel/router_helper.rb +9 -3
  16. data/app/helpers/adminpanel/shared_pages_helper.rb +1 -1
  17. data/app/models/concerns/adminpanel/base.rb +34 -11
  18. data/app/models/concerns/adminpanel/sitemap.rb +0 -1
  19. data/app/models/concerns/adminpanel/sortable.rb +33 -30
  20. data/app/models/concerns/adminpanel/sortable_gallery.rb +90 -0
  21. data/app/views/adminpanel/form/_adminpanel_file_field.html.erb +1 -1
  22. data/app/views/adminpanel/templates/index.html.erb +41 -13
  23. data/app/views/adminpanel/templates/show.html.erb +33 -13
  24. data/config/initializers/adminpanel/carrierwave_mini_magick_quality.rb +11 -0
  25. data/config/locales/en.yml +3 -7
  26. data/config/locales/es.yml +1 -8
  27. data/config/routes.rb +6 -8
  28. data/lib/adminpanel.rb +9 -8
  29. data/lib/adminpanel/version.rb +1 -1
  30. data/lib/generators/adminpanel/custom_errors/custom_errors_generator.rb +37 -0
  31. data/lib/generators/adminpanel/custom_errors/templates/errors_controller.rb +14 -0
  32. data/lib/generators/adminpanel/custom_errors/templates/show.html.erb +1 -0
  33. data/lib/generators/adminpanel/gallery/templates/gallery_template.rb +8 -3
  34. data/lib/generators/adminpanel/gallery/templates/uploader.rb +4 -1
  35. data/lib/generators/adminpanel/initialize/initialize_generator.rb +0 -12
  36. data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +1 -2
  37. data/lib/generators/adminpanel/resource/resource_generator.rb +29 -8
  38. data/lib/generators/adminpanel/resource/resource_generator_helper.rb +34 -7
  39. data/lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb +7 -2
  40. data/lib/tasks/adminpanel/adminpanel.rake +19 -61
  41. data/test/dummy/app/models/adminpanel/file_resourcefile.rb +1 -1
  42. data/test/dummy/app/models/adminpanel/gallery.rb +9 -4
  43. data/test/dummy/app/models/adminpanel/galleryfile.rb +2 -2
  44. data/test/dummy/app/models/adminpanel/photo.rb +1 -1
  45. data/test/dummy/app/models/adminpanel/product.rb +0 -4
  46. data/test/dummy/config/initializers/adminpanel_setup.rb +1 -1
  47. data/test/dummy/test/fixtures/adminpanel/galleryfiles.yml +24 -0
  48. data/test/features/shared/concerns/sortable_gallery_ui_test.rb +25 -0
  49. data/test/features/shared/concerns/sortable_test.rb +4 -4
  50. data/test/features/shared/form/{belongs_to_non_category_modal_test.rb → belongs_to_remote_test.rb} +1 -1
  51. data/test/features/shared/form/{has_many_through_non_category_modal_test.rb → has_many_through_remote_test.rb} +1 -1
  52. data/test/generators/dump_generator_test.rb +1 -13
  53. data/test/generators/gallery_generator_test.rb +1 -1
  54. data/test/generators/initialize_generator_test.rb +1 -9
  55. data/test/generators/resource_generator_test.rb +21 -1
  56. data/test/helpers/router_helper_test.rb +0 -4
  57. data/test/models/adminpanel/sortable_gallery_unit_test.rb +118 -0
  58. data/test/models/adminpanel/sortable_unit_test.rb +75 -0
  59. data/test/tasks/adminpanel_rake_test.rb +1 -1
  60. metadata +86 -85
  61. data/app/assets/images/adminpanel/loguito.png +0 -0
  62. data/app/controllers/adminpanel/categories_controller.rb +0 -52
  63. data/app/controllers/concerns/adminpanel/galleryzable_actions.rb +0 -34
  64. data/app/models/concerns/adminpanel/galleryzation.rb +0 -78
  65. data/app/views/adminpanel/categories/_categories_table.html.erb +0 -48
  66. data/app/views/adminpanel/categories/_category_form.html.erb +0 -33
  67. data/app/views/adminpanel/categories/create.js.erb +0 -6
  68. data/app/views/adminpanel/categories/index.html.erb +0 -63
  69. data/app/views/adminpanel/categories/new.js.erb +0 -5
  70. data/app/views/adminpanel/icons/_move_to_better.html.erb +0 -17
  71. data/app/views/adminpanel/icons/_move_to_worst.html.erb +0 -18
  72. data/app/views/adminpanel/shared/_gallery_entries.html.erb +0 -11
  73. data/app/views/adminpanel/shared/_index_records.html.erb +0 -32
  74. data/app/views/adminpanel/templates/gallery_entries.js.erb +0 -1
  75. data/app/views/adminpanel/templates/index_records.js.erb +0 -1
  76. data/lib/generators/adminpanel/initialize/templates/category_template.rb +0 -45
  77. data/lib/generators/adminpanel/initialize/templates/create_adminpanel_categories_table.rb +0 -11
  78. data/test/features/categories/categories_index_test.rb +0 -31
  79. data/test/features/shared/concerns/galleryzable_test.rb +0 -22
  80. data/test/features/shared/form/belongs_to_category_modal_test.rb +0 -35
  81. data/test/features/shared/form/has_many_through_category_modal_test.rb +0 -35
  82. data/test/models/adminpanel/galleryzable_test.rb +0 -28
@@ -1,11 +0,0 @@
1
- class CreateAdminpanelCategoriesTable < ActiveRecord::Migration
2
- def change
3
- create_table :adminpanel_categories do |t|
4
-
5
-
6
- t.string :name
7
- t.string :model
8
- t.timestamps
9
- end
10
- end
11
- end
@@ -1,31 +0,0 @@
1
- require 'test_helper'
2
- require 'adminpanel/product'
3
- require 'adminpanel/category'
4
- require 'adminpanel/test_object'
5
-
6
- class CategoriesIndexTest < ViewCase
7
- setup :visit_adminpanel_categories_path
8
- teardown :teardown
9
-
10
- def test_adding_invalid_category
11
- assert_link('Crear Categoria para test_object')
12
- trigger_modal('Crear Categoria para test_object')
13
- assert_equal('Agregar Categoria', find('#modal-title').text)
14
- submit_modal 'Agregar Categoria'
15
- assert_content( I18n.t('errors', model: 'Categoria', count: 1) )
16
- end
17
-
18
- def test_adding_valid_category
19
- trigger_modal('Crear Categoria para test_object')
20
- fill_in 'category_name', with: 'categories index name'
21
- submit_modal 'Agregar Categoria'
22
- assert_xpath("//a[contains(text(), 'categories index name' )]")
23
- end
24
-
25
- private
26
- def visit_adminpanel_categories_path
27
- visit adminpanel.signin_path
28
- login
29
- visit adminpanel.categories_path
30
- end
31
- end
@@ -1,22 +0,0 @@
1
- require 'test_helper'
2
-
3
- class GalleryzableTest < ViewCase
4
- fixtures :all
5
-
6
- setup :sign_in
7
- teardown :teardown
8
-
9
- def test_including_chveron_icons
10
- visit adminpanel.galleries_path(adminpanel_galleries(:one))
11
-
12
- # if this 2 icons exists, routes exist too
13
- assert_selector 'i.fa.fa-chevron-down'
14
- assert_selector 'i.fa.fa-chevron-up'
15
- end
16
-
17
- protected
18
- def sign_in
19
- visit adminpanel.signin_path
20
- login
21
- end
22
- end
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
- require 'adminpanel/product'
3
- require 'adminpanel/category'
4
-
5
- class BelongsToCategoryModalTest < ViewCase
6
-
7
- setup :visit_adminpanel_new_department_path
8
- teardown :teardown
9
-
10
- def test_add_remote_category_link_exist
11
- assert_link('Agregar Categoria')
12
- end
13
-
14
- def test_adding_a_remote_category_with_invalid_information
15
- trigger_modal 'Agregar Categoria'
16
- assert_equal 'Agregar Categoria', find('#modal-title').text
17
- submit_modal 'Agregar Categoria'
18
- assert_content( I18n.t('errors', model: 'Categoria', count: 1) )
19
- end
20
-
21
- def test_adding_a_remote_category_with_valid_information
22
- trigger_modal 'Agregar Categoria'
23
- fill_in 'category_name', with: 'remote product'
24
- submit_modal 'Agregar Categoria'
25
- assert_xpath("//option[contains(text(), 'remote product' )]")
26
- end
27
-
28
- private
29
-
30
- def visit_adminpanel_new_department_path
31
- visit adminpanel.signin_path
32
- login
33
- visit adminpanel.new_department_path
34
- end
35
- end
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
- require 'adminpanel/product'
3
- require 'adminpanel/category'
4
-
5
- class HasManyThroughCategoryModalTest < ViewCase
6
-
7
- setup :visit_adminpanel_new_product_path
8
- teardown :teardown
9
-
10
- def test_add_remote_product_link_exist
11
- assert_link('Agregar Categoria')
12
- end
13
-
14
- def test_adding_a_remote_product_with_invalid_information
15
- trigger_modal 'Agregar Categoria'
16
- assert_equal 'Agregar Categoria', find('#modal-title').text
17
- submit_modal 'Agregar Categoria'
18
- assert_content( I18n.t('errors', model: 'Categoria', count: 1) )
19
- end
20
-
21
- def test_adding_a_remote_product_with_valid_information
22
- trigger_modal 'Agregar Categoria'
23
- fill_in 'category_name', with: 'remote option of category'
24
- submit_modal 'Agregar Categoria'
25
- assert_content('remote option of category')
26
- end
27
-
28
- private
29
-
30
- def visit_adminpanel_new_product_path
31
- visit adminpanel.signin_path
32
- login
33
- visit adminpanel.new_product_path
34
- end
35
- end
@@ -1,28 +0,0 @@
1
- require 'test_helper'
2
- module Adminpanel
3
- class GalleryzableTest < ActiveSupport::TestCase
4
-
5
- def test_sortable_funcionallity
6
- gallery = Adminpanel::Gallery.first
7
- assert_equal 1, gallery.position
8
-
9
- gallery.move_to_better_position
10
- assert_equal 1, gallery.position
11
-
12
- gallery.move_to_worst_position
13
- assert_equal 2, gallery.position
14
-
15
- assert_not_equal Adminpanel::Gallery.first, gallery
16
-
17
- Adminpanel::Gallery.find_by_position(3).move_to_better_position
18
- assert_equal Adminpanel::Gallery.last, gallery
19
-
20
- gallery.reload
21
- assert_equal 3, gallery.position
22
-
23
- gallery.move_to_worst_position
24
- assert_equal 3, gallery.position
25
- end
26
-
27
- end
28
- end