public
Description: Sample Nyane app.
Homepage:
Clone URL: git://github.com/arthurgeek/toodoo.git
toodoo / app.rb
100644 35 lines (30 sloc) 0.624 kb
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
get '/' do
  @pending_tasks = Task.all_pending
  @completed_tasks = Task.all_completed
  erb :index
end
 
post '/' do
  @task = Task.create(:description => @params["description"], :done => false)
  redirect_to "/"
end
 
get '/edit/([0-9]+)' do |id|
  @task = Task.get(id)
  erb :edit
end
 
post '/edit/([0-9]+)' do |id|
  @task = Task.get(id)
  @task.description = @params["description"]
  @task.save
  redirect_to "/"
end
 
post '/finish/([0-9]+)' do |id|
  @task = Task.get(id)
  @task.done = true
  @task.save
  redirect_to "/"
end
 
post '/delete/([0-9]+)' do |id|
  @task = Task.get(id)
  @task.destroy
  redirect_to "/"
end