simple_text 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/app/models/document.rb +4 -0
- data/app/views/documents/show.html.slim +1 -1
- data/lib/simple_text/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1c45774052e0db624ec6541517bcf3670225c7f
|
4
|
+
data.tar.gz: af29ce833839bb7a27841bb3afec0413832128f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
```
|
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
|
data/app/models/document.rb
CHANGED
@@ -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
|
data/lib/simple_text/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|