]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4290 suppress old console of action plans
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 22 May 2013 13:26:39 +0000 (15:26 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 22 May 2013 13:26:51 +0000 (15:26 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_action_plans_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/_new.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/_progress.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/_new.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/_progress.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_menu_resource_settings.html.erb

index 6aee839865e29401b8479fd3275b96217fdae482..45e519f5f6b2967b991ea40e66218daec5d6f09e 100644 (file)
@@ -342,7 +342,6 @@ duplications.page=Duplications
 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
@@ -629,9 +628,8 @@ action_plans.no_action_plan=No action plan
 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
@@ -639,49 +637,14 @@ action_plans.date_cant_be_in_past=The dead-line can't be in the past
 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
 
 
 #------------------------------------------------------------------------------
index 557c4eabdb083341d405ecfdf337a5e1c587184c..7b93155ccaa77d93d1e26c0c5ed394ec0f532093 100644 (file)
@@ -22,68 +22,51 @@ class ActionPlansController < 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 = 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
@@ -95,10 +78,17 @@ class ActionPlansController < ApplicationController
     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
index 60ff6c00bf2f79776f785c7c05214f4c637a1b00..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,94 +0,0 @@
-#
-# 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
index 0f920221930b345b87480e88726d85dbd4ef7f62..8bd4a17584f70458013d00e364cbba58ee8fc7fe 100644 (file)
@@ -1,39 +1,40 @@
 <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
index 8948b7dbaee88c6d6725519dd569f3758d20957e..cd42fad87185f4ef557e55edc7cd85b94e6c94e7 100644 (file)
@@ -1,42 +1,42 @@
 <%
-  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
index 59c3607b87fe52ccf5845294ed0a222b92ac13a5..a3d08301a5bdba1f40259bd15f862b0acc84cd44 100644 (file)
@@ -1,7 +1,7 @@
 <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' -%>
               &nbsp;
-              <% 
-                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) -%>
               &nbsp;
-              <%= 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'} -%>
-              &nbsp;
-              <%= 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'} -%>
+                &nbsp;
+                <%= 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>
index 6c3f8d407e540a2ec8ddd7f2aab4a33cf0f61327..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,40 +0,0 @@
-<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
index 0d666b0c3afd5ff83082506a9026e5595342ddf1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,42 +0,0 @@
-<%
-  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
index 573de3ec5a0401a5b025a9604bfdb5412f5bf594..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,117 +0,0 @@
-<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' -%>
-              &nbsp;
-              <%
-                 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) -%>
-              &nbsp;
-              <%= 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'} -%>
-                &nbsp;
-                <%= 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>
index b091d44e599cd3c12e710d724b0d069b6cc9c1fb..411ceca89d01de2b8106bc9ebc7673e25e13c668 100644 (file)
       <% 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 %>