Skip to content

Commit

Permalink
first steps in adding new hours by date range report
Browse files Browse the repository at this point in the history
  • Loading branch information
baroquon committed Feb 12, 2015
1 parent 36ce2f3 commit 94f1055
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -8,7 +8,7 @@ script:
notifications:
email:
- josh@isotope11.com
- agamble@isotope11.com
- brandon@isotope11.com
- rclements@isotope11.com
rvm:
- 1.9.3
Expand Down
7 changes: 5 additions & 2 deletions app/controllers/users_controller.rb
@@ -1,11 +1,11 @@
class UsersController < ApplicationController
before_filter :load_user, :only => [:show, :edit, :change_password, :historical_time, :update]
before_filter :load_user, :only => [:show, :edit, :change_password, :historical_time, :update, :hours_by_date_range]
skip_before_filter :redirect_clients

access_control do
allow :admin
allow :developer, :to => [:edit, :change_password, :update], :if => :user_is_current_user?
allow :developer, :to => [:index, :show, :historical_time]
allow :developer, :to => [:index, :show, :historical_time, :hours_by_date_range]
allow :client, :to => [:edit, :show, :change_password], :if => :user_is_current_user?
end

Expand Down Expand Up @@ -36,6 +36,9 @@ def change_password
def historical_time
end

def hours_by_date_range
end

def update
if @user.update_attributes(params[:user])
flash[:notice] = t(:user_updated_successfully)
Expand Down
5 changes: 5 additions & 0 deletions app/views/users/hours_by_date_range.html.haml
@@ -0,0 +1,5 @@
%h2= "#{t(:historical_time_entered_for)} #{@user.to_s}"
- (0..5).each do |x|
- start_date = Date.current.beginning_of_week - x.weeks
%h3= "#{t(:week_of)} #{start_date} #{t(:to)} #{start_date + 1.week}"
= render 'shared/calendar', :start_date => start_date, :user => @user, :work_units => @user.work_units_between(start_date, start_date + 6.days)
1 change: 1 addition & 0 deletions app/views/users/show.html.haml
Expand Up @@ -2,6 +2,7 @@

%ul.nav.nav-pills
%li= link_to t(:historical_time_report), historical_time_user_path
%li= link_to t(:hours_by_date_range), hours_by_date_range_user_path
- if @user == current_user or admin?
%li= link_to "Edit User", edit_user_path(@user)

Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Expand Up @@ -83,6 +83,7 @@
member do
put :change_password
get :historical_time
get :hours_by_date_range
end
end

Expand Down

0 comments on commit 94f1055

Please sign in to comment.