run_simple_render 0.1.3 → 0.1.4

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: 1716e5a1f6d3f78d56fd57dc7997b1c3b86be355
4
- data.tar.gz: 1438daf4426e5041b75d9e170295a18b32bbe461
3
+ metadata.gz: 73bf814a354e77b3c41f7552dba092bf45002136
4
+ data.tar.gz: 1a1d6a16d35a199e172e0ff5c4fa7897c299567a
5
5
  SHA512:
6
- metadata.gz: 363ea4b56d72ad8169af5179fb5942b924ea78056bd8bd618c59838ad6e1d55a4f0d26683371c78b130faa5a28cb23a122a4eb217eeb5bf19e8e4434798b986d
7
- data.tar.gz: 1a49d81d5da075ca2757e163e252dbcf51eb3bd06fa47d40c73a2dc7342c835883d8157fac474d2f31df265e77c9a1943d571053cb3fab1c7235e5a58362b646
6
+ metadata.gz: 1f2e3645a595dadeddad3a467884423ef482d77b7f5abae9b0600637973c5262a42adf03fc8af8fa7ac47e26eb4e32031773911baef6cd5b136b301399c46e93
7
+ data.tar.gz: b277be1330976f4d0190a51697b417e75d3624732f1a8180efaaa91a433859165e7127fcd67b7df9f895873e14be7ba174b8c1e58226a68791d87217c41bfbed
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Simple approach to have a more powerful presentation in rails.
4
4
 
5
5
  The idea behind this gem is to be able to tie models to the appropriate
6
- views for the maximun reusability while **avoiding**:
6
+ views for the maximum reusability while **avoiding**:
7
7
 
8
8
  a. helpers with inline html
9
9
 
@@ -13,6 +13,13 @@ c. bloating the models with presentation methods (bad practice)
13
13
 
14
14
  d. a learning curve (this is extremely easy to use)
15
15
 
16
+ ## Latest Update (April 16 2015)
17
+ + Optionally pass arguments to the rendition. This will allow an even better reuse of the renditions
18
+
19
+
20
+ @usr.render(:card, args:{ background_picture: 'bg_picture.jpg'})
21
+
22
+
16
23
 
17
24
  ## Installation
18
25
 
@@ -43,16 +50,16 @@ A. Include RunSimpleRender in the model
43
50
  B. Create your model views under a folder called renditions
44
51
 
45
52
 
46
- $ /views/renditions/[modelname]/
53
+ $ /app/views/renditions/[modelname]/
47
54
 
48
55
 
49
- ex. /views/renditions/user/default.html.erb:
56
+ ex. /app/views/renditions/user/default.html.erb:
50
57
 
51
58
 
52
59
  Name: <%=obj.last_name %>, <%obj.first_name%>
53
60
 
54
61
 
55
- ex. /views/renditions/user/email.html.erb:
62
+ ex. /app/views/renditions/user/email.html.erb:
56
63
 
57
64
 
58
65
  Email: <%=obj.email %>
@@ -76,7 +83,7 @@ You can also call related models
76
83
 
77
84
  @usr.company.render(:short_description)
78
85
 
79
- Or render a collection from the view ex. /views/renditions/company/all_users.html.erb:
86
+ Or render a collection from the view ex. /app/views/renditions/company/all_users.html.erb:
80
87
 
81
88
  Company: <%= obj.name %>
82
89
 
@@ -1,3 +1,3 @@
1
1
  module RunSimpleRender
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -4,7 +4,11 @@ module RunSimpleRender
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- def render(path= :default, *args, layout: false)
7
+ # Runs a subprocess and applies handlers for stdout and stderr
8
+ # Params:
9
+ # +path+:: Optional. Name of the chosen rendition, defaults to :default
10
+ # +args+:: Optional. Arguments passed to the rendition as a hash
11
+ def render(path= :default, args: {}, layout: false )
8
12
  unless path.nil?
9
13
  if path.to_s.include?('/')
10
14
  template_path = path.to_s
@@ -14,8 +18,9 @@ module RunSimpleRender
14
18
  template_path += "#{self.class.name}/#{path.to_s}"
15
19
  end
16
20
  template_path = template_path.underscore
21
+ locals = {obj:self, args: args}
17
22
  begin
18
- ApplicationController.new.render_to_string(template: template_path, locals:{ obj: self, args: args}, layout: false).html_safe
23
+ ApplicationController.new.render_to_string(template: template_path, locals: locals, layout: false).html_safe
19
24
  #Call the parent if not let it fail
20
25
  rescue ActionView::MissingTemplate
21
26
  puts "Warning: [#{self.class.name}] did not have #{template_path} defined. Trying the parent [#{self.class.base_class.name}]"
@@ -23,7 +28,7 @@ module RunSimpleRender
23
28
  template_path = template_path.split('/')
24
29
  template_path.delete_at(2)
25
30
  template_path = template_path.join('/')
26
- ApplicationController.new.render_to_string(template: template_path,locals:{ obj: self}, layout: false).html_safe
31
+ ApplicationController.new.render_to_string(template: template_path, locals: locals, layout: false).html_safe
27
32
  end
28
33
  end
29
34
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["jiriso@gmail.com"]
11
11
  spec.summary = %q{RunSimple Render}
12
12
  spec.description = %q{Because Simple is better}
13
- spec.homepage = ""
13
+ spec.homepage = "http://www.runsimple.com"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_runtime_dependency "activemodel", ">= 3.0"
24
- spec.add_runtime_dependency "activesupport", ">= 3.0"
23
+ spec.add_runtime_dependency "activemodel", "~> 3.0"
24
+ spec.add_runtime_dependency "activesupport", "~> 3.0"
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_simple_render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Iriso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-31 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,28 +42,28 @@ dependencies:
42
42
  name: activemodel
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  description: Because Simple is better
@@ -81,7 +81,7 @@ files:
81
81
  - lib/run_simple_render.rb
82
82
  - lib/run_simple_render/version.rb
83
83
  - run_simple_render.gemspec
84
- homepage: ''
84
+ homepage: http://www.runsimple.com
85
85
  licenses:
86
86
  - MIT
87
87
  metadata: {}