+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar 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.
-#
-# Sonar 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 Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-class EventCategoriesController < ApplicationController
-
- before_filter :admin_required
-
- verify :method => :post, :only => [ :save, :delete ], :redirect_to => { :action => :index }
-
- SECTION=Navigation::SECTION_CONFIGURATION
-
- def index
- @categories=EventCategory.categories(true).sort
- if params['name']
- @category=EventCategory.category(params['name'])
- else
- @category=EventCategory.new()
- end
- end
-
- def save
- category=EventCategory.new(params['name'], params['description'])
-
- if params[:previous_name]!=category.name
- errors=category.rename(params[:previous_name])
- else
- errors=category.save
- end
-
- if errors.empty?
- flash[:notice]='Category saved.'
- else
- flash[:error]=errors.join('<br/>')
- end
- redirect_to :action => 'index'
- end
-
- def delete
- if params['name']
- category=EventCategory.category(params['name'])
- if category
- category.delete
- flash[:notice]='Category deleted.'
- end
- end
- redirect_to :action => 'index'
- end
-
-end
+++ /dev/null
-<table width="100%">
- <tr>
- <td valign="top">
- <table class="sortable data width100" id="event_categories">
- <thead>
- <tr>
- <th class="left sortfirstasc">Name</th>
- <th class="left">Description</th>
- <th class="left nosort" colspan="2">Operations</th>
- </tr>
- </thead>
- <tbody>
- <% @categories.each do |category| %>
- <tr>
- <td class="left" nowrap><%= category.name %></td>
- <td class="left"><%= category.description %></td>
- <td class="left" width="1%" nowrap>
- <% if category.editable? %>
- <form method="get" action="<%= ApplicationController.root_context -%>/event_categories/index" class="button-to"><div><input type="hidden" name="name" value="<%= category.name -%>" /><input class="action" id="edit_<%=category.name-%>" value="Edit" type="submit"></div></form>
- <% end %>
- </td>
- <td class="left">
- <% if category.editable? %>
- <form method="post" action="<%= ApplicationController.root_context -%>/event_categories/delete" class="button-to"><div><input type="hidden" name="name" value="<%= category.name -%>"/> <input class="action red-button" id="delete_<%= category.name -%>" onclick="return confirm('Info : events with this category will not be deleted.');" value="Delete" type="submit"></div></form>
- <% end %>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <script>TableKit.Sortable.init('event_categories');</script>
- </td>
- <td class="sep"> </td>
- <td valign="top" align="right" width="210">
- <table class="admintable" width="100%">
- <form action="<%= ApplicationController.root_context -%>/event_categories/save" method="post">
- <tbody>
- <tr>
- <td class="left" valign="top">
- Name:<br/>
- <input id="name" name="name" size="50" type="text" value="<%= @category.name if @category -%>" /><br/>
- <span class="desc">Ex. : UAT</span>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
- Description:<br/>
- <input id="description" name="description" size="50" type="text" value="<%= @category.description if @category -%>" /><br/>
- <span class="desc">Ex. : Start of User Acceptance Tests phase</span>
- </td>
- </tr>
- <tr>
- <td class="left" valign="top">
- <% if @category.nil? or @category.name.blank? %>
- <%= submit_tag 'Create' %>
- <% else %>
- <input type="hidden" name="previous_name" value="<%= @category.name -%>" />
- <%= submit_tag "Update #{@category.name}" %>
- <a href="<%= ApplicationController.root_context -%>/event_categories/index" class="action">cancel</a>
- <% end %>
- </td>
- </tr>
- </tbody>
- </form>
- </table>
- </td>
-</tr>
-</table>
\ No newline at end of file
<a href="<%= ApplicationController.root_context -%>/account/index"><%= message('my_profile.page') -%></a></li>
<% end %>
<% if is_admin? %>
- <li class="<%= 'selected' if controller.controller_path=='event_categories' -%>">
- <a href="<%= ApplicationController.root_context -%>/event_categories/index"><%= message('event_categories.page') -%></a></li>
<li class="<%= 'selected' if controller.controller_path=='metrics' -%>">
<a href="<%= ApplicationController.root_context -%>/metrics/index"><%= message('manual_metrics.page') -%></a></li>
<li class="<%= 'selected' if controller.controller_path=='manual_rules' -%>">