diff --git a/appname/app/main/config/routes.rb b/appname/app/main/config/routes.rb index 1caa03a..c0509ae 100644 --- a/appname/app/main/config/routes.rb +++ b/appname/app/main/config/routes.rb @@ -5,6 +5,7 @@ # Routes for login and signup, provided by user-templates component gem get '/signup', _controller: 'user-templates', _action: 'signup' get '/login', _controller: 'user-templates', _action: 'login' +get '/todos', _action: 'todos' # The main route, this should be last. It will match any params not # previously matched. diff --git a/appname/app/main/controllers/main_controller.rb b/appname/app/main/controllers/main_controller.rb index 005197e..499a26d 100644 --- a/appname/app/main/controllers/main_controller.rb +++ b/appname/app/main/controllers/main_controller.rb @@ -7,6 +7,11 @@ def index def about # Add code for when the about view is loaded end + + def add_todo + page._todos << { name: page._new_todo } + page._new_todo = '' + end private diff --git a/appname/app/main/views/main/main.html b/appname/app/main/views/main/main.html index 6fabf28..e0b3cb3 100644 --- a/appname/app/main/views/main/main.html +++ b/appname/app/main/views/main/main.html @@ -1,11 +1,11 @@ <:Title> {{ template main_path, "title", {controller_group: 'main'} }} - <:Body>
@@ -17,7 +17,7 @@

appname

{{ template main_path, 'body', {controller_group: 'main'} }}