use hook to fulfill issue #3303

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1618 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
t.felgentreff 14 years ago
parent 5a98e85ccf
commit 88868c9a1f
  1. 18
      app/views/hooks/_view_projects_show_sidebar_bottom_hook.rhtml
  2. 10
      features/links.feature
  3. 3
      init.rb
  4. 3
      lib/view_projects_show_sidebar_bottom_hook.rb

@ -0,0 +1,18 @@
<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, hide the links, which are in the second para
$("sidebar").down().siblings()[1].hide();
// Make the hours a link, which are in the first para
reporting_link = "<%= link_to('PLACEHOLDER', {
:controller => 'cost_reports', :project_id => project }).gsub('"', "'") %>";
old_html = $("sidebar").down().siblings().first().innerHTML;
$("sidebar").down().siblings().first().innerHTML = reporting_link.replace("PLACEHOLDER", old_html)
}
}
remove_old_sidebar();
//]]>
</script>

@ -97,9 +97,9 @@ Feature: Cost Reporting Linkage
| user | manager |
And I am logged in as "manager"
When I am on the page for the project "Standard Project"
Then I should see "Spent time" within "sidebar"
And I should see "1.00 hours" within "sidebar"
And I should not see "Details" within "sidebar"
And I should not see "Report" within "div[@id='sidebar']"
When I follow "1.00 hours"
Then I should 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 "/projects/Standard%20Project/cost_reports"

@ -6,6 +6,9 @@ require "hwia_rails"
require 'big_decimal_patch'
require 'to_date_patch'
# Hooks
require 'view_projects_show_sidebar_bottom_hook'
Redmine::Plugin.register :redmine_reporting do
name 'Reporting Plugin'
author 'Konstantin Haase, Philipp Tessenow @ finnlabs'

@ -0,0 +1,3 @@
class ViewProjectsShowSidebarBottomHook < Redmine::Hook::ViewListener
render_on :view_projects_show_sidebar_bottom, :partial => 'hooks/view_projects_show_sidebar_bottom_hook'
end
Loading…
Cancel
Save