Sha256: 211826f98cb5fbd6bcb63e806fda419f28dd4491dec17540002385ff0584750f

Contents?: true

Size: 715 Bytes

Versions: 24

Compression:

Stored size: 715 Bytes

Contents

module TodoList
  class Tasks < Controller
    map '/'

    def index
      @tasks = Task.all
      @title = request[:title]
    end

    def create
      if request.post? and title = request[:title]
        title.strip!

        unless title.empty?
          Task.create :title => title
        end
      end

      redirect route('/', :title => title)
    rescue Sequel::DatabaseError => ex
      redirect route('/', :title => title)
    end

    def open(title)
      Task[:title => title].open!
      redirect r('/')
    end

    def close(title)
      Task[:title => title].close!
      redirect r('/')
    end

    def delete(title)
      Task[:title => title].destroy
      redirect r('/')
    end
  end
end

Version data entries

24 entries across 24 versions & 4 rubygems

Version Path
Pistos-ramaze-2009.04.08 examples/app/todolist/controller/task.rb
Pistos-ramaze-2009.06.12 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.04.01 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.04.08 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.04.18 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.04.22 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.04 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.05.08 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.05 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.06.04 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.06.12 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.06 examples/app/todolist/controller/task.rb
manveru-ramaze-2009.07 examples/app/todolist/controller/task.rb
rjspotter-ramaze-2009.06.29 examples/app/todolist/controller/task.rb
rjspotter-ramaze-2009.06.31 examples/app/todolist/controller/task.rb
ramaze-2010.03 examples/app/todolist/controller/task.rb
ramaze-2010.01 examples/app/todolist/controller/task.rb
ramaze-2009.10 examples/app/todolist/controller/task.rb
ramaze-2009.07 examples/app/todolist/controller/task.rb
ramaze-2009.05 examples/app/todolist/controller/task.rb