simple_text 0.0.18 → 0.0.19

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: 840d9da92b00626a852cc9c61f217d1db94b4395
4
- data.tar.gz: 77822454a6a2ae30c2aa41b84b5818e39e378502
3
+ metadata.gz: f1c45774052e0db624ec6541517bcf3670225c7f
4
+ data.tar.gz: af29ce833839bb7a27841bb3afec0413832128f1
5
5
  SHA512:
6
- metadata.gz: 748d78721eaab520d5d2f62f3c2c87edc3a17402df044fb907312b91e352703dc23a7e3a4cb1a5f2afc08ad0a4639515417d74f8fc9fb03f44cddb731cb49098
7
- data.tar.gz: 8fdde36697457167a63dc05b5538683da6bea29aa46296a317bb7518af1e8319a88bbd097ceb1335347ab1e07f4195f793e174156ab626360b83c4b60e249960
6
+ metadata.gz: 5493081d6aa1f0377a4adb89449e9b6d193bf9c7beea24881275eb55cacefccef080513a571ea6d3b7a2f8aac9dce107a15949d72227b088ab4c9be2c47788ab
7
+ data.tar.gz: 7502926bdfd79a9a68af5beeee5c40de4e59b741f4fc8d3b3fd9b88c0c2d9b19c114076e1237c88249987a196daa1f141836a947aa94ac0a9160760dc5a6000e
data/README.md CHANGED
@@ -9,7 +9,7 @@ rake db:migrate
9
9
  Which will generate a migration for the `documents` table.
10
10
 
11
11
  Optionally, add the SimpleText css to your `application.css`
12
- ```Ruby
12
+ ```Scss
13
13
  *= require simple_text/application
14
14
  ```
15
15
 
@@ -18,11 +18,22 @@ Add the documents management routes to a protected part of the routes:
18
18
  resources :documents, only: [:edit, :update, :index, :new, :create]
19
19
  ```
20
20
 
21
+ In a document, `name` is the key for the document, `title` is shown to users above the document.
22
+
21
23
  If you've created a document, add the public route to your routes:
22
24
  ```Ruby
23
25
  get '/disclaimer', to: 'documents#show', name: 'disclaimer'
24
26
  ```
25
27
 
28
+ And finally, link to your document:
29
+ ```Ruby
30
+ link_to 'Disclaimer', disclaimer_path
31
+ ```
32
+
33
+ ## Customizing the view
34
+ If you want different styling for your document, just overwrite the `documents/show` view in your application.
35
+ The contents of the document can be rendered by calling `to_s` on the document object.
36
+
26
37
  ## Overriding the default controller
27
38
  For certain functionality, overriding the `DocumentsController` is required, e.g. to make [Pundit](https://github.com/elabs/pundit) work:
28
39
  ```Ruby
@@ -2,4 +2,8 @@ class Document < ActiveRecord::Base
2
2
  validates_length_of :name, minimum: 4, maximum: 100
3
3
  validates_length_of :title, minimum: 4, maximum: 100
4
4
 
5
+
6
+ def to_s
7
+ Redcarpet::Markdown.new(Redcarpet::Render::HTML.new, {tables: true, fenced_code_blocks: false, no_styles: true, escape_html: true}).render(contents)
8
+ end
5
9
  end
@@ -3,4 +3,4 @@
3
3
  article.document.show
4
4
  section.content
5
5
  .contents[id="#{@document.name}"]
6
- == Redcarpet::Markdown.new(Redcarpet::Render::HTML.new, {tables: true, fenced_code_blocks: false, no_styles: true, escape_html: true}).render(@document.contents)
6
+ == @document.to_s
@@ -1,3 +1,3 @@
1
1
  module SimpleText
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher91
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails