adminpanel 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/.rspec +2 -2
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +8 -8
  4. data/Gemfile +26 -24
  5. data/README.md +57 -57
  6. data/adminpanel.gemspec +41 -39
  7. data/app/assets/fonts/fontawesome-webfont.svg +254 -254
  8. data/app/assets/javascripts/adminpanel/bootstrap-datepicker.js +1159 -1159
  9. data/app/assets/javascripts/adminpanel/bootstrap-timepicker.js +803 -803
  10. data/app/assets/javascripts/adminpanel/bootstrap.js +2170 -2170
  11. data/app/assets/javascripts/adminpanel/{products.js → images_form.js} +13 -13
  12. data/app/assets/javascripts/adminpanel/imagesloaded.js +12 -12
  13. data/app/assets/javascripts/adminpanel/jquery.dataTables.min.js +155 -155
  14. data/app/assets/javascripts/adminpanel/jquery.facybox.js +395 -395
  15. data/app/assets/javascripts/adminpanel/jquery.masonry.min.js +9 -9
  16. data/app/assets/javascripts/adminpanel/jquery.slimscroll.min.js +13 -13
  17. data/app/assets/javascripts/adminpanel/medium-editor.js +702 -702
  18. data/app/assets/javascripts/adminpanel/realm.js +87 -87
  19. data/app/assets/javascripts/adminpanel/tables.js +126 -126
  20. data/app/assets/javascripts/application-admin.js +15 -15
  21. data/app/assets/stylesheets/adminpanel/_clearfix.css.scss +7 -7
  22. data/app/assets/stylesheets/adminpanel/alertify.css +241 -241
  23. data/app/assets/stylesheets/adminpanel/bootstrap.css +6103 -6103
  24. data/app/assets/stylesheets/adminpanel/colorpicker.css +6 -6
  25. data/app/assets/stylesheets/adminpanel/datepicker.css +9 -9
  26. data/app/assets/stylesheets/adminpanel/elfinder.min.css +59 -59
  27. data/app/assets/stylesheets/adminpanel/facybox.css +146 -146
  28. data/app/assets/stylesheets/adminpanel/font-awesome.min.css +33 -33
  29. data/app/assets/stylesheets/adminpanel/fullcalendar.css +618 -618
  30. data/app/assets/stylesheets/adminpanel/fullcalendar.print.css +61 -61
  31. data/app/assets/stylesheets/adminpanel/select2.css +524 -524
  32. data/app/assets/stylesheets/adminpanel/theme.css +1571 -1571
  33. data/app/assets/stylesheets/adminpanel/timepicker.css +82 -82
  34. data/app/assets/stylesheets/application-admin.css +13 -13
  35. data/app/controllers/adminpanel/application_controller.rb +32 -17
  36. data/app/controllers/adminpanel/galleries_controller.rb +80 -80
  37. data/app/controllers/adminpanel/sections_controller.rb +45 -45
  38. data/app/controllers/adminpanel/sessions_controller.rb +26 -26
  39. data/app/controllers/adminpanel/users_controller.rb +84 -84
  40. data/app/helpers/adminpanel/application_helper.rb +41 -51
  41. data/app/helpers/adminpanel/breadcrumbs_helper.rb +16 -0
  42. data/app/helpers/adminpanel/custom_form_builder.rb +248 -0
  43. data/app/helpers/adminpanel/images_helper.rb +9 -9
  44. data/app/helpers/adminpanel/rest_actions_helper.rb +47 -0
  45. data/app/helpers/adminpanel/router_helper.rb +33 -0
  46. data/app/helpers/adminpanel/sessions_helper.rb +25 -25
  47. data/app/models/adminpanel/gallery.rb +60 -60
  48. data/app/models/adminpanel/image.rb +14 -14
  49. data/app/models/adminpanel/section.rb +22 -22
  50. data/app/models/adminpanel/user.rb +35 -35
  51. data/app/uploaders/adminpanel/gallery_uploader.rb +55 -55
  52. data/app/uploaders/adminpanel/image_uploader.rb +57 -57
  53. data/app/views/adminpanel/galleries/_galleries_table.html.erb +14 -14
  54. data/app/views/adminpanel/galleries/create.html.erb +2 -2
  55. data/app/views/adminpanel/galleries/delete.html.erb +2 -2
  56. data/app/views/adminpanel/galleries/edit.html.erb +25 -25
  57. data/app/views/adminpanel/galleries/index.html.erb +51 -51
  58. data/app/views/adminpanel/galleries/new.html.erb +17 -17
  59. data/app/views/adminpanel/galleries/show.html.erb +17 -17
  60. data/app/views/adminpanel/galleries/update.html.erb +2 -2
  61. data/app/views/adminpanel/sections/_image_fields.html.erb +23 -23
  62. data/app/views/adminpanel/sections/_sections_table.html.erb +16 -16
  63. data/app/views/adminpanel/sections/create.html.erb +2 -2
  64. data/app/views/adminpanel/sections/destroy.html.erb +2 -2
  65. data/app/views/adminpanel/sections/edit.html.erb +41 -41
  66. data/app/views/adminpanel/sections/index.html.erb +44 -44
  67. data/app/views/adminpanel/sections/new.html.erb +26 -26
  68. data/app/views/adminpanel/sections/show.html.erb +30 -30
  69. data/app/views/adminpanel/sections/update.html.erb +2 -2
  70. data/app/views/adminpanel/sessions/new.html.erb +25 -25
  71. data/app/views/adminpanel/users/_user_form.html.erb +20 -20
  72. data/app/views/adminpanel/users/edit.html.erb +5 -5
  73. data/app/views/adminpanel/users/index.html.erb +49 -49
  74. data/app/views/adminpanel/users/new.html.erb +5 -5
  75. data/app/views/adminpanel/users/show.html.erb +20 -20
  76. data/app/views/layouts/_shim.html.erb +3 -3
  77. data/app/views/layouts/_side_menu.html.erb +49 -43
  78. data/app/views/layouts/_top_bar.html.erb +43 -43
  79. data/app/views/layouts/admin-login.html.erb +28 -28
  80. data/app/views/layouts/admin.html.erb +41 -39
  81. data/app/views/shared/_breadcrumb.html.erb +6 -6
  82. data/app/views/shared/_error_messages.html.erb +16 -16
  83. data/app/views/shared/_form_fields.html.erb +25 -0
  84. data/app/views/{adminpanel/products → shared}/_image_fields.html.erb +23 -23
  85. data/app/views/shared/_init_editor.html.erb +24 -0
  86. data/app/views/shared/edit.html.erb +28 -0
  87. data/app/views/shared/index.html.erb +94 -0
  88. data/app/views/shared/new.html.erb +28 -0
  89. data/app/views/shared/show.html.erb +63 -0
  90. data/config/locales/en.yml +5 -5
  91. data/config/locales/es.yml +127 -129
  92. data/config/routes.rb +24 -16
  93. data/lib/adminpanel.rb +9 -7
  94. data/lib/adminpanel/active_record_extension.rb +38 -0
  95. data/lib/adminpanel/engine.rb +5 -5
  96. data/lib/adminpanel/version.rb +3 -3
  97. data/lib/generators/adminpanel/initialize/initialize_generator.rb +17 -0
  98. data/lib/generators/adminpanel/{install/templates/migrations → initialize/templates}/create_adminpanel_tables.rb +45 -64
  99. data/lib/generators/adminpanel/resource/resource_generator.rb +105 -0
  100. data/lib/generators/adminpanel/resource/templates/controller.rb +4 -0
  101. data/lib/generators/adminpanel/resource/templates/migration.rb +9 -0
  102. data/lib/generators/adminpanel/resource/templates/resource.rb +19 -0
  103. data/spec/dummy/.gitignore +17 -17
  104. data/spec/dummy/README.rdoc +261 -261
  105. data/spec/dummy/Rakefile +7 -7
  106. data/{app/views/adminpanel/categories/show.html.erb → spec/dummy/app/adminpanel/products.rb} +0 -0
  107. data/spec/dummy/app/assets/javascripts/application.js +13 -13
  108. data/spec/dummy/app/assets/stylesheets/application.css +13 -13
  109. data/spec/dummy/app/controllers/adminpanel/.gitkeep +0 -0
  110. data/spec/dummy/app/controllers/application_controller.rb +3 -11
  111. data/spec/dummy/app/helpers/application_helper.rb +2 -2
  112. data/spec/dummy/app/views/layouts/application.html.erb +14 -14
  113. data/spec/dummy/config.ru +4 -4
  114. data/spec/dummy/config/application.rb +62 -62
  115. data/spec/dummy/config/boot.rb +9 -9
  116. data/spec/dummy/config/carrierwve.rb +5 -5
  117. data/spec/dummy/config/database.yml +24 -24
  118. data/spec/dummy/config/environment.rb +5 -5
  119. data/spec/dummy/config/environments/development.rb +41 -41
  120. data/spec/dummy/config/environments/production.rb +72 -72
  121. data/spec/dummy/config/environments/test.rb +41 -41
  122. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
  123. data/spec/dummy/config/initializers/inflections.rb +15 -15
  124. data/spec/dummy/config/initializers/mime_types.rb +5 -5
  125. data/spec/dummy/config/initializers/secret_token.rb +8 -8
  126. data/spec/dummy/config/initializers/session_store.rb +8 -8
  127. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
  128. data/spec/dummy/config/locales/en.yml +5 -5
  129. data/spec/dummy/config/routes.rb +4 -4
  130. data/spec/dummy/db/schema.rb +15 -15
  131. data/spec/dummy/public/404.html +26 -26
  132. data/spec/dummy/public/422.html +26 -26
  133. data/spec/dummy/public/500.html +25 -25
  134. data/spec/dummy/public/uploads/gallery/file/1/hipster.jpg +0 -0
  135. data/spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg +0 -0
  136. data/spec/dummy/script/rails +6 -6
  137. data/spec/features/authentication_pages_spec.rb +43 -43
  138. data/spec/features/galleries_pages_spec.rb +124 -124
  139. data/spec/features/section_pages_spec.rb +37 -37
  140. data/spec/features/user_pages_spec.rb +48 -48
  141. data/spec/generators/initialize_spec.rb +9 -0
  142. data/spec/generators/resource_spec.rb +122 -0
  143. data/spec/models/gallery_spec.rb +21 -21
  144. data/spec/models/section_spec.rb +66 -66
  145. data/spec/models/user_spec.rb +105 -105
  146. data/spec/spec_helper.rb +32 -31
  147. data/spec/support/define_factory_models.rb +25 -36
  148. data/spec/support/helper_methods.rb +26 -26
  149. data/spec/support/submit_forms_without_button.rb +16 -16
  150. data/spec/support/test_database.rb +45 -58
  151. data/spec/uploaders/gallery_uploader_spec.rb +36 -30
  152. data/spec/uploaders/image_uploader_spec.rb +30 -29
  153. metadata +208 -64
  154. checksums.yaml +0 -7
  155. data/app/assets/javascripts/adminpanel/init_editor.js +0 -28
  156. data/app/controllers/adminpanel/categories_controller.rb +0 -41
  157. data/app/controllers/adminpanel/products_controller.rb +0 -88
  158. data/app/helpers/custom_form_builder.rb +0 -219
  159. data/app/models/adminpanel/category.rb +0 -7
  160. data/app/models/adminpanel/product.rb +0 -24
  161. data/app/views/adminpanel/categories/edit.html.erb +0 -18
  162. data/app/views/adminpanel/categories/index.html.erb +0 -55
  163. data/app/views/adminpanel/categories/new.html.erb +0 -18
  164. data/app/views/adminpanel/products/.DS_Store +0 -0
  165. data/app/views/adminpanel/products/_product_form.html.erb +0 -31
  166. data/app/views/adminpanel/products/edit.html.erb +0 -10
  167. data/app/views/adminpanel/products/index.html.erb +0 -51
  168. data/app/views/adminpanel/products/new.html.erb +0 -10
  169. data/app/views/adminpanel/products/show.html.erb +0 -61
  170. data/config/database.yml +0 -24
  171. data/lib/generators/adminpanel/install/install_generator.rb +0 -12
  172. data/spec/features/categories_pages_spec.rb +0 -44
  173. data/spec/features/product_pages_spec.rb +0 -64
  174. data/spec/models/category_spec.rb +0 -58
  175. data/spec/models/product_spec.rb +0 -51
@@ -1,37 +1,26 @@
1
- include ActionDispatch::TestProcess
2
-
3
- Factory.define :user, :class => Adminpanel::User do |user|
4
- user.name "test user"
5
- user.email "email@test.com"
6
- user.password "123456"
7
- user.password_confirmation "123456"
8
- end
9
-
10
- Factory.define :category, :class => Adminpanel::Category do |category|
11
- category.name "test category"
12
- end
13
-
14
- Factory.define :product, :class => Adminpanel::Product do |product|
15
- product.name "test product"
16
- product.brief "very little description"
17
- product.description "this is a little longer description, can be very long"
18
- product.association :category, :factory => :category
19
- end
20
-
21
- Factory.define :gallery, :class => Adminpanel::Gallery do |gallery|
22
- gallery.file { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'hipster.jpg'), 'image/jpeg') }
23
- end
24
-
25
- Factory.define :image_section, :class => Adminpanel::Image do |image|
26
- image.model "Section"
27
- image.file { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'hipster.jpg'), 'image/jpeg') }
28
- end
29
-
30
- Factory.define :section_with_gallery, :class => Adminpanel::Section do |section|
31
- section.key "key"
32
- # section.description "<p>description</p>"
33
- section.has_image true
34
- section.has_description false
35
- section.name "section_name"
36
- section.page "index"
1
+ include ActionDispatch::TestProcess
2
+
3
+ Factory.define :user, :class => Adminpanel::User do |user|
4
+ user.name "test user"
5
+ user.email "email@test.com"
6
+ user.password "123456"
7
+ user.password_confirmation "123456"
8
+ end
9
+
10
+ Factory.define :gallery, :class => Adminpanel::Gallery do |gallery|
11
+ gallery.file { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'hipster.jpg'), 'image/jpeg') }
12
+ end
13
+
14
+ Factory.define :image_section, :class => Adminpanel::Image do |image|
15
+ image.model "Section"
16
+ image.file { fixture_file_upload(Rails.root.join('app', 'assets', 'images', 'hipster.jpg'), 'image/jpeg') }
17
+ end
18
+
19
+ Factory.define :section_with_gallery, :class => Adminpanel::Section do |section|
20
+ section.key "key"
21
+ # section.description "<p>description</p>"
22
+ section.has_image true
23
+ section.has_description false
24
+ section.name "section_name"
25
+ section.page "index"
37
26
  end
@@ -1,27 +1,27 @@
1
- def valid_signin(user)
2
- fill_in "inputEmail", :with => user.email
3
- fill_in "inputPassword", :with => user.password
4
- click_button "signin-button"
5
- end
6
-
7
- RSpec::Matchers::define :have_title do |text|
8
- match do |page|
9
- Capybara.string(page.body).has_selector?('title', :text => text)
10
- end
11
- end
12
-
13
- def clean_uploads_folder
14
- FileUtils.rm_rf(Dir["#{Rails.root}/public/uploads/."])
15
- end
16
-
17
- RSpec::Matchers.define(:have_image) do |src|
18
- match { |node| node.has_selector? %(img[src="#{src}"]) }
19
-
20
- failure_message_for_should do
21
- "Expected an image with src #{src.inspect}"
22
- end
23
-
24
- failure_message_for_should_not do
25
- "Found image with src #{src.inspect}!"
26
- end
1
+ def valid_signin(user)
2
+ fill_in "inputEmail", :with => user.email
3
+ fill_in "inputPassword", :with => user.password
4
+ click_button "signin-button"
5
+ end
6
+
7
+ RSpec::Matchers::define :have_title do |text|
8
+ match do |page|
9
+ Capybara.string(page.body).has_selector?('title', :text => text)
10
+ end
11
+ end
12
+
13
+ def clean_uploads_folder
14
+ FileUtils.rm_rf(Dir["#{Rails.root}/public/uploads/."])
15
+ end
16
+
17
+ RSpec::Matchers.define(:have_image) do |src|
18
+ match { |node| node.has_selector? %(img[src="#{src}"]) }
19
+
20
+ failure_message_for_should do
21
+ "Expected an image with src #{src.inspect}"
22
+ end
23
+
24
+ failure_message_for_should_not do
25
+ "Found image with src #{src.inspect}!"
26
+ end
27
27
  end
@@ -1,17 +1,17 @@
1
- class Capybara::Driver::Node
2
- def submit_form!
3
- raise NotImplementedError
4
- end
5
- end
6
-
7
- class Capybara::RackTest::Node
8
- def submit_form!
9
- Capybara::RackTest::Form.new(driver, self.native).submit({})
10
- end
11
- end
12
-
13
- class Capybara::Node::Element
14
- def submit_form!
15
- wait_until { base.submit_form! }
16
- end
1
+ class Capybara::Driver::Node
2
+ def submit_form!
3
+ raise NotImplementedError
4
+ end
5
+ end
6
+
7
+ class Capybara::RackTest::Node
8
+ def submit_form!
9
+ Capybara::RackTest::Form.new(driver, self.native).submit({})
10
+ end
11
+ end
12
+
13
+ class Capybara::Node::Element
14
+ def submit_form!
15
+ wait_until { base.submit_form! }
16
+ end
17
17
  end
@@ -1,59 +1,46 @@
1
- ActiveRecord::Migration.create_table :adminpanel_users do |t|
2
- t.string :name
3
- t.string :email
4
- t.string :password_digest
5
- t.string :remember_token
6
- t.datetime :created_at, :null => false
7
- t.datetime :updated_at, :null => false
8
- end
9
- ActiveRecord::Migration.create_table :adminpanel_categories do |t|
10
- t.string :name
11
- t.datetime :created_at, :null => false
12
- t.datetime :updated_at, :null => false
13
- end
14
- ActiveRecord::Migration.create_table :adminpanel_galleries do |t|
15
- t.string :file
16
- t.integer :position
17
- t.datetime :created_at, :null => false
18
- t.datetime :updated_at, :null => false
19
- end
20
- ActiveRecord::Migration.create_table :adminpanel_images do |t|
21
- t.string :file
22
- t.string :foreign_key
23
- t.string :model
24
- t.datetime :created_at, :null => false
25
- t.datetime :updated_at, :null => false
26
- end
27
- ActiveRecord::Migration.create_table :adminpanel_products do |t|
28
- t.string :name
29
- t.text :description
30
- t.datetime :created_at, :null => false
31
- t.datetime :updated_at, :null => false
32
- t.string :category_id
33
- t.string :brief
34
- end
35
- ActiveRecord::Migration.create_table :adminpanel_sections do |t|
36
- t.string :name
37
- t.text :description
38
- t.string :key
39
- t.boolean :has_image
40
- t.string :page
41
- t.datetime :created_at, :null => false
42
- t.datetime :updated_at, :null => false
43
- t.boolean :has_description
44
- end
45
- module ActiveModel::Validations
46
- def errors_on(attribute)
47
- self.valid?
48
- [self.errors[attribute]].flatten.compact
49
- end
50
- alias :error_on :errors_on
51
- end
52
- RSpec.configure do |config|
53
- config.around do |example|
54
- ActiveRecord::Base.transaction do
55
- example.run
56
- raise ActiveRecord::Rollback
57
- end
58
- end
1
+ ActiveRecord::Migration.create_table :adminpanel_users do |t|
2
+ t.string :name
3
+ t.string :email
4
+ t.string :password_digest
5
+ t.string :remember_token
6
+ t.datetime :created_at, :null => false
7
+ t.datetime :updated_at, :null => false
8
+ end
9
+ ActiveRecord::Migration.create_table :adminpanel_galleries do |t|
10
+ t.string :file
11
+ t.integer :position
12
+ t.datetime :created_at, :null => false
13
+ t.datetime :updated_at, :null => false
14
+ end
15
+ ActiveRecord::Migration.create_table :adminpanel_images do |t|
16
+ t.string :file
17
+ t.string :foreign_key
18
+ t.string :model
19
+ t.datetime :created_at, :null => false
20
+ t.datetime :updated_at, :null => false
21
+ end
22
+ ActiveRecord::Migration.create_table :adminpanel_sections do |t|
23
+ t.string :name
24
+ t.text :description
25
+ t.string :key
26
+ t.boolean :has_image
27
+ t.string :page
28
+ t.datetime :created_at, :null => false
29
+ t.datetime :updated_at, :null => false
30
+ t.boolean :has_description
31
+ end
32
+ module ActiveModel::Validations
33
+ def errors_on(attribute)
34
+ self.valid?
35
+ [self.errors[attribute]].flatten.compact
36
+ end
37
+ alias :error_on :errors_on
38
+ end
39
+ RSpec.configure do |config|
40
+ config.around do |example|
41
+ ActiveRecord::Base.transaction do
42
+ example.run
43
+ raise ActiveRecord::Rollback
44
+ end
45
+ end
59
46
  end
@@ -1,31 +1,37 @@
1
- require 'spec_helper'
2
- require 'support/test_database'
3
- require 'carrierwave/test/matchers'
4
-
5
- describe Adminpanel::GalleryUploader do
6
- include CarrierWave::Test::Matchers
7
-
8
- before do
9
- Adminpanel::GalleryUploader.enable_processing = true
10
- @gallery = Adminpanel::Gallery.new(:file => "test.jpg")
11
- @gallery_uploader = Adminpanel::GalleryUploader.new(@gallery, :file)
12
- @gallery_uploader.store!(File.open(Rails.root + "app/assets/images/hipster.jpg"))
13
- end
14
-
15
- after do
16
- Adminpanel::GalleryUploader.enable_processing = false
17
- @gallery_uploader.remove!
18
- end
19
-
20
- context 'the gallery.thumb version' do
21
- it "should scale down a landscape image to be exactly 200 by 200 pixels" do
22
- @gallery_uploader.thumb.should be_no_larger_than(200, 200)
23
- end
24
- end
25
-
26
- context 'the gallery.default version' do
27
- it "should scale down a landscape image to fit within 1024 by 450 pixels" do
28
- @gallery_uploader.should have_dimensions(1024, 450)
29
- end
30
- end
1
+ require 'spec_helper'
2
+ require 'support/test_database'
3
+ require 'carrierwave/test/matchers'
4
+
5
+ describe Adminpanel::GalleryUploader do
6
+ include CarrierWave::Test::Matchers
7
+
8
+ before do
9
+ Adminpanel::GalleryUploader.enable_processing = true
10
+ @gallery = Adminpanel::Gallery.new(:file => "test.jpg")
11
+ @gallery_uploader = Adminpanel::GalleryUploader.new(@gallery, :file)
12
+ @gallery_uploader.store!(File.open(Rails.root + "app/assets/images/hipster.jpg"))
13
+ end
14
+
15
+
16
+ context 'the gallery.thumb version' do
17
+ it "should scale down a landscape image to be exactly 200 by 200 pixels" do
18
+ @gallery_uploader.thumb.should be_no_larger_than(200, 200)
19
+ end
20
+
21
+ after do
22
+ Adminpanel::GalleryUploader.enable_processing = false
23
+ @gallery_uploader.remove!
24
+ end
25
+ end
26
+
27
+ context 'the gallery.default version' do
28
+ it "should scale down a landscape image to fit within 1024 by 450 pixels" do
29
+ @gallery_uploader.should have_dimensions(1024, 450)
30
+ end
31
+
32
+ after do
33
+ Adminpanel::GalleryUploader.enable_processing = false
34
+ @gallery_uploader.remove!
35
+ end
36
+ end
31
37
  end
@@ -1,30 +1,31 @@
1
- require 'spec_helper'
2
- require 'carrierwave/test/matchers'
3
-
4
- describe Adminpanel::ImageUploader do
5
- include CarrierWave::Test::Matchers
6
-
7
- before do
8
- Adminpanel::ImageUploader.enable_processing = true
9
- @image = Adminpanel::Image.new(:file => "test.jpg")
10
- @image_uploader = Adminpanel::ImageUploader.new(@image, :file)
11
- @image_uploader.store!(File.open(Rails.root + "app/assets/images/test.jpg"))
12
- end
13
-
14
- after do
15
- Adminpanel::ImageUploader.enable_processing = false
16
- @image_uploader.remove!
17
- end
18
-
19
- context 'the thumb version' do
20
- it "should scale down a landscape image to be exactly 220 by 220 pixels" do
21
- @image_uploader.thumb.should be_no_larger_than(220, 220)
22
- end
23
- end
24
-
25
- context 'the porfolio version' do
26
- it "should scale down a landscape image to be exactly 468 by 312 pixels" do
27
- @image_uploader.portfolio.should be_no_larger_than(468, 312)
28
- end
29
- end
1
+ require 'spec_helper'
2
+ require 'carrierwave/test/matchers'
3
+
4
+ describe Adminpanel::ImageUploader do
5
+ include CarrierWave::Test::Matchers
6
+
7
+ before do
8
+ Adminpanel::ImageUploader.enable_processing = true
9
+ @image = Adminpanel::Image.new(:file => "test.jpg")
10
+ @image_uploader = Adminpanel::ImageUploader.new(@image, :file)
11
+ @image_uploader.store!(File.open(Rails.root + "app/assets/images/test.jpg"))
12
+ end
13
+
14
+
15
+ context 'the thumb version' do
16
+ it "should scale down a landscape image to be exactly 220 by 220 pixels" do
17
+ @image_uploader.thumb.should be_no_larger_than(220, 220)
18
+ end
19
+ end
20
+
21
+ context 'the porfolio version' do
22
+ it "should scale down a landscape image to be exactly 468 by 312 pixels" do
23
+ @image_uploader.portfolio.should be_no_larger_than(468, 312)
24
+ end
25
+ end
26
+
27
+ after do
28
+ Adminpanel::ImageUploader.enable_processing = false
29
+ @image_uploader.remove!
30
+ end
30
31
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Jose Ramon Camacho
@@ -10,15 +16,22 @@ autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
18
 
13
- date: 2014-01-11 00:00:00 Z
19
+ date: 2014-02-06 00:00:00 -06:00
20
+ default_executable:
14
21
  dependencies:
15
22
  - !ruby/object:Gem::Dependency
16
23
  name: rails
17
24
  prerelease: false
18
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
19
27
  requirements:
20
28
  - - ~>
21
- - &id009 !ruby/object:Gem::Version
29
+ - !ruby/object:Gem::Version
30
+ hash: 23
31
+ segments:
32
+ - 3
33
+ - 2
34
+ - 12
22
35
  version: 3.2.12
23
36
  type: :runtime
24
37
  version_requirements: *id001
@@ -26,9 +39,15 @@ dependencies:
26
39
  name: carrierwave
27
40
  prerelease: false
28
41
  requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
29
43
  requirements:
30
44
  - - ~>
31
45
  - !ruby/object:Gem::Version
46
+ hash: 59
47
+ segments:
48
+ - 0
49
+ - 9
50
+ - 0
32
51
  version: 0.9.0
33
52
  type: :runtime
34
53
  version_requirements: *id002
@@ -36,9 +55,15 @@ dependencies:
36
55
  name: rmagick
37
56
  prerelease: false
38
57
  requirement: &id003 !ruby/object:Gem::Requirement
58
+ none: false
39
59
  requirements:
40
60
  - - ~>
41
61
  - !ruby/object:Gem::Version
62
+ hash: 63
63
+ segments:
64
+ - 2
65
+ - 13
66
+ - 2
42
67
  version: 2.13.2
43
68
  type: :runtime
44
69
  version_requirements: *id003
@@ -46,9 +71,15 @@ dependencies:
46
71
  name: jquery-rails
47
72
  prerelease: false
48
73
  requirement: &id004 !ruby/object:Gem::Requirement
74
+ none: false
49
75
  requirements:
50
76
  - - ~>
51
77
  - !ruby/object:Gem::Version
78
+ hash: 15
79
+ segments:
80
+ - 3
81
+ - 0
82
+ - 4
52
83
  version: 3.0.4
53
84
  type: :runtime
54
85
  version_requirements: *id004
@@ -56,118 +87,221 @@ dependencies:
56
87
  name: bcrypt-ruby
57
88
  prerelease: false
58
89
  requirement: &id005 !ruby/object:Gem::Requirement
90
+ none: false
59
91
  requirements:
60
92
  - - ~>
61
- - &id006 !ruby/object:Gem::Version
93
+ - !ruby/object:Gem::Version
94
+ hash: 7
95
+ segments:
96
+ - 3
97
+ - 0
98
+ - 0
62
99
  version: 3.0.0
63
100
  type: :runtime
64
101
  version_requirements: *id005
65
102
  - !ruby/object:Gem::Dependency
66
103
  name: rails-i18n
67
104
  prerelease: false
105
+ requirement: &id006 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ hash: 7
111
+ segments:
112
+ - 3
113
+ - 0
114
+ - 0
115
+ version: 3.0.0
116
+ type: :runtime
117
+ version_requirements: *id006
118
+ - !ruby/object:Gem::Dependency
119
+ name: inherited_resources
120
+ prerelease: false
68
121
  requirement: &id007 !ruby/object:Gem::Requirement
122
+ none: false
69
123
  requirements:
70
124
  - - ~>
71
- - *id006
125
+ - !ruby/object:Gem::Version
126
+ hash: 25
127
+ segments:
128
+ - 1
129
+ - 3
130
+ - 1
131
+ version: 1.3.1
72
132
  type: :runtime
73
133
  version_requirements: *id007
74
134
  - !ruby/object:Gem::Dependency
75
135
  name: bundler
76
136
  prerelease: false
77
137
  requirement: &id008 !ruby/object:Gem::Requirement
138
+ none: false
78
139
  requirements:
79
140
  - - ~>
80
141
  - !ruby/object:Gem::Version
142
+ hash: 9
143
+ segments:
144
+ - 1
145
+ - 3
81
146
  version: "1.3"
82
147
  type: :development
83
148
  version_requirements: *id008
84
149
  - !ruby/object:Gem::Dependency
85
150
  name: activerecord
86
151
  prerelease: false
87
- requirement: &id010 !ruby/object:Gem::Requirement
152
+ requirement: &id009 !ruby/object:Gem::Requirement
153
+ none: false
88
154
  requirements:
89
155
  - - ~>
90
- - *id009
156
+ - !ruby/object:Gem::Version
157
+ hash: 23
158
+ segments:
159
+ - 3
160
+ - 2
161
+ - 12
162
+ version: 3.2.12
91
163
  type: :development
92
- version_requirements: *id010
164
+ version_requirements: *id009
93
165
  - !ruby/object:Gem::Dependency
94
166
  name: rake
95
167
  prerelease: false
96
- requirement: &id011 !ruby/object:Gem::Requirement
168
+ requirement: &id010 !ruby/object:Gem::Requirement
169
+ none: false
97
170
  requirements:
98
- - &id012
99
- - ">="
171
+ - - ">="
100
172
  - !ruby/object:Gem::Version
173
+ hash: 3
174
+ segments:
175
+ - 0
101
176
  version: "0"
102
177
  type: :development
103
- version_requirements: *id011
178
+ version_requirements: *id010
104
179
  - !ruby/object:Gem::Dependency
105
180
  name: sqlite3
106
181
  prerelease: false
107
- requirement: &id013 !ruby/object:Gem::Requirement
182
+ requirement: &id011 !ruby/object:Gem::Requirement
183
+ none: false
108
184
  requirements:
109
- - *id012
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ hash: 3
188
+ segments:
189
+ - 0
190
+ version: "0"
110
191
  type: :development
111
- version_requirements: *id013
192
+ version_requirements: *id011
112
193
  - !ruby/object:Gem::Dependency
113
194
  name: factory_girl_rails
114
195
  prerelease: false
115
- requirement: &id014 !ruby/object:Gem::Requirement
196
+ requirement: &id012 !ruby/object:Gem::Requirement
197
+ none: false
116
198
  requirements:
117
199
  - - "="
118
200
  - !ruby/object:Gem::Version
201
+ hash: 31
202
+ segments:
203
+ - 2
204
+ - 6
205
+ - 4
119
206
  version: 2.6.4
120
207
  type: :development
121
- version_requirements: *id014
208
+ version_requirements: *id012
122
209
  - !ruby/object:Gem::Dependency
123
210
  name: rspec
124
211
  prerelease: false
125
- requirement: &id015 !ruby/object:Gem::Requirement
212
+ requirement: &id013 !ruby/object:Gem::Requirement
213
+ none: false
126
214
  requirements:
127
215
  - - ~>
128
- - &id016 !ruby/object:Gem::Version
216
+ - !ruby/object:Gem::Version
217
+ hash: 55
218
+ segments:
219
+ - 2
220
+ - 14
221
+ - 0
129
222
  version: 2.14.0
130
223
  type: :development
131
- version_requirements: *id015
224
+ version_requirements: *id013
132
225
  - !ruby/object:Gem::Dependency
133
226
  name: rspec-rails
134
227
  prerelease: false
135
- requirement: &id017 !ruby/object:Gem::Requirement
228
+ requirement: &id014 !ruby/object:Gem::Requirement
229
+ none: false
136
230
  requirements:
137
231
  - - ~>
138
- - *id016
232
+ - !ruby/object:Gem::Version
233
+ hash: 55
234
+ segments:
235
+ - 2
236
+ - 14
237
+ - 0
238
+ version: 2.14.0
139
239
  type: :development
140
- version_requirements: *id017
240
+ version_requirements: *id014
141
241
  - !ruby/object:Gem::Dependency
142
242
  name: capybara
143
243
  prerelease: false
144
- requirement: &id018 !ruby/object:Gem::Requirement
244
+ requirement: &id015 !ruby/object:Gem::Requirement
245
+ none: false
145
246
  requirements:
146
247
  - - "="
147
248
  - !ruby/object:Gem::Version
249
+ hash: 27
250
+ segments:
251
+ - 1
252
+ - 1
253
+ - 4
148
254
  version: 1.1.4
149
255
  type: :development
150
- version_requirements: *id018
256
+ version_requirements: *id015
151
257
  - !ruby/object:Gem::Dependency
152
258
  name: nokogiri
153
259
  prerelease: false
154
- requirement: &id019 !ruby/object:Gem::Requirement
260
+ requirement: &id016 !ruby/object:Gem::Requirement
261
+ none: false
155
262
  requirements:
156
263
  - - "="
157
264
  - !ruby/object:Gem::Version
265
+ hash: 17
266
+ segments:
267
+ - 1
268
+ - 5
269
+ - 9
158
270
  version: 1.5.9
159
271
  type: :development
160
- version_requirements: *id019
272
+ version_requirements: *id016
161
273
  - !ruby/object:Gem::Dependency
162
274
  name: rubyzip
163
275
  prerelease: false
164
- requirement: &id020 !ruby/object:Gem::Requirement
276
+ requirement: &id017 !ruby/object:Gem::Requirement
277
+ none: false
165
278
  requirements:
166
279
  - - "="
167
280
  - !ruby/object:Gem::Version
281
+ hash: 41
282
+ segments:
283
+ - 0
284
+ - 9
285
+ - 9
168
286
  version: 0.9.9
169
287
  type: :development
170
- version_requirements: *id020
288
+ version_requirements: *id017
289
+ - !ruby/object:Gem::Dependency
290
+ name: genspec
291
+ prerelease: false
292
+ requirement: &id018 !ruby/object:Gem::Requirement
293
+ none: false
294
+ requirements:
295
+ - - "="
296
+ - !ruby/object:Gem::Version
297
+ hash: 41
298
+ segments:
299
+ - 0
300
+ - 9
301
+ - 9
302
+ version: 0.9.9
303
+ type: :development
304
+ version_requirements: *id018
171
305
  description: Gem that makes the admin panel for a site a breeze!
172
306
  email:
173
307
  - joserracamacho@gmail.com
@@ -180,6 +314,7 @@ extra_rdoc_files: []
180
314
  files:
181
315
  - .gitignore
182
316
  - .rspec
317
+ - .ruby-version
183
318
  - .travis.yml
184
319
  - Gemfile
185
320
  - LICENSE.txt
@@ -232,14 +367,13 @@ files:
232
367
  - app/assets/javascripts/adminpanel/bootstrap-datepicker.js
233
368
  - app/assets/javascripts/adminpanel/bootstrap-timepicker.js
234
369
  - app/assets/javascripts/adminpanel/bootstrap.js
370
+ - app/assets/javascripts/adminpanel/images_form.js
235
371
  - app/assets/javascripts/adminpanel/imagesloaded.js
236
- - app/assets/javascripts/adminpanel/init_editor.js
237
372
  - app/assets/javascripts/adminpanel/jquery.dataTables.min.js
238
373
  - app/assets/javascripts/adminpanel/jquery.facybox.js
239
374
  - app/assets/javascripts/adminpanel/jquery.masonry.min.js
240
375
  - app/assets/javascripts/adminpanel/jquery.slimscroll.min.js
241
376
  - app/assets/javascripts/adminpanel/medium-editor.js
242
- - app/assets/javascripts/adminpanel/products.js
243
377
  - app/assets/javascripts/adminpanel/realm.js
244
378
  - app/assets/javascripts/adminpanel/tables.js
245
379
  - app/assets/javascripts/application-admin.js
@@ -259,29 +393,24 @@ files:
259
393
  - app/assets/stylesheets/adminpanel/timepicker.css
260
394
  - app/assets/stylesheets/application-admin.css
261
395
  - app/controllers/adminpanel/application_controller.rb
262
- - app/controllers/adminpanel/categories_controller.rb
263
396
  - app/controllers/adminpanel/galleries_controller.rb
264
- - app/controllers/adminpanel/products_controller.rb
265
397
  - app/controllers/adminpanel/sections_controller.rb
266
398
  - app/controllers/adminpanel/sessions_controller.rb
267
399
  - app/controllers/adminpanel/users_controller.rb
268
400
  - app/helpers/adminpanel/application_helper.rb
401
+ - app/helpers/adminpanel/breadcrumbs_helper.rb
402
+ - app/helpers/adminpanel/custom_form_builder.rb
269
403
  - app/helpers/adminpanel/images_helper.rb
404
+ - app/helpers/adminpanel/rest_actions_helper.rb
405
+ - app/helpers/adminpanel/router_helper.rb
270
406
  - app/helpers/adminpanel/sessions_helper.rb
271
- - app/helpers/custom_form_builder.rb
272
- - app/models/adminpanel/category.rb
273
407
  - app/models/adminpanel/gallery.rb
274
408
  - app/models/adminpanel/image.rb
275
- - app/models/adminpanel/product.rb
276
409
  - app/models/adminpanel/section.rb
277
410
  - app/models/adminpanel/user.rb
278
411
  - app/uploaders/adminpanel/gallery_uploader.rb
279
412
  - app/uploaders/adminpanel/image_uploader.rb
280
413
  - app/views/adminpanel/.DS_Store
281
- - app/views/adminpanel/categories/edit.html.erb
282
- - app/views/adminpanel/categories/index.html.erb
283
- - app/views/adminpanel/categories/new.html.erb
284
- - app/views/adminpanel/categories/show.html.erb
285
414
  - app/views/adminpanel/galleries/_galleries_table.html.erb
286
415
  - app/views/adminpanel/galleries/create.html.erb
287
416
  - app/views/adminpanel/galleries/delete.html.erb
@@ -292,13 +421,6 @@ files:
292
421
  - app/views/adminpanel/galleries/new.html.erb
293
422
  - app/views/adminpanel/galleries/show.html.erb
294
423
  - app/views/adminpanel/galleries/update.html.erb
295
- - app/views/adminpanel/products/.DS_Store
296
- - app/views/adminpanel/products/_image_fields.html.erb
297
- - app/views/adminpanel/products/_product_form.html.erb
298
- - app/views/adminpanel/products/edit.html.erb
299
- - app/views/adminpanel/products/index.html.erb
300
- - app/views/adminpanel/products/new.html.erb
301
- - app/views/adminpanel/products/show.html.erb
302
424
  - app/views/adminpanel/sections/_image_fields.html.erb
303
425
  - app/views/adminpanel/sections/_sections_table.html.erb
304
426
  - app/views/adminpanel/sections/create.html.erb
@@ -321,22 +443,35 @@ files:
321
443
  - app/views/layouts/admin.html.erb
322
444
  - app/views/shared/_breadcrumb.html.erb
323
445
  - app/views/shared/_error_messages.html.erb
324
- - config/database.yml
446
+ - app/views/shared/_form_fields.html.erb
447
+ - app/views/shared/_image_fields.html.erb
448
+ - app/views/shared/_init_editor.html.erb
449
+ - app/views/shared/edit.html.erb
450
+ - app/views/shared/index.html.erb
451
+ - app/views/shared/new.html.erb
452
+ - app/views/shared/show.html.erb
325
453
  - config/locales/en.yml
326
454
  - config/locales/es.yml
327
455
  - config/routes.rb
328
456
  - lib/adminpanel.rb
457
+ - lib/adminpanel/active_record_extension.rb
329
458
  - lib/adminpanel/engine.rb
330
459
  - lib/adminpanel/version.rb
331
- - lib/generators/adminpanel/install/install_generator.rb
332
- - lib/generators/adminpanel/install/templates/migrations/create_adminpanel_tables.rb
460
+ - lib/generators/adminpanel/initialize/initialize_generator.rb
461
+ - lib/generators/adminpanel/initialize/templates/create_adminpanel_tables.rb
462
+ - lib/generators/adminpanel/resource/resource_generator.rb
463
+ - lib/generators/adminpanel/resource/templates/controller.rb
464
+ - lib/generators/adminpanel/resource/templates/migration.rb
465
+ - lib/generators/adminpanel/resource/templates/resource.rb
333
466
  - spec/dummy/.gitignore
334
467
  - spec/dummy/README.rdoc
335
468
  - spec/dummy/Rakefile
469
+ - spec/dummy/app/adminpanel/products.rb
336
470
  - spec/dummy/app/assets/images/hipster.jpg
337
471
  - spec/dummy/app/assets/images/test.jpg
338
472
  - spec/dummy/app/assets/javascripts/application.js
339
473
  - spec/dummy/app/assets/stylesheets/application.css
474
+ - spec/dummy/app/controllers/adminpanel/.gitkeep
340
475
  - spec/dummy/app/controllers/application_controller.rb
341
476
  - spec/dummy/app/helpers/application_helper.rb
342
477
  - spec/dummy/app/mailers/.gitkeep
@@ -370,14 +505,12 @@ files:
370
505
  - spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg
371
506
  - spec/dummy/script/rails
372
507
  - spec/features/authentication_pages_spec.rb
373
- - spec/features/categories_pages_spec.rb
374
508
  - spec/features/galleries_pages_spec.rb
375
- - spec/features/product_pages_spec.rb
376
509
  - spec/features/section_pages_spec.rb
377
510
  - spec/features/user_pages_spec.rb
378
- - spec/models/category_spec.rb
511
+ - spec/generators/initialize_spec.rb
512
+ - spec/generators/resource_spec.rb
379
513
  - spec/models/gallery_spec.rb
380
- - spec/models/product_spec.rb
381
514
  - spec/models/section_spec.rb
382
515
  - spec/models/user_spec.rb
383
516
  - spec/spec_helper.rb
@@ -387,11 +520,10 @@ files:
387
520
  - spec/support/test_database.rb
388
521
  - spec/uploaders/gallery_uploader_spec.rb
389
522
  - spec/uploaders/image_uploader_spec.rb
523
+ has_rdoc: true
390
524
  homepage: https://github.com/joseramonc/adminpanel
391
525
  licenses:
392
526
  - MIT
393
- metadata: {}
394
-
395
527
  post_install_message:
396
528
  rdoc_options: []
397
529
 
@@ -399,26 +531,40 @@ require_paths:
399
531
  - lib
400
532
  - app/assets
401
533
  required_ruby_version: !ruby/object:Gem::Requirement
534
+ none: false
402
535
  requirements:
403
- - *id012
536
+ - - ">="
537
+ - !ruby/object:Gem::Version
538
+ hash: 3
539
+ segments:
540
+ - 0
541
+ version: "0"
404
542
  required_rubygems_version: !ruby/object:Gem::Requirement
543
+ none: false
405
544
  requirements:
406
- - *id012
545
+ - - ">="
546
+ - !ruby/object:Gem::Version
547
+ hash: 3
548
+ segments:
549
+ - 0
550
+ version: "0"
407
551
  requirements: []
408
552
 
409
553
  rubyforge_project:
410
- rubygems_version: 2.1.11
554
+ rubygems_version: 1.6.2
411
555
  signing_key:
412
- specification_version: 4
556
+ specification_version: 3
413
557
  summary: Developed with love for ruby 1.8.7
414
558
  test_files:
415
559
  - spec/dummy/.gitignore
416
560
  - spec/dummy/README.rdoc
417
561
  - spec/dummy/Rakefile
562
+ - spec/dummy/app/adminpanel/products.rb
418
563
  - spec/dummy/app/assets/images/hipster.jpg
419
564
  - spec/dummy/app/assets/images/test.jpg
420
565
  - spec/dummy/app/assets/javascripts/application.js
421
566
  - spec/dummy/app/assets/stylesheets/application.css
567
+ - spec/dummy/app/controllers/adminpanel/.gitkeep
422
568
  - spec/dummy/app/controllers/application_controller.rb
423
569
  - spec/dummy/app/helpers/application_helper.rb
424
570
  - spec/dummy/app/mailers/.gitkeep
@@ -452,14 +598,12 @@ test_files:
452
598
  - spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg
453
599
  - spec/dummy/script/rails
454
600
  - spec/features/authentication_pages_spec.rb
455
- - spec/features/categories_pages_spec.rb
456
601
  - spec/features/galleries_pages_spec.rb
457
- - spec/features/product_pages_spec.rb
458
602
  - spec/features/section_pages_spec.rb
459
603
  - spec/features/user_pages_spec.rb
460
- - spec/models/category_spec.rb
604
+ - spec/generators/initialize_spec.rb
605
+ - spec/generators/resource_spec.rb
461
606
  - spec/models/gallery_spec.rb
462
- - spec/models/product_spec.rb
463
607
  - spec/models/section_spec.rb
464
608
  - spec/models/user_spec.rb
465
609
  - spec/spec_helper.rb