[#1999] Added a link to expand/collapse all Deliverable rows to the sidebar

This commit is contained in:
Eric Davis
2009-04-27 14:13:51 -07:00
parent 2018561e6a
commit 931c1ef6ed
5 changed files with 29 additions and 3 deletions

View File

@@ -73,8 +73,8 @@ module DeliverablesHelper
end
def toggle_arrows(deliverable_id)
open_js = "$('deliverable-details-#{deliverable_id}').show(); $$('.toggle_#{deliverable_id}').each(function(e) {e.toggle();})"
close_js = "$('deliverable-details-#{deliverable_id}').hide(); $$('.toggle_#{deliverable_id}').each(function(e) {e.toggle();})"
open_js = "expandRow(#{deliverable_id})"
close_js = "collapseRow(#{deliverable_id})"
return toggle_arrow(deliverable_id, "toggle-arrow-closed.gif", open_js, false) +
toggle_arrow(deliverable_id, "toggle-arrow-open.gif", close_js, true)
@@ -86,7 +86,7 @@ module DeliverablesHelper
content_tag(:span,
link_to_function(image_tag(image, :plugin => "budget_plugin"), js),
:class => "toggle_" + deliverable_id.to_s,
:class => "toggle toggle_" + deliverable_id.to_s,
:style => style
)

View File

@@ -1,3 +1,4 @@
<h3><%= l(:budget_title) %></h3>
<%= link_to l(:label_issue_view_all), { :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 } %><br />
<%= link_to_function l(:label_new_deliverable), "$('new-deliverable').toggle();" if allowed_management? %><br />
<%= link_to_function l(:label_toggle_all), "toggleAll();" if allowed_management? %><br />

View File

@@ -108,3 +108,26 @@ Object.extend(BudgetModule.prototype, {
});
Budget = new BudgetModule();
function toggleAll() {
$$('.deliverable-details').each(function(ele) {
ele.toggle();
});
$$('.toggle').each(function(e) {
e.toggle();
});
}
function expandRow(deliverable_id) {
$('deliverable-details-'+ deliverable_id).show();
$$('.toggle_' + deliverable_id).each(function(e) {
e.toggle();
});
}
function collapseRow(deliverable_id) {
$('deliverable-details-'+ deliverable_id).hide();
$$('.toggle_' + deliverable_id).each(function(e) {
e.toggle();
});
}

View File

@@ -45,3 +45,4 @@ en:
label_fixed_amount: "Fixed Amount: "
label_hours_estimated: "Hours Estimated: "
label_hours_used: "Hours Used: "
label_toggle_all: "Expand all deliverable rows"

View File

@@ -44,3 +44,4 @@ label_labor: "Labor: "
label_fixed_amount: "Fixed Amount: "
label_hours_estimated: "Hours Estimated: "
label_hours_used: "Hours Used: "
label_toggle_all: "Expand all deliverable rows"