fondant-rails 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a39ead5479b83675473610ba5635bd724d08e0a
4
- data.tar.gz: 973cc6c77bcb5e597d4b7a97491a6175200d59f6
3
+ metadata.gz: ea8f67fa775fe28e3580606bb997dc6119e77a3c
4
+ data.tar.gz: 15a8d98d368a0581a19fab8eb76086374caf56df
5
5
  SHA512:
6
- metadata.gz: 2911a15462910db37b90fec3e08785e9931765dd51ef21d31680e1af55214959ea15d239a6acfe1b819398f84201ed4ca3d6aae5cc885f157fd2b50e76541113
7
- data.tar.gz: 3ecc5882927c38b77ae12292d5da659851abd8d039a943153b683e252a72ad980a164674a470a4c692fecc6c04466b91b1d5cc28ee1be40afff52f51d9e40b9e
6
+ metadata.gz: bc2bb3d8b65ca95b2ae078f895a120f8eae061cffa8fbfcfc52fa317231f340e6613fd432e52be7f61e9b456192cab8a304c1aa574563e7e97cbf74eee08d194
7
+ data.tar.gz: c2b6c5dc93d52e0b21e6cc561a7b83b4c9b394cdc94ebc1343496f3d0fda27d34d1d2479126ebe12d03075c278ff30a6a1a29bdcc4518d20666e02bd269733c9
data/README.md CHANGED
@@ -6,7 +6,7 @@ Use [fondant](https://github.com/ovenbits-ingredients/fondant) in Rails' asset p
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'fondant-rails', '~> 0.5.0'
9
+ gem 'fondant-rails', '~> 0.6.0'
10
10
 
11
11
  ## Contributing
12
12
 
@@ -1,5 +1,5 @@
1
1
  module Fondant
2
2
  module Rails
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- # ## Fondant v0.5.0
1
+ # ## Fondant v0.6.0
2
2
  #
3
3
  # The icing on the cake for user input. A simple jQuery HTML5 WYSIWYG editor
4
4
  # using `contenteditable`.
@@ -38,6 +38,12 @@
38
38
  # a toolbar and you are responsible for building and wiring up your own.
39
39
  # (default: `true`)
40
40
  #
41
+ # * `buttons` - An array of commands to include as buttons. Links & custom html cannot be
42
+ # automatically addes as a toolbar button because there needs to be some form of input between
43
+ # the button click and the application. Everything else is available to use.
44
+ # (default: [ 'bold', 'italic', 'p', 'h1', 'h2', 'h3', 'h4', 'blockquote', 'ol', 'ul', 'indent',
45
+ # 'outdent', 'remove', 'unlink', 'undo', 'redo' ]`)
46
+ #
41
47
 
42
48
 
43
49
  $ = jQuery
@@ -50,6 +56,7 @@ if typeof $ isnt 'undefined'
50
56
  # is called.
51
57
  #
52
58
  class Fondant
59
+ version: "0.6.0"
53
60
 
54
61
  # ## Methods
55
62
 
@@ -120,7 +127,7 @@ if typeof $ isnt 'undefined'
120
127
  #
121
128
  bindToolbar: ->
122
129
  for action in @actions
123
- $button = $("[data-action='#{ @type }-#{ action }']")
130
+ $button = $("##{ @type }-#{ @id } [data-action='#{ @type }-#{ action }']")
124
131
  $button.on 'click.fondant', { action: action, editor: this }, (event) ->
125
132
  event.preventDefault()
126
133
  event.data.editor[event.data.action]()
@@ -131,7 +138,7 @@ if typeof $ isnt 'undefined'
131
138
  # this is not needed since the DOM elements will be destroyed
132
139
  #
133
140
  unbindToolbar: ->
134
- $("[data-action^='#{ @type }-']").off('.fondant') unless @options.toolbar
141
+ $("##{ @type }-#{ @id } [data-action^='#{ @type }-']").off('.fondant') unless @options.toolbar
135
142
 
136
143
  # ### removeToolbar()
137
144
  #
@@ -397,33 +404,13 @@ if typeof $ isnt 'undefined'
397
404
  # ### templates.toolbar()
398
405
  #
399
406
  toolbar: ->
400
- group = @toolbarClass() + '-button-group'
401
407
  button = @toolbarClass() + '-button'
402
- """
403
- <ul class="#{ @toolbarClass() }">
404
- <li class="#{ group }-label">Text Styles</li>
405
- <ul class="#{ group }">
406
- <li class="#{ button } #{ button }-bold"><a href="#" data-action="#{ @fondant.type }-bold">B</a></li>
407
- <li class="#{ button } #{ button }-italic"><a href="#" data-action="#{ @fondant.type }-italic">I</a></li>
408
- </ul>
409
- <li class="#{ group }-label">Block Styles</li>
410
- <ul class="#{ group }">
411
- <li class="#{ button } #{ button }-p"><a href="#" data-action="#{ @fondant.type }-p">P</a></li>
412
- <li class="#{ button } #{ button }-h1"><a href="#" data-action="#{ @fondant.type }-h1">H1</a></li>
413
- <li class="#{ button } #{ button }-h2"><a href="#" data-action="#{ @fondant.type }-h2">H2</a></li>
414
- <li class="#{ button } #{ button }-h3"><a href="#" data-action="#{ @fondant.type }-h3">H3</a></li>
415
- <li class="#{ button } #{ button }-h4"><a href="#" data-action="#{ @fondant.type }-h4">H4</a></li>
416
- <li class="#{ button } #{ button }-blockquote"><a href="#" data-action="#{ @fondant.type }-blockquote">Quote</a></li>
417
- </ul>
418
- <li class="#{ group }-label">Lists</li>
419
- <ul class="#{ group }">
420
- <li class="#{ button } #{ button }-ol"><a href="#" data-action="#{ @fondant.type }-ol">Numbers</a></li>
421
- <li class="#{ button } #{ button }-ul"><a href="#" data-action="#{ @fondant.type }-ul">Bullets</a></li>
422
- <li class="#{ button } #{ button }-indent"><a href="#" data-action="#{ @fondant.type }-indent">Increase Indent</a></li>
423
- <li class="#{ button } #{ button }-outdent"><a href="#" data-action="#{ @fondant.type }-outdent">Decrease Indent</a></li>
424
- </ul>
425
- </ul>
426
- """
408
+ html = """<ul class="#{ @toolbarClass() }">"""
409
+ for action in @fondant.options.buttons
410
+ html += """<li class="#{ button } #{ button }-#{ action }">"""
411
+ html += """<a href="#" data-action="#{ @fondant.type }-#{ action }">#{ action }</a>"""
412
+ html += """</li>"""
413
+ html
427
414
 
428
415
  window.Fondant = Fondant
429
416
 
@@ -465,4 +452,10 @@ if typeof $ isnt 'undefined'
465
452
  $.fn.fondant.defaults =
466
453
  prefix: 'fondant'
467
454
  toolbar: true
455
+ buttons: [
456
+ 'bold', 'italic',
457
+ 'p', 'h1', 'h2', 'h3', 'h4', 'blockquote',
458
+ 'ol', 'ul', 'indent', 'outdent',
459
+ 'remove', 'unlink', 'undo', 'redo'
460
+ ]
468
461
 
@@ -1,4 +1,4 @@
1
- // Fondant v0.5.0
1
+ // Fondant v0.6.0
2
2
  // see http://github.com/ovenbits-ingredients/fondant for more information
3
3
  //
4
4
  .fondant-toolbar {
@@ -8,30 +8,21 @@
8
8
  padding: 0;
9
9
 
10
10
  li {
11
- display: none;
12
- }
13
-
14
- ul {
15
- display: inline;
16
- margin: 0;
17
- padding: 0;
18
-
19
- li {
20
- display: inline-block;
11
+ display: inline-block;
12
+ margin-right: 3px;
21
13
 
22
- a {
23
- background: #eee;
24
- border: 1px solid #ddd;
25
- border-radius: 0.3rem;
26
- color: #777;
27
- padding: 0.2rem 0.4rem;
28
- &:hover {
29
- background: #e0e0e0;
30
- text-decoration: none;
31
- }
14
+ a {
15
+ background: #eee;
16
+ border: 1px solid #ddd;
17
+ border-radius: 0.3rem;
18
+ color: #777;
19
+ padding: 0.2rem 0.4rem;
20
+ &:hover {
21
+ background: #e0e0e0;
22
+ text-decoration: none;
32
23
  }
33
-
34
24
  }
35
25
  }
26
+
36
27
  }
37
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fondant-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phillip Ridlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-02 00:00:00.000000000 Z
11
+ date: 2013-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties