run_simple_render 0.1.1 → 0.1.2

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: f471de75651883adc8dcb4d04b4d0ca0d8f60a92
4
- data.tar.gz: 8d327d6a37ba992b8855d92295717558c88aba6b
3
+ metadata.gz: 833966d0efcb0d59e0a39cdc6eb46c2206083e3f
4
+ data.tar.gz: cd82ada654c19361de37630466a6e45dffc9b2bc
5
5
  SHA512:
6
- metadata.gz: e8fcdf726e1027dc94c8fb3764893f11bf60686d856c8e2291c50536a527ee50a641a999d086429a3b85177ebdb321f2463c67df55f0a5c4901d88f8100f13fa
7
- data.tar.gz: 80838c652d9dc485a5f2eae90f50ece568f9c2c4f62cf00d3afbf35e7eb658a169bf55bc580f01fc47d29e8d11f7ee91a99e7dea445ec841a3f2a1b49c671d08
6
+ metadata.gz: 8221a3cb304eb0dbd2a8570b8481cb0ad476e527039dbd76114e072489dad501796a4b43ebecac4918f261a6513fe1d0620e1819522df0e679be777294e55442
7
+ data.tar.gz: bf14cf69fa78874a7c7018a5b6df2eba9b7f5081ac107b9e269247f25fe2af36a9cd8c60e0e8d20bfca7c66459a5f8324fae52d9cbb703ae9cb7fca82f73d2ba
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # RunSimpleRender
2
2
 
3
- TODO: Write a gem description
3
+ Simple approach to have an powerful presentation
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- ```ruby
10
- gem 'run_simple_render'
11
- ```
9
+
10
+ ruby gem 'run_simple_render'
11
+
12
12
 
13
13
  And then execute:
14
14
 
@@ -20,12 +20,62 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ A. Include RunSimpleRender in the model
24
+
25
+
26
+ class User < ActiveRecord::Base
27
+ include RunSimpleRender
28
+
29
+
30
+
31
+ B. Create your model views under a folder called renditions
32
+
33
+
34
+ $ /views/renditions/[modelname]/
35
+
36
+
37
+ ex. /views/renditions/user/default.html.erb:
38
+
39
+
40
+ Name: <%=obj.last_name %>, <%obj.first_name%>
41
+
42
+
43
+ ex. /views/renditions/user/email.html.erb:
44
+
45
+
46
+ Email: <%=obj.email %>
47
+
48
+
49
+
50
+ C. Render the appropriate view as needed and were needed
51
+
52
+ @usr = User.find(1)
53
+
54
+ @usr.render #Name: Louis, Joe
55
+
56
+ @usr.render(:email) #Email: joe@louis.com
57
+
58
+
59
+ ## More
60
+
61
+ You can also call relate models
62
+
63
+ @usr = User.find(1)
64
+
65
+ @usr.company.render(:short_description)
66
+
67
+ Or render collection from the view ex. /views/renditions/company/all_users.html.erb:
68
+
69
+ Company: <%= obj.name %>
70
+
71
+ <p>Users</p>
72
+ <ul>
73
+ <% obj.users.each |u| %>
74
+ <li><%= u.render %> [ <%= u.email %>]</li>
75
+ <% end %>
76
+ </ul>
77
+
24
78
 
25
79
  ## Contributing
26
80
 
27
- 1. Fork it ( https://github.com/[my-github-username]/run_simple_render/fork )
28
- 2. Create your feature branch (`git checkout -b my-new-feature`)
29
- 3. Commit your changes (`git commit -am 'Add some feature'`)
30
- 4. Push to the branch (`git push origin my-new-feature`)
31
- 5. Create a new Pull Request
81
+ Coming soon!!
@@ -1,3 +1,3 @@
1
1
  module RunSimpleRender
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_simple_render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Iriso