poodle-rb 0.1.2 → 0.1.3

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/poodle/application.js +1 -2
  3. data/app/assets/javascripts/poodle/cropper.js +1525 -0
  4. data/app/assets/javascripts/poodle/utilities.js +23 -7
  5. data/app/assets/stylesheets/poodle/poodle-theme.css +18 -1
  6. data/app/controllers/poodle/admin_controller.rb +0 -26
  7. data/app/controllers/poodle/images_controller.rb +65 -0
  8. data/app/helpers/poodle/image_helper.rb +171 -31
  9. data/app/helpers/poodle/render_helper.rb +31 -0
  10. data/{spec/dummy/app → app}/uploaders/image_uploader.rb +19 -22
  11. data/app/views/layouts/poodle/application/_footer.html.erb +1 -1
  12. data/app/views/layouts/poodle/application.html.erb +7 -3
  13. data/app/views/layouts/poodle/image_upload.html.erb +16 -0
  14. data/app/views/layouts/poodle/public/_footer.html.erb +2 -4
  15. data/app/views/layouts/poodle/public/_header.html.erb +1 -3
  16. data/app/views/layouts/poodle/public/public.html.erb +51 -0
  17. data/app/views/layouts/poodle/public.html.erb +8 -5
  18. data/lib/poodle/action_view/theme_helper.rb +0 -76
  19. data/lib/poodle/engine.rb +2 -0
  20. data/lib/poodle/version.rb +1 -1
  21. data/spec/dummy/app/controllers/profile_pictures_controller.rb +2 -0
  22. data/spec/dummy/app/models/image/base.rb +30 -0
  23. data/spec/dummy/app/models/image/profile_picture.rb +2 -0
  24. data/spec/dummy/app/models/user.rb +1 -1
  25. data/spec/dummy/app/views/profile_pictures/_crop_form.html.erb +44 -0
  26. data/spec/dummy/app/views/profile_pictures/_form.html.erb +41 -0
  27. data/spec/dummy/app/views/profile_pictures/_new.html.erb +9 -0
  28. data/spec/dummy/app/views/profile_pictures/_photos.html.erb +16 -0
  29. data/spec/dummy/app/views/profile_pictures/create.html.erb +10 -0
  30. data/spec/dummy/app/views/profile_pictures/crop.html.erb +5 -0
  31. data/spec/dummy/app/views/profile_pictures/edit.js.erb +7 -0
  32. data/spec/dummy/app/views/profile_pictures/new.js.erb +7 -0
  33. data/spec/dummy/app/views/profile_pictures/update.html.erb +10 -0
  34. data/spec/dummy/app/views/profile_pictures/update.js.erb +2 -0
  35. data/spec/dummy/config/initializers/carrier_wave.rb +2 -0
  36. data/spec/dummy/config/routes.rb +15 -1
  37. data/spec/dummy/db/migrate/20131108102728_create_images.rb +12 -0
  38. data/spec/dummy/db/schema.rb +5 -2
  39. data/spec/dummy/db/test.sqlite3 +0 -0
  40. data/{app/assets/javascripts/poodle/common.js → spec/dummy/log/development.log} +0 -0
  41. data/spec/dummy/log/test.log +11173 -0
  42. data/spec/dummy/spec/controllers/profile_pictures_controller_spec.rb +50 -0
  43. data/spec/dummy/spec/helpers/image_helper_spec.rb +129 -0
  44. data/spec/dummy/spec/helpers/theme_helper_spec.rb +14 -43
  45. data/spec/dummy/spec/support/factories/profile_pictures.rb +2 -2
  46. data/spec/dummy/spec/support/factories/users.rb +1 -1
  47. data/spec/dummy/{public/uploads/profile_picture/image → uploads/image/profile_picture}/1/large_test.jpg +0 -0
  48. data/spec/dummy/uploads/image/profile_picture/1/medium_test.jpg +0 -0
  49. data/spec/dummy/{public/uploads/profile_picture/image → uploads/image/profile_picture}/1/test.jpg +0 -0
  50. data/spec/dummy/{public/uploads/profile_picture/image → uploads/image/profile_picture}/1/thumb_test.jpg +0 -0
  51. data/spec/dummy/uploads/image/profile_picture/2/large_test.jpg +0 -0
  52. data/spec/dummy/uploads/image/profile_picture/2/medium_test.jpg +0 -0
  53. data/spec/dummy/uploads/image/profile_picture/2/test.jpg +0 -0
  54. data/spec/dummy/uploads/image/profile_picture/2/thumb_test.jpg +0 -0
  55. metadata +60 -18
  56. data/app/assets/javascripts/poodle/photo_upload.js +0 -104
  57. data/spec/dummy/app/models/profile_picture.rb +0 -8
  58. data/spec/dummy/db/migrate/20131108102728_create_profile_pictures.rb +0 -9
  59. data/spec/dummy/public/uploads/profile_picture/image/1/medium_test.jpg +0 -0
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe ProfilePicturesController, :type => :controller do
4
+
5
+ let(:user) {FactoryGirl.create(:user)}
6
+ let(:user_with_image) {FactoryGirl.create(:user_with_image)}
7
+
8
+ context "new" do
9
+ it "should display the form" do
10
+ xhr :get, :new, {image_type: "Image::ProfilePicture", imageable_type: "User", imageable_id: user.id}, {}
11
+ expect(assigns(:image)).to be_a Image::ProfilePicture
12
+ expect(assigns(:resource)).to eq(user)
13
+ expect(response.code).to eq("200")
14
+ end
15
+ end
16
+
17
+ context "create" do
18
+ it "positive case" do
19
+ image = Rack::Test::UploadedFile.new(Rails.root + 'spec/support/factories/test.jpg', 'image/jpg')
20
+ valid_params = {image: image, image_type: "Image::ProfilePicture", imageable_type: "User", imageable_id: user.id}
21
+ post :create, valid_params, {}
22
+ expect(assigns(:image)).to be_a Image::ProfilePicture
23
+ expect(assigns(:resource)).to eq(user)
24
+ expect(Image::ProfilePicture.count).to eq 1
25
+ expect(response.status).to eq(200)
26
+ end
27
+ end
28
+
29
+ context "edit" do
30
+ it "should display the form" do
31
+ xhr :get, :edit, {id: user_with_image.profile_picture.id, image_type: "Image::ProfilePicture", imageable_type: "User", imageable_id: user_with_image.id}, {}
32
+ expect(assigns(:image)).to be_a Image::ProfilePicture
33
+ expect(assigns(:resource)).to eq(user_with_image)
34
+ expect(response.code).to eq("200")
35
+ end
36
+ end
37
+
38
+ context "update" do
39
+ it "positive case" do
40
+ image = Rack::Test::UploadedFile.new(Rails.root + 'spec/support/factories/test.jpg', 'image/jpg')
41
+ valid_params = {id: user_with_image.profile_picture.id, image: image, image_type: "Image::ProfilePicture", imageable_type: "User", imageable_id: user_with_image.id}
42
+ put :update, valid_params, {}
43
+ expect(assigns(:image)).to be_a Image::ProfilePicture
44
+ expect(assigns(:resource)).to eq(user_with_image)
45
+ expect(Image::ProfilePicture.count).to eq 1
46
+ expect(response.status).to eq(200)
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,129 @@
1
+ require 'spec_helper'
2
+
3
+ module Poodle
4
+ module ActionView
5
+ describe ImageHelper, type: :helper do
6
+
7
+ let(:user) { FactoryGirl.create(:user) }
8
+ let(:user_with_image) { FactoryGirl.create(:user_with_image, name: "Some Name") }
9
+
10
+ describe '#placeholdit' do
11
+ it "should return placeholdit url" do
12
+ expect(helper.placeholdit()).to eq("http://placehold.it/60x60&text=<No Image>")
13
+ expect(helper.placeholdit(width: 60, height: 40, text: "Not Found")).to eq("http://placehold.it/60x40&text=Not Found")
14
+ end
15
+ end
16
+
17
+ describe '#image_url' do
18
+ it "should return placeholder url for user without profile picture" do
19
+ expect(helper.image_url(user, "profile_picture.image.large.url")).to eq("http://placehold.it/60x60&text=<No Image>")
20
+ expect(helper.image_url(user, "profile_picture.image.thumb.url", width: 40, height: 10)).to eq("http://placehold.it/40x10&text=<No Image>")
21
+ end
22
+
23
+ it "should return careerwave url for user with profile picture" do
24
+ expect(helper.image_url(user_with_image, "profile_picture.image.large.url")).to eq("/spec/dummy/uploads/image/profile_picture/1/large_test.jpg")
25
+ expect(helper.image_url(user_with_image, "profile_picture.image.thumb.url")).to eq("/spec/dummy/uploads/image/profile_picture/1/thumb_test.jpg")
26
+ end
27
+ end
28
+
29
+ describe '#display_image' do
30
+ it "should return image tag with placeholder url for user without profile picture" do
31
+ exptected_result = image_tag(placeholdit(), class: "#{user.id}-poodle-thumb-image", width: "100%", height: "auto")
32
+ expect(helper.display_image(user, 'profile_picture.image.large.url')).to eq(exptected_result)
33
+
34
+ exptected_result = image_tag(placeholdit(width: 40, height: 50, text: "Hello World"), class: "#{user.id}-poodle-thumb-image", width: "100%", height: "auto")
35
+ expect(helper.display_image(user, 'profile_picture.image.large.url', place_holder: {width: 40, height: 50, text: "Hello World"})).to eq(exptected_result)
36
+ end
37
+
38
+ it "should return image tag with careerwave url for user with profile picture" do
39
+ exptected_result = image_tag(user_with_image.profile_picture.image.thumb.url, class: "#{user_with_image.id}-poodle-thumb-image", width: "100%", height: "auto")
40
+ expect(helper.display_image(user_with_image, 'profile_picture.image.thumb.url')).to eq(exptected_result)
41
+
42
+ exptected_result = image_tag(user_with_image.profile_picture.image.thumb.url, class: "#{user_with_image.id}-poodle-thumb-image", width: "30px", height: "50px")
43
+ expect(helper.display_image(user_with_image, 'profile_picture.image.thumb.url', width: "30px", height: "50px")).to eq(exptected_result)
44
+ end
45
+ end
46
+
47
+ describe '#display_user_image' do
48
+ it "should display placeholder image for user without image" do
49
+ exptected_result = content_tag(:div) do
50
+ content_tag(:div, class: "rounded", style: "width:60px;height:auto") do
51
+ image_tag(placeholdit(), {style: "width:100%;height:auto;cursor:default;", class: "#{user.id}-poodle-thumb-image"})
52
+ end
53
+ end
54
+ expect(helper.display_user_image(user, "profile_picture.image.thumb.url")).to eq(exptected_result)
55
+ end
56
+
57
+ it "should display placeholder image with custom width, height and text for user without image" do
58
+ exptected_result = content_tag(:div) do
59
+ content_tag(:div, class: "rounded", style: "width:60px;height:auto") do
60
+ image_tag(placeholdit(width: 100, height: 80, text: "Hello World"), {style: "width:100%;height:auto;cursor:default;", class: "#{user.id}-poodle-thumb-image"})
61
+ end
62
+ end
63
+ expect(helper.display_user_image(user, "profile_picture.image.thumb.url", place_holder: {width: 100, height: 80, text: "Hello World"})).to eq(exptected_result)
64
+ end
65
+
66
+ it "should display the profile picture for user with image" do
67
+ exptected_result = content_tag(:div) do
68
+ content_tag(:div, class: "rounded", style: "width:120px;height:auto") do
69
+ image_tag(user_with_image.profile_picture.image.thumb.url, {style: "width:100%;height:auto;cursor:default;", class: "#{user_with_image.id}-poodle-thumb-image"})
70
+ end
71
+ end
72
+ expect(helper.display_user_image(user_with_image, "profile_picture.image.thumb.url", width: "120px")).to eq(exptected_result)
73
+ end
74
+
75
+ it "should display the profile picture with popover" do
76
+ exptected_result = content_tag(:div) do
77
+ content_tag(:div, class: "rounded", style: "width:120px;height:auto") do
78
+ image_tag(user_with_image.profile_picture.image.thumb.url, {style: "width:100%;height:auto;cursor:pointer;", class: "#{user_with_image.id}-poodle-thumb-image", "data-toggle" => "popover", "data-placement" => "bottom", title: user_with_image.name, "data-content" => ""})
79
+ end
80
+ end
81
+ expect(helper.display_user_image(user_with_image, "profile_picture.image.thumb.url", width: "120px", popover: true)).to eq(exptected_result)
82
+
83
+ exptected_result = content_tag(:div) do
84
+ content_tag(:div, class: "rounded", style: "width:120px;height:auto") do
85
+ image_tag(user_with_image.profile_picture.image.thumb.url, {style: "width:100%;height:auto;cursor:pointer;", class: "#{user_with_image.id}-poodle-thumb-image", "data-toggle" => "popover", "data-placement" => "bottom", title: user_with_image.name, "data-content" => "Senior Engineer"})
86
+ end
87
+ end
88
+ expect(helper.display_user_image(user_with_image, "profile_picture.image.thumb.url", width: "120px", popover: "Senior Engineer")).to eq(exptected_result)
89
+ end
90
+ end
91
+
92
+ describe '#edit_image' do
93
+ it "should return an image with edit link" do
94
+ img_tag = helper.display_image(user, "profile_picture.image.thumb.url")
95
+ btn_display = raw(helper.theme_fa_icon('photo') + helper.theme_button_text("Change Image"))
96
+ edit_url = "www.qwinixtech.com"
97
+ exptected_result = link_to(img_tag, edit_url, :remote => true) + link_to(btn_display, edit_url, :class=>"btn btn-default btn-xs mt-10", :remote=>true)
98
+ expect(helper.edit_image(user, "profile_picture.image.thumb.url", edit_url)).to eq(exptected_result)
99
+ end
100
+ end
101
+
102
+ describe '#edit_user_image' do
103
+ it "should return an image with edit link" do
104
+ img_tag = helper.display_user_image(user, "profile_picture.image.thumb.url")
105
+ btn_display = raw(helper.theme_fa_icon('photo') + helper.theme_button_text("Change Image"))
106
+ edit_url = "www.qwinixtech.com"
107
+ exptected_result = link_to(img_tag, edit_url, :remote => true) + link_to(btn_display, edit_url, :class=>"btn btn-default btn-xs mt-10", :remote=>true)
108
+ expect(helper.edit_user_image(user, "profile_picture.image.thumb.url", edit_url)).to eq(exptected_result)
109
+ end
110
+ end
111
+
112
+ describe '#upload_image_link' do
113
+ it "should return new image path for user with no profile picture" do
114
+ expect(helper.upload_image_link(user, :profile_picture, nil)).to eq("/images/new?image_type=Image%3A%3AProfilePicture&imageable_id=#{user.id}&imageable_type=User")
115
+ end
116
+
117
+ it "should return edit image path for user with profile picture" do
118
+ expect(helper.upload_image_link(user_with_image, :profile_picture, nil)).to eq("/images/1/edit?image_type=Image%3A%3AProfilePicture&imageable_id=#{user_with_image.id}&imageable_type=User")
119
+ end
120
+
121
+ it "should return edit image path for user with profile picture for custom scope" do
122
+ expect(helper.upload_image_link(user, :profile_picture, :custom)).to eq("/custom/images/new?image_type=Image%3A%3AProfilePicture&imageable_id=#{user.id}&imageable_type=User")
123
+ expect(helper.upload_image_link(user_with_image, :profile_picture, :custom)).to eq("/custom/images/1/edit?image_type=Image%3A%3AProfilePicture&imageable_id=#{user_with_image.id}&imageable_type=User")
124
+ end
125
+ end
126
+
127
+ end
128
+ end
129
+ end
@@ -4,6 +4,9 @@ module Poodle
4
4
  module ActionView
5
5
  describe ThemeHelper, type: :helper do
6
6
 
7
+ let(:user) { FactoryGirl.create(:user) }
8
+ let(:user_with_image) { FactoryGirl.create(:user_with_image, name: "Some Name") }
9
+
7
10
  describe '#theme_fa_icon' do
8
11
  it "theme_fa_icon" do
9
12
  expect(helper.theme_fa_icon("some-class")).to eq("<i class='fa fa-some-class'></i>")
@@ -48,7 +51,7 @@ module Poodle
48
51
 
49
52
  describe '#theme_heading' do
50
53
  it "theme_heading" do
51
- expect(helper.theme_heading("Heading Text")).to eq("<div class=\"row mb-10\"><div class=\"fs-22 col-sm-12\"><i class='fa fa-rub fa-lg'></i> Heading Text</div></div>")
54
+ expect(helper.theme_heading("Heading Text")).to eq("<div class=\"row mb-10\"><div class=\"fs-22 col-sm-12\"><i class='fa fa- fa-lg'></i> Heading Text</div></div>")
52
55
  expect(helper.theme_heading("Heading Text2", icon='icon-abcd')).to eq("<div class=\"row mb-10\"><div class=\"fs-22 col-sm-12\"><i class='fa fa-icon-abcd fa-lg'></i> Heading Text2</div></div>")
53
56
  end
54
57
  end
@@ -73,16 +76,6 @@ module Poodle
73
76
  end
74
77
  end
75
78
 
76
- describe '#theme_panel_message' do
77
- it "theme_panel_message" do
78
- end
79
- end
80
-
81
- describe '#theme_panel_title' do
82
- it "theme_panel_title" do
83
- end
84
- end
85
-
86
79
  describe '#theme_item_title' do
87
80
  it "theme_item_title" do
88
81
  end
@@ -108,50 +101,28 @@ module Poodle
108
101
  end
109
102
  end
110
103
 
111
- describe '#theme_panel_heading' do
112
- it "theme_panel_heading" do
113
- end
114
- end
115
-
116
- describe '#theme_panel_sub_heading' do
117
- it "theme_panel_sub_heading" do
104
+ describe '#theme_panel_message' do
105
+ it "theme_panel_message" do
118
106
  end
119
107
  end
120
108
 
121
- describe '#theme_panel_description' do
122
- it "theme_panel_description" do
109
+ describe '#theme_panel_title' do
110
+ it "theme_panel_title" do
123
111
  end
124
112
  end
125
113
 
126
- describe '#theme_image' do
127
- it "theme_image" do
114
+ describe '#theme_panel_heading' do
115
+ it "theme_panel_heading" do
128
116
  end
129
117
  end
130
118
 
131
- describe '#palceholdit' do
132
- it "palceholdit" do
133
- expect(helper.palceholdit()).to eq("http://placehold.it/60x60&text=<No Image>")
134
- expect(helper.palceholdit(width: 60, height: 40, text: "Not Found")).to eq("http://placehold.it/60x40&text=Not Found")
119
+ describe '#theme_panel_sub_heading' do
120
+ it "theme_panel_sub_heading" do
135
121
  end
136
122
  end
137
123
 
138
- describe '#theme_user_image' do
139
- let(:user) { FactoryGirl.create(:user) }
140
- let(:user_with_image) { FactoryGirl.create(:user_with_image, name: "Some Name") }
141
- it "should display placeholder image for user without image" do
142
- expect(helper.theme_user_image(user, "profile_picture.image_url(:thumb)")).to eq("<div><div class=\"rounded\" style=\"width:60px;height:60px;\"><img class=\"\" style=\"width:100%;height:auto;cursor:pointer;\" src=\"http://placehold.it/60x60&amp;text=&lt;No Image&gt;\" alt=\"60x60&amp;text=&lt;no image&gt;\" /></div></div>")
143
- end
144
-
145
- it "should display the profile picture user with image" do
146
- # data-toggle=\"popover\" data-placement=\"bottom\" title=\"Some Name\" data-content=\"true\"
147
- expect(helper.theme_user_image(user_with_image, "profile_picture.image_url(:thumb)")).to eq("<div><div class=\"rounded\" style=\"width:60px;height:60px;\"><img class=\"\" style=\"width:100%;height:auto;cursor:pointer;\" src=\"http://localhost:9001/uploads/profile_picture/image/1/thumb_test.jpg\" alt=\"Thumb test\" /></div></div>")
148
- end
149
-
150
- it "should display the profile picture with popover" do
151
- expect(helper.theme_user_image(user_with_image, "profile_picture.image_url(:thumb)", popover: true)).to eq("<div><div class=\"rounded\" style=\"width:60px;height:60px;\"><img class=\"\" style=\"width:100%;height:auto;cursor:pointer;\" data-toggle=\"popover\" data-placement=\"bottom\" title=\"Some Name\" data-content=\"\" src=\"http://localhost:9001/uploads/profile_picture/image/1/thumb_test.jpg\" alt=\"Thumb test\" /></div></div>")
152
-
153
- expect(helper.theme_user_image(user_with_image, "profile_picture.image_url(:thumb)", popover:
154
- "Hello")).to eq("<div><div class=\"rounded\" style=\"width:60px;height:60px;\"><img class=\"\" style=\"width:100%;height:auto;cursor:pointer;\" data-toggle=\"popover\" data-placement=\"bottom\" title=\"Some Name\" data-content=\"Hello\" src=\"http://localhost:9001/uploads/profile_picture/image/1/thumb_test.jpg\" alt=\"Thumb test\" /></div></div>")
124
+ describe '#theme_panel_description' do
125
+ it "theme_panel_description" do
155
126
  end
156
127
  end
157
128
 
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
- factory :profile_picture do
2
+ factory :profile_picture, :class => Image::ProfilePicture do
3
3
  image { Rack::Test::UploadedFile.new(Rails.root + 'spec/support/factories/test.jpg', 'image/jpg') }
4
- user
4
+ association :imageable, :factory => :user
5
5
  end
6
6
  end
@@ -6,7 +6,7 @@ FactoryGirl.define do
6
6
 
7
7
  factory :user_with_image, parent: :user do
8
8
  after(:create) do |user|
9
- FactoryGirl.create(:profile_picture, user: user)
9
+ FactoryGirl.create(:profile_picture, imageable: user)
10
10
  end
11
11
  end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poodle-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krishnaprasad Varma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-16 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari
@@ -309,8 +309,7 @@ files:
309
309
  - app/assets/fonts/fontawesome-webfont.woff
310
310
  - app/assets/javascripts/poodle/application.js
311
311
  - app/assets/javascripts/poodle/bootstrap.js
312
- - app/assets/javascripts/poodle/common.js
313
- - app/assets/javascripts/poodle/photo_upload.js
312
+ - app/assets/javascripts/poodle/cropper.js
314
313
  - app/assets/javascripts/poodle/utilities.js
315
314
  - app/assets/javascripts/poodle/validations/sample.js
316
315
  - app/assets/stylesheets/poodle/application.css
@@ -319,6 +318,7 @@ files:
319
318
  - app/assets/stylesheets/poodle/font-awesome.css
320
319
  - app/assets/stylesheets/poodle/poodle-theme.css
321
320
  - app/controllers/poodle/admin_controller.rb
321
+ - app/controllers/poodle/images_controller.rb
322
322
  - app/helpers/poodle/application_helper.rb
323
323
  - app/helpers/poodle/display_helper.rb
324
324
  - app/helpers/poodle/flash_helper.rb
@@ -326,8 +326,10 @@ files:
326
326
  - app/helpers/poodle/meta_tags_helper.rb
327
327
  - app/helpers/poodle/navigation_helper.rb
328
328
  - app/helpers/poodle/params_parser_helper.rb
329
+ - app/helpers/poodle/render_helper.rb
329
330
  - app/helpers/poodle/title_helper.rb
330
331
  - app/helpers/poodle/url_helper.rb
332
+ - app/uploaders/image_uploader.rb
331
333
  - app/views/kaminari/_first_page.html.erb
332
334
  - app/views/kaminari/_gap.html.erb
333
335
  - app/views/kaminari/_last_page.html.erb
@@ -340,9 +342,11 @@ files:
340
342
  - app/views/layouts/poodle/application/_header.html.erb
341
343
  - app/views/layouts/poodle/application/_sidebar.html.erb
342
344
  - app/views/layouts/poodle/common/_overlays.html.erb
345
+ - app/views/layouts/poodle/image_upload.html.erb
343
346
  - app/views/layouts/poodle/public.html.erb
344
347
  - app/views/layouts/poodle/public/_footer.html.erb
345
348
  - app/views/layouts/poodle/public/_header.html.erb
349
+ - app/views/layouts/poodle/public/public.html.erb
346
350
  - app/views/widgets/_more_details.html.erb
347
351
  - app/views/widgets/_more_details_table.html.erb
348
352
  - config/initializers/poodle_validators.rb
@@ -363,11 +367,22 @@ files:
363
367
  - spec/dummy/app/assets/javascripts/application.js
364
368
  - spec/dummy/app/assets/stylesheets/application.css
365
369
  - spec/dummy/app/controllers/application_controller.rb
370
+ - spec/dummy/app/controllers/profile_pictures_controller.rb
366
371
  - spec/dummy/app/helpers/application_helper.rb
367
- - spec/dummy/app/models/profile_picture.rb
372
+ - spec/dummy/app/models/image/base.rb
373
+ - spec/dummy/app/models/image/profile_picture.rb
368
374
  - spec/dummy/app/models/user.rb
369
- - spec/dummy/app/uploaders/image_uploader.rb
370
375
  - spec/dummy/app/views/layouts/application.html.erb
376
+ - spec/dummy/app/views/profile_pictures/_crop_form.html.erb
377
+ - spec/dummy/app/views/profile_pictures/_form.html.erb
378
+ - spec/dummy/app/views/profile_pictures/_new.html.erb
379
+ - spec/dummy/app/views/profile_pictures/_photos.html.erb
380
+ - spec/dummy/app/views/profile_pictures/create.html.erb
381
+ - spec/dummy/app/views/profile_pictures/crop.html.erb
382
+ - spec/dummy/app/views/profile_pictures/edit.js.erb
383
+ - spec/dummy/app/views/profile_pictures/new.js.erb
384
+ - spec/dummy/app/views/profile_pictures/update.html.erb
385
+ - spec/dummy/app/views/profile_pictures/update.js.erb
371
386
  - spec/dummy/bin/bundle
372
387
  - spec/dummy/bin/rails
373
388
  - spec/dummy/bin/rake
@@ -381,6 +396,7 @@ files:
381
396
  - spec/dummy/config/environments/test.rb
382
397
  - spec/dummy/config/initializers/assets.rb
383
398
  - spec/dummy/config/initializers/backtrace_silencers.rb
399
+ - spec/dummy/config/initializers/carrier_wave.rb
384
400
  - spec/dummy/config/initializers/cookies_serializer.rb
385
401
  - spec/dummy/config/initializers/filter_parameter_logging.rb
386
402
  - spec/dummy/config/initializers/inflections.rb
@@ -389,23 +405,30 @@ files:
389
405
  - spec/dummy/config/initializers/wrap_parameters.rb
390
406
  - spec/dummy/config/routes.rb
391
407
  - spec/dummy/config/secrets.yml
392
- - spec/dummy/db/migrate/20131108102728_create_profile_pictures.rb
408
+ - spec/dummy/db/migrate/20131108102728_create_images.rb
393
409
  - spec/dummy/db/migrate/20140402113213_create_users.rb
394
410
  - spec/dummy/db/schema.rb
395
411
  - spec/dummy/db/test.sqlite3
412
+ - spec/dummy/log/development.log
396
413
  - spec/dummy/log/test.log
397
414
  - spec/dummy/public/404.html
398
415
  - spec/dummy/public/422.html
399
416
  - spec/dummy/public/500.html
400
417
  - spec/dummy/public/favicon.ico
401
- - spec/dummy/public/uploads/profile_picture/image/1/large_test.jpg
402
- - spec/dummy/public/uploads/profile_picture/image/1/medium_test.jpg
403
- - spec/dummy/public/uploads/profile_picture/image/1/test.jpg
404
- - spec/dummy/public/uploads/profile_picture/image/1/thumb_test.jpg
418
+ - spec/dummy/spec/controllers/profile_pictures_controller_spec.rb
419
+ - spec/dummy/spec/helpers/image_helper_spec.rb
405
420
  - spec/dummy/spec/helpers/theme_helper_spec.rb
406
421
  - spec/dummy/spec/support/factories/profile_pictures.rb
407
422
  - spec/dummy/spec/support/factories/test.jpg
408
423
  - spec/dummy/spec/support/factories/users.rb
424
+ - spec/dummy/uploads/image/profile_picture/1/large_test.jpg
425
+ - spec/dummy/uploads/image/profile_picture/1/medium_test.jpg
426
+ - spec/dummy/uploads/image/profile_picture/1/test.jpg
427
+ - spec/dummy/uploads/image/profile_picture/1/thumb_test.jpg
428
+ - spec/dummy/uploads/image/profile_picture/2/large_test.jpg
429
+ - spec/dummy/uploads/image/profile_picture/2/medium_test.jpg
430
+ - spec/dummy/uploads/image/profile_picture/2/test.jpg
431
+ - spec/dummy/uploads/image/profile_picture/2/thumb_test.jpg
409
432
  - spec/spec_helper.rb
410
433
  homepage: http://kpvarma.com
411
434
  licenses:
@@ -435,11 +458,22 @@ test_files:
435
458
  - spec/dummy/app/assets/javascripts/application.js
436
459
  - spec/dummy/app/assets/stylesheets/application.css
437
460
  - spec/dummy/app/controllers/application_controller.rb
461
+ - spec/dummy/app/controllers/profile_pictures_controller.rb
438
462
  - spec/dummy/app/helpers/application_helper.rb
439
- - spec/dummy/app/models/profile_picture.rb
463
+ - spec/dummy/app/models/image/base.rb
464
+ - spec/dummy/app/models/image/profile_picture.rb
440
465
  - spec/dummy/app/models/user.rb
441
- - spec/dummy/app/uploaders/image_uploader.rb
442
466
  - spec/dummy/app/views/layouts/application.html.erb
467
+ - spec/dummy/app/views/profile_pictures/_crop_form.html.erb
468
+ - spec/dummy/app/views/profile_pictures/_form.html.erb
469
+ - spec/dummy/app/views/profile_pictures/_new.html.erb
470
+ - spec/dummy/app/views/profile_pictures/_photos.html.erb
471
+ - spec/dummy/app/views/profile_pictures/create.html.erb
472
+ - spec/dummy/app/views/profile_pictures/crop.html.erb
473
+ - spec/dummy/app/views/profile_pictures/edit.js.erb
474
+ - spec/dummy/app/views/profile_pictures/new.js.erb
475
+ - spec/dummy/app/views/profile_pictures/update.html.erb
476
+ - spec/dummy/app/views/profile_pictures/update.js.erb
443
477
  - spec/dummy/bin/bundle
444
478
  - spec/dummy/bin/rails
445
479
  - spec/dummy/bin/rake
@@ -452,6 +486,7 @@ test_files:
452
486
  - spec/dummy/config/environments/test.rb
453
487
  - spec/dummy/config/initializers/assets.rb
454
488
  - spec/dummy/config/initializers/backtrace_silencers.rb
489
+ - spec/dummy/config/initializers/carrier_wave.rb
455
490
  - spec/dummy/config/initializers/cookies_serializer.rb
456
491
  - spec/dummy/config/initializers/filter_parameter_logging.rb
457
492
  - spec/dummy/config/initializers/inflections.rb
@@ -461,24 +496,31 @@ test_files:
461
496
  - spec/dummy/config/routes.rb
462
497
  - spec/dummy/config/secrets.yml
463
498
  - spec/dummy/config.ru
464
- - spec/dummy/db/migrate/20131108102728_create_profile_pictures.rb
499
+ - spec/dummy/db/migrate/20131108102728_create_images.rb
465
500
  - spec/dummy/db/migrate/20140402113213_create_users.rb
466
501
  - spec/dummy/db/schema.rb
467
502
  - spec/dummy/db/test.sqlite3
503
+ - spec/dummy/log/development.log
468
504
  - spec/dummy/log/test.log
469
505
  - spec/dummy/public/404.html
470
506
  - spec/dummy/public/422.html
471
507
  - spec/dummy/public/500.html
472
508
  - spec/dummy/public/favicon.ico
473
- - spec/dummy/public/uploads/profile_picture/image/1/large_test.jpg
474
- - spec/dummy/public/uploads/profile_picture/image/1/medium_test.jpg
475
- - spec/dummy/public/uploads/profile_picture/image/1/test.jpg
476
- - spec/dummy/public/uploads/profile_picture/image/1/thumb_test.jpg
477
509
  - spec/dummy/Rakefile
478
510
  - spec/dummy/README.rdoc
511
+ - spec/dummy/spec/controllers/profile_pictures_controller_spec.rb
512
+ - spec/dummy/spec/helpers/image_helper_spec.rb
479
513
  - spec/dummy/spec/helpers/theme_helper_spec.rb
480
514
  - spec/dummy/spec/support/factories/profile_pictures.rb
481
515
  - spec/dummy/spec/support/factories/test.jpg
482
516
  - spec/dummy/spec/support/factories/users.rb
517
+ - spec/dummy/uploads/image/profile_picture/1/large_test.jpg
518
+ - spec/dummy/uploads/image/profile_picture/1/medium_test.jpg
519
+ - spec/dummy/uploads/image/profile_picture/1/test.jpg
520
+ - spec/dummy/uploads/image/profile_picture/1/thumb_test.jpg
521
+ - spec/dummy/uploads/image/profile_picture/2/large_test.jpg
522
+ - spec/dummy/uploads/image/profile_picture/2/medium_test.jpg
523
+ - spec/dummy/uploads/image/profile_picture/2/test.jpg
524
+ - spec/dummy/uploads/image/profile_picture/2/thumb_test.jpg
483
525
  - spec/spec_helper.rb
484
526
  has_rdoc:
@@ -1,104 +0,0 @@
1
- var status;
2
- var maxPhotoUploadFileSize = 5000000;
3
-
4
- // Used to clone photo uploader
5
- function add_fields(link, association, content) {
6
- var new_id = new Date().getTime();
7
- var regexp = new RegExp("new_" + association, "g")
8
- $(link).parent().before(content.replace(regexp, new_id));
9
- var upload_label = $('label.upload_image');
10
- if($(upload_label).length > 0) {
11
- $(upload_label).text('browse');
12
- }
13
- }
14
-
15
- // Remove a photo uploader
16
- function remove_fields(link) {
17
- $(link).prev("input[type=hidden]").val("1");
18
- $(link).closest("div.add-photos-path").hide();
19
- }
20
-
21
- // Remove Option filed
22
- function remove_option_field(link) {
23
- $(link).prev("input[type=hidden]").val("1");
24
- $(link).closest("div.div-new-field").hide();
25
- }
26
-
27
- /* Validate image file extension. The Supported formats are
28
- .jpg, .jpeg, .ico, .png, .gif
29
- */
30
- function validate_file_extn(filename) {
31
- var image_extns = new Array(/^jpg$/i, /^png$/i, /^jpeg$/i, /^ico$/i, /^gif$/i)
32
- var extn = filename.split('.');
33
- for(var i = 0; i < image_extns.length; i++) {
34
- if(extn[1].match(image_extns[i])) {
35
- status = "true"
36
- break;
37
- }
38
- else {
39
- status = "false";
40
- }
41
- }
42
- return status;
43
- }
44
-
45
- // Client side image preview before uploading to server
46
-
47
- function preview_image(input, element_id, width) {
48
-
49
- if(width == undefined){
50
- width = 90;
51
- }
52
-
53
- var filename = $(input).val().split('\\').pop();
54
- var status = validate_file_extn(filename);
55
- var reader = '';
56
-
57
- if(status == "false") {
58
- $(input).val('');
59
- alert("File type is not supported");
60
- }
61
- else {
62
-
63
- if(navigator.userAgent.match(/msie/i) && !navigator.userAgent.match(/msie 10/i)) {
64
- if($('.div-sg-photo-preview').length > 0) {
65
- $('.div-sg-photo-preview').css('border', '1px solid lightgray').html(filename);
66
- }
67
- else {
68
- $(input).parents('.add-photos-path').find('.jquery-sg-image-container').
69
- css('border-top', '1px solid gray').html(filename);
70
- }
71
- }
72
- else if(navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/msie 10/i)) {
73
- reader = new FileReader();
74
- reader.onload = function (e) {
75
- $('#'+element_id)
76
- .attr('src', e.target.result)
77
- .width(width);
78
- };
79
-
80
- reader.readAsDataURL(input.files[0]);
81
- }
82
-
83
- else {
84
-
85
- if (input.files && input.files[0]) {
86
- if(input.files[0].size < maxPhotoUploadFileSize) {
87
- reader = new FileReader();
88
- reader.onload = function (e) {
89
- $('#'+element_id)
90
- .attr('src', e.target.result)
91
- .width(width);
92
- };
93
-
94
- reader.readAsDataURL(input.files[0]);
95
- }
96
- else {
97
- alert("Maximum Size is " + maxPhotoUploadFileSize + " KB");
98
- }
99
-
100
- }
101
- }
102
- }
103
-
104
- }
@@ -1,8 +0,0 @@
1
- class ProfilePicture < ActiveRecord::Base
2
-
3
- # Associations
4
- belongs_to :user
5
-
6
- mount_uploader :image, ImageUploader
7
-
8
- end
@@ -1,9 +0,0 @@
1
- class CreateProfilePictures < ActiveRecord::Migration
2
- def change
3
- create_table :profile_pictures do |t|
4
- t.string :image
5
- t.references :user
6
- t.timestamps
7
- end
8
- end
9
- end