Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ The plugin is compatible with Redmine 3.3.X

## Installation and Setup

1. Clone this repository to your Redmine `plugins/` directory.
2. Restart web server
1. Clone this repository to your Redmine as `plugins/timesheet`:

`$ git clone https://github.com/Contargo/redmine-timesheet-plugin plugins/timesheet`

The name is important, because of the way the Redmine plugin system works.
2. Restart web server

## License

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/timesheets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TimesheetsController < ApplicationController
# GET /timesheet.json
# GET /timesheet.csv
def show
sort_init(@timesheet.query.sort_criteria.empty? ? [['spent_on', 'desc']] : @query.sort_criteria)
sort_init(@timesheet.query.sort_criteria.empty? ? [['spent_on', 'desc']] : @query.try(:sort_criteria))
sort_update(@timesheet.query.sortable_columns)

scope = @timesheet.query.results_scope(:order => sort_clause)
Expand All @@ -29,6 +29,8 @@ def show
@entries = scope.offset(@entry_pages.offset).limit(@entry_pages.per_page).to_a
@total_hours = scope.sum(:hours).to_f

@query=@timesheet.query

render :layout => !request.xhr?
}
format.api {
Expand Down
2 changes: 1 addition & 1 deletion app/models/timesheet_query.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'timesheet_plugin/permission_helper'
require File.expand_path('../../../lib/timesheet_plugin/permission_helper', __FILE__)

class TimesheetQuery < TimeEntryQuery

Expand Down
5 changes: 2 additions & 3 deletions app/views/timesheets/_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<%= form_tag({}) do -%>
<%= hidden_field_tag 'back_url', url_for(params), :id => nil %>
<div class="autoscroll">
<table class="list time_entries <%= sort_css_classes %>">
<thead>
Expand All @@ -9,7 +8,7 @@
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
</th>
<% query.inline_columns.each do |column| %>
<%= column_header(column) %>
<%= column_header(query,column) %>
<% end %>
</tr>
</thead>
Expand Down Expand Up @@ -43,4 +42,4 @@
</div>
<% end -%>

<%= context_menu time_entries_context_menu_path %>
<%= context_menu %>
6 changes: 3 additions & 3 deletions app/views/timesheets/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="contextual">
<% other_formats_links do |f| %>
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
<%= f.link_to 'CSV', :url => params.to_unsafe_hash, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
<% end %>
</div>

Expand All @@ -16,7 +16,7 @@

<div id="csv-export-options" style="display:none;">
<h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
<%= form_tag(params.slice(:project_id, :issue_id).merge(:format => 'csv', :page => nil), :method => :get, :id => 'csv-export-form') do %>
<%= form_tag(params.permit(:project_id, :issue_id).slice(:project_id, :issue_id).merge(:format => 'csv', :page => nil), :method => :get, :id => 'csv-export-form') do %>
<%= query_hidden_tags @timesheet.query %>
<p>
<label><%= radio_button_tag 'columns', '', true %> <%= l(:description_visible_columns) %></label><br/>
Expand All @@ -29,4 +29,4 @@
<% end %>
</div>

<% html_title l(:timesheet_title) %>
<% html_title l(:timesheet_title) %>
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'redmine'
require 'timesheet_plugin/permission_helper'
require File.expand_path('../lib/timesheet_plugin/permission_helper', __FILE__)

Redmine::Plugin.register :timesheet do
name 'Timesheet Plugin'
Expand Down