]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3373 Remove rails stuff to manage manual rules
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 21 Jul 2014 16:34:02 +0000 (18:34 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 21 Jul 2014 16:34:02 +0000 (18:34 +0200)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/_create_form.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/_edit_form.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb [deleted file]

diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb
deleted file mode 100644 (file)
index a98f6f1..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 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 ManualRulesController < ApplicationController
-
-  before_filter :admin_required
-
-  SECTION=Navigation::SECTION_CONFIGURATION
-
-  def index
-    @rules = Internal.rules.searchManualRules
-    render :action => 'index'
-  end
-
-  def edit
-    verify_post_request
-    call_backend do
-      rule_update = {
-          'ruleKey' => params[:key],
-          'name' => params[:name],
-          'markdownDescription' => params[:description]
-      }
-      Internal.rules.updateManualRule(rule_update)
-      render :text => 'ok', :status => 200
-    end
-  end
-
-  # Information : if the key already exists but is removed, it will be automatically reactivated without any message to the user
-  def create
-    verify_post_request
-    require_parameters 'name'
-
-    call_backend do
-      manual_key = params[:name].strip.downcase.gsub(/\s/, '_')
-      new_rule = {
-          'manualKey' => manual_key,
-          'name' => params[:name],
-          'markdownDescription' => params[:description]
-      }
-      Internal.rules.createManualRule(new_rule)
-      render :text => 'ok', :status => 200
-    end
-  end
-
-  def create_form
-    render :partial => 'manual_rules/create_form'
-  end
-
-  def edit_form
-    @rule = Internal.rules.findByKey(params['key'])
-    render :partial => 'manual_rules/edit_form', :status => 200
-  end
-
-  def delete
-    verify_post_request
-
-    call_backend do
-      Internal.rules.deleteManualRule(params['key'])
-      redirect_to :action => 'index'
-    end
-  end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/_create_form.html.erb
deleted file mode 100644 (file)
index 03539de..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<form action="<%= ApplicationController.root_context -%>/manual_rules/create" method="POST" id="manual-rules-form">
-    <fieldset>
-        <div class="modal-head">
-            <h2>Create Manual Rule</h2>
-        </div>
-
-        <div class="modal-body">
-          <div class="modal-error"/>
-          <div class="modal-field">
-            <label for="manual_rules[]">Name <em class="mandatory">*</em></label>
-            <input type="text" name="name" value=""/>
-          </div>
-          <div class="modal-field">
-            <label for="manual_rules[]">Description <em class="mandatory">*</em></label>
-            <textarea rows="5" cols="50" name="description"></textarea>
-            <br/>
-          </div>
-        </div>
-
-        <div class="modal-foot">
-            <input type="submit" value="<%= message('create') -%>">
-            <%= link_to 'Cancel', { :controller => 'manual_rules', :action => 'index'}, { :class => 'action' } %><br/>
-        </div>
-    </fieldset>
-</form>
-
-<script>
-  $j("#manual-rules-form").modalForm();
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/_edit_form.html.erb
deleted file mode 100644 (file)
index cfc01ca..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<form action="<%= ApplicationController.root_context -%>/manual_rules/edit" method="POST" id="manual-rules-form">
-  <fieldset>
-    <div class="modal-head">
-        <h2>Edit Manual Rule: <%= h @rule.name() -%></h2>
-    </div>
-
-    <div class="modal-body">
-      <div class="modal-error"/>
-      <input type="hidden" name="key" value="<%= @rule.key().to_s -%>"/>
-      <div class="modal-field">
-        <label for="manual_rules[]">Name <em class="mandatory">*</em></label>
-        <input type="text" name="name" value="<%= h @rule.name() -%>"/>
-      </div>
-      <div class="modal-field">
-        <label for="manual_rules[]">Description <em class="mandatory">*</em></label>
-        <textarea rows="5" cols="50" name="description"><%= h @rule.markdownDescription() -%></textarea>
-        <br/>
-      </div>
-    </div>
-
-    <div class="modal-foot">
-      <input type="submit" value="<%= message('save') -%>">
-      <%= link_to 'Cancel', { :controller => 'manual_rules', :action => 'index'}, { :class => 'action' } %><br/>
-    </div>
-  </fieldset>
-</form>
-
-<script>
-  $j("#manual-rules-form").modalForm();
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb
deleted file mode 100644 (file)
index e911fb4..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<div>
-    <% if profiles_administrator? %>
-      <ul style="float: right" class="horizontal">
-          <li class="marginleft10 add">
-              <a id="link-create-rule" href="<%=ApplicationController.root_context-%>/manual_rules/create_form" class="open-modal link-action"><%= message('manual_rules.add_manual_rule') %></a>
-          </li>
-      </ul>
-    <% end %>
-    <h1 class="admin-page-title"><%= message('manual_rules.page') -%></h1>
-    <p class="admin-page-description"><%= message('manual_rules.page.description') -%> </p>
-</div>
-
-<table width="100%">
-  <tr>
-    <td valign="top">
-      <table class="data width100" id="manual-rules">
-        <thead>
-        <tr>
-          <th>Name</th>
-          <th class="right">Operations</th>
-        </tr>
-        </thead>
-        <tbody>
-        <% if @rules.empty? %>
-          <tr class="even">
-            <td colspan="2"><%= message('no_results') -%></td>
-          </tr>
-        <% end %>
-        <% @rules.each do |rule| %>
-          <tr class="<%= cycle('even', 'odd') -%>">
-            <td class="left" nowrap>
-              <%= h rule.name() -%>
-              &nbsp;&nbsp;
-              <span class="note"><%= h rule.htmlDescription() -%></span>
-            </td>
-            <td class="right thin nowrap">
-              <a id="edit-<%= u(rule.key().to_s) -%>" class="open-modal link-action" href="<%=ApplicationController.root_context-%>/manual_rules/edit_form?key=<%= h rule.key().to_s -%>">Edit</a>&nbsp;
-              <%= link_to_action message('delete'), "#{ApplicationController.root_context}/manual_rules/delete?key=#{rule.key().to_s}",
-                 :class => 'link-action link-red',
-                 :id => "delete_#{rule.key().to_s.parameterize}",
-                 :confirm_button => message('delete'),
-                 :confirm_title => message('manual_rules.delete_manual_rule'),
-                 :confirm_msg => message('manual_rules.delete_manual_rule_message', :params => [h(rule.name())]),
-                 :confirm_msg_params => [rule.name()]
-              -%>
-            </td>
-          </tr>
-        <% end %>
-        </tbody>
-      </table>
-    </td>
-  </tr>
-</table>