fix details view

git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1568 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
rkh 14 years ago
parent beedc80c44
commit d32f907e15
  1. 4
      app/controllers/cost_reports_controller.rb
  2. 6
      app/helpers/reporting_helper.rb
  3. 9
      app/views/cost_reports/_cost_entry_table.rhtml
  4. 1
      config/locales/de.yml
  5. 1
      config/locales/en.yml

@ -6,15 +6,13 @@ class CostReportsController < ApplicationController
include ReportingHelper
def index
set_cost_type
if @query.group_bys.empty?
@table_partial = "cost_entry_table"
set_cost_type(0)
elsif @query.depth_of(:column) == 0 or @query.depth_of(:row) == 0
@table_partial = "simple_cost_report_table"
set_cost_type(0)
else
@table_partial = "cost_report_table"
set_cost_type
end
render :layout => !request.xhr?
end

@ -44,7 +44,9 @@ module ReportingHelper
end
def label_for(field)
l(CostQuery::Filter.const_get(field.to_s.camelcase).label)
name = field.to_s.camelcase
return l(field) unless CostQuery::Filter.const_defined? name
l(CostQuery::Filter.const_get(name).label)
end
def debug_fields(result, prefix = ", ")
@ -59,7 +61,7 @@ module ReportingHelper
when :activity_id then mapped value, Enumeration, :caption_material_costs
when :project_id then link_to_project Project.find(value.to_i)
when :user_id, :assigned_to_id then link_to_user User.find(value.to_i)
when :tyear then value
when :tyear, :units then value
when :tweek then "#{l(:label_week)} ##{value}"
when :tmonth then month_name(value.to_i)
when :category_id then IssueCategory.find(value.to_i).name

@ -1,15 +1,18 @@
<% list = [:project_id, :issue_id, :spent_on, :user_id, :activity_id] %>
<% list = [:project_id, :issue_id, :units, :cost_type_id, :spent_on, :user_id, :activity_id] %>
<table class="list">
<thead>
<% list.each do |field| %><th><%= label_for(field) %></th><% end %>
<th><%= l(:field_costs) %></th>
<th><%= @cost_type.try(:unit_plural) || l(:field_costs) %></th>
</thead>
<tfoot>
<th colspan='<%= list.size + 1 %>'><%= show_result @query %></th>
</tfoot>
<tbody>
<% @query.each_direct_result do |result| %>
<tr class='<%= cycle("odd", "even") %>'>
<% list.each do |field| %><td><%= show_field field, result.fields[field.to_s] %></td><% end %>
<td class="currency"><%= number_to_currency result.real_costs %></td>
<td class="currency"><%= show_result(result) %></td>
</tr>
<% if params[:debug] %>
<tr>

@ -1,5 +1,6 @@
---
de:
units: Einheiten
label_entry: "Kosteneintrag"
label_less: "<"
label_greater: ">"

@ -1,5 +1,6 @@
---
en:
units: Units
label_less: "<"
label_greater: ">"
label_cost_entry_attributes: "Cost Entry Attributes"

Loading…
Cancel
Save