From f7de4ea77a67e64bb4a1730ec92b74cce69ce36b Mon Sep 17 00:00:00 2001 From: Loos Date: Mon, 3 Nov 2014 20:26:55 -0500 Subject: [PATCH] WIP - begin adding reports --- app/controllers/reports_controller.rb | 8 ++++++++ app/models/reports.rb | 5 +++++ app/models/user.rb | 10 +++++++--- app/views/reports/bikes_sold_per_year.html.haml | 1 + app/views/static_pages/home.html.haml | 3 +++ config/routes.rb | 1 + notes.txt | 1 - 7 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 app/controllers/reports_controller.rb create mode 100644 app/models/reports.rb create mode 100644 app/views/reports/bikes_sold_per_year.html.haml diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb new file mode 100644 index 0000000..c38539c --- /dev/null +++ b/app/controllers/reports_controller.rb @@ -0,0 +1,8 @@ +class ReportsController < ApplicationController + before_action :authenticate_user! + + def bikes_sold_per_year + @bikes_sold_per_year = Report.bikes_sold_per_year + end + +end diff --git a/app/models/reports.rb b/app/models/reports.rb new file mode 100644 index 0000000..167e8c1 --- /dev/null +++ b/app/models/reports.rb @@ -0,0 +1,5 @@ +class Report + def self.bikes_sold_per_year + "KITTIES" + end +end diff --git a/app/models/user.rb b/app/models/user.rb index c822027..59e0d9d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,10 @@ class User < ActiveRecord::Base # Include default devise modules. Others available are: - # :confirmable, :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :trackable, :validatable + # :confirmable, :lockable, :timeoutable, :omniauthable, :registerable, + + devise :database_authenticatable, + :recoverable, + :rememberable, + :trackable, + :validatable end diff --git a/app/views/reports/bikes_sold_per_year.html.haml b/app/views/reports/bikes_sold_per_year.html.haml new file mode 100644 index 0000000..fbda96f --- /dev/null +++ b/app/views/reports/bikes_sold_per_year.html.haml @@ -0,0 +1 @@ += @bikes_sold_per_year diff --git a/app/views/static_pages/home.html.haml b/app/views/static_pages/home.html.haml index c3e9793..47a689f 100644 --- a/app/views/static_pages/home.html.haml +++ b/app/views/static_pages/home.html.haml @@ -18,3 +18,6 @@ = link_to "Freecyclery Closed Applications", closed_applications_path %br = link_to "Available Bikes", available_bikes_path + %h2 Reports + %br + = link_to "Bikes Sold Per Year", bikes_sold_per_year_path diff --git a/config/routes.rb b/config/routes.rb index 238d670..c8439c8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,4 +19,5 @@ Bikedb::Application.routes.draw do get 'ready_for_pickup' => 'freecyclery#ready_for_pickup' get 'available_bikes' => 'freecyclery#available_bikes' + get 'bikes_sold_per_year' => 'reports#bikes_sold_per_year' end diff --git a/notes.txt b/notes.txt index f807652..42d7e5d 100644 --- a/notes.txt +++ b/notes.txt @@ -14,7 +14,6 @@ mark as picked up from the ready for pickup page validations around parameters that break site if incomplete mark as sold should be disabled after bike is sold there should be nice feedback indicating that the bike was sold -disable new users Improve form layouts make navigation always on the left side of the page Make customer facing bike index with pitchers