Fix index form

pull/6827/head
Hagen Schink 12 years ago
parent 038d7a83c7
commit d3b04f9eab
  1. 22
      app/controllers/costlog_controller.rb
  2. 6
      app/views/costlog/_list.html.erb
  3. 2
      app/views/costlog/index.html.erb

@ -16,6 +16,7 @@ class CostlogController < ApplicationController
include SortHelper
helper :issues
include CostlogHelper
include PaginationHelper
def index
sort_init 'spent_on', 'desc'
@ -47,15 +48,11 @@ class CostlogController < ApplicationController
respond_to do |format|
format.html {
# Paginate results
@entry_count = CostEntry.count(:include => [:project, :user, :issue], :conditions => cond.conditions)
@entry_pages = Paginator.new self, @entry_count, per_page_option, params['page']
@entries = CostEntry.find(:all,
:include => [:project, :cost_type, :user, {:issue => :tracker}],
:conditions => cond.conditions,
:order => sort_clause,
:limit => @entry_pages.items_per_page,
:offset => @entry_pages.current.offset)
@entries = CostEntry.includes(:project, :cost_type, :user, {:work_package => :tracker})
.where(cond.conditions)
.order(sort_clause)
.page(page_param)
.per_page(per_page_param)
render :layout => !request.xhr?
}
@ -154,8 +151,11 @@ private
end
def find_optional_project
if !params[:work_package_id].blank?
@issue = Issue.find(params[:work_package_id])
if !params[:issue_id].blank?
@issue = Issue.find(params[:issue_id])
@project = @issue.project
elsif !params[:work_package_id].blank?
@issue = WorkPackage.find(params[:work_package_id])
@project = @issue.project
elsif !params[:project_id].blank?
@project = Project.find(params[:project_id])

@ -18,8 +18,8 @@
<td class="user"><%=h entry.user %></td>
<td class="project"><%=h entry.project %></td>
<td class="subject">
<% if entry.issue -%>
<%= link_to_issue entry.issue -%>
<% if entry.work_package -%>
<%= link_to_issue entry.work_package -%>
<% end -%>
</td>
@ -36,7 +36,7 @@
:title => l(:button_edit) %>
<%= link_to image_tag('delete.png'), {:controller => '/costlog', :action => 'destroy', :id => entry, :project_id => nil},
:confirm => l(:text_are_you_sure),
:method => :post,
:method => :delete,
:title => l(:button_delete) %>
<% end -%>
</td>

@ -16,7 +16,7 @@
<% unless @entries.empty? %>
<%= render :partial => 'list', :locals => { :entries => @entries }%>
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
<%= pagination_links_full @entries %>
<% end %>
<% html_title Issue.human_attribute_name(:spent_costs), l(:label_details) %>

Loading…
Cancel
Save