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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/poodle/application.js +1 -2
- data/app/assets/javascripts/poodle/cropper.js +1525 -0
- data/app/assets/javascripts/poodle/utilities.js +23 -7
- data/app/assets/stylesheets/poodle/poodle-theme.css +18 -1
- data/app/controllers/poodle/admin_controller.rb +0 -26
- data/app/controllers/poodle/images_controller.rb +65 -0
- data/app/helpers/poodle/image_helper.rb +171 -31
- data/app/helpers/poodle/render_helper.rb +31 -0
- data/{spec/dummy/app → app}/uploaders/image_uploader.rb +19 -22
- data/app/views/layouts/poodle/application/_footer.html.erb +1 -1
- data/app/views/layouts/poodle/application.html.erb +7 -3
- data/app/views/layouts/poodle/image_upload.html.erb +16 -0
- data/app/views/layouts/poodle/public/_footer.html.erb +2 -4
- data/app/views/layouts/poodle/public/_header.html.erb +1 -3
- data/app/views/layouts/poodle/public/public.html.erb +51 -0
- data/app/views/layouts/poodle/public.html.erb +8 -5
- data/lib/poodle/action_view/theme_helper.rb +0 -76
- data/lib/poodle/engine.rb +2 -0
- data/lib/poodle/version.rb +1 -1
- data/spec/dummy/app/controllers/profile_pictures_controller.rb +2 -0
- data/spec/dummy/app/models/image/base.rb +30 -0
- data/spec/dummy/app/models/image/profile_picture.rb +2 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/app/views/profile_pictures/_crop_form.html.erb +44 -0
- data/spec/dummy/app/views/profile_pictures/_form.html.erb +41 -0
- data/spec/dummy/app/views/profile_pictures/_new.html.erb +9 -0
- data/spec/dummy/app/views/profile_pictures/_photos.html.erb +16 -0
- data/spec/dummy/app/views/profile_pictures/create.html.erb +10 -0
- data/spec/dummy/app/views/profile_pictures/crop.html.erb +5 -0
- data/spec/dummy/app/views/profile_pictures/edit.js.erb +7 -0
- data/spec/dummy/app/views/profile_pictures/new.js.erb +7 -0
- data/spec/dummy/app/views/profile_pictures/update.html.erb +10 -0
- data/spec/dummy/app/views/profile_pictures/update.js.erb +2 -0
- data/spec/dummy/config/initializers/carrier_wave.rb +2 -0
- data/spec/dummy/config/routes.rb +15 -1
- data/spec/dummy/db/migrate/20131108102728_create_images.rb +12 -0
- data/spec/dummy/db/schema.rb +5 -2
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/{app/assets/javascripts/poodle/common.js → spec/dummy/log/development.log} +0 -0
- data/spec/dummy/log/test.log +11173 -0
- data/spec/dummy/spec/controllers/profile_pictures_controller_spec.rb +50 -0
- data/spec/dummy/spec/helpers/image_helper_spec.rb +129 -0
- data/spec/dummy/spec/helpers/theme_helper_spec.rb +14 -43
- data/spec/dummy/spec/support/factories/profile_pictures.rb +2 -2
- data/spec/dummy/spec/support/factories/users.rb +1 -1
- data/spec/dummy/{public/uploads/profile_picture/image → uploads/image/profile_picture}/1/large_test.jpg +0 -0
- data/spec/dummy/uploads/image/profile_picture/1/medium_test.jpg +0 -0
- data/spec/dummy/{public/uploads/profile_picture/image → uploads/image/profile_picture}/1/test.jpg +0 -0
- data/spec/dummy/{public/uploads/profile_picture/image → uploads/image/profile_picture}/1/thumb_test.jpg +0 -0
- data/spec/dummy/uploads/image/profile_picture/2/large_test.jpg +0 -0
- data/spec/dummy/uploads/image/profile_picture/2/medium_test.jpg +0 -0
- data/spec/dummy/uploads/image/profile_picture/2/test.jpg +0 -0
- data/spec/dummy/uploads/image/profile_picture/2/thumb_test.jpg +0 -0
- metadata +60 -18
- data/app/assets/javascripts/poodle/photo_upload.js +0 -104
- data/spec/dummy/app/models/profile_picture.rb +0 -8
- data/spec/dummy/db/migrate/20131108102728_create_profile_pictures.rb +0 -9
- data/spec/dummy/public/uploads/profile_picture/image/1/medium_test.jpg +0 -0
@@ -1,5 +1,23 @@
|
|
1
1
|
// Write down only those functions which are being used by application.init or any part of the application like ajax event handlers.
|
2
2
|
|
3
|
+
function cropImage(formId, aspectRatio, minHeight, minWidth) {
|
4
|
+
if(aspectRatio == undefined){var aspectRatio=1}
|
5
|
+
if(minHeight == undefined){var minHeight=116}
|
6
|
+
if(minWidth == undefined){var minWidth=116}
|
7
|
+
$("#"+formId+ " img").cropper({
|
8
|
+
aspectRatio: aspectRatio,
|
9
|
+
minHeight: minHeight,
|
10
|
+
minWidth: minWidth,
|
11
|
+
data: {},
|
12
|
+
done: function(data) {
|
13
|
+
$("#"+formId+" .crop_x").val(data.x);
|
14
|
+
$("#"+formId+" .crop_y").val(data.y);
|
15
|
+
$("#"+formId+" .crop_w").val(data.width);
|
16
|
+
$("#"+formId+" .crop_h").val(data.height);
|
17
|
+
}
|
18
|
+
});
|
19
|
+
}
|
20
|
+
|
3
21
|
// loadANewPage will accept a url and will load a new page
|
4
22
|
// It can be tuned to show a lightbox showing a loading, please wait message.
|
5
23
|
function loadANewPage(url){
|
@@ -13,19 +31,17 @@ function sendAjaxRequest(url, mType){
|
|
13
31
|
jQuery.ajax({type: methodType, dataType:"script", url:url});
|
14
32
|
}
|
15
33
|
|
16
|
-
// Call this function by passing model Id, heading and a bodyContent.
|
17
|
-
// it will pop up bootstrap 3 modal.
|
18
34
|
var messageModalId = "div_modal_message";
|
19
35
|
var genericModalId = "div_modal_generic";
|
36
|
+
// Call this function by passing model Id, heading and a bodyContent.
|
37
|
+
// it will pop up bootstrap 3 modal.
|
20
38
|
function showModal(heading, bodyContent, modalId){
|
21
39
|
if(modalId==null){
|
22
40
|
var modalId = genericModalId;
|
23
41
|
}
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
$('#' + modalId).modal('show');
|
28
|
-
//$('#' + modalId + ' .modal-footer button.btn-primary').button('reset');
|
42
|
+
$('#' + modalId + ' .modal-header h4.modal-title').text(heading);
|
43
|
+
$('#' + modalId + ' div.modal-body-main').html(bodyContent);
|
44
|
+
$('#' + modalId).modal('show');
|
29
45
|
}
|
30
46
|
|
31
47
|
// Call this function by passing heading and a message.
|
@@ -1,5 +1,22 @@
|
|
1
1
|
/* Styles for footer */
|
2
|
-
.footer {
|
2
|
+
.footer {
|
3
|
+
color: #4b4b4b;
|
4
|
+
text-align: center;
|
5
|
+
bottom: 2%;
|
6
|
+
display: block;
|
7
|
+
width: 100%;
|
8
|
+
height: auto;
|
9
|
+
position: absolute;
|
10
|
+
}
|
11
|
+
|
12
|
+
.footer-with-sidebar {
|
13
|
+
padding: 20px 0px;
|
14
|
+
color: #4b4b4b;
|
15
|
+
position: fixed;
|
16
|
+
text-align: center;
|
17
|
+
width: 70%;
|
18
|
+
bottom: 10px;
|
19
|
+
}
|
3
20
|
|
4
21
|
/* Styles for Sidebar and Main Content */
|
5
22
|
|
@@ -126,31 +126,5 @@ module Poodle
|
|
126
126
|
render_or_redirect(obj.errors.any?, url, action_name)
|
127
127
|
end
|
128
128
|
|
129
|
-
def render_or_redirect(error, redirect_url, action)
|
130
|
-
respond_to do |format|
|
131
|
-
format.html {
|
132
|
-
if error
|
133
|
-
render action: action
|
134
|
-
else
|
135
|
-
redirect_to redirect_url, notice: @options[:message]
|
136
|
-
end
|
137
|
-
}
|
138
|
-
format.js {}
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def render_list
|
143
|
-
respond_to do |format|
|
144
|
-
format.html { get_collections and render :index }
|
145
|
-
format.js {}
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def render_show
|
150
|
-
respond_to do |format|
|
151
|
-
format.js { render action: :show }
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
129
|
end
|
156
130
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Poodle
|
2
|
+
class ImagesController < ApplicationController
|
3
|
+
|
4
|
+
#skip_before_filter :set_navs, :parse_pagination_params
|
5
|
+
before_filter :get_image_class
|
6
|
+
before_filter :get_resource
|
7
|
+
|
8
|
+
def new
|
9
|
+
@image = @image_class.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def edit
|
13
|
+
@image = @image_class.find(params[:id])
|
14
|
+
end
|
15
|
+
|
16
|
+
def create
|
17
|
+
@image = @image_class.new
|
18
|
+
@image.imageable = @resource
|
19
|
+
@image.image = params[:image]
|
20
|
+
@image.save
|
21
|
+
set_flash_message("Image has been created successfully", :success)
|
22
|
+
render layout: "poodle/image_upload"
|
23
|
+
end
|
24
|
+
|
25
|
+
def update
|
26
|
+
@image = @image_class.find(params[:id])
|
27
|
+
@image.image = params[:image]
|
28
|
+
@image.save
|
29
|
+
set_flash_message("Image has been updated successfully", :success)
|
30
|
+
render layout: "poodle/image_upload"
|
31
|
+
end
|
32
|
+
|
33
|
+
def crop
|
34
|
+
@image = @image_class.find(params[:id])
|
35
|
+
@image.assign_attributes(image_params)
|
36
|
+
@image.image = params[:image]
|
37
|
+
@image.save
|
38
|
+
set_flash_message("Image has been cropped successfully", :success)
|
39
|
+
render layout: "poodle/image_upload"
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def image_params
|
45
|
+
params.require(:image).permit(:crop_x, :crop_y, :crop_w, :crop_h, :image)
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_image_class
|
49
|
+
@image_type = params[:image_type]
|
50
|
+
@image_class = @image_type.constantize
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_resource
|
54
|
+
@resource = params[:imageable_type].constantize.find(params[:imageable_id]) if params[:imageable_type] && params[:imageable_id]
|
55
|
+
end
|
56
|
+
|
57
|
+
def save_image
|
58
|
+
@image = @image_class.new
|
59
|
+
@image.imageable = @resource
|
60
|
+
@image.image = params[:image][:image]
|
61
|
+
@image.save
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -1,45 +1,185 @@
|
|
1
1
|
module Poodle
|
2
2
|
module ImageHelper
|
3
|
-
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
|
3
|
+
|
4
|
+
# placeholdit is a helper method used to return placechold.it urls with custom width, height and text
|
5
|
+
# It is quite useful for POC Applications to get started with place holder images while developing views
|
6
|
+
#
|
7
|
+
# @example Without Any Arguments
|
8
|
+
#
|
9
|
+
# >>> placeholdit()
|
10
|
+
# "http://placehold.it/60x60&text=<No Image>"
|
11
|
+
#
|
12
|
+
# @example With width, height and custom text
|
13
|
+
#
|
14
|
+
# >>> placeholdit(width: 120, height: 80, text: "User")
|
15
|
+
# "http://placehold.it/120x80&text=User"
|
16
|
+
def placeholdit(**options)
|
17
|
+
options.reverse_merge!( width: 60, height: 60, text: "<No Image>" )
|
18
|
+
"http://placehold.it/#{options[:width]}x#{options[:height]}&text=#{options[:text]}"
|
19
|
+
end
|
20
|
+
|
21
|
+
# image_url is a helper method which can be used along with carrier_wave gem
|
22
|
+
# Suppose, you have an object 'user' which has a profile_picture
|
23
|
+
# image_url will return you placehold.it image if profile_picture is not set else it will return you the carrier wave url
|
24
|
+
#
|
25
|
+
# @example Basic Usage without Image
|
26
|
+
#
|
27
|
+
# >>> image_url(user, "profile_picture.image.thumb.url")
|
28
|
+
# "http://placehold.it/60x60&text=<No Image>"
|
29
|
+
#
|
30
|
+
# @example Basic Usage with Image
|
31
|
+
#
|
32
|
+
# >>> image_url(user_with_image, "profile_picture.image.thumb.url")
|
33
|
+
# "uploads/profile_picture/image/1/thumb_test.jpg"
|
34
|
+
#
|
35
|
+
# @example Advance Usage with Placehold.it Arguments
|
36
|
+
#
|
37
|
+
# >>> image_url(user, "profile_picture.image.large.url", {width: 40, height: 10, text: "Pic"})
|
38
|
+
# "http://placehold.it/40x10&text=Pic"
|
39
|
+
def image_url(object, method_name, **options)
|
11
40
|
begin
|
12
|
-
url = object.send :eval,
|
41
|
+
url = object.send :eval, method_name
|
13
42
|
raise if url.blank?
|
14
43
|
rescue
|
15
|
-
url =
|
44
|
+
url = placeholdit(**options)
|
16
45
|
end
|
17
46
|
return url
|
18
47
|
end
|
19
48
|
|
20
49
|
# This method will render the image with required width and height.
|
21
50
|
# The image url will be set to the placeholder url if the object doesn't respond to the image method
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
51
|
+
#
|
52
|
+
# @example Basic Usage without Image
|
53
|
+
#
|
54
|
+
# >>> display_image(user, "profile_picture.image.thumb.url")
|
55
|
+
# "<img class=\"\" width=\"100%\" height=\"auto\" src=\"http://placehold.it/100x60&text=<No Image>\" alt=\"100x60&text=<no image>\" />"
|
56
|
+
#
|
57
|
+
# @example Basic Usage with image
|
58
|
+
#
|
59
|
+
# >>> display_image(user, "profile_picture.image.thumb.url", width: "100%", height:"100%")
|
60
|
+
# "<img class=\"\" width=\"100%\" height=\"100%\" src=\"http://placehold.it/100x60&text=<No Image>\" alt=\"100x60&text=<no image>\" />"
|
61
|
+
#
|
62
|
+
# @example Advanced Usage with width & height
|
63
|
+
#
|
64
|
+
# >>> display_image(user_with_image, 'profile_picture.image.large.url', width: "30px", height: "50px", place_holder: {width: 100, height: 50, text: "SOME TEXT"})
|
65
|
+
# "<img class=\"\" width=\"30px\" height=\"50px\" src=\"/spec/dummy/uploads/image/profile_picture/1/large_test.jpg\" alt=\"Large test\" />"
|
66
|
+
def display_image(object, method_name, **options)
|
67
|
+
options.reverse_merge!(
|
68
|
+
width: "100%",
|
69
|
+
height: "auto",
|
70
|
+
place_holder: {},
|
71
|
+
class: object.persisted? ? "#{object.id}-poodle-thumb-image" : ""
|
72
|
+
)
|
73
|
+
|
74
|
+
img_url = image_url(object, method_name, **options[:place_holder])
|
75
|
+
return image_tag(img_url, class: options[:class], width: options[:width], height: options[:height])
|
76
|
+
end
|
77
|
+
|
78
|
+
# @example Basic Usage
|
79
|
+
#
|
80
|
+
# >>> display_user_image(@user, 'profile_picture.image.thumb.url')
|
81
|
+
# "<div><div class="rounded" style="width:60px;height:60px;"><img alt="Thumb krishnan" class="" src="/uploads/image/profile_picture/39/thumb_krishnan.jpg" style="width:100%;height:auto;cursor:default;"></div></div>"
|
82
|
+
#
|
83
|
+
# @example Advanced Usage with
|
84
|
+
#
|
85
|
+
# >>> display_user_image(@user, 'profile_picture.image.thumb.url', width: 100, height: 100)
|
86
|
+
# "<div><div class="rounded" style="width:100px;height:60px;"><img alt="Thumb krishnan" class="" src="/uploads/image/profile_picture/39/thumb_krishnan.jpg" style="width:100%;height:auto;cursor:default;"></div></div>"
|
87
|
+
def display_user_image(user, method_name, **options)
|
88
|
+
|
89
|
+
url_domain = defined?(QAuthRubyClient) ? QAuthRubyClient.configuration.q_auth_url : ""
|
90
|
+
|
91
|
+
options.reverse_merge!(
|
92
|
+
width: "60px",
|
93
|
+
height: "auto",
|
94
|
+
url_domain: url_domain,
|
95
|
+
place_holder: {},
|
96
|
+
html_options: {}
|
97
|
+
)
|
98
|
+
|
99
|
+
options[:html_options].reverse_merge!(
|
100
|
+
style: "width:100%;height:auto;cursor:#{options.has_key?(:popover) ? "pointer" : "default"};",
|
101
|
+
class: user.persisted? ? "#{user.id}-poodle-thumb-image" : ""
|
102
|
+
)
|
103
|
+
|
104
|
+
options[:html_options].reverse_merge!(
|
105
|
+
"data-toggle" => "popover",
|
106
|
+
"data-placement" => "bottom",
|
107
|
+
"title" => user.name,
|
108
|
+
"data-content" => options[:popover] === true ? "" : options[:popover].to_s
|
109
|
+
) if options[:popover]
|
110
|
+
|
111
|
+
begin
|
112
|
+
url = options[:url_domain] + user.send(:eval, method_name)
|
113
|
+
rescue
|
114
|
+
url = placeholdit(**options[:place_holder])
|
115
|
+
end
|
116
|
+
|
117
|
+
content_tag(:div) do
|
118
|
+
content_tag(:div, class: "rounded", style: "width:#{options[:width]};height:#{options[:height]}") do
|
119
|
+
image_tag(url, options[:html_options])
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Displays the image with a edit button below it
|
125
|
+
# @example Basic Usage
|
126
|
+
# >>> edit_image(@project, "logo.image.url", edit_url, width: "100px", height: "auto")
|
127
|
+
# ""
|
128
|
+
def edit_image(object, method_name, edit_url, **options)
|
129
|
+
options.reverse_merge!(
|
130
|
+
remote: true,
|
131
|
+
text: "Change Image",
|
132
|
+
icon: "photo",
|
133
|
+
classes: "btn btn-default btn-xs mt-10"
|
134
|
+
)
|
135
|
+
img_tag = display_image(object, method_name, **options)
|
136
|
+
btn_display = raw(theme_fa_icon(options[:icon]) + theme_button_text(options[:text]))
|
137
|
+
link_to(img_tag, edit_url, :remote => options[:remote]) +
|
138
|
+
link_to(btn_display, edit_url, :class=>options[:classes], :remote=>options[:remote])
|
139
|
+
end
|
140
|
+
|
141
|
+
# Displays the user image in a rounded frame with a edit button below it
|
142
|
+
# @example Basic Usage
|
143
|
+
# >>> edit_user_image(@project, "logo.image.url", edit_url, width: "100px", height: "auto")
|
144
|
+
# ""
|
145
|
+
def edit_user_image(object, method_name, edit_url, **options)
|
146
|
+
options.reverse_merge!(
|
147
|
+
remote: true,
|
148
|
+
text: "Change Image",
|
149
|
+
icon: "photo",
|
150
|
+
classes: "btn btn-default btn-xs mt-10"
|
151
|
+
)
|
152
|
+
img_tag = display_user_image(object, method_name, **options)
|
153
|
+
btn_display = raw(theme_fa_icon(options[:icon]) + theme_button_text(options[:text]))
|
154
|
+
link_to(img_tag, edit_url, :remote => options[:remote]) +
|
155
|
+
link_to(btn_display, edit_url, :class=>options[:classes], :remote=>options[:remote])
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns new photo url or edit existing photo url based on object is associated with photo or not
|
159
|
+
# @example Basic Usage - User without Image
|
160
|
+
# >>> upload_image_link(@user, :profile_picture, :admin)
|
161
|
+
# "/admin/images/new"
|
162
|
+
#
|
163
|
+
# @example Basic Usage - User with Iamge
|
164
|
+
#
|
165
|
+
# >>> upload_image_link(@user_with_image, :profile_picture, :admin)
|
166
|
+
# "/admin/images/1/edit"
|
167
|
+
#
|
168
|
+
# @example Basic Usage - Custom Scope
|
169
|
+
#
|
170
|
+
# >>> upload_image_link(@project, :profile_picture, :client)
|
171
|
+
# "/client/images/new"
|
172
|
+
# >>> upload_image_link(@project_with_image, :profile_picture, :client)
|
173
|
+
# "/client/images/1/edit"
|
174
|
+
def upload_image_link(object, assoc_name=:photo, scope=:admin)
|
175
|
+
photo_object = nil
|
176
|
+
photo_object = object.send(assoc_name) if object.respond_to?(assoc_name)
|
177
|
+
if photo_object.present? && photo_object.persisted?
|
178
|
+
url_for([:edit, scope, :image, id: photo_object.id, imageable_id: object.id, imageable_type: object.class.to_s, image_type: photo_object.class.name])
|
179
|
+
else
|
180
|
+
photo_object = object.send("build_#{assoc_name}")
|
181
|
+
url_for([:new, scope, :image, imageable_id: object.id, imageable_type: object.class.to_s, image_type: photo_object.class.name])
|
182
|
+
end
|
43
183
|
end
|
44
184
|
end
|
45
185
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Poodle
|
2
|
+
module RenderHelper
|
3
|
+
|
4
|
+
def render_or_redirect(error, redirect_url, action, notice=nil)
|
5
|
+
respond_to do |format|
|
6
|
+
format.html {
|
7
|
+
if error
|
8
|
+
render action: action
|
9
|
+
else
|
10
|
+
redirect_to redirect_url, notice: notice
|
11
|
+
end
|
12
|
+
}
|
13
|
+
format.js {}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def render_list
|
18
|
+
respond_to do |format|
|
19
|
+
format.html { get_collections and render :index }
|
20
|
+
format.js {}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def render_show
|
25
|
+
respond_to do |format|
|
26
|
+
format.js { render action: :show }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -7,44 +7,41 @@ class ImageUploader < CarrierWave::Uploader::Base
|
|
7
7
|
# include CarrierWave::MiniMagick
|
8
8
|
|
9
9
|
# Choose what kind of storage to use for this uploader:
|
10
|
-
|
11
|
-
storage :file
|
12
|
-
|
13
|
-
def root
|
14
|
-
Rails.root.join 'public/'
|
15
|
-
end
|
10
|
+
storage Rails.env.production? ? :fog : :file
|
16
11
|
|
17
12
|
# Override the directory where uploaded files will be stored.
|
18
13
|
# This is a sensible default for uploaders that are meant to be mounted:
|
19
14
|
def store_dir
|
20
|
-
"uploads/#{model.class.to_s.underscore}/#{
|
15
|
+
"#{Rails.root}/uploads/#{model.class.to_s.underscore}/#{model.id}"
|
21
16
|
end
|
22
17
|
|
18
|
+
#process :crop
|
19
|
+
|
23
20
|
version :large do
|
24
|
-
resize_to_limit
|
21
|
+
process :resize_to_limit => [540, 540]
|
25
22
|
end
|
26
23
|
|
27
24
|
version :medium do
|
28
|
-
|
25
|
+
process :resize_to_limit => [232, 232]
|
29
26
|
end
|
30
27
|
|
31
28
|
version :thumb do
|
32
29
|
#process :crop
|
33
|
-
resize_to_fill
|
30
|
+
process :resize_to_fill => [116, 116]
|
34
31
|
end
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
def crop
|
34
|
+
if model.crop_x.present?
|
35
|
+
resize_to_limit(540, 540)
|
36
|
+
manipulate! do |img|
|
37
|
+
x = model.crop_x.to_i
|
38
|
+
y = model.crop_y.to_i
|
39
|
+
w = model.crop_w.to_i
|
40
|
+
h = model.crop_h.to_i
|
41
|
+
img.crop!(x, y, w, h)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
48
45
|
|
49
46
|
# Provide a default URL as a default if there hasn't been a file uploaded:
|
50
47
|
# def default_url
|
@@ -4,7 +4,8 @@
|
|
4
4
|
<title><%= title -%></title>
|
5
5
|
<%= meta_tags %>
|
6
6
|
<link rel="icon" href="/assets/favicon.ico" type="image/png">
|
7
|
-
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag @stylesheet_filename, :media => "all" -%>
|
8
9
|
<%= csrf_meta_tags -%>
|
9
10
|
<%= yield :javascript_header -%>
|
10
11
|
</head>
|
@@ -30,12 +31,15 @@
|
|
30
31
|
</div>
|
31
32
|
|
32
33
|
<%#* Page Content Starts here -%>
|
33
|
-
<div
|
34
|
+
<div id="div_page_content">
|
34
35
|
<%= yield %>
|
35
36
|
</div>
|
36
37
|
|
37
38
|
<%#* Display Footer -%>
|
39
|
+
<div class="cl-40"></div>
|
40
|
+
<div id="div_page_footer" class="row footer-with-sidebar">
|
38
41
|
<%= render :partial=>"/layouts/poodle/application/footer" -%>
|
42
|
+
</div>
|
39
43
|
|
40
44
|
</div>
|
41
45
|
|
@@ -47,7 +51,7 @@
|
|
47
51
|
<%= render :partial=>"/layouts/poodle/common/overlays" -%>
|
48
52
|
|
49
53
|
<%#* Loading Javascripts -%>
|
50
|
-
<%= javascript_include_tag javascript_filename -%>
|
54
|
+
<%= javascript_include_tag @javascript_filename -%>
|
51
55
|
|
52
56
|
<%= yield :javascript_footer -%>
|
53
57
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<div class="
|
2
|
-
<
|
3
|
-
© 2015 <a href="http://qwinixtech.com">Poodle Copyright Message</a>
|
4
|
-
</div>
|
1
|
+
<div class="col-md-12 text-center mt-15">
|
2
|
+
© 2015 <a href="github.com/qwinixlabs/poodle">All rights reserved - Poodle | QwinixLabs </a>
|
5
3
|
</div>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en" class="no-js">
|
3
|
+
<head>
|
4
|
+
<title><%= title -%></title>
|
5
|
+
<%= meta_tags %>
|
6
|
+
<link rel="icon" href="/assets/favicon.ico" type="image/png">
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag @stylesheet_filename, :media => "all" -%>
|
9
|
+
<%= csrf_meta_tags -%>
|
10
|
+
<%= yield :javascript_header -%>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<div>
|
15
|
+
|
16
|
+
<div class="container-fluid header-block clearfix">
|
17
|
+
|
18
|
+
<div id="div_page_header">
|
19
|
+
<%= render :partial=>"/layouts/poodle/public/header" -%>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<%#* Show flash messages if controller has set any. -%>
|
23
|
+
<div id="div_flash_message" class="mt-30">
|
24
|
+
<%= flash_message(false) if defined?(flash) -%>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%#* Page Content Starts here -%>
|
28
|
+
<div id="div_page_content_main">
|
29
|
+
<%= yield %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<%#* Display Footer -%>
|
33
|
+
<div id="div_page_footer" class="row footer">
|
34
|
+
<%= render :partial=>"/layouts/poodle/public/footer" -%>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<%#* Display Hidden Overlays -%>
|
42
|
+
<%= render :partial=>"/layouts/poodle/common/overlays" -%>
|
43
|
+
|
44
|
+
<%#* Loading Javascripts -%>
|
45
|
+
<%= javascript_include_tag @javascript_filename -%>
|
46
|
+
|
47
|
+
<%= yield :javascript_footer -%>
|
48
|
+
|
49
|
+
</body>
|
50
|
+
|
51
|
+
</html>
|
@@ -4,7 +4,8 @@
|
|
4
4
|
<title><%= title -%></title>
|
5
5
|
<%= meta_tags %>
|
6
6
|
<link rel="icon" href="/assets/favicon.ico" type="image/png">
|
7
|
-
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag @stylesheet_filename, :media => "all" -%>
|
8
9
|
<%= csrf_meta_tags -%>
|
9
10
|
<%= yield :javascript_header -%>
|
10
11
|
</head>
|
@@ -19,17 +20,19 @@
|
|
19
20
|
</div>
|
20
21
|
|
21
22
|
<%#* Show flash messages if controller has set any. -%>
|
22
|
-
<div id="div_flash_message">
|
23
|
+
<div id="div_flash_message" class="mt-30">
|
23
24
|
<%= flash_message(false) if defined?(flash) -%>
|
24
25
|
</div>
|
25
26
|
|
26
27
|
<%#* Page Content Starts here -%>
|
27
|
-
<div
|
28
|
+
<div id="div_page_content_main">
|
28
29
|
<%= yield %>
|
29
30
|
</div>
|
30
31
|
|
31
32
|
<%#* Display Footer -%>
|
32
|
-
|
33
|
+
<div id="div_page_footer" class="row footer">
|
34
|
+
<%= render :partial=>"/layouts/poodle/public/footer" -%>
|
35
|
+
</div>
|
33
36
|
|
34
37
|
</div>
|
35
38
|
|
@@ -39,7 +42,7 @@
|
|
39
42
|
<%= render :partial=>"/layouts/poodle/common/overlays" -%>
|
40
43
|
|
41
44
|
<%#* Loading Javascripts -%>
|
42
|
-
<%= javascript_include_tag javascript_filename -%>
|
45
|
+
<%= javascript_include_tag @javascript_filename -%>
|
43
46
|
|
44
47
|
<%= yield :javascript_footer -%>
|
45
48
|
|