diff --git a/README.md b/README.md index f731598..a6b70ad 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/controllers/timesheets_controller.rb b/app/controllers/timesheets_controller.rb index 2ab7756..fa11334 100644 --- a/app/controllers/timesheets_controller.rb +++ b/app/controllers/timesheets_controller.rb @@ -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) @@ -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 { diff --git a/app/models/timesheet_query.rb b/app/models/timesheet_query.rb index 4c47fb3..e303555 100644 --- a/app/models/timesheet_query.rb +++ b/app/models/timesheet_query.rb @@ -1,4 +1,4 @@ -require 'timesheet_plugin/permission_helper' +require File.expand_path('../../../lib/timesheet_plugin/permission_helper', __FILE__) class TimesheetQuery < TimeEntryQuery diff --git a/app/views/timesheets/_list.html.erb b/app/views/timesheets/_list.html.erb index 825b202..3452eb7 100644 --- a/app/views/timesheets/_list.html.erb +++ b/app/views/timesheets/_list.html.erb @@ -1,5 +1,4 @@ <%= form_tag({}) do -%> -<%= hidden_field_tag 'back_url', url_for(params), :id => nil %>
@@ -9,7 +8,7 @@ :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> <% query.inline_columns.each do |column| %> - <%= column_header(column) %> + <%= column_header(query,column) %> <% end %> @@ -43,4 +42,4 @@ <% end -%> -<%= context_menu time_entries_context_menu_path %> +<%= context_menu %> diff --git a/app/views/timesheets/show.html.erb b/app/views/timesheets/show.html.erb index 7f39acd..aafb26a 100644 --- a/app/views/timesheets/show.html.erb +++ b/app/views/timesheets/show.html.erb @@ -1,6 +1,6 @@
<% 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 %>
@@ -16,7 +16,7 @@ -<% html_title l(:timesheet_title) %> \ No newline at end of file +<% html_title l(:timesheet_title) %> diff --git a/init.rb b/init.rb index 8f5d1ca..07132f4 100644 --- a/init.rb +++ b/init.rb @@ -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'