adminpanel 0.0.4 → 0.0.5
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.
- data/.rspec +2 -0
- data/Gemfile +6 -1
- data/adminpanel.gemspec +3 -0
- data/app/controllers/adminpanel/products_controller.rb +1 -0
- data/app/models/adminpanel/image.rb +2 -0
- data/app/models/adminpanel/section.rb +4 -2
- data/app/models/adminpanel/user.rb +1 -0
- data/app/views/adminpanel/sections/edit.html.erb +5 -3
- data/app/views/adminpanel/sections/show.html.erb +5 -1
- data/config/locales/es.yml +3 -1
- data/lib/adminpanel/version.rb +1 -1
- data/spec/dummy/.gitignore +19 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/hipster.jpg +0 -0
- data/spec/dummy/app/assets/images/test.jpg +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +11 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +61 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/carrierwve.rb +6 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +72 -0
- data/spec/dummy/config/environments/test.rb +41 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +8 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/schema.rb +65 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/adminpanel/category_spec.rb +59 -0
- data/spec/models/adminpanel/gallery_spec.rb +19 -0
- data/spec/models/adminpanel/image_uploader.rb +26 -0
- data/spec/models/adminpanel/product_spec.rb +52 -0
- data/spec/models/adminpanel/section_spec.rb +58 -0
- data/spec/models/adminpanel/user_spec.rb +107 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/active_record.rb +60 -0
- data/spec/support/schema.rb +65 -0
- data/spec/uploaders/adminpanel/gallery_uploader_spec.rb +31 -0
- data/spec/uploaders/adminpanel/image_uploader_spec.rb +37 -0
- data/spec/uploaders/adminpanel/section_uploader_spec.rb +32 -0
- metadata +149 -8
- data/app/models/adminpanel/contact.rb +0 -25
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20131120070259) do
|
15
|
+
|
16
|
+
create_table "adminpanel_users", :force => true do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.string "email"
|
19
|
+
t.string "password_digest"
|
20
|
+
t.string "remember_token"
|
21
|
+
t.datetime "created_at", :null => false
|
22
|
+
t.datetime "updated_at", :null => false
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "adminpanel_categories", :force => true do |t|
|
26
|
+
t.string "name"
|
27
|
+
t.datetime "created_at", :null => false
|
28
|
+
t.datetime "updated_at", :null => false
|
29
|
+
end
|
30
|
+
|
31
|
+
create_table "adminpanel_galleries", :force => true do |t|
|
32
|
+
t.string "file"
|
33
|
+
t.datetime "created_at", :null => false
|
34
|
+
t.datetime "updated_at", :null => false
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table "adminpanel_images", :force => true do |t|
|
38
|
+
t.string "file"
|
39
|
+
t.integer "foreign_key"
|
40
|
+
t.datetime "created_at", :null => false
|
41
|
+
t.datetime "updated_at", :null => false
|
42
|
+
t.string "model"
|
43
|
+
end
|
44
|
+
|
45
|
+
create_table "adminpanel_products", :force => true do |t|
|
46
|
+
t.string "name"
|
47
|
+
t.text "description"
|
48
|
+
t.datetime "created_at", :null => false
|
49
|
+
t.datetime "updated_at", :null => false
|
50
|
+
t.integer "category_id"
|
51
|
+
t.string "brief"
|
52
|
+
end
|
53
|
+
|
54
|
+
create_table "adminpanel_sections", :force => true do |t|
|
55
|
+
t.string "name"
|
56
|
+
t.text "description"
|
57
|
+
t.string "key"
|
58
|
+
t.boolean "has_image"
|
59
|
+
t.string "file"
|
60
|
+
t.datetime "created_at", :null => false
|
61
|
+
t.datetime "updated_at", :null => false
|
62
|
+
t.boolean "has_description"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/active_record'
|
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
|
31
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/active_record'
|
3
|
+
require 'carrierwave/test/matchers'
|
4
|
+
|
5
|
+
describe Adminpanel::ImageUploader do
|
6
|
+
include CarrierWave::Test::Matchers
|
7
|
+
|
8
|
+
before do
|
9
|
+
Adminpanel::ImageUploader.enable_processing = true
|
10
|
+
@image = Adminpanel::Image.new(:file => "test.jpg")
|
11
|
+
@image_uploader = Adminpanel::ImageUploader.new(@image, :file)
|
12
|
+
@image_uploader.store!(File.open(Rails.root + "app/assets/images/test.jpg"))
|
13
|
+
end
|
14
|
+
|
15
|
+
after do
|
16
|
+
Adminpanel::ImageUploader.enable_processing = false
|
17
|
+
@image_uploader.remove!
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'the thumb version' do
|
21
|
+
it "should scale down a landscape image to be exactly 220 by 220 pixels" do
|
22
|
+
@image_uploader.thumb.should be_no_larger_than(220, 220)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'the porfolio version' do
|
27
|
+
it "should scale down a landscape image to be exactly 468 by 312 pixels" do
|
28
|
+
@image_uploader.portfolio.should be_no_larger_than(468, 312)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'the tiny version' do
|
33
|
+
it "should scale down a landscape image to fit within 400 by 307 pixels" do
|
34
|
+
@image_uploader.tiny.should have_dimensions(460, 307)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'support/active_record'
|
3
|
+
require 'carrierwave/test/matchers'
|
4
|
+
|
5
|
+
describe Adminpanel::SectionUploader do
|
6
|
+
include CarrierWave::Test::Matchers
|
7
|
+
|
8
|
+
before do
|
9
|
+
Adminpanel::SectionUploader.enable_processing = true
|
10
|
+
@section = Adminpanel::Section.new(
|
11
|
+
:file => "test.jpg",
|
12
|
+
:description => nil,
|
13
|
+
:has_image => true,
|
14
|
+
:key => "section_key",
|
15
|
+
:name => "identifier name",
|
16
|
+
:has_description => false
|
17
|
+
)
|
18
|
+
@section_uploader = Adminpanel::SectionUploader.new(@section, :file)
|
19
|
+
@section_uploader.store!(File.open(Rails.root + "app/assets/images/test.jpg"))
|
20
|
+
end
|
21
|
+
|
22
|
+
after do
|
23
|
+
Adminpanel::SectionUploader.enable_processing = false
|
24
|
+
@section_uploader.remove!
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'the section.thumb version' do
|
28
|
+
it "should scale down a landscape image to be exactly 460 by 355 pixels" do
|
29
|
+
@section_uploader.thumb.should be_no_larger_than(460, 355)
|
30
|
+
end
|
31
|
+
end\
|
32
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adminpanel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jose Ramon Camacho
|
@@ -146,9 +146,25 @@ dependencies:
|
|
146
146
|
type: :development
|
147
147
|
version_requirements: *id008
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
|
-
name:
|
149
|
+
name: activerecord
|
150
150
|
prerelease: false
|
151
151
|
requirement: &id009 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - "="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 23
|
157
|
+
segments:
|
158
|
+
- 3
|
159
|
+
- 2
|
160
|
+
- 12
|
161
|
+
version: 3.2.12
|
162
|
+
type: :development
|
163
|
+
version_requirements: *id009
|
164
|
+
- !ruby/object:Gem::Dependency
|
165
|
+
name: rake
|
166
|
+
prerelease: false
|
167
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
152
168
|
none: false
|
153
169
|
requirements:
|
154
170
|
- - ">="
|
@@ -158,7 +174,37 @@ dependencies:
|
|
158
174
|
- 0
|
159
175
|
version: "0"
|
160
176
|
type: :development
|
161
|
-
version_requirements: *
|
177
|
+
version_requirements: *id010
|
178
|
+
- !ruby/object:Gem::Dependency
|
179
|
+
name: sqlite3
|
180
|
+
prerelease: false
|
181
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
hash: 3
|
187
|
+
segments:
|
188
|
+
- 0
|
189
|
+
version: "0"
|
190
|
+
type: :development
|
191
|
+
version_requirements: *id011
|
192
|
+
- !ruby/object:Gem::Dependency
|
193
|
+
name: rspec
|
194
|
+
prerelease: false
|
195
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
197
|
+
requirements:
|
198
|
+
- - "="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 35
|
201
|
+
segments:
|
202
|
+
- 2
|
203
|
+
- 11
|
204
|
+
- 0
|
205
|
+
version: 2.11.0
|
206
|
+
type: :development
|
207
|
+
version_requirements: *id012
|
162
208
|
description: Gem that makes the admin panel for a site a breeze!
|
163
209
|
email:
|
164
210
|
- joserracamacho@gmail.com
|
@@ -170,6 +216,7 @@ extra_rdoc_files: []
|
|
170
216
|
|
171
217
|
files:
|
172
218
|
- .gitignore
|
219
|
+
- .rspec
|
173
220
|
- Gemfile
|
174
221
|
- LICENSE.txt
|
175
222
|
- README.md
|
@@ -258,7 +305,6 @@ files:
|
|
258
305
|
- app/helpers/adminpanel/sessions_helper.rb
|
259
306
|
- app/helpers/custom_form_builder.rb
|
260
307
|
- app/models/adminpanel/category.rb
|
261
|
-
- app/models/adminpanel/contact.rb
|
262
308
|
- app/models/adminpanel/gallery.rb
|
263
309
|
- app/models/adminpanel/image.rb
|
264
310
|
- app/models/adminpanel/product.rb
|
@@ -315,6 +361,54 @@ files:
|
|
315
361
|
- lib/adminpanel/version.rb
|
316
362
|
- lib/generators/adminpanel/install/install_generator.rb
|
317
363
|
- lib/generators/adminpanel/install/templates/migrations/create_adminpanel_tables.rb
|
364
|
+
- spec/dummy/.gitignore
|
365
|
+
- spec/dummy/README.rdoc
|
366
|
+
- spec/dummy/Rakefile
|
367
|
+
- spec/dummy/app/assets/images/hipster.jpg
|
368
|
+
- spec/dummy/app/assets/images/test.jpg
|
369
|
+
- spec/dummy/app/assets/javascripts/application.js
|
370
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
371
|
+
- spec/dummy/app/controllers/application_controller.rb
|
372
|
+
- spec/dummy/app/helpers/application_helper.rb
|
373
|
+
- spec/dummy/app/mailers/.gitkeep
|
374
|
+
- spec/dummy/app/models/.gitkeep
|
375
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
376
|
+
- spec/dummy/config.ru
|
377
|
+
- spec/dummy/config/application.rb
|
378
|
+
- spec/dummy/config/boot.rb
|
379
|
+
- spec/dummy/config/carrierwve.rb
|
380
|
+
- spec/dummy/config/environment.rb
|
381
|
+
- spec/dummy/config/environments/development.rb
|
382
|
+
- spec/dummy/config/environments/production.rb
|
383
|
+
- spec/dummy/config/environments/test.rb
|
384
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
385
|
+
- spec/dummy/config/initializers/inflections.rb
|
386
|
+
- spec/dummy/config/initializers/mime_types.rb
|
387
|
+
- spec/dummy/config/initializers/secret_token.rb
|
388
|
+
- spec/dummy/config/initializers/session_store.rb
|
389
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
390
|
+
- spec/dummy/config/locales/en.yml
|
391
|
+
- spec/dummy/config/routes.rb
|
392
|
+
- spec/dummy/db/schema.rb
|
393
|
+
- spec/dummy/lib/assets/.gitkeep
|
394
|
+
- spec/dummy/log/.gitkeep
|
395
|
+
- spec/dummy/public/404.html
|
396
|
+
- spec/dummy/public/422.html
|
397
|
+
- spec/dummy/public/500.html
|
398
|
+
- spec/dummy/public/favicon.ico
|
399
|
+
- spec/dummy/script/rails
|
400
|
+
- spec/models/adminpanel/category_spec.rb
|
401
|
+
- spec/models/adminpanel/gallery_spec.rb
|
402
|
+
- spec/models/adminpanel/image_uploader.rb
|
403
|
+
- spec/models/adminpanel/product_spec.rb
|
404
|
+
- spec/models/adminpanel/section_spec.rb
|
405
|
+
- spec/models/adminpanel/user_spec.rb
|
406
|
+
- spec/spec_helper.rb
|
407
|
+
- spec/support/active_record.rb
|
408
|
+
- spec/support/schema.rb
|
409
|
+
- spec/uploaders/adminpanel/gallery_uploader_spec.rb
|
410
|
+
- spec/uploaders/adminpanel/image_uploader_spec.rb
|
411
|
+
- spec/uploaders/adminpanel/section_uploader_spec.rb
|
318
412
|
homepage: https://github.com/joseramonc/adminpanel
|
319
413
|
licenses:
|
320
414
|
- MIT
|
@@ -349,5 +443,52 @@ rubygems_version: 1.8.24
|
|
349
443
|
signing_key:
|
350
444
|
specification_version: 3
|
351
445
|
summary: Developed with love for ruby 1.8.7
|
352
|
-
test_files:
|
353
|
-
|
446
|
+
test_files:
|
447
|
+
- spec/dummy/.gitignore
|
448
|
+
- spec/dummy/README.rdoc
|
449
|
+
- spec/dummy/Rakefile
|
450
|
+
- spec/dummy/app/assets/images/hipster.jpg
|
451
|
+
- spec/dummy/app/assets/images/test.jpg
|
452
|
+
- spec/dummy/app/assets/javascripts/application.js
|
453
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
454
|
+
- spec/dummy/app/controllers/application_controller.rb
|
455
|
+
- spec/dummy/app/helpers/application_helper.rb
|
456
|
+
- spec/dummy/app/mailers/.gitkeep
|
457
|
+
- spec/dummy/app/models/.gitkeep
|
458
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
459
|
+
- spec/dummy/config.ru
|
460
|
+
- spec/dummy/config/application.rb
|
461
|
+
- spec/dummy/config/boot.rb
|
462
|
+
- spec/dummy/config/carrierwve.rb
|
463
|
+
- spec/dummy/config/environment.rb
|
464
|
+
- spec/dummy/config/environments/development.rb
|
465
|
+
- spec/dummy/config/environments/production.rb
|
466
|
+
- spec/dummy/config/environments/test.rb
|
467
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
468
|
+
- spec/dummy/config/initializers/inflections.rb
|
469
|
+
- spec/dummy/config/initializers/mime_types.rb
|
470
|
+
- spec/dummy/config/initializers/secret_token.rb
|
471
|
+
- spec/dummy/config/initializers/session_store.rb
|
472
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
473
|
+
- spec/dummy/config/locales/en.yml
|
474
|
+
- spec/dummy/config/routes.rb
|
475
|
+
- spec/dummy/db/schema.rb
|
476
|
+
- spec/dummy/lib/assets/.gitkeep
|
477
|
+
- spec/dummy/log/.gitkeep
|
478
|
+
- spec/dummy/public/404.html
|
479
|
+
- spec/dummy/public/422.html
|
480
|
+
- spec/dummy/public/500.html
|
481
|
+
- spec/dummy/public/favicon.ico
|
482
|
+
- spec/dummy/script/rails
|
483
|
+
- spec/models/adminpanel/category_spec.rb
|
484
|
+
- spec/models/adminpanel/gallery_spec.rb
|
485
|
+
- spec/models/adminpanel/image_uploader.rb
|
486
|
+
- spec/models/adminpanel/product_spec.rb
|
487
|
+
- spec/models/adminpanel/section_spec.rb
|
488
|
+
- spec/models/adminpanel/user_spec.rb
|
489
|
+
- spec/spec_helper.rb
|
490
|
+
- spec/support/active_record.rb
|
491
|
+
- spec/support/schema.rb
|
492
|
+
- spec/uploaders/adminpanel/gallery_uploader_spec.rb
|
493
|
+
- spec/uploaders/adminpanel/image_uploader_spec.rb
|
494
|
+
- spec/uploaders/adminpanel/section_uploader_spec.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
class Contact
|
3
|
-
include ActiveModel::Validations
|
4
|
-
include ActiveModel::Conversion
|
5
|
-
extend ActiveModel::Naming
|
6
|
-
|
7
|
-
attr_accessor :name, :email, :subject, :body
|
8
|
-
|
9
|
-
validates_presence_of :name
|
10
|
-
validates_format_of :email, :with => /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
|
11
|
-
validates_presence_of :email
|
12
|
-
validates_presence_of :subject
|
13
|
-
validates_presence_of :body
|
14
|
-
|
15
|
-
def initialize(attributes = {})
|
16
|
-
attributes.each do |name, value|
|
17
|
-
send("#{name}=", value)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def persisted?
|
22
|
-
false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|