diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-27 19:44:29 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-27 19:44:29 -0700 |
| commit | 3e27cf92632ffdb0f7b02dbc7781229ec82bd207 (patch) | |
| tree | 65ce0a8e24e4af287756402c1574005b06d08d47 | |
| parent | 0cdd9264ceb5d6bd3d143b8fe08c9093abd5d234 (diff) | |
add a homepage to display the different types of routes.
| -rw-r--r-- | app/controllers/home_controller.rb | 6 | ||||
| -rw-r--r-- | app/views/home/index.html.erb | 45 | ||||
| -rw-r--r-- | config/routes.rb | 2 |
3 files changed, 52 insertions, 1 deletions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..a7d44f1 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,6 @@ +class HomeController < ApplicationController + def index + @licenses = License.all + @companies = Company.all + end +end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..154d340 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,45 @@ +<html> +<head> +<meta http-equiv="content-type" content="text/html; charset=utf-8" /> +<title></title> +</head> +<body> + +<h1>oh hai</h1> +<%= link_to "all licenses", v1_licenses_path %> + +<h2>Licenses</h2> +<ul> + <% @licenses.each do |license| %> + <li><%= link_to "license #{license.id}", v1_license_path(license) %></li> +<% end %> +</ul> + +<h2>Companies</h2> +<ul> + <% @companies.each do |company| %> + <li> + <%= company.name %> + <ul> + <li> + <%= link_to "active", v1_company_licenses_path(company) %> + <ul> + <% Location.all.each do |location| %> + <li> <%= link_to location.township, v1_company_licenses_path(company, status: "active", township: location.township) %> </li> + <% end %> + </ul> + </li> + <li> + <%= link_to "expired", v1_company_licenses_path(company, status: "expired") %> + <ul> + <% Location.all.each do |location| %> + <li> <%= link_to location.township, v1_company_licenses_path(company, status: "expired", township: location.township) %> </li> + <% end %> + </ul> + </li> + </ul> + </li> +<% end %> +</ul> +</body> +</html> diff --git a/config/routes.rb b/config/routes.rb index 39fc8ea..cc8a846 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,5 +5,5 @@ CodeChallengeMo::Application.routes.draw do resources :licenses, controller: 'company_licenses', only: [:index] end end - root to: 'v1/licenses#index' + root to: 'home#index' end |
