ruby_gallery 0.1.7 → 0.1.8
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/README.markdown +4 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/ruby_gallery/app.js +5 -1
- data/app/assets/javascripts/ruby_gallery/ga.js +9 -0
- data/app/assets/javascripts/ruby_gallery/jquery.nanoscroller.js +752 -0
- data/app/assets/javascripts/ruby_gallery/main.js +11 -0
- data/app/assets/javascripts/ruby_gallery/overthrow.min.js +2 -0
- data/app/assets/javascripts/ruby_gallery/ruby_gallery.js +121 -66
- data/app/assets/stylesheets/ruby_gallery/main.css +164 -0
- data/app/assets/stylesheets/ruby_gallery/nanoscroller.css +55 -0
- data/app/assets/stylesheets/ruby_gallery/ruby_gallery.css.scss.erb +8 -8
- data/app/assets/stylesheets/ruby_gallery/styles.css +2 -0
- data/app/helpers/ruby_gallery/ruby_gallery_helper.rb +49 -82
- data/ruby_gallery.gemspec +8 -2
- metadata +9 -3
|
@@ -1,96 +1,63 @@
|
|
|
1
1
|
module RubyGallery::RubyGalleryHelper
|
|
2
2
|
def show_gallery_images(model_name, opts={})
|
|
3
3
|
object = model_name.to_s.singularize.classify.constantize.find(params[:id])
|
|
4
|
-
opts = {reorder: true,
|
|
4
|
+
opts = {reorder: true, close: true}.merge(opts)
|
|
5
5
|
content = ""
|
|
6
|
-
content
|
|
7
|
-
[
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
content = content_tag(:div, class: "upload-box") do
|
|
7
|
+
[
|
|
8
|
+
content_tag(:div, t("ruby_gallery.web_content.upload_album"), class: "legend"),
|
|
9
|
+
content_tag(:div, class: "form-box") do
|
|
10
|
+
[
|
|
11
|
+
content_tag(:form, id: "fileupload", class: "fileupload", method: "POST", enctype: "multipart/form-data", action: "/#{model_name}/upload_album?id=#{params[:id]}", multipart: true) do
|
|
12
|
+
content_tag(:span, id: "upload_button", class: "upload-button btn btn-success fileinput-button", status: "") do
|
|
13
|
+
[content_tag(:i, "", class: "icon-plus icon-white"),
|
|
14
|
+
content_tag(:span, t("ruby_gallery.web_content.upload_button")),
|
|
15
|
+
tag(:input, class: "upload-button-input", type: :file, multiple: "multiple", name: "file[]", accept: "image/*")].join.html_safe
|
|
16
|
+
end
|
|
17
|
+
end,
|
|
18
|
+
opts[:close] ? content_tag(:a, t("ruby_gallery.web_content.close_link"), class: "close-link", href: "#") : ""
|
|
19
|
+
|
|
20
|
+
].join.html_safe
|
|
21
|
+
end, # end form-box
|
|
22
|
+
content_tag(:div, class: "nano") do
|
|
23
|
+
content_tag(:div , id: "file_box", class: "file-box overthrow content description", data_model: "#{model_name}", model_id: "#{object.id}") do
|
|
24
|
+
content_tag(:ul, id: "photos_album", class: "album #{opts[:reorder] ? "ruby-gallery-sortable" : ""}", data_url: "/#{model_name}/update_ruby_gallery_position?id=#{object.id}") do
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
if object.nil? || object.album_photos.size == 0
|
|
27
|
+
content_tag(:span, t("ruby_gallery.web_content.no_file_selected"), id: "no_file")
|
|
28
|
+
else
|
|
29
|
+
img_array = []
|
|
30
|
+
object.album_photos.order("position ASC").each do |photo|
|
|
31
|
+
img_array.push(content_tag(:li, class: "photo-cat photo_#{photo.id}" , key: "#{photo.id}") do
|
|
32
|
+
[content_tag(:span, raw("✖"), class: "entypo-icon-1 remove-photo hide", photo_id: photo.id),
|
|
33
|
+
content_tag(:a, class: "gallery-colorbox", href: "#{photo.photo.url(:original)}") do
|
|
34
|
+
tag(:img, src: photo.photo.url(:medium), width: '120', height: '120', rel: "ruby_gallery")
|
|
35
|
+
end,
|
|
36
|
+
tag(:input, type: :hidden, name: "position-item", class: "item-position", value: "#{photo.position}")
|
|
37
|
+
].join.html_safe
|
|
38
|
+
end)
|
|
39
|
+
end
|
|
40
|
+
img_array.join.html_safe # conclude what to be displayed
|
|
41
|
+
end
|
|
35
42
|
end
|
|
36
|
-
img_array.join.html_safe # conclude what to be displayed
|
|
37
43
|
end
|
|
38
|
-
end
|
|
39
|
-
|
|
44
|
+
end, # end nano-scrollbar
|
|
45
|
+
content_tag(:div, class: "ruby-gallery-translation hide") do
|
|
46
|
+
[
|
|
47
|
+
content_tag(:div, t("ruby_gallery.web_content.please_upload_image_files"), id: "please_upload_image_files_text"),
|
|
48
|
+
content_tag(:div, t("ruby_gallery.web_content.processing"), id: "processing_text"),
|
|
49
|
+
content_tag(:div, t("ruby_gallery.web_content.upload_button"), id: "upload_button_text"),
|
|
50
|
+
content_tag(:div, t("ruby_gallery.web_content.upload_failed"), id: "upload_failed_text")
|
|
51
|
+
].join.html_safe
|
|
52
|
+
end # end ruby-gallery-translation
|
|
53
|
+
].join.html_safe
|
|
40
54
|
end
|
|
41
55
|
|
|
42
|
-
content += javascript_tag(%Q
|
|
43
|
-
|
|
44
|
-
function renderPhoto(photoResult) {
|
|
45
|
-
return function() {
|
|
46
|
-
$('#file_box ul#photos_album li.new-photo').remove();
|
|
47
|
-
$('#file_box ul#photos_album').append(photoResult);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
56
|
+
content += javascript_tag(%Q{
|
|
50
57
|
$(function () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
$('#fileupload').fileupload({
|
|
54
|
-
dropZone: $('#fileupload'),
|
|
55
|
-
progressInterval: 20,
|
|
56
|
-
add: function(e,data){
|
|
57
|
-
if ($('span#upload_button').attr('status') == 'process'){
|
|
58
|
-
return false;
|
|
59
|
-
} else {
|
|
60
|
-
var types = /(.)(png|jpg|gif|jpeg)$/i;
|
|
61
|
-
var file = data.files[0];
|
|
62
|
-
if (types.test(file.type) || types.test(file.name) ){
|
|
63
|
-
$('span.upload-button span').html("#{t("ruby_gallery.web_content.processing")}");
|
|
64
|
-
$("span#no_285.giffile").remove();
|
|
65
|
-
$("span#no_file").remove();
|
|
66
|
-
$('#file_box ul#photos_album').append("<li class='photo-cat new-photo' ><div id='progress' class='pic-icon' ></div></li>");
|
|
67
|
-
data.submit();
|
|
68
|
-
} else {
|
|
69
|
-
alert("#{t("ruby_gallery.web_content.please_upload_image_files")}");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
progressall: function(e, data){
|
|
74
|
-
var progress = parseInt(data.loaded / data.total * 100, 10);
|
|
75
|
-
$('#file_box ul#photos_album li.new-photo').find('#progress div.bar').css('width',progress + '%' );
|
|
76
|
-
},
|
|
77
|
-
done: function(e, data){
|
|
78
|
-
var report = '';
|
|
79
|
-
if(data.result != 'failed'){
|
|
80
|
-
$('span#upload_button span').html("#{t("ruby_gallery.web_content.upload_button")}");
|
|
81
|
-
var fn = renderPhoto(data.result);
|
|
82
|
-
$('#file_box ul#photos_album li.new-photo').fadeOut();
|
|
83
|
-
fn.call();
|
|
84
|
-
} else {
|
|
85
|
-
$('#file_box ul#photos_album li.new-photo').html("#{t("ruby_gallery.web_content.upload_failed")}");
|
|
86
|
-
var t = setTimeout(function(){
|
|
87
|
-
$('#file_box ul#photos_album li.new-photo').remove();
|
|
88
|
-
}, 2000);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
58
|
+
RubyGallery.init();
|
|
92
59
|
});
|
|
93
|
-
|
|
60
|
+
})
|
|
94
61
|
|
|
95
62
|
return content.html_safe
|
|
96
63
|
end
|
data/ruby_gallery.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "ruby_gallery"
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.8"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Peter Dang"]
|
|
12
|
-
s.date = "2013-04-
|
|
12
|
+
s.date = "2013-04-02"
|
|
13
13
|
s.description = "Upload image use gallery"
|
|
14
14
|
s.email = "peter@rubify.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -35,8 +35,12 @@ Gem::Specification.new do |s|
|
|
|
35
35
|
"app/assets/images/ruby_gallery/upload_processing.gif",
|
|
36
36
|
"app/assets/javascripts/.DS_Store",
|
|
37
37
|
"app/assets/javascripts/ruby_gallery/app.js",
|
|
38
|
+
"app/assets/javascripts/ruby_gallery/ga.js",
|
|
38
39
|
"app/assets/javascripts/ruby_gallery/jquery-ui.js",
|
|
39
40
|
"app/assets/javascripts/ruby_gallery/jquery.colorbox.js",
|
|
41
|
+
"app/assets/javascripts/ruby_gallery/jquery.nanoscroller.js",
|
|
42
|
+
"app/assets/javascripts/ruby_gallery/main.js",
|
|
43
|
+
"app/assets/javascripts/ruby_gallery/overthrow.min.js",
|
|
40
44
|
"app/assets/javascripts/ruby_gallery/ruby_gallery.js",
|
|
41
45
|
"app/assets/stylesheets/.DS_Store",
|
|
42
46
|
"app/assets/stylesheets/ruby_gallery/colorbox.css.erb",
|
|
@@ -44,6 +48,8 @@ Gem::Specification.new do |s|
|
|
|
44
48
|
"app/assets/stylesheets/ruby_gallery/entypo.svg",
|
|
45
49
|
"app/assets/stylesheets/ruby_gallery/entypo.ttf",
|
|
46
50
|
"app/assets/stylesheets/ruby_gallery/entypo.woff",
|
|
51
|
+
"app/assets/stylesheets/ruby_gallery/main.css",
|
|
52
|
+
"app/assets/stylesheets/ruby_gallery/nanoscroller.css",
|
|
47
53
|
"app/assets/stylesheets/ruby_gallery/ruby_gallery.css.scss.erb",
|
|
48
54
|
"app/assets/stylesheets/ruby_gallery/styles.css",
|
|
49
55
|
"app/helpers/ruby_gallery/ruby_gallery_helper.rb",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_gallery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-04-
|
|
12
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bourbon
|
|
@@ -165,8 +165,12 @@ files:
|
|
|
165
165
|
- app/assets/images/ruby_gallery/upload_processing.gif
|
|
166
166
|
- app/assets/javascripts/.DS_Store
|
|
167
167
|
- app/assets/javascripts/ruby_gallery/app.js
|
|
168
|
+
- app/assets/javascripts/ruby_gallery/ga.js
|
|
168
169
|
- app/assets/javascripts/ruby_gallery/jquery-ui.js
|
|
169
170
|
- app/assets/javascripts/ruby_gallery/jquery.colorbox.js
|
|
171
|
+
- app/assets/javascripts/ruby_gallery/jquery.nanoscroller.js
|
|
172
|
+
- app/assets/javascripts/ruby_gallery/main.js
|
|
173
|
+
- app/assets/javascripts/ruby_gallery/overthrow.min.js
|
|
170
174
|
- app/assets/javascripts/ruby_gallery/ruby_gallery.js
|
|
171
175
|
- app/assets/stylesheets/.DS_Store
|
|
172
176
|
- app/assets/stylesheets/ruby_gallery/colorbox.css.erb
|
|
@@ -174,6 +178,8 @@ files:
|
|
|
174
178
|
- app/assets/stylesheets/ruby_gallery/entypo.svg
|
|
175
179
|
- app/assets/stylesheets/ruby_gallery/entypo.ttf
|
|
176
180
|
- app/assets/stylesheets/ruby_gallery/entypo.woff
|
|
181
|
+
- app/assets/stylesheets/ruby_gallery/main.css
|
|
182
|
+
- app/assets/stylesheets/ruby_gallery/nanoscroller.css
|
|
177
183
|
- app/assets/stylesheets/ruby_gallery/ruby_gallery.css.scss.erb
|
|
178
184
|
- app/assets/stylesheets/ruby_gallery/styles.css
|
|
179
185
|
- app/helpers/ruby_gallery/ruby_gallery_helper.rb
|
|
@@ -208,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
208
214
|
version: '0'
|
|
209
215
|
segments:
|
|
210
216
|
- 0
|
|
211
|
-
hash: -
|
|
217
|
+
hash: -1866346399130088318
|
|
212
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
219
|
none: false
|
|
214
220
|
requirements:
|