Merge branch 'release/4.2' into dev

pull/6827/head
Jens Ulferts 10 years ago
commit 0e8aecf5da
  1. 42
      app/views/hooks/_view_projects_show_sidebar_bottom_hook.html.erb
  2. 19
      features/links.feature
  3. 66
      lib/open_project/reporting/engine.rb
  4. 3
      lib/open_project/reporting/hooks.rb

@ -1,42 +0,0 @@
<%#-- copyright
OpenProject Reporting Plugin
Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++#%>
<script type="text/javascript">
//<![CDATA[
remove_old_sidebar = function() {
if ($($("sidebar").down()).innerHTML === "<%= l(:label_spent_time) %>") {
var reporting_link, old_html;
// The sidebar is showing spent time, remove the links, which are in the second para
$("sidebar").down().siblings()[1].remove();
// Make the hours a link, which are in the first para
reporting_link = "<%= raw link_to('PLACEHOLDER', {
:controller => 'cost_reports', :project_id => project,
:unit => -1, :set_filter => 1,
:values => {:project_id => [project.id]},
:operators => {:project_id => '='},
:fields => [:project_id] }).gsub('"', "'") %>";
old_html = $("sidebar").down().siblings().first().innerHTML;
$("sidebar").down().siblings().first().innerHTML = reporting_link.replace("PLACEHOLDER", old_html)
}
}
remove_old_sidebar();
//]]>
</script>

@ -147,25 +147,6 @@ Feature: Cost Reporting Linkage
And I should not see "50.00" And I should not see "50.00"
And I should not see "150.00" And I should not see "150.00"
@javascript
Scenario: Reporting on the project page should be accessible from the spent time
Given there is a standard cost control project named "Standard Project"
And the project "Standard Project" has 1 issue with the following:
| subject | test_work_package |
And the issue "test_work_package" has 1 time entry with the following:
| hours | 1.00 |
| user | manager |
And I am already logged in as "manager"
When I am on the page for the project "Standard Project"
Then I see spent time within "#sidebar"
And I should see "1.00 hour" within "#sidebar"
And I should not see "Details" within "#sidebar"
And I should not see "Report" within "#sidebar"
When I follow "1.00 hour"
Then I should be on the Cost Reports page for the project called "Standard Project"
@javascript @javascript
Scenario: Jump to project from the cost report jumps to the cost report of the selected project Scenario: Jump to project from the cost report jumps to the cost report of the selected project
Given there is a standard cost control project named "First Project" Given there is a standard cost control project named "First Project"

@ -27,41 +27,45 @@ module OpenProject::Reporting
author_url: 'http://finn.de', author_url: 'http://finn.de',
requires_openproject: '>= 4.0.0' do requires_openproject: '>= 4.0.0' do
view_actions = [:index, :show, :drill_down, :available_values, :display_report_list] view_actions = [:index, :show, :drill_down, :available_values, :display_report_list]
edit_actions = [:create, :update, :rename, :delete] edit_actions = [:create, :update, :rename, :delete]
#register reporting_module including permissions #register reporting_module including permissions
project_module :reporting_module do project_module :reporting_module do
permission :save_cost_reports, {cost_reports: edit_actions} permission :save_cost_reports, {cost_reports: edit_actions}
permission :save_private_cost_reports, {cost_reports: edit_actions} permission :save_private_cost_reports, {cost_reports: edit_actions}
end end
#register additional permissions for viewing time and cost entries through the CostReportsController #register additional permissions for viewing time and cost entries through the CostReportsController
view_actions.each do |action| view_actions.each do |action|
Redmine::AccessControl.permission(:view_time_entries).actions << "cost_reports/#{action}" Redmine::AccessControl.permission(:view_time_entries).actions << "cost_reports/#{action}"
Redmine::AccessControl.permission(:view_own_time_entries).actions << "cost_reports/#{action}" Redmine::AccessControl.permission(:view_own_time_entries).actions << "cost_reports/#{action}"
Redmine::AccessControl.permission(:view_cost_entries).actions << "cost_reports/#{action}" Redmine::AccessControl.permission(:view_cost_entries).actions << "cost_reports/#{action}"
Redmine::AccessControl.permission(:view_own_cost_entries).actions << "cost_reports/#{action}" Redmine::AccessControl.permission(:view_own_cost_entries).actions << "cost_reports/#{action}"
end end
#menu extensions
menu :top_menu, :cost_reports_global, {controller: 'cost_reports', action: 'index', project_id: nil},
caption: :cost_reports_title,
if: Proc.new {
( User.current.allowed_to?(:view_time_entries, nil, global: true) ||
User.current.allowed_to?(:view_own_time_entries, nil, global: true) ||
User.current.allowed_to?(:view_cost_entries, nil, global: true) ||
User.current.allowed_to?(:view_own_cost_entries, nil, global: true)
)
}
#menu extensions menu :project_menu, :cost_reports,
menu :top_menu, :cost_reports_global, {controller: 'cost_reports', action: 'index', project_id: nil}, {controller: 'cost_reports', action: 'index'},
caption: :cost_reports_title, param: :project_id,
if: Proc.new { after: :time_entries,
( User.current.allowed_to?(:view_time_entries, nil, global: true) || caption: :cost_reports_title,
User.current.allowed_to?(:view_own_time_entries, nil, global: true) || if: Proc.new { |project| project.module_enabled?(:reporting_module) },
User.current.allowed_to?(:view_cost_entries, nil, global: true) || html: { class: 'icon2 icon-stats' }
User.current.allowed_to?(:view_own_cost_entries, nil, global: true)
)
}
menu :project_menu, :cost_reports, hide_menu_item :project_menu,
{controller: 'cost_reports', action: 'index'}, :time_entries,
param: :project_id, hide_if: -> (project) { project.module_enabled?(:reporting_module) }
after: :cost_objects,
caption: :cost_reports_title,
if: Proc.new { |project| project.module_enabled?(:reporting_module) },
html: {class: 'icon2 icon-stats'}
end end
initializer "reporting.register_hooks" do initializer "reporting.register_hooks" do

@ -17,6 +17,5 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#++ #++
class ViewProjectsShowSidebarBottomHook < Redmine::Hook::ViewListener module OpenProject::Reporting::Hooks
render_on :view_projects_show_sidebar_bottom, partial: 'hooks/view_projects_show_sidebar_bottom_hook'
end end

Loading…
Cancel
Save