Skip to content

Commit

Permalink
Wiki example: form on 'pages' to create new page
Browse files Browse the repository at this point in the history
  • Loading branch information
EugZol committed May 3, 2008
1 parent ec0591e commit a3bc642
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion examples/strokewiki/view/pages.xhtml
Expand Up @@ -15,8 +15,13 @@
<li><a href="/show/#{page.name}">#{page.name}</a> - <a href="/edit/#{page.name}">edit</a> | <a href="/delete/#{page.name}">delete</a></li>
<?r end ?>
</ul>
<h2>Create page</h2>
<form method="post" action="/new">
Enter title: <input type="text" name="name">
<input type="submit">
</form>
<hr/>
<a href="/">Home</a> |
<a href="/pages">Pages</a>
</body>
</html>
</html>
10 changes: 5 additions & 5 deletions examples/strokewiki/wiki.rb
Expand Up @@ -65,17 +65,17 @@ def pages
def show name,version=nil
@page = Page.find(:name => name).first
@page = @page.versions[version] if version
redirect("/new/#{name}") unless @page
redirect("/new?name=#{name}") unless @page
end

def versions name
@page = Page.find(:name => name).first
@versions = @page.versions.all
redirect("/new/#{name}") unless @page
redirect("/new?name=#{name}") unless @page
end

def new name
@page = Page.new(:name => name)
def new
@page = Page.new(:name => request['name'])
end

def create name
Expand Down Expand Up @@ -103,4 +103,4 @@ def delete name

end

Ramaze.start
Ramaze.start

0 comments on commit a3bc642

Please sign in to comment.