public
Description: Vanilla in Ruby
Homepage: http://lazyatom.com
Clone URL: git://github.com/lazyatom/vanilla-rb.git
Search Repo:
We can be generic about passing attributes via the URL for creating new 
snips, by using the parameter 'name' instead of 'snip_to_edit' or 
'snip_to_create'. This lets us pass other attributes via the URL too.
lazyatom (author)
Thu Jul 17 08:26:56 -0700 2008
commit  c4ae2d98f2cc0fa3a1f96207ff26253f54047e38
tree    367e8b9bb26ea9f1848c4dbf33b59638792cd9a9
parent  dfca2f00f0b67df91b41ceab674c9c8005fa0e0d
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@ class EditSnip < Dynasnip
0
   
0
   def get(snip_name=nil)
0
     return login_required unless logged_in?
0
- snip = Vanilla.snip(snip_name || app.request.params[:snip_to_edit])
0
+ snip = Vanilla.snip(snip_name || app.request.params[:name])
0
     edit(snip)
0
   end
0
   
...
8
9
10
11
 
12
13
14
15
...
8
9
10
 
11
12
13
14
15
0
@@ -8,7 +8,7 @@ class NewSnip < Dynasnip
0
   
0
   def handle(*arg)
0
     return login_required unless logged_in?
0
- base_params = {:name => 'newsnip', :render_as => '', :content => '', :author => current_user}
0
+ base_params = {:render_as => '', :content => '', :author => current_user}.update(app.request.params)
0
     editor = EditSnip.new(app).edit(Snip.new(base_params))
0
   end
0
 end
0
\ No newline at end of file
...
17
18
19
20
 
21
22
23
24
 
25
26
27
...
17
18
19
 
20
21
22
23
 
24
25
26
27
0
@@ -17,11 +17,11 @@ module Vanilla
0
     end
0
   
0
     def edit_link(snip_name, link_text)
0
- %[<a href="/edit?snip_to_edit=#{snip_name}">#{link_text}</a>]
0
+ %[<a href="/edit?name=#{snip_name}">#{link_text}</a>]
0
     end
0
   
0
     def new_link(snip_name="New")
0
- %[<a href="/new" class="new">#{snip_name}</a>]
0
+ %[<a href="/new?name=#{snip_name}" class="new">#{snip_name}</a>]
0
     end
0
   
0
     extend self

Comments

    No one has commented yet.