bootsy 2.0.11 → 2.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 820e0bc4f995904c5752a2368376ee0702667cd4
4
- data.tar.gz: 4e488bfa53486db0a91b52d49cb6057ccfcc65b7
3
+ metadata.gz: b37d916855aa7e4327004cdb3c5eb7f11199d256
4
+ data.tar.gz: 623f7dc9e67b1e31877b375bbbe6662954f491c5
5
5
  SHA512:
6
- metadata.gz: e008a0a422e94b496932314e14100003f491724e4e7fca6588a5cff8dfbb9e8cf87f56512809aee54d7ec8ca5540d29a5ba0f1a39193681747e2641592131881
7
- data.tar.gz: fae73019c6c3523bc1144af866cf4715c87c6b87d7dd86266bb14aab2517da4324119fc35ef4edeb87ed659ef38335a41f01ed89450cdde732f43175f389afe8
6
+ metadata.gz: 7883163157131dcb09ca23523dc4ed0039de0a9609d39b45898574e47b45ca1226b74f734235cdeb43f1ea3e65a85cd515784e6db3e150bbd23b2f78b096dc53
7
+ data.tar.gz: 3dbd46fcaf211a137fb00bc39f92c6eab5737c294796fbd3186a75dd22f20f7824918fb2e817e00e383c238fcdb464f171976c832d666bbe3161379c399d1132
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Code Climate](https://codeclimate.com/github/volmer/bootsy.png)](https://codeclimate.com/github/volmer/bootsy)
7
7
  [![Coverage Status](https://coveralls.io/repos/volmer/bootsy/badge.png?branch=master)](https://coveralls.io/r/volmer/bootsy)
8
8
 
9
- *Bootsy* is a WYSIWYG solution for Rails based on [Bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5) which includes image uploads via [CarrierWave](https://github.com/carrierwaveuploader/carrierwave).
9
+ *Bootsy* is a WYSIWYG editor for Rails based on [Bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5) with image uploads using [CarrierWave](https://github.com/carrierwaveuploader/carrierwave).
10
10
 
11
11
  ### Live demo
12
12
 
@@ -19,7 +19,7 @@
19
19
  * Ruby `2` or `1.9.3`;
20
20
  * ImageMagick or GraphicsMagick (for MiniMagick);
21
21
  * Rails `4`;
22
- * [Bootstrap `3`](http://getbootstrap.com/) properly added to your application.
22
+ * [Bootstrap `3`](http://getbootstrap.com/) fully installed in your app.
23
23
 
24
24
 
25
25
  ## Installation
@@ -41,7 +41,7 @@ rails generate bootsy:install
41
41
  It will include the javascripts and stylesheets in the assets pipeline,
42
42
  create the `bootsy.rb` initializer and add a copy of the english translations.
43
43
 
44
- 4\. Add and run migrations (if you're using ActiveRecord):
44
+ 4\. Add and run migrations:
45
45
  ```console
46
46
  rake bootsy:install:migrations
47
47
  rake db:migrate
@@ -50,8 +50,8 @@ rake db:migrate
50
50
 
51
51
  ## Usage
52
52
 
53
- Just call the brand new method `bootsy_area` in your `FormBuilder` instances, the
54
- same way you'd call the basic `textarea` method. Example:
53
+ Just call `bootsy_area` in your `FormBuilder` instances, the
54
+ same way you'd call `textarea`. Example:
55
55
  ```erb
56
56
  <%= form_for(@post) do |f| %>
57
57
  <%= f.label :title %>
@@ -65,20 +65,20 @@ same way you'd call the basic `textarea` method. Example:
65
65
  ```
66
66
 
67
67
  Bootsy will group the uploaded images as galleries and associate them to one of
68
- your models. For example, if you have a `Post` model and you want to use `bootsy_area`
69
- with it, then you should include the `Bootsy::Container` module:
68
+ your models. For instance, if you have a `Post` model and you want to use `bootsy_area`
69
+ with it, you must include the `Bootsy::Container` module:
70
70
  ```ruby
71
71
  class Post < ActiveRecord::Base
72
72
  include Bootsy::Container
73
73
  end
74
74
  ```
75
75
 
76
- Don't forget to ensure the association of new instances of your model with Bootsy
77
- image galleries. For `strong_parameters`, you must allow the parameter `bootsy_image_gallery_id`
78
- in your controllers. Example:
76
+ Don't forget to ensure the association between your model objects with Bootsy
77
+ image galleries. For `strong_parameters`, you must whitelist the `bootsy_image_gallery_id` parameter
78
+ in your controller:
79
79
  ```ruby
80
80
  private
81
- # Never trust parameters from the scary internet, only allow the white list through.
81
+
82
82
  def post_params
83
83
  params.require(:post).permit(:title, :content, :bootsy_image_gallery_id)
84
84
  end
@@ -87,8 +87,7 @@ end
87
87
 
88
88
  ## Bootsy with [Simple Form](https://github.com/plataformatec/simple_form) builders
89
89
 
90
- Just use the brand new input type `bootsy` in your `SimpleForm::FormBuilder` instances,
91
- in the same way you would use the basic `text` input. Example:
90
+ You can use `bootsy` as an input type in `SimpleForm::FormBuilder` instances. Example:
92
91
  ```erb
93
92
  <%= simple_form_for @post do |f| %>
94
93
  <%= f.input :title %>
@@ -102,52 +101,47 @@ in the same way you would use the basic `text` input. Example:
102
101
 
103
102
  ## Editor options
104
103
 
105
- It is possible to customize how the editor is displayed and its behavior by passing
106
- a hash `editor_options` to your `bootsy_area`.
104
+ You can customize Bootsy through a hash of `editor_options`:
107
105
 
108
106
 
109
- ### Buttons
107
+ ### Enable/disable features
110
108
 
111
- You can enable/disable the buttons available on the editor. For example, if you
112
- want to disable the link and color buttons:
109
+ You can enable and disable features as you like. For instance, if you don't want link and color features:
113
110
  ```erb
114
- <%= f.bootsy_area :my_attribute, editor_options: {link: false, color: false} %>
111
+ <%= f.bootsy_area :my_attribute, editor_options: { link: false, color: false } %>
115
112
  ```
116
113
  Available options are: `:font_styles`, `:emphasis`, `:lists`, `:html`, `:link`, `:image` and `:color`.
117
114
 
118
115
 
119
- ### Alert for usaved changes
116
+ ### Alert of usaved changes
120
117
 
121
- By default, Bootsy alerts for unsaved changes if the user attempts to unload
122
- the window. You can disable this behaviour by doing:
118
+ By default Bootsy alerts the user about unsaved changes if the page is closed or reloaded. You can disable
119
+ this feature with:
123
120
  ```erb
124
- <%= f.bootsy_area :my_attribute, editor_options: {alert_unsaved: false} %>
121
+ <%= f.bootsy_area :my_attribute, editor_options: { alert_unsaved: false } %>
125
122
  ```
126
123
 
127
- ## Uploader
124
+ ## Uploads
128
125
 
129
- It's also possible to use Bootsy without the image upload feature. Just call
130
- `bootsy_area` in a form builder not associated to a `Bootsy::Container` model.
131
- This way users can insert images in their texts by providing an image url.
126
+ If you don't want to have image uploads, just call `bootsy_area` in a form builder not
127
+ associated to a `Bootsy::Container` model. This way users will still be able to insert
128
+ images in the text area using an external image URL.
132
129
 
133
130
 
134
131
  ## Configuration
135
132
 
136
133
  You can set the default editor options, image sizes available (small, medium,
137
- large and/or its original), its dimensions and more. Take a look at the initalizer
138
- file, `/config/initializers/bootsy.rb`.
134
+ large and/or its original), dimensions and more. Take a look at Bootsy's initalizer
135
+ file `/config/initializers/bootsy.rb` in your app and feel free to uncomment and change
136
+ the options as you like.
139
137
 
140
138
 
141
139
  ## I18n
142
140
 
143
- Bootsy defines some i18n keys. The english translation is automatically added
144
- to your `config/locales` directory as `bootsy.en.yml`. You can follow that template
145
- in order to translate Bootsy to your language. You can find some examples
146
- [here](https://github.com/volmer/bootsy/tree/master/config/locales). It is also
147
- necessary to add a translation for Bootstrap-wysihtml5, the javascript editor, in
148
- your assets pipeline. Instructions [here](https://github.com/jhollingworth/bootstrap-wysihtml5#i18n).
149
- If you are using the alert for unsaved changes, you have to define a translation
150
- for it as well. Just follow [this example](https://github.com/volmer/bootsy/tree/master/app/assets/bootsy/locales/bootsy.pt-BR.js).
141
+ Bootsy defines some i18n keys. English translations are added by default to your
142
+ `config/locales` directory as `bootsy.en.yml`. You can use it as a template
143
+ to translate Bootsy to your language. [Here are some examples](https://github.com/volmer/bootsy/tree/master/config/locales). You also need to translate Bootstrap-wysihtml5, the underlying javascript editor. Instructions [here](https://github.com/jhollingworth/bootstrap-wysihtml5#i18n). Unless you have disabled it, it's
144
+ also nice to translate the alert message of unsaved changes. Just follow [this example](https://github.com/volmer/bootsy/tree/master/app/assets/bootsy/locales/bootsy.pt-BR.js).
151
145
 
152
146
 
153
147
  ## License
data/Rakefile CHANGED
@@ -25,14 +25,14 @@ Bundler::GemHelper.install_tasks
25
25
  require 'cucumber/rake/task'
26
26
  require 'rspec/core/rake_task'
27
27
  require 'coveralls/rake/task'
28
+ require 'rubocop/rake_task'
28
29
 
30
+ RuboCop::RakeTask.new
29
31
  Coveralls::RakeTask.new
30
-
31
- task default: [:spec, :cucumber, 'coveralls:push']
32
-
33
32
  RSpec::Core::RakeTask.new(:spec)
34
-
35
- Cucumber::Rake::Task.new do |t|
33
+ Cucumber::Rake::Task.new do |_|
36
34
  # Uncomment this line when cucumber/multi_test work with minitest.
37
35
  # t.cucumber_opts = %w{--format pretty -s}
38
36
  end
37
+
38
+ task default: [:rubocop, :spec, :cucumber, 'coveralls:push']
@@ -72,7 +72,19 @@ window.Bootsy.options = {
72
72
  "div": 1,
73
73
  // to allow save and edit files with code tag hacks
74
74
  "code": 1,
75
- "pre": 1
75
+ "pre": 1,
76
+ // this allows youtube embed codes
77
+ "iframe": {
78
+ set_attributes: {
79
+ "frameborder": "0",
80
+ "allowfullscreen": "1"
81
+ },
82
+ check_attributes: {
83
+ "width": "numbers",
84
+ "height": "numbers",
85
+ "src": "href"
86
+ }
87
+ }
76
88
  }
77
89
  },
78
90
  color: true,
@@ -1,3 +1,333 @@
1
- /*
2
- *= require_tree .
3
- */
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-gallery-loader {
318
+ display: block;
319
+ margin: 0 auto;
320
+ }
321
+
322
+ /*The below code is needed for capybara to be able to find the input, as it*/
323
+ /*does not work*/
324
+ .file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover {
325
+ opacity: .01;
326
+ }
327
+
328
+ /* Avoid Boostrap input borders */
329
+ body.bootsy_text_area.form-control {
330
+ border: none;
331
+ -webkit-box-shadow: none;
332
+ box-shadow: none;
333
+ }