bootsy-rails3 2.0.5.1
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 +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +155 -0
- data/Rakefile +38 -0
- data/app/assets/images/bootsy/gallery-loader.gif +0 -0
- data/app/assets/images/bootsy/upload-loader.gif +0 -0
- data/app/assets/javascripts/bootsy.js +8 -0
- data/app/assets/javascripts/bootsy/bootstrap-wysihtml5.js +530 -0
- data/app/assets/javascripts/bootsy/bootstrap.file-input.js +122 -0
- data/app/assets/javascripts/bootsy/bootsy.js +305 -0
- data/app/assets/javascripts/bootsy/editor_options.js +80 -0
- data/app/assets/javascripts/bootsy/init.js +31 -0
- data/app/assets/javascripts/bootsy/locales/bootstrap-wysihtml5.pt-BR.js +50 -0
- data/app/assets/javascripts/bootsy/locales/bootsy.pt-BR.js +9 -0
- data/app/assets/javascripts/bootsy/translations.js +8 -0
- data/app/assets/javascripts/bootsy/wysihtml5.js +9564 -0
- data/app/assets/stylesheets/bootsy.css +3 -0
- data/app/assets/stylesheets/bootsy/bootstrap-submenu.css +47 -0
- data/app/assets/stylesheets/bootsy/bootstrap-wysihtml5.css +102 -0
- data/app/assets/stylesheets/bootsy/bootsy.css +161 -0
- data/app/controllers/bootsy/application_controller.rb +7 -0
- data/app/controllers/bootsy/images_controller.rb +80 -0
- data/app/helpers/bootsy/application_helper.rb +11 -0
- data/app/uploaders/bootsy/image_uploader.rb +35 -0
- data/app/views/bootsy/images/_image.html.erb +43 -0
- data/app/views/bootsy/images/_modal.html.erb +28 -0
- data/app/views/bootsy/images/_new.html.erb +8 -0
- data/config/cucumber.yml +8 -0
- data/config/locales/en.yml +27 -0
- data/config/locales/pt-BR.yml +27 -0
- data/config/routes.rb +11 -0
- data/db/migrate/20120624171333_create_bootsy_images.rb +9 -0
- data/db/migrate/20120628124845_create_bootsy_image_galleries.rb +8 -0
- data/lib/bootsy-rails3.rb +66 -0
- data/lib/bootsy/activerecord/image.rb +11 -0
- data/lib/bootsy/activerecord/image_gallery.rb +8 -0
- data/lib/bootsy/container.rb +31 -0
- data/lib/bootsy/core_ext.rb +2 -0
- data/lib/bootsy/engine.rb +31 -0
- data/lib/bootsy/form_builder.rb +7 -0
- data/lib/bootsy/form_helper.rb +68 -0
- data/lib/bootsy/simple_form/bootsy_input.rb +11 -0
- data/lib/bootsy/version.rb +3 -0
- data/lib/generators/bootsy/USAGE +12 -0
- data/lib/generators/bootsy/install_generator.rb +50 -0
- data/lib/generators/bootsy/templates/bootsy.rb +64 -0
- data/lib/tasks/bootsy_tasks.rake +4 -0
- data/lib/tasks/cucumber.rake +65 -0
- metadata +137 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
.dropdown-submenu {
|
2
|
+
position:relative;
|
3
|
+
}
|
4
|
+
|
5
|
+
.dropdown-submenu>.dropdown-menu {
|
6
|
+
top: 0;
|
7
|
+
left: 100%;
|
8
|
+
margin-top: -6px;
|
9
|
+
margin-left: -1px;
|
10
|
+
-webkit-border-radius: 0 6px 6px 6px;
|
11
|
+
-moz-border-radius: 0 6px 6px 6px;
|
12
|
+
border-radius: 0 6px 6px 6px;
|
13
|
+
}
|
14
|
+
|
15
|
+
.dropdown-submenu:hover > .dropdown-menu {
|
16
|
+
display:block;
|
17
|
+
}
|
18
|
+
|
19
|
+
.dropdown-submenu > a:after {
|
20
|
+
display: block;
|
21
|
+
content: " ";
|
22
|
+
float: right;
|
23
|
+
width: 0;
|
24
|
+
height: 0;
|
25
|
+
border-color: transparent;
|
26
|
+
border-style: solid;
|
27
|
+
border-width: 5px 0 5px 5px;
|
28
|
+
border-left-color: #cccccc;
|
29
|
+
margin-top: 5px;
|
30
|
+
margin-right: -10px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.dropdown-submenu:hover > a:after {
|
34
|
+
border-left-color: #ffffff;
|
35
|
+
}
|
36
|
+
|
37
|
+
.dropdown-submenu.pull-left {
|
38
|
+
float:none;
|
39
|
+
}
|
40
|
+
|
41
|
+
.dropdown-submenu.pull-left > .dropdown-menu {
|
42
|
+
left: -100%;
|
43
|
+
margin-left: 10px;
|
44
|
+
-webkit-border-radius: 6px 0 6px 6px;
|
45
|
+
-moz-border-radius: 6px 0 6px 6px;
|
46
|
+
border-radius: 6px 0 6px 6px;
|
47
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
ul.wysihtml5-toolbar {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
display: block;
|
5
|
+
}
|
6
|
+
|
7
|
+
ul.wysihtml5-toolbar::after {
|
8
|
+
clear: both;
|
9
|
+
display: table;
|
10
|
+
content: "";
|
11
|
+
}
|
12
|
+
|
13
|
+
ul.wysihtml5-toolbar > li {
|
14
|
+
float: left;
|
15
|
+
display: list-item;
|
16
|
+
list-style: none;
|
17
|
+
margin: 0 5px 10px 0;
|
18
|
+
}
|
19
|
+
|
20
|
+
ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] {
|
21
|
+
font-weight: bold;
|
22
|
+
}
|
23
|
+
|
24
|
+
ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] {
|
25
|
+
font-style: italic;
|
26
|
+
}
|
27
|
+
|
28
|
+
ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] {
|
29
|
+
text-decoration: underline;
|
30
|
+
}
|
31
|
+
|
32
|
+
ul.wysihtml5-toolbar a.btn.wysihtml5-command-active {
|
33
|
+
background-image: none;
|
34
|
+
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
|
35
|
+
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
|
36
|
+
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
|
37
|
+
background-color: #E6E6E6;
|
38
|
+
background-color: #D9D9D9;
|
39
|
+
outline: 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
ul.wysihtml5-commands-disabled .dropdown-menu {
|
43
|
+
display: none !important;
|
44
|
+
}
|
45
|
+
|
46
|
+
ul.wysihtml5-toolbar div.wysihtml5-colors {
|
47
|
+
display:block;
|
48
|
+
width: 50px;
|
49
|
+
height: 20px;
|
50
|
+
margin-top: 2px;
|
51
|
+
margin-left: 5px;
|
52
|
+
position: absolute;
|
53
|
+
pointer-events: none;
|
54
|
+
}
|
55
|
+
|
56
|
+
ul.wysihtml5-toolbar a.wysihtml5-colors-title {
|
57
|
+
padding-left: 70px;
|
58
|
+
}
|
59
|
+
|
60
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="black"] {
|
61
|
+
background: black !important;
|
62
|
+
}
|
63
|
+
|
64
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="silver"] {
|
65
|
+
background: silver !important;
|
66
|
+
}
|
67
|
+
|
68
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="gray"] {
|
69
|
+
background: gray !important;
|
70
|
+
}
|
71
|
+
|
72
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="maroon"] {
|
73
|
+
background: maroon !important;
|
74
|
+
}
|
75
|
+
|
76
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="red"] {
|
77
|
+
background: red !important;
|
78
|
+
}
|
79
|
+
|
80
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="purple"] {
|
81
|
+
background: purple !important;
|
82
|
+
}
|
83
|
+
|
84
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="green"] {
|
85
|
+
background: green !important;
|
86
|
+
}
|
87
|
+
|
88
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="olive"] {
|
89
|
+
background: olive !important;
|
90
|
+
}
|
91
|
+
|
92
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="navy"] {
|
93
|
+
background: navy !important;
|
94
|
+
}
|
95
|
+
|
96
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="blue"] {
|
97
|
+
background: blue !important;
|
98
|
+
}
|
99
|
+
|
100
|
+
ul.wysihtml5-toolbar div[data-wysihtml5-command-value="orange"] {
|
101
|
+
background: orange !important;
|
102
|
+
}
|
@@ -0,0 +1,161 @@
|
|
1
|
+
.wysiwyg-color-black {
|
2
|
+
color: black;
|
3
|
+
}
|
4
|
+
|
5
|
+
.wysiwyg-color-silver {
|
6
|
+
color: silver;
|
7
|
+
}
|
8
|
+
|
9
|
+
.wysiwyg-color-gray {
|
10
|
+
color: gray;
|
11
|
+
}
|
12
|
+
|
13
|
+
.wysiwyg-color-white {
|
14
|
+
color: white;
|
15
|
+
}
|
16
|
+
|
17
|
+
.wysiwyg-color-maroon {
|
18
|
+
color: maroon;
|
19
|
+
}
|
20
|
+
|
21
|
+
.wysiwyg-color-red {
|
22
|
+
color: red;
|
23
|
+
}
|
24
|
+
|
25
|
+
.wysiwyg-color-purple {
|
26
|
+
color: purple;
|
27
|
+
}
|
28
|
+
|
29
|
+
.wysiwyg-color-fuchsia {
|
30
|
+
color: fuchsia;
|
31
|
+
}
|
32
|
+
|
33
|
+
.wysiwyg-color-green {
|
34
|
+
color: green;
|
35
|
+
}
|
36
|
+
|
37
|
+
.wysiwyg-color-lime {
|
38
|
+
color: lime;
|
39
|
+
}
|
40
|
+
|
41
|
+
.wysiwyg-color-olive {
|
42
|
+
color: olive;
|
43
|
+
}
|
44
|
+
|
45
|
+
.wysiwyg-color-yellow {
|
46
|
+
color: yellow;
|
47
|
+
}
|
48
|
+
|
49
|
+
.wysiwyg-color-navy {
|
50
|
+
color: navy;
|
51
|
+
}
|
52
|
+
|
53
|
+
.wysiwyg-color-blue {
|
54
|
+
color: blue;
|
55
|
+
}
|
56
|
+
|
57
|
+
.wysiwyg-color-teal {
|
58
|
+
color: teal;
|
59
|
+
}
|
60
|
+
|
61
|
+
.wysiwyg-color-aqua {
|
62
|
+
color: aqua;
|
63
|
+
}
|
64
|
+
|
65
|
+
.wysiwyg-float-left {
|
66
|
+
float: left;
|
67
|
+
margin: 0 8px 8px 0;
|
68
|
+
}
|
69
|
+
|
70
|
+
.wysiwyg-float-right {
|
71
|
+
float: right;
|
72
|
+
margin: 0 0 8px 8px;
|
73
|
+
}
|
74
|
+
|
75
|
+
blockquote {
|
76
|
+
padding: 0 0 0 15px;
|
77
|
+
margin: 0 0 20px;
|
78
|
+
border-left: 5px solid #eeeeee;
|
79
|
+
}
|
80
|
+
|
81
|
+
blockquote p {
|
82
|
+
margin-bottom: 0;
|
83
|
+
}
|
84
|
+
|
85
|
+
blockquote small {
|
86
|
+
display: block;
|
87
|
+
line-height: 20px;
|
88
|
+
color: #999999;
|
89
|
+
}
|
90
|
+
|
91
|
+
blockquote small:before {
|
92
|
+
content: '\2014 \00A0';
|
93
|
+
}
|
94
|
+
|
95
|
+
blockquote.pull-right {
|
96
|
+
float: right;
|
97
|
+
padding-right: 15px;
|
98
|
+
padding-left: 0;
|
99
|
+
border-right: 5px solid #eeeeee;
|
100
|
+
border-left: 0;
|
101
|
+
}
|
102
|
+
|
103
|
+
blockquote.pull-right p,
|
104
|
+
blockquote.pull-right small {
|
105
|
+
text-align: right;
|
106
|
+
}
|
107
|
+
|
108
|
+
blockquote.pull-right small:before {
|
109
|
+
content: '';
|
110
|
+
}
|
111
|
+
|
112
|
+
blockquote.pull-right small:after {
|
113
|
+
content: '\00A0 \2014';
|
114
|
+
}
|
115
|
+
|
116
|
+
q:before,
|
117
|
+
q:after,
|
118
|
+
blockquote:before,
|
119
|
+
blockquote:after {
|
120
|
+
content: "";
|
121
|
+
}
|
122
|
+
|
123
|
+
textarea.bootsy:required:invalid {
|
124
|
+
color: inherit;
|
125
|
+
}
|
126
|
+
|
127
|
+
/*Modal Design Styles*/
|
128
|
+
|
129
|
+
.bootsy-modal .file-input-name {display: none;} /*Hide the input file name from showing as it's not needed and ruins design*/
|
130
|
+
|
131
|
+
/*Set a min-height on the modal body to prevent jumping up and down of modal when adding content*/
|
132
|
+
.bootsy-modal .modal-body {
|
133
|
+
min-height: 120px;
|
134
|
+
}
|
135
|
+
|
136
|
+
.bootsy-image {
|
137
|
+
margin-bottom: 15px;
|
138
|
+
}
|
139
|
+
|
140
|
+
.bootsy-upload-loader {
|
141
|
+
display: inline-block;
|
142
|
+
padding-right: 5px;
|
143
|
+
}
|
144
|
+
|
145
|
+
.bootsy-gallery-loader {
|
146
|
+
display: block;
|
147
|
+
margin: 0 auto;
|
148
|
+
}
|
149
|
+
|
150
|
+
/*The below code is needed for capybara to be able to find the input, as it*/
|
151
|
+
/*does not work*/
|
152
|
+
.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover {
|
153
|
+
opacity: .01;
|
154
|
+
}
|
155
|
+
|
156
|
+
/* Avoid Boostrap input borders */
|
157
|
+
body.bootsy_text_area.form-control {
|
158
|
+
border: none;
|
159
|
+
-webkit-box-shadow: none;
|
160
|
+
box-shadow: none;
|
161
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require_dependency 'bootsy/application_controller'
|
2
|
+
|
3
|
+
module Bootsy
|
4
|
+
class ImagesController < Bootsy::ApplicationController
|
5
|
+
# GET /images
|
6
|
+
# GET /images.json
|
7
|
+
def index
|
8
|
+
@gallery = find_gallery
|
9
|
+
@images = @gallery.images
|
10
|
+
|
11
|
+
respond_to do |format|
|
12
|
+
format.html # index.html.erb
|
13
|
+
format.json do
|
14
|
+
rendered_images = []
|
15
|
+
|
16
|
+
@images.each do |image|
|
17
|
+
rendered_images << render_to_string(file: 'bootsy/images/_image',
|
18
|
+
formats: [:html],
|
19
|
+
locals: { image: image })
|
20
|
+
end
|
21
|
+
|
22
|
+
new_image = render_to_string(file: 'bootsy/images/_new',
|
23
|
+
formats: [:html],
|
24
|
+
locals: { gallery: @gallery, image: @gallery.images.new })
|
25
|
+
|
26
|
+
render json: { images: rendered_images, form: new_image }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# POST /images
|
32
|
+
# POST /images.json
|
33
|
+
def create
|
34
|
+
@gallery = find_gallery
|
35
|
+
@gallery.save! unless @gallery.persisted?
|
36
|
+
@image = Image.new image_params
|
37
|
+
@image.image_gallery_id = @gallery.id
|
38
|
+
|
39
|
+
respond_to do |format|
|
40
|
+
if @image.save
|
41
|
+
image_view = render_to_string(file: 'bootsy/images/_image',
|
42
|
+
formats: [:html],
|
43
|
+
locals: { image: @image })
|
44
|
+
|
45
|
+
new_image = render_to_string(file: 'bootsy/images/_new',
|
46
|
+
formats: [:html],
|
47
|
+
locals: { gallery: @gallery, image: @gallery.images.new })
|
48
|
+
|
49
|
+
format.json { render json: { image: image_view, form: new_image, gallery_id: @gallery.id } }
|
50
|
+
else
|
51
|
+
format.json { render json: @image.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# DELETE /images/1
|
57
|
+
# DELETE /images/1.json
|
58
|
+
def destroy
|
59
|
+
@image = Image.find(params[:id])
|
60
|
+
@image.destroy
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
format.json { render json: { id: params[:id] } }
|
64
|
+
format.html { redirect_to images_url }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def find_gallery
|
71
|
+
ImageGallery.find(params[:image_gallery_id])
|
72
|
+
end
|
73
|
+
|
74
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
75
|
+
# FIXME RoR3 hack
|
76
|
+
def image_params
|
77
|
+
params[:image]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Bootsy
|
2
|
+
module ApplicationHelper
|
3
|
+
def refresh_btn
|
4
|
+
link_to t('bootsy.action.refresh'), '#refresh-gallery', class: 'btn btn-default btn-sm refresh-btn'
|
5
|
+
end
|
6
|
+
|
7
|
+
def resource_or_nil resource
|
8
|
+
resource if resource.present? && resource.persisted?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Bootsy
|
3
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
4
|
+
include CarrierWave::MiniMagick
|
5
|
+
|
6
|
+
storage Bootsy.storage
|
7
|
+
|
8
|
+
def store_dir
|
9
|
+
"#{Bootsy.store_dir}/#{model.class.to_s.underscore}/#{model.id}"
|
10
|
+
end
|
11
|
+
|
12
|
+
# Process files as they are uploaded:
|
13
|
+
process resize_to_limit: [1160, 2000]
|
14
|
+
|
15
|
+
version :large do
|
16
|
+
process resize_to_fit: [Bootsy.large_image[:width], Bootsy.large_image[:height]]
|
17
|
+
end
|
18
|
+
|
19
|
+
version :medium do
|
20
|
+
process resize_to_fit: [Bootsy.medium_image[:width], Bootsy.medium_image[:height]]
|
21
|
+
end
|
22
|
+
|
23
|
+
version :small do
|
24
|
+
process resize_to_fit: [Bootsy.small_image[:width], Bootsy.small_image[:height]]
|
25
|
+
end
|
26
|
+
|
27
|
+
version :thumb do
|
28
|
+
process resize_to_fill: [60, 60]
|
29
|
+
end
|
30
|
+
|
31
|
+
def extension_white_list
|
32
|
+
%w(jpg jpeg gif png)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|