stage 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,28 +1,41 @@
1
+ == 0.5.0 2008-06-24
2
+
3
+ *Modified: usage of text_field_tag to text_field
4
+
1
5
  == 0.4.4 2008-06-17
6
+
2
7
  *Fixed: model_name was not correct with name contained underscore, missed this in the controller
3
8
 
4
9
  == 0.4.3 2008-06-17
10
+
5
11
  *Fixed: model_name was not correct with name contained underscore
6
12
 
7
13
  == 0.4.2 2008-06-04
14
+
8
15
  *Fixed: action_name is no longer an instance variable in 2.1
9
16
 
10
17
  == 0.4.1 2008-05-26
18
+
11
19
  *Fixed: Namespacing bugs with model
12
20
 
13
21
  == 0.4.0 2008-05-25
22
+
14
23
  *Fixed: Support for namespacing in Rails.
15
24
 
16
25
  == 0.3.2 2008-04-27
26
+
17
27
  * Merb: Added route to config/router.rb when generating resource
18
28
 
19
29
  == 0.3.1 2008-04-26
30
+
20
31
  * Removed unnecessary local paramater usage in show.
21
32
 
22
33
  == 0.3.0 2008-04-26
34
+
23
35
  * Rails support now added. Yeah!
24
36
 
25
37
  == 0.2.0 2008-04-20
38
+
26
39
  * Seems to have been an error with the last deploy
27
40
 
28
41
  == 0.1.10 2008-04-20
@@ -46,9 +46,5 @@ test/test_stage_generator.rb
46
46
  website/index.html
47
47
  website/index.txt
48
48
  website/javascripts/rounded_corners_lite.inc.js
49
- website/merb.html
50
- website/merb.txt
51
- website/rails.html
52
- website/rails.txt
53
49
  website/stylesheets/screen.css
54
50
  website/template.html.erb
@@ -2,7 +2,7 @@ module Stage #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -4,7 +4,7 @@ module <%= controller_class_name %>Helper
4
4
  if <%= action_name %> == "show"
5
5
  h @<%= singular_name %>.<%= attribute.name %>
6
6
  else
7
- text_field_tag "<%= singular_name%>[<%= attribute.name %>]", @<%= singular_name %>.<%= attribute.name %>
7
+ text_field <%= ":"+ singular_name %>, <%= ":"+ attribute.name %>
8
8
  end
9
9
  end
10
10
 
@@ -33,7 +33,7 @@
33
33
  <h1>stage</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/stage"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/stage" class="numbers">0.4.4</a>
36
+ <a href="http://rubyforge.org/projects/stage" class="numbers">0.4.5</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;stage&#8217;</h1>
39
39
 
@@ -44,10 +44,19 @@
44
44
  <p>Maintaining this page, the wiki at GitHub, the Google Group and no issue tracker is not an ideal setup. So, everything is moving to <a href="http://stonean.com">stonean.com</a> where I&#8217;m giving <a href="http://redmine.org">Redmine</a> a shot a running everything for me. I&#8217;ll be posting release announcements to the news feed for each project and keeping the docs up-to-date. Hopefully this will be better for everyone.</p>
45
45
 
46
46
 
47
+ <h2>Quick links</h2>
48
+
49
+
50
+ <p><a href="http://stonean.com/wiki/stage">Wiki</a></p>
51
+
52
+
53
+ <p><a href="http://stonean.com/projects/stage/boards">Forum</a></p>
54
+
55
+
47
56
  <p>Thanks for your interest in Stage,<br/>
48
57
  -andy</p>
49
58
  <p class="coda">
50
- 17th June 2008<br>
59
+ 24th June 2008<br>
51
60
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
52
61
  </p>
53
62
  </div>
@@ -6,5 +6,12 @@ h2. Consolidation of information
6
6
 
7
7
  Maintaining this page, the wiki at GitHub, the Google Group and no issue tracker is not an ideal setup. So, everything is moving to "stonean.com":http://stonean.com where I'm giving "Redmine":http://redmine.org a shot a running everything for me. I'll be posting release announcements to the news feed for each project and keeping the docs up-to-date. Hopefully this will be better for everyone.
8
8
 
9
+ h2. Quick links
10
+
11
+ "Wiki":http://stonean.com/wiki/stage
12
+
13
+ "Forum":http://stonean.com/projects/stage/boards
14
+
15
+
9
16
  Thanks for your interest in Stage,<br/>
10
17
  -andy
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Stone
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-17 00:00:00 -04:00
12
+ date: 2008-06-24 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -26,8 +26,6 @@ extra_rdoc_files:
26
26
  - Manifest.txt
27
27
  - README.txt
28
28
  - website/index.txt
29
- - website/merb.txt
30
- - website/rails.txt
31
29
  files:
32
30
  - History.txt
33
31
  - License.txt
@@ -77,10 +75,6 @@ files:
77
75
  - website/index.html
78
76
  - website/index.txt
79
77
  - website/javascripts/rounded_corners_lite.inc.js
80
- - website/merb.html
81
- - website/merb.txt
82
- - website/rails.html
83
- - website/rails.txt
84
78
  - website/stylesheets/screen.css
85
79
  - website/template.html.erb
86
80
  has_rdoc: true
@@ -1,244 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <title>
8
- stage
9
- </title>
10
- <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
- <style>
12
-
13
- </style>
14
- <script type="text/javascript">
15
- window.onload = function() {
16
- settings = {
17
- tl: { radius: 10 },
18
- tr: { radius: 10 },
19
- bl: { radius: 10 },
20
- br: { radius: 10 },
21
- antiAlias: true,
22
- autoPad: true,
23
- validTags: ["div"]
24
- }
25
- var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
- versionBox.applyCornersToAll();
27
- }
28
- </script>
29
- </head>
30
- <body>
31
- <div id="main">
32
-
33
- <h1>stage</h1>
34
- <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/stage"; return false'>
35
- <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/stage" class="numbers">0.4.4</a>
37
- </div>
38
- <h1>&#x2192; &#8216;stage&#8217;</h1>
39
-
40
-
41
- <h2>Merb Instructions</h2>
42
-
43
-
44
- <h2>Installing</h2>
45
-
46
-
47
- <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">stage</span></pre></p>
48
-
49
-
50
- <h2>Demonstration of usage</h2>
51
-
52
-
53
- <p><pre class='syntax'>
54
- <span class="global">$ </span><span class="ident">merb</span><span class="punct">-</span><span class="ident">gen</span> <span class="ident">stage</span> <span class="ident">page</span> <span class="ident">title</span><span class="symbol">:string</span> <span class="ident">content</span><span class="symbol">:text</span>
55
- <span class="ident">exists</span> <span class="ident">app</span>
56
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">controllers</span>
57
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">helpers</span>
58
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">models</span>
59
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span>
60
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span>
61
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">controllers</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">.</span><span class="ident">rb</span>
62
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">helpers</span><span class="punct">/</span><span class="ident">pages_helper</span><span class="punct">.</span><span class="ident">rb</span>
63
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">models</span><span class="punct">/</span><span class="ident">page</span><span class="punct">.</span><span class="ident">rb</span>
64
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">/</span><span class="ident">_data</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
65
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">/</span><span class="ident">_form</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
66
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">/</span><span class="ident">edit</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
67
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">/</span><span class="ident">index</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
68
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">/</span><span class="ident">new</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
69
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">pages</span><span class="punct">/</span><span class="ident">show</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
70
- </pre></p>
71
-
72
-
73
- <p>The controller generated:
74
- <pre class='syntax'>
75
- <span class="keyword">class </span><span class="class">Pages</span> <span class="punct">&lt;</span> <span class="constant">Application</span>
76
- <span class="ident">before</span> <span class="symbol">:find_page</span><span class="punct">,</span> <span class="symbol">:only</span> <span class="punct">=&gt;</span> <span class="punct">[</span><span class="symbol">:show</span><span class="punct">,</span> <span class="symbol">:edit</span><span class="punct">,</span> <span class="symbol">:update</span><span class="punct">,</span> <span class="symbol">:delete</span><span class="punct">]</span>
77
-
78
- <span class="keyword">def </span><span class="method">index</span>
79
- <span class="attribute">@pages</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">all</span>
80
- <span class="ident">display</span> <span class="attribute">@pages</span>
81
- <span class="keyword">end</span>
82
-
83
- <span class="keyword">def </span><span class="method">show</span>
84
- <span class="ident">display</span> <span class="attribute">@page</span>
85
- <span class="keyword">end</span>
86
-
87
- <span class="keyword">def </span><span class="method">new</span>
88
- <span class="ident">only_provides</span> <span class="symbol">:html</span>
89
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">new</span>
90
- <span class="ident">render</span>
91
- <span class="keyword">end</span>
92
-
93
- <span class="keyword">def </span><span class="method">edit</span>
94
- <span class="ident">only_provides</span> <span class="symbol">:html</span>
95
- <span class="ident">render</span>
96
- <span class="keyword">end</span>
97
-
98
- <span class="keyword">def </span><span class="method">create</span>
99
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:page</span><span class="punct">])</span>
100
- <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">save</span>
101
- <span class="ident">redirect</span> <span class="ident">url</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">,</span> <span class="attribute">@page</span><span class="punct">)</span>
102
- <span class="keyword">else</span>
103
- <span class="ident">render</span> <span class="symbol">:new</span>
104
- <span class="keyword">end</span>
105
- <span class="keyword">end</span>
106
-
107
- <span class="keyword">def </span><span class="method">update</span>
108
- <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">update_attributes</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:page</span><span class="punct">])</span>
109
- <span class="ident">redirect</span> <span class="ident">url</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">,</span> <span class="attribute">@page</span><span class="punct">)</span>
110
- <span class="keyword">else</span>
111
- <span class="keyword">raise</span> <span class="constant">BadRequest</span>
112
- <span class="keyword">end</span>
113
- <span class="keyword">end</span>
114
-
115
- <span class="keyword">def </span><span class="method">delete</span>
116
- <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">destroy!</span>
117
- <span class="ident">redirect</span> <span class="ident">url</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">)</span>
118
- <span class="keyword">else</span>
119
- <span class="keyword">raise</span> <span class="constant">BadRequest</span>
120
- <span class="keyword">end</span>
121
- <span class="keyword">end</span>
122
-
123
- <span class="ident">private</span>
124
- <span class="keyword">def </span><span class="method">find_page</span>
125
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">first</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:id</span><span class="punct">])</span>
126
- <span class="keyword">raise</span> <span class="constant">NotFound</span> <span class="keyword">unless</span> <span class="attribute">@page</span>
127
- <span class="keyword">end</span>
128
- <span class="keyword">end</span>
129
- </pre></p>
130
-
131
-
132
- <p>The edit page:
133
- <pre class='syntax'>
134
- <span class="punct">&lt;</span><span class="ident">h1</span><span class="punct">&gt;</span><span class="constant">Editing</span> <span class="ident">page</span><span class="punct">&lt;/</span><span class="regex">h1&gt;
135
-
136
- &lt;%= partial &quot;form&quot; %&gt;
137
-
138
- &lt;%= link_to 'Show', url(:page, @page) %&gt; |
139
- &lt;%= link_to 'Back', url(:pages) %&gt;<span class="normal">
140
- </span></span></pre></p>
141
-
142
-
143
- <p>The form partial:
144
- <pre class='syntax'>
145
- <span class="punct">&lt;%</span>
146
- <span class="ident">submit_label</span> <span class="punct">=</span> <span class="punct">&quot;</span><span class="string">Update</span><span class="punct">&quot;</span>
147
- <span class="ident">submit_label</span> <span class="punct">=</span> <span class="punct">&quot;</span><span class="string">Create</span><span class="punct">&quot;</span> <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">new_record?</span>
148
- <span class="punct">-%&gt;</span><span class="string">
149
-
150
- &lt;%= error_messages_for @page %</span><span class="punct">&gt;</span>
151
-
152
- <span class="punct">&lt;%</span> <span class="ident">form_for</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">,</span> <span class="symbol">:action</span> <span class="punct">=&gt;</span> <span class="ident">url</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">,</span><span class="attribute">@page</span><span class="punct">))</span> <span class="keyword">do</span> <span class="punct">%&gt;</span><span class="string">
153
- &lt;%= partial :data %</span><span class="punct">&gt;</span>
154
- <span class="punct">&lt;</span><span class="ident">p</span><span class="punct">&gt;</span> <span class="punct">&lt;%=</span><span class="string"> submit_button submit_label %&gt; &lt;/p&gt;
155
- &lt;% end %&gt;<span class="normal">
156
- </span></span></pre></p>
157
-
158
-
159
- <p>The data partial (the show view calls this directly):
160
- <pre class='syntax'>
161
- <span class="punct">&lt;</span><span class="ident">p</span><span class="punct">&gt;</span>
162
- <span class="punct">&lt;</span><span class="ident">b</span><span class="punct">&gt;</span><span class="constant">Title</span><span class="punct">&lt;/</span><span class="regex">b&gt;&lt;br </span><span class="punct">/&gt;</span>
163
- <span class="punct">&lt;%=</span><span class="string"> page_title_value %&gt;
164
- &lt;/p&gt;
165
-
166
- &lt;p&gt;
167
- &lt;b&gt;Content&lt;/b&gt;&lt;br /&gt;
168
- &lt;%</span><span class="punct">=</span> <span class="ident">page_content_value</span> <span class="punct">%&gt;</span><span class="string">
169
- &lt;/p</span><span class="punct">&gt;</span>
170
- </pre></p>
171
-
172
-
173
- <p>As you can see, there are &lt;model&gt;_&lt;field&gt;_value methods. These are defined in the pages helper:
174
- <pre class='syntax'>
175
- <span class="keyword">module </span><span class="module">Merb</span>
176
- <span class="keyword">module </span><span class="module">PagesHelper</span>
177
- <span class="keyword">def </span><span class="method">page_title_value</span>
178
- <span class="keyword">if</span> <span class="attribute">@action_name</span> <span class="punct">==</span> <span class="punct">&quot;</span><span class="string">show</span><span class="punct">&quot;</span>
179
- <span class="attribute">@page</span><span class="punct">.</span><span class="ident">title</span>
180
- <span class="keyword">else</span>
181
- <span class="ident">text_field</span> <span class="symbol">:name</span> <span class="punct">=&gt;</span> <span class="punct">&quot;</span><span class="string">page[title]</span><span class="punct">&quot;,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">title</span>
182
- <span class="keyword">end</span>
183
- <span class="keyword">end</span>
184
-
185
- <span class="keyword">def </span><span class="method">page_content_value</span>
186
- <span class="keyword">if</span> <span class="attribute">@action_name</span> <span class="punct">==</span> <span class="punct">&quot;</span><span class="string">show</span><span class="punct">&quot;</span>
187
- <span class="attribute">@page</span><span class="punct">.</span><span class="ident">content</span>
188
- <span class="keyword">else</span>
189
- <span class="ident">text_field</span> <span class="symbol">:name</span> <span class="punct">=&gt;</span> <span class="punct">&quot;</span><span class="string">page[content]</span><span class="punct">&quot;,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">content</span>
190
- <span class="keyword">end</span>
191
- <span class="keyword">end</span>
192
- <span class="keyword">end</span>
193
- <span class="keyword">end</span>
194
- </pre></p>
195
-
196
-
197
- <p>I need to get more precise with the form helpers, but for now this will do.</p>
198
-
199
-
200
- <h2>Forum</h2>
201
-
202
-
203
- <p><a href="http://groups.google.com/group/stonean_stage?hl=en">http://groups.google.com/group/stonean_stage?hl=en</a></p>
204
-
205
-
206
- <h2>How to submit patches</h2>
207
-
208
-
209
- <p>The Clone <span class="caps">URL</span>: git://github.com/stonean/stage.git</p>
210
-
211
-
212
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
213
-
214
-
215
- <p>I&#8217;m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.</p>
216
-
217
-
218
- <h2>License</h2>
219
-
220
-
221
- <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
222
-
223
-
224
- <h2>Contact</h2>
225
-
226
-
227
- <p>Comments and suggestions are welcome via the <a href="http://groups.google.com/group/stonean_stage?hl=en">forum</a></p>
228
- <p class="coda">
229
- 26th April 2008<br>
230
- Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
231
- </p>
232
- </div>
233
-
234
- <script type="text/javascript">
235
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
236
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
237
- </script>
238
- <script type="text/javascript">
239
- var pageTracker = _gat._getTracker("UA-4186995-1");
240
- pageTracker._initData();
241
- pageTracker._trackPageview();
242
- </script>
243
- </body>
244
- </html>
@@ -1,173 +0,0 @@
1
- h1. stage
2
-
3
- h1. &#x2192; 'stage'
4
-
5
- h2. Merb Instructions
6
-
7
- h2. Installing
8
-
9
- <pre syntax="ruby">sudo gem install stage</pre>
10
-
11
- h2. Demonstration of usage
12
-
13
- <pre syntax="ruby">
14
- $ merb-gen stage page title:string content:text
15
- exists app
16
- exists app/controllers
17
- exists app/helpers
18
- exists app/models
19
- exists app/views
20
- create app/views/pages
21
- create app/controllers/pages.rb
22
- create app/helpers/pages_helper.rb
23
- create app/models/page.rb
24
- create app/views/pages/_data.html.erb
25
- create app/views/pages/_form.html.erb
26
- create app/views/pages/edit.html.erb
27
- create app/views/pages/index.html.erb
28
- create app/views/pages/new.html.erb
29
- create app/views/pages/show.html.erb
30
- </pre>
31
-
32
- The controller generated:
33
- <pre syntax="ruby">
34
- class Pages < Application
35
- before :find_page, :only => [:show, :edit, :update, :delete]
36
-
37
- def index
38
- @pages = Page.all
39
- display @pages
40
- end
41
-
42
- def show
43
- display @page
44
- end
45
-
46
- def new
47
- only_provides :html
48
- @page = Page.new
49
- render
50
- end
51
-
52
- def edit
53
- only_provides :html
54
- render
55
- end
56
-
57
- def create
58
- @page = Page.new(params[:page])
59
- if @page.save
60
- redirect url(:page, @page)
61
- else
62
- render :new
63
- end
64
- end
65
-
66
- def update
67
- if @page.update_attributes(params[:page])
68
- redirect url(:page, @page)
69
- else
70
- raise BadRequest
71
- end
72
- end
73
-
74
- def delete
75
- if @page.destroy!
76
- redirect url(:page)
77
- else
78
- raise BadRequest
79
- end
80
- end
81
-
82
- private
83
- def find_page
84
- @page = Page.first(params[:id])
85
- raise NotFound unless @page
86
- end
87
- end
88
- </pre>
89
-
90
- The edit page:
91
- <pre syntax="ruby">
92
- <h1>Editing page</h1>
93
-
94
- <%= partial "form" %>
95
-
96
- <%= link_to 'Show', url(:page, @page) %> |
97
- <%= link_to 'Back', url(:pages) %>
98
- </pre>
99
-
100
- The form partial:
101
- <pre syntax="ruby">
102
- <%
103
- submit_label = "Update"
104
- submit_label = "Create" if @page.new_record?
105
- -%>
106
-
107
- <%= error_messages_for @page %>
108
-
109
- <% form_for(:page, :action => url(:page,@page)) do %>
110
- <%= partial :data %>
111
- <p> <%= submit_button submit_label %> </p>
112
- <% end %>
113
- </pre>
114
-
115
- The data partial (the show view calls this directly):
116
- <pre syntax="ruby">
117
- <p>
118
- <b>Title</b><br />
119
- <%= page_title_value %>
120
- </p>
121
-
122
- <p>
123
- <b>Content</b><br />
124
- <%= page_content_value %>
125
- </p>
126
- </pre>
127
-
128
- As you can see, there are &lt;model&gt;_&lt;field&gt;_value methods. These are defined in the pages helper:
129
- <pre syntax="ruby">
130
- module Merb
131
- module PagesHelper
132
- def page_title_value
133
- if @action_name == "show"
134
- @page.title
135
- else
136
- text_field :name => "page[title]", :value => @page.title
137
- end
138
- end
139
-
140
- def page_content_value
141
- if @action_name == "show"
142
- @page.content
143
- else
144
- text_field :name => "page[content]", :value => @page.content
145
- end
146
- end
147
- end
148
- end
149
- </pre>
150
-
151
- I need to get more precise with the form helpers, but for now this will do.
152
-
153
- h2. Forum
154
-
155
- "http://groups.google.com/group/stonean_stage?hl=en":http://groups.google.com/group/stonean_stage?hl=en
156
-
157
-
158
- h2. How to submit patches
159
-
160
- The Clone URL: git://github.com/stonean/stage.git
161
-
162
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
163
-
164
- I'm new to git and this whole opensource project admin gig, so please be patient with my stumbling around.
165
-
166
- h2. License
167
-
168
- This code is free to use under the terms of the MIT license.
169
-
170
- h2. Contact
171
-
172
- Comments and suggestions are welcome via the "forum":http://groups.google.com/group/stonean_stage?hl=en
173
-
@@ -1,275 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <title>
8
- stage
9
- </title>
10
- <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
- <style>
12
-
13
- </style>
14
- <script type="text/javascript">
15
- window.onload = function() {
16
- settings = {
17
- tl: { radius: 10 },
18
- tr: { radius: 10 },
19
- bl: { radius: 10 },
20
- br: { radius: 10 },
21
- antiAlias: true,
22
- autoPad: true,
23
- validTags: ["div"]
24
- }
25
- var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
- versionBox.applyCornersToAll();
27
- }
28
- </script>
29
- </head>
30
- <body>
31
- <div id="main">
32
-
33
- <h1>stage</h1>
34
- <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/stage"; return false'>
35
- <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/stage" class="numbers">0.4.4</a>
37
- </div>
38
- <h1>&#x2192; &#8216;stage&#8217;</h1>
39
-
40
-
41
- <h1>Rails instructions</h1>
42
-
43
-
44
- <h2>Installing</h2>
45
-
46
-
47
- <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">stage</span></pre></p>
48
-
49
-
50
- <h2>Demonstration of usage</h2>
51
-
52
-
53
- <p><pre class='syntax'>
54
- <span class="global">$ </span><span class="punct">./</span><span class="ident">script</span><span class="punct">/</span><span class="ident">generate</span> <span class="ident">stage</span> <span class="ident">product</span> <span class="ident">name</span><span class="symbol">:string</span> <span class="ident">cost</span><span class="symbol">:integer</span> <span class="ident">weight</span><span class="symbol">:integer</span>
55
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">models</span><span class="punct">/</span>
56
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">controllers</span><span class="punct">/</span>
57
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">helpers</span><span class="punct">/</span>
58
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span>
59
- <span class="ident">exists</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">layouts</span><span class="punct">/</span>
60
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span><span class="punct">/</span><span class="ident">index</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
61
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span><span class="punct">/</span><span class="ident">show</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
62
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span><span class="punct">/</span><span class="ident">new</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
63
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span><span class="punct">/</span><span class="ident">edit</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
64
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span><span class="punct">/</span><span class="ident">_form</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
65
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">views</span><span class="punct">/</span><span class="ident">products</span><span class="punct">/</span><span class="ident">_data</span><span class="punct">.</span><span class="ident">html</span><span class="punct">.</span><span class="ident">erb</span>
66
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">models</span><span class="punct">/</span><span class="ident">product</span><span class="punct">.</span><span class="ident">rb</span>
67
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">controllers</span><span class="punct">/</span><span class="ident">products_controller</span><span class="punct">.</span><span class="ident">rb</span>
68
- <span class="ident">create</span> <span class="ident">app</span><span class="punct">/</span><span class="ident">helpers</span><span class="punct">/</span><span class="ident">products_helper</span><span class="punct">.</span><span class="ident">rb</span>
69
- <span class="ident">create</span> <span class="ident">db</span><span class="punct">/</span><span class="ident">migrate</span>
70
- <span class="ident">create</span> <span class="ident">db</span><span class="punct">/</span><span class="ident">migrate</span><span class="punct">/</span><span class="number">001_</span><span class="ident">create_products</span><span class="punct">.</span><span class="ident">rb</span>
71
- <span class="ident">route</span> <span class="ident">map</span><span class="punct">.</span><span class="ident">resources</span> <span class="symbol">:products</span>
72
- </pre></p>
73
-
74
-
75
- <p>The controller generated:
76
- <pre class='syntax'>
77
- <span class="keyword">class </span><span class="class">PagesController</span> <span class="punct">&lt;</span> <span class="constant">ApplicationController</span>
78
- <span class="comment"># GET /pages</span>
79
- <span class="comment"># GET /pages.xml</span>
80
- <span class="keyword">def </span><span class="method">index</span>
81
- <span class="attribute">@pages</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">find</span><span class="punct">(</span><span class="symbol">:all</span><span class="punct">)</span>
82
-
83
- <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span>
84
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="comment"># index.html.erb</span>
85
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:xml</span> <span class="punct">=&gt;</span> <span class="attribute">@pages</span> <span class="punct">}</span>
86
- <span class="keyword">end</span>
87
- <span class="keyword">end</span>
88
-
89
- <span class="comment"># GET /pages/1</span>
90
- <span class="comment"># GET /pages/1.xml</span>
91
- <span class="keyword">def </span><span class="method">show</span>
92
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">find</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:id</span><span class="punct">])</span>
93
-
94
- <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span>
95
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="comment"># show.html.erb</span>
96
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:xml</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span> <span class="punct">}</span>
97
- <span class="keyword">end</span>
98
- <span class="keyword">end</span>
99
-
100
- <span class="comment"># GET /pages/new</span>
101
- <span class="comment"># GET /pages/new.xml</span>
102
- <span class="keyword">def </span><span class="method">new</span>
103
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">new</span>
104
-
105
- <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span>
106
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="comment"># new.html.erb</span>
107
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:xml</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span> <span class="punct">}</span>
108
- <span class="keyword">end</span>
109
- <span class="keyword">end</span>
110
-
111
- <span class="comment"># GET /pages/1/edit</span>
112
- <span class="keyword">def </span><span class="method">edit</span>
113
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">find</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:id</span><span class="punct">])</span>
114
- <span class="keyword">end</span>
115
-
116
- <span class="comment"># POST /pages</span>
117
- <span class="comment"># POST /pages.xml</span>
118
- <span class="keyword">def </span><span class="method">create</span>
119
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:page</span><span class="punct">])</span>
120
-
121
- <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span>
122
- <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">save</span>
123
- <span class="ident">flash</span><span class="punct">[</span><span class="symbol">:notice</span><span class="punct">]</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">Page was successfully created.</span><span class="punct">'</span>
124
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="punct">{</span> <span class="ident">redirect_to</span><span class="punct">(</span><span class="attribute">@page</span><span class="punct">)</span> <span class="punct">}</span>
125
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:xml</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span><span class="punct">,</span> <span class="symbol">:status</span> <span class="punct">=&gt;</span> <span class="symbol">:created</span><span class="punct">,</span> <span class="symbol">:location</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span> <span class="punct">}</span>
126
- <span class="keyword">else</span>
127
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:action</span> <span class="punct">=&gt;</span> <span class="punct">&quot;</span><span class="string">new</span><span class="punct">&quot;</span> <span class="punct">}</span>
128
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:xml</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">errors</span><span class="punct">,</span> <span class="symbol">:status</span> <span class="punct">=&gt;</span> <span class="symbol">:unprocessable_entity</span> <span class="punct">}</span>
129
- <span class="keyword">end</span>
130
- <span class="keyword">end</span>
131
- <span class="keyword">end</span>
132
-
133
- <span class="comment"># PUT /pages/1</span>
134
- <span class="comment"># PUT /pages/1.xml</span>
135
- <span class="keyword">def </span><span class="method">update</span>
136
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">find</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:id</span><span class="punct">])</span>
137
-
138
- <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span>
139
- <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">update_attributes</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:page</span><span class="punct">])</span>
140
- <span class="ident">flash</span><span class="punct">[</span><span class="symbol">:notice</span><span class="punct">]</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">Page was successfully updated.</span><span class="punct">'</span>
141
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="punct">{</span> <span class="ident">redirect_to</span><span class="punct">(</span><span class="attribute">@page</span><span class="punct">)</span> <span class="punct">}</span>
142
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">head</span> <span class="symbol">:ok</span> <span class="punct">}</span>
143
- <span class="keyword">else</span>
144
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:action</span> <span class="punct">=&gt;</span> <span class="punct">&quot;</span><span class="string">edit</span><span class="punct">&quot;</span> <span class="punct">}</span>
145
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:xml</span> <span class="punct">=&gt;</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">errors</span><span class="punct">,</span> <span class="symbol">:status</span> <span class="punct">=&gt;</span> <span class="symbol">:unprocessable_entity</span> <span class="punct">}</span>
146
- <span class="keyword">end</span>
147
- <span class="keyword">end</span>
148
- <span class="keyword">end</span>
149
-
150
- <span class="comment"># DELETE /pages/1</span>
151
- <span class="comment"># DELETE /pages/1.xml</span>
152
- <span class="keyword">def </span><span class="method">destroy</span>
153
- <span class="attribute">@page</span> <span class="punct">=</span> <span class="constant">Page</span><span class="punct">.</span><span class="ident">find</span><span class="punct">(</span><span class="ident">params</span><span class="punct">[</span><span class="symbol">:id</span><span class="punct">])</span>
154
- <span class="attribute">@page</span><span class="punct">.</span><span class="ident">destroy</span>
155
-
156
- <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span>
157
- <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="punct">{</span> <span class="ident">redirect_to</span><span class="punct">(</span><span class="ident">pages_url</span><span class="punct">)</span> <span class="punct">}</span>
158
- <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">head</span> <span class="symbol">:ok</span> <span class="punct">}</span>
159
- <span class="keyword">end</span>
160
- <span class="keyword">end</span>
161
- <span class="keyword">end</span>
162
- </pre></p>
163
-
164
-
165
- <p>The edit page:
166
- <pre class='syntax'>
167
- <span class="punct">&lt;</span><span class="ident">h1</span><span class="punct">&gt;</span><span class="constant">Editing</span> <span class="constant">Page</span><span class="punct">&lt;/</span><span class="regex">h1&gt;
168
-
169
- &lt;%= render :partial =&gt; &quot;form&quot; %&gt;
170
-
171
- &lt;%= link_to 'Show', @page %&gt; |
172
- &lt;%= link_to 'Back', pages_path %&gt;<span class="normal">
173
- </span></span></pre></p>
174
-
175
-
176
- <p>The form partial:
177
- <pre class='syntax'>
178
- <span class="punct">&lt;%</span>
179
- <span class="ident">submit_label</span> <span class="punct">=</span> <span class="punct">&quot;</span><span class="string">Update</span><span class="punct">&quot;</span>
180
- <span class="ident">submit_label</span> <span class="punct">=</span> <span class="punct">&quot;</span><span class="string">Create</span><span class="punct">&quot;</span> <span class="keyword">if</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">new_record?</span>
181
- <span class="punct">-%&gt;</span><span class="string">
182
-
183
- &lt;%= error_messages_for @page %</span><span class="punct">&gt;</span>
184
-
185
- <span class="punct">&lt;%</span> <span class="ident">form_for</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">,</span> <span class="symbol">:action</span> <span class="punct">=&gt;</span> <span class="ident">url</span><span class="punct">(</span><span class="symbol">:page</span><span class="punct">,</span><span class="attribute">@page</span><span class="punct">))</span> <span class="keyword">do</span> <span class="punct">%&gt;</span><span class="string">
186
- &lt;%= partial :data %</span><span class="punct">&gt;</span>
187
- <span class="punct">&lt;</span><span class="ident">p</span><span class="punct">&gt;</span> <span class="punct">&lt;%=</span><span class="string"> submit_button submit_label %&gt; &lt;/p&gt;
188
- &lt;% end %&gt;<span class="normal">
189
- </span></span></pre></p>
190
-
191
-
192
- <p>The data partial (the show view calls this directly):
193
- <pre class='syntax'>
194
- <span class="punct">&lt;</span><span class="ident">p</span><span class="punct">&gt;</span>
195
- <span class="punct">&lt;</span><span class="ident">b</span><span class="punct">&gt;</span><span class="constant">Title</span><span class="punct">&lt;/</span><span class="regex">b&gt;&lt;br </span><span class="punct">/&gt;</span>
196
- <span class="punct">&lt;%=</span><span class="string"> page_title_value %&gt;
197
- &lt;/p&gt;
198
- &lt;p&gt;
199
- &lt;b&gt;Content&lt;/b&gt;&lt;br /&gt;
200
- &lt;%</span><span class="punct">=</span> <span class="ident">page_content_value</span> <span class="punct">%&gt;</span><span class="string">
201
- &lt;/p</span><span class="punct">&gt;</span>
202
- </pre></p>
203
-
204
-
205
- <p>As you can see, there are &lt;model&gt;_&lt;field&gt;_value methods. These are defined in the pages helper:
206
- <pre class='syntax'>
207
- <span class="keyword">module </span><span class="module">PagesHelper</span>
208
- <span class="keyword">def </span><span class="method">page_title_value</span>
209
- <span class="keyword">if</span> <span class="attribute">@action_name</span> <span class="punct">==</span> <span class="punct">&quot;</span><span class="string">show</span><span class="punct">&quot;</span>
210
- <span class="ident">h</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">title</span>
211
- <span class="keyword">else</span>
212
- <span class="ident">text_field_tag</span> <span class="punct">&quot;</span><span class="string">page[title]</span><span class="punct">&quot;,</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">title</span>
213
- <span class="keyword">end</span>
214
- <span class="keyword">end</span>
215
-
216
- <span class="keyword">def </span><span class="method">page_content_value</span>
217
- <span class="keyword">if</span> <span class="attribute">@action_name</span> <span class="punct">==</span> <span class="punct">&quot;</span><span class="string">show</span><span class="punct">&quot;</span>
218
- <span class="ident">h</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">content</span>
219
- <span class="keyword">else</span>
220
- <span class="ident">text_field_tag</span> <span class="punct">&quot;</span><span class="string">page[content]</span><span class="punct">&quot;,</span> <span class="attribute">@page</span><span class="punct">.</span><span class="ident">content</span>
221
- <span class="keyword">end</span>
222
- <span class="keyword">end</span>
223
-
224
- <span class="keyword">end</span>
225
- </pre></p>
226
-
227
-
228
- <p>I need to get more precise with the form helpers, but for now this will do.</p>
229
-
230
-
231
- <h2>Forum</h2>
232
-
233
-
234
- <p><a href="http://groups.google.com/group/stonean_stage?hl=en">http://groups.google.com/group/stonean_stage?hl=en</a></p>
235
-
236
-
237
- <h2>How to submit patches</h2>
238
-
239
-
240
- <p>The Clone <span class="caps">URL</span>: git://github.com/stonean/stage.git</p>
241
-
242
-
243
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
244
-
245
-
246
- <p>I&#8217;m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.</p>
247
-
248
-
249
- <h2>License</h2>
250
-
251
-
252
- <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
253
-
254
-
255
- <h2>Contact</h2>
256
-
257
-
258
- <p>Comments and suggestions are welcome via the <a href="http://groups.google.com/group/stonean_stage?hl=en">forum</a></p>
259
- <p class="coda">
260
- 26th April 2008<br>
261
- Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
262
- </p>
263
- </div>
264
-
265
- <script type="text/javascript">
266
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
267
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
268
- </script>
269
- <script type="text/javascript">
270
- var pageTracker = _gat._getTracker("UA-4186995-1");
271
- pageTracker._initData();
272
- pageTracker._trackPageview();
273
- </script>
274
- </body>
275
- </html>
@@ -1,204 +0,0 @@
1
- h1. stage
2
-
3
- h1. &#x2192; 'stage'
4
-
5
- h1. Rails instructions
6
-
7
- h2. Installing
8
-
9
- <pre syntax="ruby">sudo gem install stage</pre>
10
-
11
- h2. Demonstration of usage
12
-
13
- <pre syntax="ruby">
14
- $ ./script/generate stage product name:string cost:integer weight:integer
15
- exists app/models/
16
- exists app/controllers/
17
- exists app/helpers/
18
- create app/views/products
19
- exists app/views/layouts/
20
- create app/views/products/index.html.erb
21
- create app/views/products/show.html.erb
22
- create app/views/products/new.html.erb
23
- create app/views/products/edit.html.erb
24
- create app/views/products/_form.html.erb
25
- create app/views/products/_data.html.erb
26
- create app/models/product.rb
27
- create app/controllers/products_controller.rb
28
- create app/helpers/products_helper.rb
29
- create db/migrate
30
- create db/migrate/001_create_products.rb
31
- route map.resources :products
32
- </pre>
33
-
34
- The controller generated:
35
- <pre syntax="ruby">
36
- class PagesController < ApplicationController
37
- # GET /pages
38
- # GET /pages.xml
39
- def index
40
- @pages = Page.find(:all)
41
-
42
- respond_to do |format|
43
- format.html # index.html.erb
44
- format.xml { render :xml => @pages }
45
- end
46
- end
47
-
48
- # GET /pages/1
49
- # GET /pages/1.xml
50
- def show
51
- @page = Page.find(params[:id])
52
-
53
- respond_to do |format|
54
- format.html # show.html.erb
55
- format.xml { render :xml => @page }
56
- end
57
- end
58
-
59
- # GET /pages/new
60
- # GET /pages/new.xml
61
- def new
62
- @page = Page.new
63
-
64
- respond_to do |format|
65
- format.html # new.html.erb
66
- format.xml { render :xml => @page }
67
- end
68
- end
69
-
70
- # GET /pages/1/edit
71
- def edit
72
- @page = Page.find(params[:id])
73
- end
74
-
75
- # POST /pages
76
- # POST /pages.xml
77
- def create
78
- @page = Page.new(params[:page])
79
-
80
- respond_to do |format|
81
- if @page.save
82
- flash[:notice] = 'Page was successfully created.'
83
- format.html { redirect_to(@page) }
84
- format.xml { render :xml => @page, :status => :created, :location => @page }
85
- else
86
- format.html { render :action => "new" }
87
- format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
88
- end
89
- end
90
- end
91
-
92
- # PUT /pages/1
93
- # PUT /pages/1.xml
94
- def update
95
- @page = Page.find(params[:id])
96
-
97
- respond_to do |format|
98
- if @page.update_attributes(params[:page])
99
- flash[:notice] = 'Page was successfully updated.'
100
- format.html { redirect_to(@page) }
101
- format.xml { head :ok }
102
- else
103
- format.html { render :action => "edit" }
104
- format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
105
- end
106
- end
107
- end
108
-
109
- # DELETE /pages/1
110
- # DELETE /pages/1.xml
111
- def destroy
112
- @page = Page.find(params[:id])
113
- @page.destroy
114
-
115
- respond_to do |format|
116
- format.html { redirect_to(pages_url) }
117
- format.xml { head :ok }
118
- end
119
- end
120
- end
121
- </pre>
122
-
123
- The edit page:
124
- <pre syntax="ruby">
125
- <h1>Editing Page</h1>
126
-
127
- <%= render :partial => "form" %>
128
-
129
- <%= link_to 'Show', @page %> |
130
- <%= link_to 'Back', pages_path %>
131
- </pre>
132
-
133
- The form partial:
134
- <pre syntax="ruby">
135
- <%
136
- submit_label = "Update"
137
- submit_label = "Create" if @page.new_record?
138
- -%>
139
-
140
- <%= error_messages_for @page %>
141
-
142
- <% form_for(:page, :action => url(:page,@page)) do %>
143
- <%= partial :data %>
144
- <p> <%= submit_button submit_label %> </p>
145
- <% end %>
146
- </pre>
147
-
148
- The data partial (the show view calls this directly):
149
- <pre syntax="ruby">
150
- <p>
151
- <b>Title</b><br />
152
- <%= page_title_value %>
153
- </p>
154
- <p>
155
- <b>Content</b><br />
156
- <%= page_content_value %>
157
- </p>
158
- </pre>
159
-
160
- As you can see, there are &lt;model&gt;_&lt;field&gt;_value methods. These are defined in the pages helper:
161
- <pre syntax="ruby">
162
- module PagesHelper
163
- def page_title_value
164
- if @action_name == "show"
165
- h @page.title
166
- else
167
- text_field_tag "page[title]", @page.title
168
- end
169
- end
170
-
171
- def page_content_value
172
- if @action_name == "show"
173
- h @page.content
174
- else
175
- text_field_tag "page[content]", @page.content
176
- end
177
- end
178
-
179
- end
180
- </pre>
181
-
182
- I need to get more precise with the form helpers, but for now this will do.
183
-
184
- h2. Forum
185
-
186
- "http://groups.google.com/group/stonean_stage?hl=en":http://groups.google.com/group/stonean_stage?hl=en
187
-
188
-
189
- h2. How to submit patches
190
-
191
- The Clone URL: git://github.com/stonean/stage.git
192
-
193
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
194
-
195
- I'm new to git and this whole opensource project admin gig, so please be patient with my stumbling around.
196
-
197
- h2. License
198
-
199
- This code is free to use under the terms of the MIT license.
200
-
201
- h2. Contact
202
-
203
- Comments and suggestions are welcome via the "forum":http://groups.google.com/group/stonean_stage?hl=en
204
-