email_configuration.page=Email Settings
event_categories.page=Event Categories
filters.page=Filters
-issues_action_plans.page=Issues Action Plans
manual_metrics.page=Manual Metrics
manual_measures.page=Manual Measures
manual_rules.page=Manual Rules
action_plans.no_reviews_linked_to_action_plan=No reviews linked to this action plan yet.
action_plans.confirm_delete=Delete this action plan? Associated reviews will not be deleted.
action_plans.confirm_close=Close this action plan? There are still open reviews linked to it.
-action_plans.create_new_action_plan=Create a new action plan
-action_plans.create_action_plan=Create action plan
-action_plans.edit_action_plan=Edit action plan
+action_plans.create_form_title=Create Action Plan
+action_plans.edit_action_plan=Edit Action Plan
action_plans.same_name_in_same_project=An action plan with this name already exists in this project.
action_plans.date_format_help=The date should be entered using the following pattern: 'day/month/year'. For instance, '31/12/2011'.
action_plans.date_not_valid=Date not valid
action_plans.x_out_of_x_reviews_solved={0} of {1} reviews solved
action_plans.resolved_reviews_x_percent=Resolved reviews - {0}% ({1} reviews)
action_plans.open_reviews_x_percent=Open reviews - {0}% ({1} reviews)
-action_plans.reopen=Reopen
-action_plans.close=Close
action_plans.closed_action_plan=Closed Action Plans
-
-
-#------------------------------------------------------------------------------
-#
-# ISSUES ACTION PLANS
-#
-#------------------------------------------------------------------------------
-
-issues_action_plans.page_title=Manage Action Plans
-issues_action_plans.add_action_plan=Add action plan
-issues_action_plans.col.status=St.
-issues_action_plans.col.name=Name
-issues_action_plans.col.due_for=Due for
-issues_action_plans.col.progress=Progress
-issues_action_plans.col.description=Description
-issues_action_plans.col.author=Author
-issues_action_plans.col.closed_on=Closed on
-issues_action_plans.col.operations=Operations
-issues_action_plans.no_action_plan=No action plan
-issues_action_plans.no_issues_linked_to_action_plan=No issues linked to this action plan yet.
-issues_action_plans.confirm_delete=Delete this action plan? Associated issues will not be deleted.
-issues_action_plans.confirm_close=Close this action plan? There are still open issues linked to it.
-issues_action_plans.create_new_action_plan=Create a new action plan
-issues_action_plans.create_action_plan=Create action plan
-issues_action_plans.edit_action_plan=Edit action plan
-issues_action_plans.same_name_in_same_project=An action plan with this name already exists in this project.
-issues_action_plans.date_format_help=The date should be entered using the following pattern: 'day/month/year'. For instance, '31/12/2011'.
-issues_action_plans.date_not_valid=Date not valid
-issues_action_plans.date_cant_be_in_past=The dead-line can't be in the past
-issues_action_plans.x_out_of_x_issues_solved={0} of {1} issues solved
-issues_action_plans.resolved_issues_x_percent=Resolved issues - {0}% ({1} issues)
-issues_action_plans.unresolved_issues_x_percent=Unresolved issues - {0}% ({1} issues)
-issues_action_plans.reopen=Reopen
-issues_action_plans.close=Close
-issues_action_plans.closed_action_plan=Closed action plans
-issues_action_plans.status.OPEN=Open
-issues_action_plans.status.CLOSED=Closed
-issues_action_plans.errors.date.cant_be_in_past=The dead-line can't be in the past
-issues_action_plans.errors.action_plan_does_not_exists=Action plan with key {0} does not exists
-issues_action_plans.errors.project_does_not_exists=Project with key {0} does not exists
+action_plans.no_issues_linked_to_action_plan=No issues linked to this action plan yet.
+action_plans.status.OPEN=Open
+action_plans.status.CLOSED=Closed
+action_plans.resolved_issues_x_percent=Resolved issues - {0}% ({1} issues)
+action_plans.unresolved_issues_x_percent=Unresolved issues - {0}% ({1} issues)
+action_plans.x_out_of_x_issues_solved={0} of {1} issues solved
+action_plans.reopen=Reopen
#------------------------------------------------------------------------------
SECTION=Navigation::SECTION_RESOURCE
before_filter :load_resource
+ verify :method => :post, :only => [:save, :delete, :change_status], :redirect_to => {:action => :index}
def index
load_action_plans()
end
def edit
- @action_plan = ActionPlan.find params[:plan_id]
+ @action_plan = find_by_key(params[:plan_key])
load_action_plans()
render 'index'
end
def save
- verify_post_request
- @action_plan = ActionPlan.find params[:plan_id] if params[:plan_id].present?
- unless @action_plan
- @action_plan = ActionPlan.new(
- :kee => Java::JavaUtil::UUID.randomUUID().toString(),
- :user_login => current_user.login,
- :project_id => @resource.id,
- :status => ActionPlan::STATUS_OPEN)
- end
-
- @action_plan.name = params[:name]
- @action_plan.description = params[:description]
- unless params[:deadline].blank?
- begin
- deadline = DateTime.strptime(params[:deadline], '%d/%m/%Y')
- # we check if the date is today or in the future
- if deadline > 1.day.ago
- @action_plan.deadline = deadline
- else
- date_not_valid = message('action_plans.date_cant_be_in_past')
- end
- rescue
- date_not_valid = message('action_plans.date_not_valid')
- end
+ options = {'project' => @resource.key, 'name' => params[:name], 'description' => params[:description], 'deadLine' => params[:deadline]}
+
+ exiting_action_plan = find_by_key(params[:plan_key]) unless params[:plan_key].blank?
+ if exiting_action_plan
+ action_plan_result = Internal.issues.updateActionPlan(params[:plan_key], options)
+ else
+ action_plan_result = Internal.issues.createActionPlan(options)
end
- if date_not_valid || !@action_plan.valid?
- @action_plan.errors.add :base, date_not_valid if date_not_valid
- flash[:error] = @action_plan.errors.full_messages.join('<br/>')
+ if action_plan_result.ok()
+ @action_plan = action_plan_result.get()
+ redirect_to :action => 'index', :id => @resource.id
+ else
+ flash[:error] = action_plan_result.errors().map{|error| error.text ? error.text : Api::Utils.message(error.l10nKey, :params => error.l10nParams)}.join('<br/>')
load_action_plans()
render 'index'
- else
- @action_plan.save
- redirect_to :action => 'index', :id => @resource.id
end
end
def delete
- verify_post_request
- action_plan = ActionPlan.find params[:plan_id]
- action_plan.destroy
+ Internal.issues.deleteActionPlan(params[:plan_key])
redirect_to :action => 'index', :id => @resource.id
end
def change_status
- verify_post_request
- action_plan = ActionPlan.find params[:plan_id]
+ action_plan = find_by_key(params[:plan_key])
if action_plan
- action_plan.status = action_plan.open? ? ActionPlan::STATUS_CLOSED : ActionPlan::STATUS_OPEN
- action_plan.save
+ if action_plan.status == 'OPEN'
+ Internal.issues.closeActionPlan(params[:plan_key])
+ else
+ Internal.issues.openActionPlan(params[:plan_key])
+ end
end
redirect_to :action => 'index', :id => @resource.id
end
return redirect_to home_path unless @resource
access_denied unless has_role?(:admin, @resource)
end
-
+
def load_action_plans
- @open_action_plans = ActionPlan.find(:all, :conditions => ['status=? AND project_id=?', ActionPlan::STATUS_OPEN, @resource.id], :include => 'reviews', :order => 'deadline ASC')
- @closed_action_plans = ActionPlan.find(:all, :conditions => ['status=? AND project_id=?', ActionPlan::STATUS_CLOSED, @resource.id], :include => 'reviews', :order => 'deadline DESC')
+ action_plans = Internal.issues.findActionPlanStats(@resource.key)
+ @open_action_plans = action_plans.select {|plan| plan.isOpen()}
+ @closed_action_plans = action_plans.reject {|plan| plan.isOpen()}
+ users = Api.users.find('logins' => (@open_action_plans + @closed_action_plans).collect {|action_plan| action_plan.userLogin()}.join(","))
+ @users = Hash[users.collect { |user| [user.login(), user.name()] }]
+ end
+
+ def find_by_key(key)
+ Internal.issues.findActionPlan(key)
end
end
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2013 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-class IssuesActionPlansController < ApplicationController
-
- SECTION=Navigation::SECTION_RESOURCE
- before_filter :load_resource
- verify :method => :post, :only => [:save, :delete, :change_status], :redirect_to => {:action => :index}
-
- def index
- load_action_plans()
- end
-
- def edit
- @action_plan = find_by_key(params[:plan_key])
- load_action_plans()
- render 'index'
- end
-
- def save
- options = {'project' => @resource.key, 'name' => params[:name], 'description' => params[:description], 'deadLine' => params[:deadline]}
-
- exiting_action_plan = find_by_key(params[:plan_key]) unless params[:plan_key].blank?
- if exiting_action_plan
- action_plan_result = Internal.issues.updateActionPlan(params[:plan_key], options)
- else
- action_plan_result = Internal.issues.createActionPlan(options)
- end
-
- if action_plan_result.ok()
- @action_plan = action_plan_result.get()
- redirect_to :action => 'index', :id => @resource.id
- else
- flash[:error] = action_plan_result.errors().map{|error| error.text ? error.text : Api::Utils.message(error.l10nKey, :params => error.l10nParams)}.join('<br/>')
- load_action_plans()
- render 'index'
- end
- end
-
- def delete
- Internal.issues.deleteActionPlan(params[:plan_key])
- redirect_to :action => 'index', :id => @resource.id
- end
-
- def change_status
- action_plan = find_by_key(params[:plan_key])
- if action_plan
- if action_plan.status == 'OPEN'
- Internal.issues.closeActionPlan(params[:plan_key])
- else
- Internal.issues.openActionPlan(params[:plan_key])
- end
- end
- redirect_to :action => 'index', :id => @resource.id
- end
-
- private
-
- def load_resource
- @resource=Project.by_key(params[:id])
- return redirect_to home_path unless @resource
- access_denied unless has_role?(:admin, @resource)
- end
-
- def load_action_plans
- action_plans = Internal.issues.findActionPlanStats(@resource.key)
- @open_action_plans = action_plans.select {|plan| plan.isOpen()}
- @closed_action_plans = action_plans.reject {|plan| plan.isOpen()}
- users = Api.users.find('logins' => (@open_action_plans + @closed_action_plans).collect {|action_plan| action_plan.userLogin()}.join(","))
- @users = Hash[users.collect { |user| [user.login(), user.name()] }]
- end
-
- def find_by_key(key)
- Internal.issues.findActionPlan(key)
- end
-
-end
<table class="admintable" width="100%">
<form action="<%= url_for :action => 'save' -%>" method="POST" id="create-action-plan-form">
<input type="hidden" name="id" value="<%= @resource.id -%>"/>
- <input type="hidden" name="plan_id" value="<%= @action_plan.id if @action_plan -%>"/>
+ <input type="hidden" name="plan_key" value="<%= @action_plan.key() if @action_plan -%>"/>
<tbody>
- <tr>
- <td colspan="2"><h1 class="marginbottom10"><%= @action_plan && @action_plan.id ? message('action_plans.edit_action_plan') : message('action_plans.create_new_action_plan') -%></h1></h1></td>
- </tr>
- <tr>
- <td class="left" valign="top">
+ <tr>
+ <td colspan="2"><h1 class="marginbottom10"><%= @action_plan && @action_plan.key() ? message('action_plans.edit_action_plan') : message('action_plans.create_form_title') -%></h1></td>
+ </tr>
+ <tr>
+ <td class="left" valign="top">
<%= message('action_plans.col.name') -%>:
<br/>
- <input type="text" name="name" id="name" value="<%= @action_plan ? @action_plan.name : params[:name] -%>"/>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
+ <input type="text" name="name" id="name" value="<%= @action_plan ? @action_plan.name() : params[:name] -%>"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="left" valign="top">
<%= message('action_plans.col.due_for') -%>:
<br/>
- <input type="text" name="deadline" id="deadline" value="<%= @action_plan && @action_plan.deadline ? @action_plan.deadline.strftime('%d/%m/%Y') : params[:deadline] -%>"/>
+ <% deadline = Api::Utils.java_to_ruby_datetime(@action_plan.deadLine()) if @action_plan && @action_plan.deadLine() %>
+ <input type="text" name="deadline" id="deadline" value="<%= @action_plan && deadline ? deadline.strftime('%d/%m/%Y') : params[:deadline] -%>"/>
<br/>
<span class="note"><%= message('action_plans.date_format_help') -%></span>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
+ </td>
+ </tr>
+ <tr>
+ <td class="left" valign="top">
<%= message('action_plans.col.description') -%>:
<br/>
- <textarea rows="5" cols="80" name="description" id="description" class="width100"><%= @action_plan ? @action_plan.description : params['description'] -%></textarea>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
- <input type="submit" value="<%= @action_plan && @action_plan.id ? message('action_plans.edit_action_plan') : message('action_plans.create_action_plan') -%>"/>
- </td>
- </tr>
+ <textarea rows="5" cols="80" name="description" id="description" class="width100"><%= @action_plan ? @action_plan.description() : params['description'] -%></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td class="left" valign="top">
+ <input type="submit" value="<%= @action_plan && @action_plan.key() ? message('edit') : message('create') -%>"/>
+ </td>
+ </tr>
</tbody>
</form>
</table>
\ No newline at end of file
<%
- unless action_plan.progress[:total]==0
- options = {:controller => 'project_reviews', :action => 'index', :action_plan_id => action_plan.id, :id => action_plan.project_id}
-
- resolved_reviews_link = action_plan.progress[:resolved].to_s
- resolved_reviews_link = link_to action_plan.progress[:resolved].to_s, options.merge({:statuses => "#{Review::STATUS_RESOLVED},#{Review::STATUS_CLOSED}"}) unless action_plan.progress[:resolved]==0
- total_reviews_link = link_to action_plan.progress[:total].to_s, options
+ unless action_plan.totalIssues()==0
+ options = {:controller => 'issues', :action => 'search', :actionPlans => action_plan.key}
- if action_plan.progress[:resolved] > 0
- resolved_reviews_url = url_for options.merge({:statuses => "#{Review::STATUS_RESOLVED},#{Review::STATUS_CLOSED}"})
- percent_resolved = (action_plan.progress[:resolved]*100/action_plan.progress[:total]).to_i
- tooltip_resolved = message('action_plans.resolved_reviews_x_percent', :params => [percent_resolved.to_s, action_plan.progress[:resolved].to_s])
- end
-
- if action_plan.progress[:open] > 0
- open_reviews_url = url_for options.merge({:statuses => "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}"})
- percent_open = (action_plan.progress[:open]*100/action_plan.progress[:total]).to_i
- tooltip_open = message('action_plans.open_reviews_x_percent', :params => [percent_open.to_s, action_plan.progress[:open].to_s])
- end
+ resolved_issues_link = action_plan.resolvedIssues().to_s
+ resolved_issues_link = link_to action_plan.resolvedIssues().to_s, options.merge({:resolved => 'true'}) unless action_plan.resolvedIssues()==0
+ total_issues_link = link_to action_plan.totalIssues().to_s, options
+
+ if action_plan.resolvedIssues() > 0
+ resolved_issues_url = url_for options.merge({:resolved => 'true'})
+ percent_resolved = (action_plan.resolvedIssues()*100 / action_plan.totalIssues()).to_i
+ tooltip_resolved = message('action_plans.resolved_issues_x_percent', :params => [percent_resolved.to_s, action_plan.resolvedIssues().to_s])
+ end
+
+ if action_plan.unresolvedIssues() > 0
+ unresolved_issues_url = url_for options.merge({:resolved => 'false'})
+ percent_open = (action_plan.unresolvedIssues()*100 / action_plan.totalIssues()).to_i
+ tooltip_open = message('action_plans.unresolved_issues_x_percent', :params => [percent_open.to_s, action_plan.unresolvedIssues().to_s])
+ end
%>
-<div class="progress">
- <table>
- <tbody>
+ <div class="progress">
+ <table>
+ <tbody>
<tr>
- <% if action_plan.progress[:resolved] > 0 %>
- <td class="resolved" style="width:<%= percent_resolved -%>%;">
- <a href="<%= resolved_reviews_url -%>" title="<%= tooltip_resolved -%>" alt="<%= tooltip_resolved -%>"></a>
- </td>
+ <% if action_plan.resolvedIssues() > 0 %>
+ <td class="resolved" style="width:<%= percent_resolved -%>%;">
+ <a href="<%= resolved_issues_url -%>" title="<%= resolved_issues_url -%>" alt="<%= tooltip_resolved -%>"></a>
+ </td>
<% end %>
- <% if action_plan.progress[:open] > 0 %>
- <td class="open" style="width:<%= percent_open -%>%;">
- <a href="<%= open_reviews_url -%>" title="<%= tooltip_open -%>" alt="<%= tooltip_open -%>"></a>
- </td>
+ <% if action_plan.unresolvedIssues() > 0 %>
+ <td class="open" style="width:<%= percent_open -%>%;">
+ <a href="<%= unresolved_issues_url -%>" title="<%= unresolved_issues_url -%>" alt="<%= tooltip_open -%>"></a>
+ </td>
<% end %>
</tr>
- </tbody>
- </table>
- <div class="note"><%= message('action_plans.x_out_of_x_reviews_solved', :params => [resolved_reviews_link, total_reviews_link]) -%></div>
-</div>
+ </tbody>
+ </table>
+ <div class="note"><%= message('action_plans.x_out_of_x_issues_solved', :params => [resolved_issues_link, total_issues_link]) -%></div>
+ </div>
<% end %>
\ No newline at end of file
<table width="100%">
<tr>
<td valign="top">
-
+
<h1><%= message('action_plans.page_title') -%></h1>
<table class="width100 data sortable actionPlans" id="openActionPlans">
<th class="thin nowrap"><%= message('action_plans.col.status') -%></th>
<th class="thin nowrap"><%= message('action_plans.col.name') -%></th>
<th class="thin nowrap righticon sortfirstasc" style="text-align: right"><%= message('action_plans.col.due_for') -%></th>
- <th class="nowrap nosort center"><%= message('action_plans.col.progress') -%></th>
+ <th class="nowrap center"><%= message('action_plans.col.progress') -%></th>
<th class="nowrap"><%= message('action_plans.col.description') -%></th>
<th class="nowrap"><%= message('action_plans.col.author') -%></th>
- <th class="thin nowrap nosort"><%= message('action_plans.col.operations') -%></th>
+ <th class="thin nowrap right"><%= message('action_plans.col.operations') -%></th>
</tr>
</thead>
<tbody>
<%
@open_action_plans.each do |plan|
%>
- <tr>
- <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status -%>.png" title="<%= message(plan.status.downcase).capitalize -%>"/></td>
- <td class="thin nowrap"><%= h(plan.name) -%></td>
- <td class="thin nowrap <%= 'over-due' if plan.over_due? -%>" align="right" x="<%= plan.deadline ? plan.deadline.tv_sec : '' -%>"><%= plan.deadline ? plan.deadline.strftime("%d %b %Y") : ' ' -%></td>
- <% if plan.progress[:total]==0 %>
- <td class="noprogress thin nowrap">
- <%= message('action_plans.no_reviews_linked_to_action_plan') -%>
- </td>
+ <tr class="<%= cycle('even', 'odd', :name => 'open_plans') -%>">
+ <td class="thin nowrap center">
+ <img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status() -%>.png" title="<%= message("action_plans.status.#{plan.status}") -%>"/></td>
+ <td class="thin nowrap"><%= h(plan.name()) -%></td>
+ <td class="thin nowrap <%= 'over-due' if plan.overDue() -%>" align="right"><%= format_date(plan.deadLine(), :time_if_today => true) -%></td>
+ <% if plan.totalIssues()==0 %>
+ <td class="noprogress thin nowrap">
+ <%= message('action_plans.no_issues_linked_to_action_plan') -%>
+ </td>
<% else %>
- <td class="progress thin">
- <%= render :partial => 'progress', :locals => {:action_plan => plan} -%>
- </td>
+ <td class="progress thin">
+ <%= render :partial => 'progress', :locals => {:action_plan => plan} -%>
+ </td>
<% end %>
- <td id="desc"><%= h(plan.description) -%></td>
- <td id="desc"><%= h(plan.user.name) -%></td>
+ <td id="desc"><%= h(plan.description()) -%></td>
+ <td id="desc"><%= h(@users[plan.userLogin()]) -%></td>
<td class="thin nowrap right">
- <%= link_to message('edit'), {:action => 'edit', :id => @resource.id, :plan_id => plan.id}, :class => 'link-action' -%>
+ <%= link_to message('edit'), {:action => 'edit', :id => @resource.id, :plan_key => plan.key()}, :class => 'link-action' -%>
- <%
- close_confirmation_message = {}
- if plan.open? && plan.has_open_reviews?
- close_confirmation_message = {:confirm => message('action_plans.confirm_close')}
- end
+ <%
+ close_confirmation_message = {}
+ if plan.isOpen() && plan.unresolvedIssues() > 0
+ close_confirmation_message = {:confirm => message('action_plans.confirm_close')}
+ end
%>
- <%= link_to message('action_plans.close'),
- {:action => 'change_status', :id => @resource.id, :plan_id => plan.id}, {:method => 'POST', :class => 'link-action'}.merge(close_confirmation_message) -%>
+ <%= link_to message('close'),
+ {:action => 'change_status', :id => @resource.id, :plan_key => plan.key()}, {:method => 'POST', :class => 'link-action'}.merge(close_confirmation_message) -%>
- <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_id => plan.id}, {:method => 'POST', :confirm => message('action_plans.confirm_delete'), :class => 'link-action link-red'} -%>
+ <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_key => plan.key()}, {:method => 'POST', :confirm => message('action_plans.confirm_delete'), :class => 'link-action link-red'} -%>
</td>
</tr>
<% end %>
</tbody>
</table>
- <script>TableKit.Sortable.init('openActionPlans');</script>
-
-
+
<% unless @closed_action_plans.empty? %>
- <br/><br/>
- <h1><%= message('action_plans.closed_action_plan') -%></h1>
-
- <table class="width100 data sortable actionPlans" id="closedActionPlans">
- <thead>
- <tr>
- <th class="thin nowrap"><%= message('action_plans.col.status') -%></th>
- <th class="thin nowrap"><%= message('action_plans.col.name') -%></th>
- <th class="thin nowrap righticon sortfirstdesc" style="text-align: right"><%= message('action_plans.col.due_for') -%></th>
- <th class="thin nowrap righticon" style="text-align: right"><%= message('action_plans.col.closed_on') -%></th>
- <th class="nowrap nosort center"><%= message('action_plans.col.progress') -%></th>
- <th class="nowrap"><%= message('action_plans.col.description') -%></th>
- <th class="nowrap"><%= message('action_plans.col.author') -%></th>
- <th class="thin nowrap nosort"><%= message('action_plans.col.operations') -%></th>
- </tr>
- </thead>
- <tbody>
- <%
- @closed_action_plans.each do |plan|
- %>
+ <br/><br/>
+
+ <h1><%= message('action_plans.closed_action_plan') -%></h1>
+
+ <table class="width100 data sortable actionPlans" id="closedActionPlans">
+ <thead>
<tr>
- <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status -%>.png" title="<%= message(plan.status.downcase).capitalize -%>"/></td>
- <td class="thin nowrap"><%= h(plan.name) -%></td>
- <td class="thin nowrap <%= 'over-due' if plan.over_due? -%>" align="right" x="<%= plan.deadline ? plan.deadline.tv_sec : '' -%>"><%= plan.deadline ? plan.deadline.strftime("%d %b %Y") : ' ' -%></td>
- <td class="thin nowrap" align="right" x="<%= plan.updated_at.tv_sec -%>"><%= plan.updated_at.strftime("%d %b %Y") -%></td>
- <% if plan.progress[:total]==0 %>
- <td class="noprogress thin nowrap">
- <%= message('action_plans.no_reviews_linked_to_action_plan') -%>
- </td>
- <% else %>
- <td class="progress thin">
- <%= render :partial => 'progress', :locals => {:action_plan => plan} -%>
- </td>
- <% end %>
- <td id="desc"><%= h(plan.description) -%></td>
- <td id="desc"><%= h(plan.user.name) -%></td>
- <td class="thin nowrap right">
- <%= link_to message('action_plans.reopen'),
- {:action => 'change_status', :id => @resource.id, :plan_id => plan.id}, {:method => 'POST', :class => 'action'} -%>
-
- <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_id => plan.id}, {:method => 'POST', :confirm => message('action_plans.confirm_delete'), :class => 'action'} -%>
- </td>
+ <th class="thin nowrap"><%= message('action_plans.col.status') -%></th>
+ <th class="thin nowrap"><%= message('action_plans.col.name') -%></th>
+ <th class="thin nowrap righticon sortfirstdesc" style="text-align: right"><%= message('action_plans.col.due_for') -%></th>
+ <th class="thin nowrap righticon" style="text-align: right"><%= message('action_plans.col.closed_on') -%></th>
+ <th class="nowrap center"><%= message('action_plans.col.progress') -%></th>
+ <th class="nowrap"><%= message('action_plans.col.description') -%></th>
+ <th class="nowrap"><%= message('action_plans.col.author') -%></th>
+ <th class="thin nowrap right"><%= message('action_plans.col.operations') -%></th>
</tr>
- <% end %>
- </tbody>
- </table>
- <script>TableKit.Sortable.init('closedActionPlans');</script>
+ </thead>
+ <tbody>
+ <%
+ @closed_action_plans.each do |plan|
+ %>
+ <tr class="<%= cycle('even', 'odd', :name => 'closed_plans') -%>">
+ <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status() -%>.png" title="<%= message("action_plans.status.#{plan.status}") -%>"/>
+ </td>
+ <td class="thin nowrap"><%= h(plan.name) -%></td>
+ <td class="thin nowrap <%= 'over-due' if plan.overDue() -%>" align="right"><%= format_date(plan.deadLine()) -%></td>
+ <td class="thin nowrap" align="right"><%= format_date(plan.updatedAt()) -%></td>
+ <% if plan.totalIssues()==0 %>
+ <td class="noprogress thin nowrap">
+ <%= message('action_plans.no_issues_linked_to_action_plan') -%>
+ </td>
+ <% else %>
+ <td class="progress thin">
+ <%= render :partial => 'progress', :locals => {:action_plan => plan} -%>
+ </td>
+ <% end %>
+ <td id="desc"><%= h(plan.description()) -%></td>
+ <td id="desc"><%= h(@users[plan.userLogin()]) -%></td>
+ <td class="thin nowrap right">
+ <%= link_to message('action_plans.reopen'),
+ {:action => 'change_status', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :class => 'link-action'} -%>
+
+ <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :confirm => message('action_plans.confirm_delete'), :class => 'link-action link-red'} -%>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
<% end %>
-
</td>
<td class="sep"></td>
-<table class="admintable" width="100%">
- <form action="<%= url_for :action => 'save' -%>" method="POST" id="create-action-plan-form">
- <input type="hidden" name="id" value="<%= @resource.id -%>"/>
- <input type="hidden" name="plan_key" value="<%= @action_plan.key() if @action_plan -%>"/>
- <tbody>
- <tr>
- <td colspan="2"><h1 class="marginbottom10"><%= @action_plan && @action_plan.key() ? message('action_plans.edit_action_plan') : message('action_plans.create_new_action_plan') -%></h1></td>
- </tr>
- <tr>
- <td class="left" valign="top">
- <%= message('action_plans.col.name') -%>:
- <br/>
- <input type="text" name="name" id="name" value="<%= @action_plan ? @action_plan.name() : params[:name] -%>"/>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
- <%= message('action_plans.col.due_for') -%>:
- <br/>
- <% deadline = Api::Utils.java_to_ruby_datetime(@action_plan.deadLine()) if @action_plan && @action_plan.deadLine() %>
- <input type="text" name="deadline" id="deadline" value="<%= @action_plan && deadline ? deadline.strftime('%d/%m/%Y') : params[:deadline] -%>"/>
- <br/>
- <span class="note"><%= message('action_plans.date_format_help') -%></span>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
- <%= message('action_plans.col.description') -%>:
- <br/>
- <textarea rows="5" cols="80" name="description" id="description" class="width100"><%= @action_plan ? @action_plan.description() : params['description'] -%></textarea>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
- <input type="submit" value="<%= @action_plan && @action_plan.key() ? message('action_plans.edit_action_plan') : message('action_plans.create_action_plan') -%>"/>
- </td>
- </tr>
- </tbody>
- </form>
-</table>
\ No newline at end of file
-<%
- unless action_plan.totalIssues()==0
- options = {:controller => 'issues', :action => 'search', :actionPlans => action_plan.key}
-
- resolved_issues_link = action_plan.resolvedIssues().to_s
- resolved_issues_link = link_to action_plan.resolvedIssues().to_s, options.merge({:resolved => 'true'}) unless action_plan.resolvedIssues()==0
- total_issues_link = link_to action_plan.totalIssues().to_s, options
-
- if action_plan.resolvedIssues() > 0
- resolved_issues_url = url_for options.merge({:resolved => 'true'})
- percent_resolved = (action_plan.resolvedIssues()*100 / action_plan.totalIssues()).to_i
- tooltip_resolved = message('issues_action_plans.resolved_issues_x_percent', :params => [percent_resolved.to_s, action_plan.resolvedIssues().to_s])
- end
-
- if action_plan.unresolvedIssues() > 0
- unresolved_issues_url = url_for options.merge({:resolved => 'false'})
- percent_open = (action_plan.unresolvedIssues()*100 / action_plan.totalIssues()).to_i
- tooltip_open = message('issues_action_plans.unresolved_issues_x_percent', :params => [percent_open.to_s, action_plan.unresolvedIssues().to_s])
- end
-%>
-
-<div class="progress">
- <table>
- <tbody>
- <tr>
- <% if action_plan.resolvedIssues() > 0 %>
- <td class="resolved" style="width:<%= percent_resolved -%>%;">
- <a href="<%= resolved_issues_url -%>" title="<%= resolved_issues_url -%>" alt="<%= tooltip_resolved -%>"></a>
- </td>
- <% end %>
- <% if action_plan.unresolvedIssues() > 0 %>
- <td class="open" style="width:<%= percent_open -%>%;">
- <a href="<%= unresolved_issues_url -%>" title="<%= unresolved_issues_url -%>" alt="<%= tooltip_open -%>"></a>
- </td>
- <% end %>
- </tr>
- </tbody>
- </table>
- <div class="note"><%= message('issues_action_plans.x_out_of_x_issues_solved', :params => [resolved_issues_link, total_issues_link]) -%></div>
-</div>
-
-<% end %>
\ No newline at end of file
-<table width="100%">
- <tr>
- <td valign="top">
-
- <h1><%= message('issues_action_plans.page_title') -%></h1>
-
- <table class="width100 data sortable actionPlans" id="openActionPlans">
- <thead>
- <tr>
- <th class="thin nowrap"><%= message('issues_action_plans.col.status') -%></th>
- <th class="thin nowrap"><%= message('issues_action_plans.col.name') -%></th>
- <th class="thin nowrap righticon sortfirstasc" style="text-align: right"><%= message('issues_action_plans.col.due_for') -%></th>
- <th class="nowrap nosort center"><%= message('issues_action_plans.col.progress') -%></th>
- <th class="nowrap"><%= message('issues_action_plans.col.description') -%></th>
- <th class="nowrap"><%= message('issues_action_plans.col.author') -%></th>
- <th class="thin nowrap nosort"><%= message('issues_action_plans.col.operations') -%></th>
- </tr>
- </thead>
- <tbody>
- <% if @open_action_plans.empty? %>
- <td colspan="7" class="even"><%= message('issues_action_plans.no_action_plan') -%></td>
- <% end %>
- <%
- @open_action_plans.each do |plan|
- %>
- <tr class="<%= cycle('even', 'odd', :name => 'open_plans') -%>">
- <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status() -%>.png" title="<%= message('issues_action_plans.status' + plan.status()) -%>"/></td>
- <td class="thin nowrap"><%= h(plan.name()) -%></td>
- <td class="thin nowrap <%= 'over-due' if plan.overDue() -%>" align="right"><%= format_date(plan.deadLine(), :time_if_today => true) -%></td>
- <% if plan.totalIssues()==0 %>
- <td class="noprogress thin nowrap">
- <%= message('issues_action_plans.no_issues_linked_to_action_plan') -%>
- </td>
- <% else %>
- <td class="progress thin">
- <%= render :partial => 'progress', :locals => {:action_plan => plan} -%>
- </td>
- <% end %>
- <td id="desc"><%= h(plan.description()) -%></td>
- <td id="desc"><%= h(@users[plan.userLogin()]) -%></td>
- <td class="thin nowrap right">
- <%= link_to message('edit'), {:action => 'edit', :id => @resource.id, :plan_key => plan.key()}, :class => 'link-action' -%>
-
- <%
- close_confirmation_message = {}
- if plan.isOpen() && plan.unresolvedIssues() > 0
- close_confirmation_message = {:confirm => message('issues_action_plans.confirm_close')}
- end
- %>
- <%= link_to message('issues_action_plans.close'),
- {:action => 'change_status', :id => @resource.id, :plan_key => plan.key()}, {:method => 'POST', :class => 'link-action'}.merge(close_confirmation_message) -%>
-
- <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_key => plan.key()}, {:method => 'POST', :confirm => message('issues_action_plans.confirm_delete'), :class => 'link-action link-red'} -%>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
-
- <% unless @closed_action_plans.empty? %>
- <br/><br/>
- <h1><%= message('issues_action_plans.closed_action_plan') -%></h1>
-
- <table class="width100 data sortable actionPlans" id="closedActionPlans">
- <thead>
- <tr>
- <th class="thin nowrap"><%= message('issues_action_plans.col.status') -%></th>
- <th class="thin nowrap"><%= message('issues_action_plans.col.name') -%></th>
- <th class="thin nowrap righticon sortfirstdesc" style="text-align: right"><%= message('issues_action_plans.col.due_for') -%></th>
- <th class="thin nowrap righticon" style="text-align: right"><%= message('issues_action_plans.col.closed_on') -%></th>
- <th class="nowrap nosort center"><%= message('issues_action_plans.col.progress') -%></th>
- <th class="nowrap"><%= message('issues_action_plans.col.description') -%></th>
- <th class="nowrap"><%= message('issues_action_plans.col.author') -%></th>
- <th class="thin nowrap nosort"><%= message('issues_action_plans.col.operations') -%></th>
- </tr>
- </thead>
- <tbody>
- <%
- @closed_action_plans.each do |plan|
- %>
- <tr class="<%= cycle('even', 'odd', :name => 'closed_plans') -%>">
- <td class="thin nowrap center"><img src="<%= ApplicationController.root_context -%>/images/status/<%= plan.status() -%>.png" title="<%= message(plan.status()) -%>"/></td>
- <td class="thin nowrap"><%= h(plan.name) -%></td>
- <td class="thin nowrap <%= 'over-due' if plan.overDue() -%>" align="right"><%= format_date(plan.deadLine()) -%></td>
- <td class="thin nowrap" align="right"><%= format_date(plan.updatedAt()) -%></td>
- <% if plan.totalIssues()==0 %>
- <td class="noprogress thin nowrap">
- <%= message('issues_action_plans.no_issues_linked_to_action_plan') -%>
- </td>
- <% else %>
- <td class="progress thin">
- <%= render :partial => 'progress', :locals => {:action_plan => plan} -%>
- </td>
- <% end %>
- <td id="desc"><%= h(plan.description()) -%></td>
- <td id="desc"><%= h(@users[plan.userLogin()]) -%></td>
- <td class="thin nowrap right">
- <%= link_to message('issues_action_plans.reopen'),
- {:action => 'change_status', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :class => 'link-action'} -%>
-
- <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_key => plan.key}, {:method => 'POST', :confirm => message('issues_action_plans.confirm_delete'), :class => 'link-action link-red'} -%>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <% end %>
-
- </td>
- <td class="sep"></td>
- <td width="210" valign="top" align="right">
- <div id="admin_form">
- <%= render :partial => 'new' %>
- </div>
- </td>
- </tr>
-</table>
<% if (is_admin && @project.project?) %>
<li><a href="<%= ApplicationController.root_context -%>/action_plans/index/<%= @project.id -%>"><%= message('action_plans.page') -%></a></li>
<% end %>
- <% if (is_admin && @project.project?) %>
- <li><a href="<%= ApplicationController.root_context -%>/issues_action_plans/index/<%= @project.id -%>"><%= message('issues_action_plans.page') -%></a></li>
- <% end %>
-
<% if (is_admin && @project.project?) %>
<li><a href="<%= ApplicationController.root_context -%>/project/links/<%= @project.id -%>"><%= message('project_links.page') -%></a></li>
<% end %>