ruby_gallery 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -2
- data/Gemfile.lock +6 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/ruby_gallery.js +4 -2
- data/app/assets/stylesheets/ruby_gallery.css.scss +92 -0
- data/app/helpers/ruby_gallery/ruby_gallery_helper.rb +15 -3
- data/lib/generators/active_record/ruby_gallery_generator.rb +4 -3
- data/lib/generators/active_record/templates/album_attachment_migration.rb +2 -6
- data/lib/generators/active_record/templates/album_photo_migration.rb +10 -9
- data/lib/generators/active_record/templates/migration.rb +1 -1
- data/lib/generators/ruby_gallery/install_generator.rb +5 -0
- data/lib/ruby_gallery.rb +3 -0
- data/ruby_gallery.gemspec +8 -5
- metadata +35 -19
- data/app/assets/stylesheets/ruby_gallery.css +0 -0
data/Gemfile
CHANGED
@@ -9,7 +9,9 @@ group :development do
|
|
9
9
|
gem "shoulda", ">= 0"
|
10
10
|
gem "rdoc", "~> 3.12"
|
11
11
|
gem "bundler", "~> 1.3.4"
|
12
|
-
gem "jeweler", "~> 1.8.4"
|
13
|
-
gem "paperclip", "~> 3.0"
|
12
|
+
gem "jeweler", "~> 1.8.4"
|
14
13
|
#gem "rcov", ">= 0"
|
15
14
|
end
|
15
|
+
|
16
|
+
gem "paperclip", "~> 3.0"
|
17
|
+
gem "bourbon"
|
data/Gemfile.lock
CHANGED
@@ -13,6 +13,9 @@ GEM
|
|
13
13
|
i18n (= 0.6.1)
|
14
14
|
multi_json (~> 1.0)
|
15
15
|
arel (3.0.2)
|
16
|
+
bourbon (3.0.0)
|
17
|
+
sass (>= 3.2.0)
|
18
|
+
thor
|
16
19
|
bourne (1.4.0)
|
17
20
|
mocha (~> 0.13.2)
|
18
21
|
builder (3.0.4)
|
@@ -42,6 +45,7 @@ GEM
|
|
42
45
|
rake (10.0.3)
|
43
46
|
rdoc (3.12.2)
|
44
47
|
json (~> 1.4)
|
48
|
+
sass (3.2.7)
|
45
49
|
shoulda (3.4.0)
|
46
50
|
shoulda-context (~> 1.0, >= 1.0.1)
|
47
51
|
shoulda-matchers (~> 1.0, >= 1.4.1)
|
@@ -49,12 +53,14 @@ GEM
|
|
49
53
|
shoulda-matchers (1.5.2)
|
50
54
|
activesupport (>= 3.0.0)
|
51
55
|
bourne (~> 1.3)
|
56
|
+
thor (0.17.0)
|
52
57
|
tzinfo (0.3.37)
|
53
58
|
|
54
59
|
PLATFORMS
|
55
60
|
ruby
|
56
61
|
|
57
62
|
DEPENDENCIES
|
63
|
+
bourbon
|
58
64
|
bundler (~> 1.3.4)
|
59
65
|
jeweler (~> 1.8.4)
|
60
66
|
paperclip (~> 3.0)
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -1,11 +1,12 @@
|
|
1
1
|
|
2
2
|
clearInterval(window.refeshWork);
|
3
3
|
window.refeshWork = null;
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
jQuery('#fileupload').fileupload({
|
6
6
|
dropZone: $('#fileupload'),
|
7
7
|
progressInterval: 20,
|
8
8
|
add: function(e,data){
|
9
|
+
|
9
10
|
if ($('span#upload_button').attr('status') == 'process'){
|
10
11
|
return false;
|
11
12
|
} else {
|
@@ -26,6 +27,7 @@
|
|
26
27
|
// $('#file_box ul#photos_album li.new-photo').find('#progress div.bar').css('width',progress + '%' );
|
27
28
|
},
|
28
29
|
done: function(e, data){
|
30
|
+
|
29
31
|
var report = '';
|
30
32
|
if(data.result != 'failed'){
|
31
33
|
var res = data.result;
|
@@ -0,0 +1,92 @@
|
|
1
|
+
@import "bourbon";
|
2
|
+
form.fileupload{
|
3
|
+
width:110px;
|
4
|
+
float:left;
|
5
|
+
}
|
6
|
+
|
7
|
+
div.upload-box{
|
8
|
+
display: block;
|
9
|
+
margin: 0 auto !important;
|
10
|
+
width: 500px !important;
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
div.file-box{
|
15
|
+
|
16
|
+
display:block;
|
17
|
+
margin-bottom: 5px;
|
18
|
+
height:185px;
|
19
|
+
span#attachment_display{
|
20
|
+
@include clearfix;
|
21
|
+
span{
|
22
|
+
float: left;
|
23
|
+
display:block;
|
24
|
+
height:20px;
|
25
|
+
float: left;
|
26
|
+
}
|
27
|
+
strong {
|
28
|
+
float:left;
|
29
|
+
margin-top: 20px;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
ul.activities-button-list{
|
37
|
+
display:block;
|
38
|
+
width:305px;
|
39
|
+
margin-top:10px;
|
40
|
+
margin-left:98px;
|
41
|
+
li.btn{
|
42
|
+
display:block;
|
43
|
+
float:left;
|
44
|
+
width: 100px;
|
45
|
+
height:20px;
|
46
|
+
@include linear-gradient(lighten(#80C66D, 5%), darken(#80C66D, 10%));
|
47
|
+
border: 1px solid #ccc;
|
48
|
+
border-left:none;
|
49
|
+
padding-top: 5px;
|
50
|
+
text-align:center;
|
51
|
+
color:#fff;
|
52
|
+
&:hover{
|
53
|
+
cursor:pointer;
|
54
|
+
}
|
55
|
+
|
56
|
+
&:active{
|
57
|
+
@include linear-gradient(#80C66D, darken(#80C66D, 20%));
|
58
|
+
@include box-shadow(inset 0 0 2px darken(#80C66D, 30%));
|
59
|
+
}
|
60
|
+
|
61
|
+
&.selected{
|
62
|
+
@include linear-gradient(#80C66D, darken(#80C66D, 20%));
|
63
|
+
@include box-shadow(inset 0 0 2px darken(#80C66D, 30%));
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
li.btn.first{
|
68
|
+
border-left: 1px solid #ccc;
|
69
|
+
border-radius: 5px 0px 0px 5px;
|
70
|
+
}
|
71
|
+
|
72
|
+
li.btn.last{
|
73
|
+
border-left:none;
|
74
|
+
border-radius: 0px 5px 5px 0px;
|
75
|
+
|
76
|
+
}
|
77
|
+
|
78
|
+
}
|
79
|
+
|
80
|
+
span.upload-button {
|
81
|
+
float:none;
|
82
|
+
@include button(pill);
|
83
|
+
}
|
84
|
+
|
85
|
+
a.upload-button{
|
86
|
+
@include button(pill);
|
87
|
+
}
|
88
|
+
|
89
|
+
span.upload-button.have-file{
|
90
|
+
float:none;
|
91
|
+
@include button(pill,#FCF0BF);
|
92
|
+
}
|
@@ -2,12 +2,24 @@ 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
4
|
content_tag(:div, class: "upload-box") do
|
5
|
-
content_tag(:div, class: "legend"
|
5
|
+
[content_tag(:div, 'upload album', class: "legend"),
|
6
6
|
content_tag(:div, class: "form-box") do
|
7
|
-
content_tag(:form, id: "fileupload", class: "fileupload", method: "POST", enctype: "multipart/form-data") do
|
7
|
+
[content_tag(:form, id: "fileupload", class: "fileupload", method: "POST", enctype: "multipart/form-data", action: "/#{model_name}") do
|
8
|
+
content_tag(:span, id: "upload_button", class: "upload-button btn btn-success fileinput-button") do
|
9
|
+
[content_tag(:i, "", class: "icon-plus icon-white"),
|
10
|
+
content_tag(:span, "Upload picture"),
|
11
|
+
tag(:input, class: "upload-button-input", type: :file, multiple: "")].join.html_safe
|
12
|
+
end
|
13
|
+
end,
|
14
|
+
content_tag(:a, "Close", class: "cancel-button cancel-link", href: "#")].join.html_safe
|
15
|
+
end].join.html_safe +
|
16
|
+
|
17
|
+
content_tag(:div , id: "file_box", class: "file-box") do
|
18
|
+
content_tag(:ul, id: "photos_album", class: "album") do
|
8
19
|
|
9
20
|
end
|
10
21
|
end
|
22
|
+
|
11
23
|
end
|
12
24
|
end
|
13
|
-
end
|
25
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rails/generators/active_record'
|
2
|
-
|
3
2
|
module ActiveRecord
|
4
3
|
module Generators
|
5
4
|
class RubyGalleryGenerator < ActiveRecord::Generators::Base
|
@@ -8,9 +7,11 @@ module ActiveRecord
|
|
8
7
|
source_root File.expand_path("../templates", __FILE__)
|
9
8
|
|
10
9
|
def copy_ruby_gallery_migration
|
11
|
-
migration_template "album_photo_migration.rb", "db/migrate/
|
10
|
+
migration_template "album_photo_migration.rb", "db/migrate/ruby_gallery_create_album_photos"
|
12
11
|
migration_template "migration.rb", "db/migrate/ruby_gallery_add_columns_to_#{table_name}"
|
13
|
-
migration_template "album_attachment_migration.rb", "db/migrate/
|
12
|
+
migration_template "album_attachment_migration.rb", "db/migrate/ruby_gallery_create_album_attachments"
|
14
13
|
end
|
14
|
+
|
15
|
+
end
|
15
16
|
end
|
16
17
|
end
|
@@ -1,13 +1,9 @@
|
|
1
|
-
class
|
2
|
-
def
|
1
|
+
class RubyGalleryCreateAlbumAttachments < ActiveRecord::Migration
|
2
|
+
def change
|
3
3
|
create_table :album_attachments do |a|
|
4
4
|
a.string :parent_type
|
5
5
|
a.integer :parent_id
|
6
6
|
a.timestamps
|
7
7
|
end
|
8
8
|
end
|
9
|
-
|
10
|
-
def down
|
11
|
-
drop_table :album_attachments
|
12
|
-
end
|
13
9
|
end
|
@@ -1,12 +1,13 @@
|
|
1
|
-
class
|
2
|
-
def up
|
3
|
-
create_table :album_photos do |a|
|
4
|
-
a.integer :album_attachment_id
|
5
|
-
a.timestamps
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def down
|
1
|
+
class RubyGalleryCreateAlbumPhotos < ActiveRecord::Migration
|
2
|
+
def self.up
|
10
3
|
drop_table :album_photos
|
11
4
|
end
|
5
|
+
def change
|
6
|
+
create_table :album_photos do |b|
|
7
|
+
b.integer :album_attachment_id
|
8
|
+
b.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
12
13
|
end
|
@@ -16,6 +16,11 @@ module RubyGallery
|
|
16
16
|
def copy_jsfile
|
17
17
|
copy_file "../../../app/assets/javascripts/ruby_gallery.js", "app/assets/javascripts/ruby_gallery.js"
|
18
18
|
end
|
19
|
+
|
20
|
+
def copy_cssfile
|
21
|
+
copy_file "../../../app/assets/stylesheets/ruby_gallery.css.scss", "app/assets/stylesheets/ruby_gallery.css.scss"
|
22
|
+
end
|
23
|
+
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
data/lib/ruby_gallery.rb
CHANGED
data/ruby_gallery.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
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.2"
|
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"]
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"app/assets/javascripts/ruby_gallery.js",
|
28
|
-
"app/assets/stylesheets/ruby_gallery.css",
|
28
|
+
"app/assets/stylesheets/ruby_gallery.css.scss",
|
29
29
|
"app/controllers/attachments_controller.rb",
|
30
30
|
"app/helpers/ruby_gallery/ruby_gallery_helper.rb",
|
31
31
|
"app/models/album_attachment.rb",
|
@@ -51,24 +51,27 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.specification_version = 3
|
52
52
|
|
53
53
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_runtime_dependency(%q<paperclip>, ["~> 3.0"])
|
55
|
+
s.add_runtime_dependency(%q<bourbon>, [">= 0"])
|
54
56
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
55
57
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
56
58
|
s.add_development_dependency(%q<bundler>, ["~> 1.3.4"])
|
57
59
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
58
|
-
s.add_development_dependency(%q<paperclip>, ["~> 3.0"])
|
59
60
|
else
|
61
|
+
s.add_dependency(%q<paperclip>, ["~> 3.0"])
|
62
|
+
s.add_dependency(%q<bourbon>, [">= 0"])
|
60
63
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
61
64
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
62
65
|
s.add_dependency(%q<bundler>, ["~> 1.3.4"])
|
63
66
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
64
|
-
s.add_dependency(%q<paperclip>, ["~> 3.0"])
|
65
67
|
end
|
66
68
|
else
|
69
|
+
s.add_dependency(%q<paperclip>, ["~> 3.0"])
|
70
|
+
s.add_dependency(%q<bourbon>, [">= 0"])
|
67
71
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
72
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
73
|
s.add_dependency(%q<bundler>, ["~> 1.3.4"])
|
70
74
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
71
|
-
s.add_dependency(%q<paperclip>, ["~> 3.0"])
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,14 +12,30 @@ cert_chain: []
|
|
12
12
|
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: paperclip
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bourbon
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
17
33
|
none: false
|
18
34
|
requirements:
|
19
35
|
- - ! '>='
|
20
36
|
- !ruby/object:Gem::Version
|
21
37
|
version: '0'
|
22
|
-
type: :
|
38
|
+
type: :runtime
|
23
39
|
prerelease: false
|
24
40
|
version_requirements: !ruby/object:Gem::Requirement
|
25
41
|
none: false
|
@@ -28,29 +44,29 @@ dependencies:
|
|
28
44
|
- !ruby/object:Gem::Version
|
29
45
|
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
47
|
+
name: shoulda
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
33
49
|
none: false
|
34
50
|
requirements:
|
35
|
-
- -
|
51
|
+
- - ! '>='
|
36
52
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
53
|
+
version: '0'
|
38
54
|
type: :development
|
39
55
|
prerelease: false
|
40
56
|
version_requirements: !ruby/object:Gem::Requirement
|
41
57
|
none: false
|
42
58
|
requirements:
|
43
|
-
- -
|
59
|
+
- - ! '>='
|
44
60
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
63
|
+
name: rdoc
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
49
65
|
none: false
|
50
66
|
requirements:
|
51
67
|
- - ~>
|
52
68
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
69
|
+
version: '3.12'
|
54
70
|
type: :development
|
55
71
|
prerelease: false
|
56
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,15 +74,15 @@ dependencies:
|
|
58
74
|
requirements:
|
59
75
|
- - ~>
|
60
76
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
77
|
+
version: '3.12'
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
79
|
+
name: bundler
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|
65
81
|
none: false
|
66
82
|
requirements:
|
67
83
|
- - ~>
|
68
84
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.
|
85
|
+
version: 1.3.4
|
70
86
|
type: :development
|
71
87
|
prerelease: false
|
72
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,15 +90,15 @@ dependencies:
|
|
74
90
|
requirements:
|
75
91
|
- - ~>
|
76
92
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.
|
93
|
+
version: 1.3.4
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
95
|
+
name: jeweler
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
81
97
|
none: false
|
82
98
|
requirements:
|
83
99
|
- - ~>
|
84
100
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
101
|
+
version: 1.8.4
|
86
102
|
type: :development
|
87
103
|
prerelease: false
|
88
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +106,7 @@ dependencies:
|
|
90
106
|
requirements:
|
91
107
|
- - ~>
|
92
108
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
109
|
+
version: 1.8.4
|
94
110
|
description: Upload image use gallery
|
95
111
|
email: peter@rubify.com
|
96
112
|
executables: []
|
@@ -107,7 +123,7 @@ files:
|
|
107
123
|
- Rakefile
|
108
124
|
- VERSION
|
109
125
|
- app/assets/javascripts/ruby_gallery.js
|
110
|
-
- app/assets/stylesheets/ruby_gallery.css
|
126
|
+
- app/assets/stylesheets/ruby_gallery.css.scss
|
111
127
|
- app/controllers/attachments_controller.rb
|
112
128
|
- app/helpers/ruby_gallery/ruby_gallery_helper.rb
|
113
129
|
- app/models/album_attachment.rb
|
@@ -137,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
153
|
version: '0'
|
138
154
|
segments:
|
139
155
|
- 0
|
140
|
-
hash: -
|
156
|
+
hash: -1535511572070158692
|
141
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
158
|
none: false
|
143
159
|
requirements:
|
File without changes
|