/
ActionView.html
122 lines (119 loc) · 9.12 KB
/
ActionView.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<title>Module: InheritViews::ActionView [inherit_views API Documentation]</title>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
<link href='../.././rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
//<![CDATA[
function popupCode(url) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode(id) {
var code = document.getElementById(id)
code.style.display = code.style.display != 'block' ? 'block' : 'none'
return true
}
// Make codeblocks hidden by default
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
//]]>
</script>
</head>
<body class='page'>
<div class='class' id='wrapper'>
<div class='header'>
<h1 class='name'>
<span class='type'>Module</span>
InheritViews::ActionView
</h1>
<ol class='paths'>
<li>
<a href="../../files/lib/inherit_views_rb.html">lib/inherit_views.rb</a>
</li>
</ol>
</div>
<div id='content'>
<div id='text'>
<div id='description'>
<p>
Mixin for ActionView::Base to enable inherit views functionality
</p>
</div>
<div id='method-list'>
<h2>Methods</h2>
<h3>public class</h3>
<ol>
<li><a href="#M000006">included</a></li>
</ol>
<h3>public instance</h3>
<ol>
<li><a href="#M000008">render_with_parent</a></li>
<li><a href="#M000007">view_paths=</a></li>
</ol>
</div>
<div id='section'>
<div id='methods'>
<h2>Public class methods</h2>
<div class='public-class method' id='method-M000006'>
<a name='M000006'> </a>
<div class='synopsis'>
<span class='name'>included</span>
<span class='arguments'>(base)</span>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
[show source]
</a>
<pre id='M000006-source'><span class="ruby-comment cmt"># File lib/inherit_views.rb, line 127</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
 <span class="ruby-identifier">base</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
 <span class="ruby-comment cmt"># use InheritViews::PathSet, and give it my controller's inherit_view_paths</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">view_paths=</span>(<span class="ruby-identifier">value</span>)
 <span class="ruby-ivar">@view_paths</span> = <span class="ruby-constant">InheritViews</span><span class="ruby-operator">::</span><span class="ruby-constant">PathSet</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">paths</span><span class="ruby-operator">|</span>
 <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">inherit_view_paths</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">inherit_view_paths</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">controller</span>.<span class="ruby-identifier">inherit_views?</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">false</span>)
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-keyword kw">end</span>
 
 <span class="ruby-identifier">alias_method_chain</span> <span class="ruby-identifier">:render</span>, <span class="ruby-identifier">:parent</span>
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<h2>Public instance methods</h2>
<div class='public-instance method' id='method-M000008'>
<a name='M000008'> </a>
<div class='synopsis'>
<span class='name'>render_with_parent</span>
<span class='arguments'>(*args, &block)</span>
</div>
<div class='description'>
<p>
Extension for render which enables <%= render :parent %> (works for
partials and top-level templates)
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
[show source]
</a>
<pre id='M000008-source'><span class="ruby-comment cmt"># File lib/inherit_views.rb, line 141</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_with_parent</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
 <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:parent</span>
 <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span>
 <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>[<span class="ruby-identifier">:file</span>] = <span class="ruby-identifier">view_paths</span>.<span class="ruby-identifier">find_parent_template</span>(<span class="ruby-identifier">template</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">template</span>.<span class="ruby-identifier">format</span>)
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-identifier">render_without_parent</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
 <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='public-instance method' id='method-M000007'>
<a name='M000007'> </a>
<div class='synopsis'>
<span class='name'>view_paths=</span>
<span class='arguments'>(value)</span>
</div>
<div class='description'>
<p>
use <a href="PathSet.html">InheritViews::PathSet</a>, and give it my
controller’s inherit_view_paths
</p>
</div>
<div class='source'>
<a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
[show source]
</a>
<pre id='M000007-source'><span class="ruby-comment cmt"># File lib/inherit_views.rb, line 130</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">view_paths=</span>(<span class="ruby-identifier">value</span>)
 <span class="ruby-ivar">@view_paths</span> = <span class="ruby-constant">InheritViews</span><span class="ruby-operator">::</span><span class="ruby-constant">PathSet</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">paths</span><span class="ruby-operator">|</span>
 <span class="ruby-identifier">paths</span>.<span class="ruby-identifier">inherit_view_paths</span> = <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">inherit_view_paths</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">controller</span>.<span class="ruby-identifier">inherit_views?</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">false</span>)
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div id='footer-push'></div>
</div>
<div id='footer'>
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
</div>
</body>
</html>