pagedown-bootstrap-rails 2.1.2 → 2.1.3

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: 7c4f85ec4fc58f5a56a42dae84cf3942aba4e638
4
- data.tar.gz: 4e2b6e4d0121f4eadd90678290ffa4bd0bf3a277
3
+ metadata.gz: 32aa899d2beb4ae6ea2782eca91c1d707dc02836
4
+ data.tar.gz: 9625daceed7838e72d31d07c1c72832236a70a4c
5
5
  SHA512:
6
- metadata.gz: 3e71bdf7a67965f2e60ecd9bfe7d7a18f3a644d51318adcc17e807d448d8b1ebfd18960c9f16c24fa319e940827d399637ef73ad2aa7d07294f18bd29fda5524
7
- data.tar.gz: 5a077a728391e8292bdba49bc4c69f9f43ce64f48ca562e60845b286f8d2d3e9aaa2bfac1526b0907b08ab0a8bf1e900c318a062a041e60dcd0410f51083916a
6
+ metadata.gz: 18cbcdc00bd93f72ca4264cdc0de1d28d59ae191e37c51513770b89bfc08014da1b192486e649e706995cb11e31060fb4e0bc2ec026a07081f25b1b6135a1ac9
7
+ data.tar.gz: 4d9644eb6fff0a6fe4fe1ff76e87c3c7144710007e74d785f05580a50341a21a608e510fb74a775fa5610cb5f43d783640aa1b2388e9e187060df9806fefb4cc
data/Readme.md CHANGED
@@ -6,71 +6,103 @@ A Ruby gem version of [https://github.com/tchapi/pagedown-bootstrap](https://git
6
6
 
7
7
  Add to your `Gemfile`:
8
8
 
9
- gem 'pagedown-bootstrap-rails'
9
+ ``` ruby
10
+ gem 'pagedown-bootstrap-rails'
11
+ ```
10
12
 
11
- In Rails 3.1 or Rails 3.2 this goes in the `:asset` group, but in Rails 4 it goes with the top level gems.
12
-
13
- You will also need Bootstrap and FontAwesome for PageDown Bootstrap Rails to work.
13
+ You’ll also need Bootstrap 3 (Sass version) and Font Awesome.
14
14
 
15
15
  ## Usage
16
16
 
17
17
  Require the CSS with Sprockets:
18
18
 
19
- /*= require pagedown_bootstrap */
19
+ ``` css
20
+ /*= require pagedown_bootstrap */
21
+ ```
20
22
 
21
- Or with a SASS import:
23
+ Or with an SCSS import:
22
24
 
23
- @import "pagedown_bootstrap";
25
+ ``` scss
26
+ @import "pagedown_bootstrap";
27
+ ```
24
28
 
25
29
  Sprockets require the JS too:
26
30
 
27
- //= require pagedown_bootstrap
31
+ ``` javascript
32
+ //= require pagedown_bootstrap
33
+ ```
28
34
 
29
35
  Or individually as you please:
30
36
 
31
- //= require markdown.converter
32
- //= require markdown.editor
33
- //= require markdown.sanitizer
34
- //= require markdown.extra
35
-
36
- You will need to instantiate PageDown and pagedown-bootstrap-rails comes with `pagedown_init` for you to optionally include:
37
-
38
- $ ->
39
- $('textarea.wmd-input').each (i, input) ->
40
- attr = $(input).attr('id').split('wmd-input')[1]
41
- converter = new Markdown.Converter()
42
- Markdown.Extra.init(converter)
43
- help =
44
- handler: () ->
45
- window.open('http://daringfireball.net/projects/markdown/syntax')
46
- return false
47
- title: "<%= I18n.t('components.markdown_editor.help', default: 'Markdown Editing Help') %>"
48
- editor = new Markdown.Editor(converter, attr, help)
49
- editor.run()
50
-
51
- Just require it with Sprockets after `pagedown_bootstrap`:
52
-
53
- //= require pagedown_bootstrap
54
- //= require pagedown_init
55
-
56
- I like to then use a new [SimpleForm](https://github.com/plataformatec/simple_form) input:
57
-
58
- class PagedownInput < SimpleForm::Inputs::TextInput
59
- def input
60
- out = "<div id=\"wmd-button-bar-#{attribute_name}\"></div>\n"
61
- out << "#{@builder.text_area(attribute_name, input_html_options.merge(
62
- { :class => 'wmd-input', :id => "wmd-input-#{attribute_name}"})) }"
63
- if input_html_options[:preview]
64
- out << "<div id=\"wmd-preview-#{attribute_name}\" class=\"wmd-preview\"></div>"
65
- end
66
- out.html_safe
67
- end
37
+ ``` javascript
38
+ //= require markdown.converter
39
+ //= require markdown.editor
40
+ //= require markdown.sanitizer
41
+ //= require markdown.extra
42
+ ```
43
+
44
+ You will need to initialize PageDown in your form, so PageDown Bootstrap Rails comes with `pagedown_init` for you to optionally include:
45
+
46
+ ``` coffee
47
+ $ ->
48
+ $('textarea.wmd-input').each (i, input) ->
49
+ attr = $(input).attr('id').split('wmd-input')[1]
50
+ converter = new Markdown.Converter()
51
+ Markdown.Extra.init(converter)
52
+ help =
53
+ handler: () ->
54
+ window.open('http://daringfireball.net/projects/markdown/syntax')
55
+ return false
56
+ title: "<%= I18n.t('components.markdown_editor.help', default: 'Markdown Editing Help') %>"
57
+ editor = new Markdown.Editor(converter, attr, help)
58
+ editor.run()
59
+ ```
60
+
61
+ Just require it after `pagedown_bootstrap`:
62
+
63
+ ``` javascript
64
+ //= require pagedown_bootstrap
65
+ //= require pagedown_init
66
+ ```
67
+
68
+ This obviously requires CoffeeScript and jQuery, so if you’re not using these then feel free to write your own initializer. Additionally, if you’re using Turbolinks then I suggest either using [jQuery Turbolinks](https://github.com/kossnocorp/jquery.turbolinks) or writing
69
+ your own initializer that does not rely on `jQuery.ready()` like the one above.
70
+
71
+ ## SimpleForm
72
+
73
+ Here’s a [SimpleForm](https://github.com/plataformatec/simple_form) input that creates the correct HTML for the initializer above.
74
+
75
+ ``` ruby
76
+ class PagedownInput < SimpleForm::Inputs::TextInput
77
+ def input
78
+ out = "<div id=\"wmd-button-bar-#{attribute_name}\"></div>#{wmd_input}"
79
+
80
+ if input_html_options[:preview]
81
+ out << "<div id=\"wmd-preview-#{attribute_name}\" class=\"wmd-preview\"></div>"
68
82
  end
69
83
 
84
+ out.html_safe
85
+ end
86
+
87
+ private
88
+
89
+ def wmd_input
90
+ @builder.text_area(
91
+ attribute_name,
92
+ input_html_options.merge(
93
+ class: 'wmd-input form-control', id: "wmd-input-#{attribute_name}"
94
+ )
95
+ )
96
+ end
97
+ end
98
+ ```
99
+
70
100
  Which you use in your form like so:
71
101
 
72
- = f.input :description, :as => :pagedown, :input_html => { :preview => true }
102
+ ``` ruby
103
+ = f.input :description, as: :pagedown, input_html: { preview: true, rows: 10 }
104
+ ```
73
105
 
74
106
  This is how it looks:
75
107
 
76
- ![Glorious](http://f.cl.ly/items/1f2H1x1F1D0o0n2r1p02/pagedown-bootstrap.png)
108
+ ![Glorious](https://cldup.com/zCzX0kUgrW.png)
@@ -1,5 +1,5 @@
1
1
  module PageDownBootstrap
2
2
  module Rails
3
- VERSION = "2.1.2"
3
+ VERSION = "2.1.3"
4
4
  end
5
5
  end
@@ -1378,11 +1378,11 @@
1378
1378
  return group
1379
1379
  };
1380
1380
 
1381
- group1 = makeGroup(1);
1381
+ var group1 = makeGroup(1);
1382
1382
  buttons.bold = makeButton("wmd-bold-button", "<%= I18n.t('components.markdown_editor.bold.button_title', default: 'Bold (Ctrl+B)') %>", "fa fa-bold", bindCommand("doBold"), group1);
1383
1383
  buttons.italic = makeButton("wmd-italic-button", "<%= I18n.t('components.markdown_editor.italic.button_title', default: 'Italic (Ctrl+I)') %>", "fa fa-italic", bindCommand("doItalic"), group1);
1384
1384
 
1385
- group2 = makeGroup(2);
1385
+ var group2 = makeGroup(2);
1386
1386
  buttons.link = makeButton("wmd-link-button", "<%= I18n.t('components.markdown_editor.insert_link.button_title', default: 'Link (Ctrl+L)') %>", "fa fa-link", bindCommand(function (chunk, postProcessing) {
1387
1387
  return this.doLinkOrImage(chunk, postProcessing, false);
1388
1388
  }), group2);
@@ -1392,7 +1392,7 @@
1392
1392
  buttons.quote = makeButton("wmd-quote-button", "<%= I18n.t('components.markdown_editor.blockquoute.button_title', default: 'Blockquote (Ctrl+Q)') %>", "fa fa-quote-left", bindCommand("doBlockquote"), group2);
1393
1393
  buttons.code = makeButton("wmd-code-button", "<%= I18n.t('components.markdown_editor.code_sample.button_title', default: 'Code Sample (Ctrl+K)') %>", "fa fa-code", bindCommand("doCode"), group2);
1394
1394
 
1395
- group3 = makeGroup(3);
1395
+ var group3 = makeGroup(3);
1396
1396
  buttons.ulist = makeButton("wmd-ulist-button", "<%= I18n.t('components.markdown_editor.bulleted_list.button_title', default: 'Bulleted List (Ctrl+U)') %>", "fa fa-list-ul", bindCommand(function (chunk, postProcessing) {
1397
1397
  this.doList(chunk, postProcessing, false);
1398
1398
  }), group3);
@@ -1401,7 +1401,7 @@
1401
1401
  }), group3);
1402
1402
  buttons.heading = makeButton("wmd-heading-button", "<%= I18n.t('components.markdown_editor.heading.button_title', default: 'Heading (Ctrl+H)') %>", "fa fa-font", bindCommand("doHeading"), group3);
1403
1403
 
1404
- group4 = makeGroup(4);
1404
+ var group4 = makeGroup(4);
1405
1405
  buttons.undo = makeButton("wmd-undo-button", "<%= I18n.t('components.markdown_editor.undo.button_title', default: 'Undo (Ctrl+Z)') %>", "fa fa-undo", null, group4);
1406
1406
  buttons.undo.execute = function (manager) { if (manager) manager.undo(); };
1407
1407
 
@@ -1413,7 +1413,7 @@
1413
1413
  buttons.redo.execute = function (manager) { if (manager) manager.redo(); };
1414
1414
 
1415
1415
  if (helpOptions) {
1416
- group5 = makeGroup(5);
1416
+ var group5 = makeGroup(5);
1417
1417
  group5.className = group5.className + " pull-right";
1418
1418
  var helpButton = document.createElement("button");
1419
1419
  var helpButtonImage = document.createElement("i");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagedown-bootstrap-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugh Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2016-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  requirements: []
65
65
  rubyforge_project:
66
- rubygems_version: 2.2.2
66
+ rubygems_version: 2.5.1
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: This gem makes PageDown Bootstrap available in the Rails asset pipeline.