Basic deliverable table implemented. #1135
This commit is contained in:
1 parent
67dc53bdca
commit
f99883c1bd
6 files changed
+78
-4
No files matched your search
@@ -3,8 +3,24 @@ class DeliverablesController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize, :get_settings
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
|
||||
def index
|
||||
@deliverables = Deliverable.find_all_by_project_id(@project.id)
|
||||
sort_init "#{Deliverable.table_name}.id", "desc"
|
||||
sort_update
|
||||
limit = per_page_option
|
||||
@deliverable_count = Deliverable.count(:conditions => { :project_id => @project.id })
|
||||
@deliverable_pages = Paginator.new self, @deliverable_count, limit, params['page']
|
||||
@deliverables = Deliverable.find(:all,
|
||||
:order => sort_clause,
|
||||
:conditions => { :project_id => @project.id },
|
||||
:limit => limit,
|
||||
:offset => @deliverable_pages.current.offset)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'index', :layout => !request.xhr? }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
class Deliverable < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
|
||||
# TODO: mocked
|
||||
def score
|
||||
0
|
||||
end
|
||||
|
||||
# TODO: mocked
|
||||
def spent
|
||||
0
|
||||
end
|
||||
|
||||
# TODO: mocked
|
||||
def progress
|
||||
0
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
<% form_tag({}) do -%>
|
||||
<table class="list deliverables">
|
||||
<thead><tr>
|
||||
<%# TODO: Other sorts %>
|
||||
<%= sort_header_tag("#{Deliverable.table_name}.id", :caption => '#', :default_order => 'desc') %>
|
||||
<%= content_tag('th', "Score") %>
|
||||
<%= sort_header_tag("#{Deliverable.table_name}.subject", :caption => 'Subject') %>
|
||||
<%= sort_header_tag("#{Deliverable.table_name}.cost", :caption => 'Budget') %>
|
||||
<%= content_tag('th', "Spent") %>
|
||||
<%= sort_header_tag("#{Deliverable.table_name}.due_date", :caption => 'Due') %>
|
||||
<%= content_tag('th', "Progress") %>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% deliverables.each do |deliverable| -%>
|
||||
<tr id="deliverable-<%= deliverable.id %>" class="deliverable <%= cycle('odd', 'even') %>">
|
||||
<%= content_tag(:td, deliverable.id) %>
|
||||
<%= content_tag(:td, deliverable.score) %>
|
||||
<%= content_tag(:td, deliverable.subject) %>
|
||||
<%= content_tag(:td, number_to_currency(deliverable.cost)) %>
|
||||
<%= content_tag(:td, number_to_currency(deliverable.spent)) %>
|
||||
<%= content_tag(:td, format_date(deliverable.due_date)) %>
|
||||
<%= content_tag(:td, progress_bar(deliverable.progress, :width => '80px')) %>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end -%>
|
||||
@@ -35,8 +35,13 @@
|
||||
</div>
|
||||
|
||||
<div id="budget-list">
|
||||
|
||||
<% if @deliverables.empty? %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% else %>
|
||||
<%= render :partial => 'list', :locals => { :deliverables => @deliverables} %>
|
||||
<p class="pagination"><%# TODO: pagination_links_full @issue_pages, @issue_count %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'deliverables/sidebar' %>
|
||||
|
||||
Reference in new issue
Block a user