bootsy_full_html 2.2.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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +159 -0
  4. data/Rakefile +35 -0
  5. data/app/assets/images/bootsy/gallery-loader.gif +0 -0
  6. data/app/assets/images/bootsy/upload-loader.gif +0 -0
  7. data/app/assets/javascripts/bootsy.js +11 -0
  8. data/app/assets/javascripts/bootsy/area.js +89 -0
  9. data/app/assets/javascripts/bootsy/editor_options.js +47 -0
  10. data/app/assets/javascripts/bootsy/image_template.js +11 -0
  11. data/app/assets/javascripts/bootsy/init.js +38 -0
  12. data/app/assets/javascripts/bootsy/locales/en.js +54 -0
  13. data/app/assets/javascripts/bootsy/locales/pt-BR.js +54 -0
  14. data/app/assets/javascripts/bootsy/modal.js +192 -0
  15. data/app/assets/javascripts/bootsy/vendor/bootstrap-wysihtml5.js +530 -0
  16. data/app/assets/javascripts/bootsy/vendor/bootstrap.file-input.js +122 -0
  17. data/app/assets/javascripts/bootsy/vendor/polyfill.js +29 -0
  18. data/app/assets/javascripts/bootsy/vendor/wysihtml5.js +9565 -0
  19. data/app/assets/stylesheets/bootsy.css +337 -0
  20. data/app/controllers/bootsy/application_controller.rb +7 -0
  21. data/app/controllers/bootsy/images_controller.rb +96 -0
  22. data/app/helpers/bootsy/application_helper.rb +13 -0
  23. data/app/uploaders/bootsy/image_uploader.rb +39 -0
  24. data/app/views/bootsy/images/_image.html.erb +43 -0
  25. data/app/views/bootsy/images/_modal.html.erb +29 -0
  26. data/app/views/bootsy/images/_new.html.erb +17 -0
  27. data/config/locales/bootsy.en.yml +30 -0
  28. data/config/locales/bootsy.pt-BR.yml +30 -0
  29. data/config/routes.rb +11 -0
  30. data/db/migrate/20120624171333_create_bootsy_images.rb +9 -0
  31. data/db/migrate/20120628124845_create_bootsy_image_galleries.rb +8 -0
  32. data/lib/bootsy.rb +68 -0
  33. data/lib/bootsy/activerecord/image.rb +12 -0
  34. data/lib/bootsy/activerecord/image_gallery.rb +23 -0
  35. data/lib/bootsy/container.rb +52 -0
  36. data/lib/bootsy/core_ext.rb +4 -0
  37. data/lib/bootsy/engine.rb +34 -0
  38. data/lib/bootsy/form_builder.rb +18 -0
  39. data/lib/bootsy/form_helper.rb +114 -0
  40. data/lib/bootsy/simple_form/bootsy_input.rb +24 -0
  41. data/lib/bootsy/version.rb +4 -0
  42. data/lib/generators/bootsy/USAGE +12 -0
  43. data/lib/generators/bootsy/install_generator.rb +53 -0
  44. data/lib/generators/bootsy/templates/bootsy.rb +69 -0
  45. data/lib/tasks/bootsy_tasks.rake +4 -0
  46. metadata +130 -0
@@ -0,0 +1,337 @@
1
+ /*
2
+ Bootstrap-submenu
3
+ */
4
+
5
+ .dropdown-submenu {
6
+ position:relative;
7
+ }
8
+
9
+ .dropdown-submenu>.dropdown-menu {
10
+ top: 0;
11
+ left: 100%;
12
+ margin-top: -6px;
13
+ margin-left: -1px;
14
+ -webkit-border-radius: 0 6px 6px 6px;
15
+ -moz-border-radius: 0 6px 6px 6px;
16
+ border-radius: 0 6px 6px 6px;
17
+ }
18
+
19
+ .dropdown-submenu:hover > .dropdown-menu {
20
+ display:block;
21
+ }
22
+
23
+ .dropdown-submenu > a:after {
24
+ display: block;
25
+ content: " ";
26
+ float: right;
27
+ width: 0;
28
+ height: 0;
29
+ border-color: transparent;
30
+ border-style: solid;
31
+ border-width: 5px 0 5px 5px;
32
+ border-left-color: #cccccc;
33
+ margin-top: 5px;
34
+ margin-right: -10px;
35
+ }
36
+
37
+ .dropdown-submenu:hover > a:after {
38
+ border-left-color: #ffffff;
39
+ }
40
+
41
+ .dropdown-submenu.pull-left {
42
+ float:none;
43
+ }
44
+
45
+ .dropdown-submenu.pull-left > .dropdown-menu {
46
+ left: -100%;
47
+ margin-left: 10px;
48
+ -webkit-border-radius: 6px 0 6px 6px;
49
+ -moz-border-radius: 6px 0 6px 6px;
50
+ border-radius: 6px 0 6px 6px;
51
+ }
52
+
53
+ /*
54
+ Bootstrap-wysihtml5
55
+ */
56
+
57
+ ul.wysihtml5-toolbar {
58
+ margin: 0;
59
+ padding: 0;
60
+ display: block;
61
+ }
62
+
63
+ ul.wysihtml5-toolbar::after {
64
+ clear: both;
65
+ display: table;
66
+ content: "";
67
+ }
68
+
69
+ ul.wysihtml5-toolbar > li {
70
+ float: left;
71
+ display: list-item;
72
+ list-style: none;
73
+ margin: 0 5px 10px 0;
74
+ }
75
+
76
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] {
77
+ font-weight: bold;
78
+ }
79
+
80
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] {
81
+ font-style: italic;
82
+ }
83
+
84
+ ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] {
85
+ text-decoration: underline;
86
+ }
87
+
88
+ ul.wysihtml5-toolbar a.btn.wysihtml5-command-active {
89
+ background-image: none;
90
+ -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
91
+ -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
92
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
93
+ background-color: #E6E6E6;
94
+ background-color: #D9D9D9;
95
+ outline: 0;
96
+ }
97
+
98
+ ul.wysihtml5-commands-disabled .dropdown-menu {
99
+ display: none !important;
100
+ }
101
+
102
+ ul.wysihtml5-toolbar div.wysihtml5-colors {
103
+ display:block;
104
+ width: 50px;
105
+ height: 20px;
106
+ margin-top: 2px;
107
+ margin-left: 5px;
108
+ position: absolute;
109
+ pointer-events: none;
110
+ }
111
+
112
+ ul.wysihtml5-toolbar a.wysihtml5-colors-title {
113
+ padding-left: 70px;
114
+ }
115
+
116
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="black"] {
117
+ background: black !important;
118
+ }
119
+
120
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="silver"] {
121
+ background: silver !important;
122
+ }
123
+
124
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="gray"] {
125
+ background: gray !important;
126
+ }
127
+
128
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="maroon"] {
129
+ background: maroon !important;
130
+ }
131
+
132
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="red"] {
133
+ background: red !important;
134
+ }
135
+
136
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="purple"] {
137
+ background: purple !important;
138
+ }
139
+
140
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="green"] {
141
+ background: green !important;
142
+ }
143
+
144
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="olive"] {
145
+ background: olive !important;
146
+ }
147
+
148
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="navy"] {
149
+ background: navy !important;
150
+ }
151
+
152
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="blue"] {
153
+ background: blue !important;
154
+ }
155
+
156
+ ul.wysihtml5-toolbar div[data-wysihtml5-command-value="orange"] {
157
+ background: orange !important;
158
+ }
159
+
160
+ /*
161
+ Bootsy
162
+ */
163
+
164
+ .wysiwyg-color-black {
165
+ color: black;
166
+ }
167
+
168
+ .wysiwyg-color-silver {
169
+ color: silver;
170
+ }
171
+
172
+ .wysiwyg-color-gray {
173
+ color: gray;
174
+ }
175
+
176
+ .wysiwyg-color-white {
177
+ color: white;
178
+ }
179
+
180
+ .wysiwyg-color-maroon {
181
+ color: maroon;
182
+ }
183
+
184
+ .wysiwyg-color-red {
185
+ color: red;
186
+ }
187
+
188
+ .wysiwyg-color-purple {
189
+ color: purple;
190
+ }
191
+
192
+ .wysiwyg-color-fuchsia {
193
+ color: fuchsia;
194
+ }
195
+
196
+ .wysiwyg-color-green {
197
+ color: green;
198
+ }
199
+
200
+ .wysiwyg-color-lime {
201
+ color: lime;
202
+ }
203
+
204
+ .wysiwyg-color-olive {
205
+ color: olive;
206
+ }
207
+
208
+ .wysiwyg-color-orange {
209
+ color: orange;
210
+ }
211
+
212
+ .wysiwyg-color-yellow {
213
+ color: yellow;
214
+ }
215
+
216
+ .wysiwyg-color-navy {
217
+ color: navy;
218
+ }
219
+
220
+ .wysiwyg-color-blue {
221
+ color: blue;
222
+ }
223
+
224
+ .wysiwyg-color-teal {
225
+ color: teal;
226
+ }
227
+
228
+ .wysiwyg-color-aqua {
229
+ color: aqua;
230
+ }
231
+
232
+ .wysiwyg-float-left {
233
+ float: left;
234
+ margin: 0 8px 8px 0;
235
+ }
236
+
237
+ .wysiwyg-float-right {
238
+ float: right;
239
+ margin: 0 0 8px 8px;
240
+ }
241
+
242
+ .bootsy blockquote {
243
+ padding: 10px 20px;
244
+ margin: 0 0 20px;
245
+ font-size: 17.5px;
246
+ border-left: 5px solid #eee;
247
+ }
248
+ .bootsy blockquote p:last-child,
249
+ .bootsy blockquote ul:last-child,
250
+ .bootsy blockquote ol:last-child {
251
+ margin-bottom: 0;
252
+ }
253
+ .bootsy blockquote footer,
254
+ .bootsy blockquote small,
255
+ .bootsy blockquote .small {
256
+ display: block;
257
+ font-size: 80%;
258
+ line-height: 1.42857143;
259
+ color: #777;
260
+ }
261
+ .bootsy blockquote footer:before,
262
+ .bootsy blockquote small:before,
263
+ .bootsy blockquote .small:before {
264
+ content: '\2014 \00A0';
265
+ }
266
+ .bootsy .blockquote-reverse,
267
+ .bootsy blockquote.pull-right {
268
+ padding-right: 15px;
269
+ padding-left: 0;
270
+ text-align: right;
271
+ border-right: 5px solid #eee;
272
+ border-left: 0;
273
+ }
274
+ .bootsy .blockquote-reverse footer:before,
275
+ .bootsy blockquote.pull-right footer:before,
276
+ .blockquote-reverse small:before,
277
+ .bootsy blockquote.pull-right small:before,
278
+ .bootsy .blockquote-reverse .small:before,
279
+ .bootsy blockquote.pull-right .small:before {
280
+ content: '';
281
+ }
282
+ .bootsy .blockquote-reverse footer:after,
283
+ .bootsy blockquote.pull-right footer:after,
284
+ .bootsy .blockquote-reverse small:after,
285
+ .bootsy blockquote.pull-right small:after,
286
+ .bootsy .blockquote-reverse .small:after,
287
+ .bootsy blockquote.pull-right .small:after {
288
+ content: '\00A0 \2014';
289
+ }
290
+ .bootsy blockquote:before,
291
+ .bootsy blockquote:after {
292
+ content: "";
293
+ }
294
+
295
+ textarea.bootsy:required:invalid {
296
+ color: inherit;
297
+ }
298
+
299
+ /*Modal Design Styles*/
300
+
301
+ .bootsy-modal .file-input-name {display: none;} /*Hide the input file name from showing as it's not needed and ruins design*/
302
+
303
+ /*Set a min-height on the modal body to prevent jumping up and down of modal when adding content*/
304
+ .bootsy-modal .modal-body {
305
+ min-height: 120px;
306
+ }
307
+
308
+ .bootsy-image {
309
+ margin-bottom: 15px;
310
+ }
311
+
312
+ .bootsy-upload-loader {
313
+ display: inline-block;
314
+ padding-right: 5px;
315
+ }
316
+
317
+ .bootsy-upload-spacer {
318
+ padding: 0 10px 0 10px;
319
+ }
320
+
321
+ .bootsy-gallery-loader {
322
+ display: block;
323
+ margin: 0 auto;
324
+ }
325
+
326
+ /*The below code is needed for capybara to be able to find the input, as it*/
327
+ /*does not work*/
328
+ .file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover {
329
+ opacity: .01;
330
+ }
331
+
332
+ /* Avoid Boostrap input borders */
333
+ body.bootsy_text_area.form-control {
334
+ border: none;
335
+ -webkit-box-shadow: none;
336
+ box-shadow: none;
337
+ }
@@ -0,0 +1,7 @@
1
+ module Bootsy
2
+ class ApplicationController < Bootsy.base_controller
3
+ # Prevent CSRF attacks by raising an exception.
4
+ # For APIs, you may want to use :null_session instead.
5
+ protect_from_forgery with: :exception
6
+ end
7
+ end
@@ -0,0 +1,96 @@
1
+ require_dependency 'bootsy/application_controller'
2
+
3
+ module Bootsy
4
+ class ImagesController < Bootsy::ApplicationController
5
+ before_action :set_gallery, only: [:index, :create]
6
+
7
+ def index
8
+ @images = @gallery.images
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+
13
+ format.json do
14
+ render json: {
15
+ images: @images.map { |image| image_markup(image) },
16
+ form: new_image_markup(@gallery)
17
+ }
18
+ end
19
+ end
20
+ end
21
+
22
+ def create
23
+ @gallery.save!
24
+ @image = @gallery.images.new(image_params)
25
+
26
+ create_and_respond
27
+ end
28
+
29
+ def destroy
30
+ @image = Image.find(params[:id])
31
+ @image.destroy
32
+
33
+ respond_to do |format|
34
+ format.json do
35
+ render json: { id: params[:id] }
36
+ end
37
+
38
+ format.html { redirect_to images_url }
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def set_gallery
45
+ @gallery = ImageGallery.find(params[:image_gallery_id])
46
+ end
47
+
48
+ # Private: Returns the String markup to render
49
+ # an image in the gallery modal.
50
+ #
51
+ # image - The `Bootsy::Image` instance that will
52
+ # be rendered.
53
+ def image_markup(image)
54
+ render_to_string(
55
+ file: 'bootsy/images/_image',
56
+ formats: [:html],
57
+ locals: { image: image }
58
+ )
59
+ end
60
+
61
+ # Private: Returns the String markup to render
62
+ # a form to upload a new image in a given gallery.
63
+ #
64
+ # gallery - The `Bootsy::ImageGallery` instance which
65
+ # the image will be uploaded to.
66
+ def new_image_markup(gallery)
67
+ render_to_string(
68
+ file: 'bootsy/images/_new',
69
+ formats: [:html],
70
+ locals: { gallery: gallery, image: gallery.images.new }
71
+ )
72
+ end
73
+
74
+ def image_params
75
+ params.require(:image).permit(:image_file, :remote_image_file_url)
76
+ end
77
+
78
+ def create_and_respond
79
+ respond_to do |format|
80
+ if @image.save
81
+ format.json do
82
+ render json: {
83
+ image: image_markup(@image),
84
+ form: new_image_markup(@gallery),
85
+ gallery_id: @gallery.id
86
+ }
87
+ end
88
+ else
89
+ format.json do
90
+ render json: @image.errors, status: :unprocessable_entity
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,13 @@
1
+ module Bootsy
2
+ module ApplicationHelper
3
+ def refresh_btn
4
+ link_to t('bootsy.action.refresh'),
5
+ '#refresh-gallery',
6
+ class: 'btn btn-default btn-sm refresh-btn'
7
+ end
8
+
9
+ def resource_or_nil(resource)
10
+ resource if resource.present? && resource.persisted?
11
+ end
12
+ end
13
+ end