From: Stas Vilchik Date: Thu, 24 Jul 2014 14:50:53 +0000 (+0200) Subject: Remove unused ruby code X-Git-Tag: 4.5-RC1~350^2~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1c18af7b7647fef636aaab4bcaecebcd02b7a7ad;p=sonarqube.git Remove unused ruby code --- diff --git a/server/sonar-web/src/main/js/issue.js b/server/sonar-web/src/main/js/issue.js deleted file mode 100644 index 33991b0a00a..00000000000 --- a/server/sonar-web/src/main/js/issue.js +++ /dev/null @@ -1,249 +0,0 @@ -/* Open form for most common actions like comment, assign or plan */ -function issueForm(actionType, elt) { - var issueElt = $j(elt).closest('[data-issue-key]'); - var issueKey = issueElt.attr('data-issue-key'); - var actionsElt = issueElt.find('.code-issue-actions'); - var formElt = issueElt.find('.code-issue-form'); - - actionsElt.addClass('hidden'); - formElt.html("").removeClass('hidden'); - - $j.ajax(baseUrl + "/issue/action_form/" + actionType + "?issue=" + issueKey) - .done(function (msg) { - formElt.html(msg); - var focusField = formElt.find('[autofocus]'); - if (focusField != null) { - focusField.focus(); - } - }) - .fail(function (jqXHR, textStatus) { - alert(textStatus); - }); - return false; -} - -/* Close forms opened through the method issueForm() */ -function closeIssueForm(elt) { - var issueElt = $j(elt).closest('[data-issue-key]'); - var actionsElt = issueElt.find('.code-issue-actions'); - var formElt = issueElt.find('.code-issue-form'); - - formElt.addClass('hidden'); - actionsElt.removeClass('hidden'); - return false; -} - -/* Raise a Javascript event for Eclipse Web View */ -function notifyIssueChange(issueKey) { - $j(document).trigger('sonar.issue.updated', [issueKey]); -} - -/* Submit forms opened through the method issueForm() */ -function submitIssueForm(elt) { - var formElt = $j(elt).closest('form'); - formElt.find('.loading').removeClass('hidden'); - formElt.find(':submit').prop('disabled', true); - var issueElt = formElt.closest('[data-issue-key]'); - var issueKey = issueElt.attr('data-issue-key'); - - $j.ajax({ - type: "POST", - url: baseUrl + '/issue/do_action', - data: formElt.serialize()} - ).success(function (htmlResponse) { - var replaced = $j(htmlResponse); - issueElt.replaceWith(replaced); - notifyIssueChange(issueKey); - } - ).fail(function (jqXHR) { - closeIssueForm(elt); - issueElt.find('.code-issue-actions').replaceWith(jqXHR.responseText); - }); - return false; -} - -function doIssueAction(elt, action, parameters) { - var issueElt = $j(elt).closest('[data-issue-key]'); - var issueKey = issueElt.attr('data-issue-key'); - - issueElt.find('.code-issue-actions').html(""); - parameters['issue'] = issueKey; - - $j.ajax({ - type: "POST", - url: baseUrl + '/issue/do_action/' + action, - data: parameters - } - ).success(function (htmlResponse) { - var replaced = $j(htmlResponse); - issueElt.replaceWith(replaced); - notifyIssueChange(issueKey); - } - ).fail(function (jqXHR) { - issueElt.find('.code-issue-actions').replaceWith(jqXHR.responseText); - }); - return false; -} - -// Used for actions defined by plugins -function doPluginIssueAction(elt, action) { - var parameters = {}; - return doIssueAction(elt, action, parameters); -} - -function assignIssueToMe(elt) { - var parameters = {'me': true}; - return doIssueAction(elt, 'assign', parameters); -} - -function doIssueTransition(elt, transition) { - var parameters = {'transition': transition}; - return doIssueAction(elt, 'transition', parameters); -} - -function deleteIssueComment(elt, confirmMsg) { - var commentElt = $j(elt).closest("[data-comment-key]"); - var commentKey = commentElt.attr('data-comment-key'); - var issueElt = commentElt.closest('[data-issue-key]'); - if (confirm(confirmMsg)) { - $j.ajax({ - type: "POST", - url: baseUrl + "/issue/delete_comment?id=" + commentKey, - success: function (htmlResponse) { - issueElt.replaceWith($j(htmlResponse)); - } - }); - } - return false; -} - -function formEditIssueComment(elt) { - var commentElt = $j(elt).closest("[data-comment-key]"); - var commentKey = commentElt.attr('data-comment-key'); - var issueElt = commentElt.closest('[data-issue-key]'); - - issueElt.find('.code-issue-actions').addClass('hidden'); - commentElt.html(""); - - $j.get(baseUrl + "/issue/edit_comment_form/" + commentKey, function (html) { - commentElt.html(html); - }); - return false; -} - -function doEditIssueComment(elt) { - var formElt = $j(elt).closest('form'); - var issueElt = formElt.closest('[data-issue-key]'); - var issueKey = issueElt.attr('data-issue-key'); - $j.ajax({ - type: "POST", - url: baseUrl + "/issue/edit_comment", - data: formElt.serialize(), - success: function (htmlResponse) { - var replaced = $j(htmlResponse); - issueElt.replaceWith(replaced); - notifyIssueChange(issueKey); - }, - error: function (jqXHR) { - closeIssueForm(elt); - var commentElt = formElt.closest('[data-comment-key]'); - commentElt.replaceWith(jqXHR.responseText); - } - }); - return false; -} - -function refreshIssue(elt) { - var issueElt = $j(elt).closest('[data-issue-key]'); - var issueKey = issueElt.attr('data-issue-key'); - $j.get(baseUrl + "/issue/show/" + issueKey + "?only_detail=true", function (html) { - var replaced = $j(html); - issueElt.replaceWith(replaced); - }); - return false; -} - -/* Open form for creating a manual issue */ -function openCIF(elt, componentId, line) { - $j.get(baseUrl + "/issue/create_form?component=" + componentId + "&line=" + line, function (html) { - $j(elt).closest('tr').find('td.line').append($j(html)); - }); - return false; -} - -/* Close the form used for creating a manual issue */ -function closeCreateIssueForm(elt) { - $j(elt).closest('.code-issue-create-form').remove(); - return false; -} - -/* Create a manual issue */ -function submitCreateIssueForm(elt) { - var formElt = $j(elt).closest('form'); - var loadingElt = formElt.find('.loading'); - - loadingElt.removeClass('hidden'); - $j.ajax({ - type: "POST", - url: baseUrl + '/issue/create', - data: formElt.serialize()} - ).success(function (html) { - var replaced = $j(html); - formElt.replaceWith(replaced); - } - ).error(function (jqXHR) { - var errorsElt = formElt.find('.code-issue-errors'); - errorsElt.html(jqXHR.responseText); - errorsElt.removeClass('hidden'); - } - ).always(function () { - loadingElt.addClass('hidden'); - }); - return false; -} - -function toggleIssueCollapsed(elt) { - var issueElt = $j(elt).closest('[data-issue-rule]'); - issueElt.toggleClass('code-issue-collapsed'); - - if (!issueElt.hasClass('code-issue-collapsed')) { - - // Load rule desc - // Display loading images and hide existing content - var ruleLoading = issueElt.find('.rule-loading'); - ruleLoading.removeClass('hidden'); - var ruleElt = issueElt.find('.issue-rule'); - ruleElt.addClass('hidden'); - var ruleKey = issueElt.attr('data-issue-rule'); - $j.get(baseUrl + "/issue/rule/" + ruleKey, function (html) { - ruleElt.html(html); - // re-enable the links opening modal popups - ruleElt.find('.open-modal').modal(); - }).always(function () { - ruleLoading.addClass('hidden'); - ruleElt.removeClass('hidden'); - }); - - // Load changelog - // Display loading images and hide existing content - var cangelogLoading = issueElt.find('.changelog-loading'); - cangelogLoading.removeClass('hidden'); - var changelogElt = issueElt.find('.issue-changelog'); - changelogElt.addClass('hidden'); - var issueKey = issueElt.attr('data-issue-key'); - $j.get(baseUrl + "/issue/changelog/" + issueKey, function (html) { - changelogElt.html(html); - }).always(function () { - cangelogLoading.addClass('hidden'); - changelogElt.removeClass('hidden'); - }); - } - return false; -} - -function openIssuePopup(elt) { - var issueElt = $j(elt).closest('[data-issue-key]'); - var issueKey = issueElt.attr('data-issue-key'); - openPopup(baseUrl + "/issue/show/" + issueKey + "?layout=false", 'issue'); - return false; -} diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_assign_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_assign_form.html.erb deleted file mode 100644 index e80b3a69106..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_assign_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<% user_select_box_id = "assignee-#{params[:issue]}" %> -
- - - - - - -
- <% - choices = {} - choices[current_user.login] = escape_javascript(message('assigned_to_me')) if !@issue.assignee || @issue.assignee != current_user.login - choices[''] = escape_javascript(message('unassigned')) if @issue.assignee - %> - <%= - user_select_tag('assignee', :html_id => user_select_box_id, :open => true, :include_choices => choices) - -%> - -   - <%= link_to_function message('cancel'), 'closeIssueForm(this)', :class => 'action' -%>  - -
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_changelog.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_changelog.html.erb deleted file mode 100644 index 15827f5df3f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_changelog.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - <% - @changelog.changes.each do |change| - user = @changelog.user(change) - %> - - - - - - <% end %> -
<%= format_datetime(@issue.creationDate()) -%><%= @issue_results.user(@issue.reporter).name if @issue.reporter -%><%= message('created') -%>
<%= format_datetime(change.creationDate()) -%><%= h(user.name()) if user -%> - <% - Internal.issues.formatChangelog(change).each_with_index do |message, index| - %> - <% if index>0 %>
<% end %> - <%= message -%> - <% end %> -
- - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_comment_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_comment_form.html.erb deleted file mode 100644 index 6b936b5dc37..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_comment_form.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
- - - - - - - - - - -
- -
- -  <%= link_to_function message('cancel'), 'closeIssueForm(this)' -%>  - - - <%= render :partial => 'markdown/tips' -%> -
-
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_create_form.html.erb deleted file mode 100644 index 5ccec3c74ac..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_create_form.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<% - manual_rules = Rule.manual_rules - is_admin = has_role?(:admin) - form_id = "create-issue-#{params[:component]}-#{params[:line]}" - rule_select_id = "#{form_id}-rules" -%> -
- <% - if manual_rules.empty? - %> -
- - <% if is_admin %> - <%= message('issue.manual.no_rules.admin') -%> -  <%= message('manage') -%> - <% else %> - <%= message('issue.manual.no_rules.non_admin') -%> - <% end %> - -  <%= link_to_function message('cancel'), 'closeCreateIssueForm(this)' -%> -
- - <% else %> - - - - -
-
- <%= dropdown_tag 'rule', - options_for_select([[]].concat(manual_rules.map { |rule| [rule.name, rule.key] })), - {:show_search_box => true, :placeholder => 'Select a Rule'}, - {:html_id => rule_select_id} -%> -
-
- - - - - - - -
- -
-   - <%= link_to_function message('cancel'), 'closeCreateIssueForm(this)' -%>   - -
- -
-
- <% end %> -
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_edit_comment_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_edit_comment_form.html.erb deleted file mode 100644 index 11b9871f6c9..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_edit_comment_form.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
- - - - - - - - - -
- -
- -  <%= link_to_function message('cancel'), 'refreshIssue(this)' -%>  - - - <%= render :partial => 'markdown/tips' -%> -
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_error.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_error.html.erb deleted file mode 100644 index 8d52d5e03e3..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_error.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
- <% @errors.each do |msg| %> -
<%= h (msg.text ? msg.text : Api::Utils.message(msg.l10nKey, :params => msg.l10nParams)) -%>
- <% end %> - <%= link_to_function message('hide'), 'refreshIssue(this)' -%> -
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb deleted file mode 100644 index f83a9992c99..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb +++ /dev/null @@ -1,158 +0,0 @@ -
-
-
- - - <%= h !issue.message.blank? ? Api::Utils.split_newlines(issue.message).join('
') : @issue_results.rule(issue).getName() -%> -
-
- -
- - - - -
- - -
- <%= image_tag 'loading.gif', :class => 'rule-loading hidden' -%> -
-
- -
- <%= image_tag 'loading.gif', :class => 'changelog-loading hidden' -%> - -
-
-
- -
- <% issue.comments.each do |comment| - comment_html_id = "comment-#{comment.key}-#{rand(100)}" %> -
-

- <%= image_tag('reviews/comment.png') -%>  <%= h( @issue_results.user(comment.userLogin()).name() ) -%> - (<%= distance_of_time_in_words_to_now(Api::Utils.java_to_ruby_datetime(comment.createdAt)) -%>) - <% if current_user && current_user.login==comment.userLogin %> -   - <%= image_tag 'sep12.png' -%> -   - <%= message('edit') -%> - <%= message('delete') -%> - <% end %> -

- <%= Internal.text.markdownToHtml(comment.markdownText) -%> -
- <% end %> -
-
- - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_manual_issue_created.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_manual_issue_created.html.erb deleted file mode 100644 index 60c05dc18aa..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_manual_issue_created.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
- <%= render :partial => 'issue/issue', :locals => {:issue => issue} -%> -
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_plan_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_plan_form.html.erb deleted file mode 100644 index 802fcf522e1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_plan_form.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<% - plans_select_box_id = "plans-#{params[:issue]}" - plans = Internal.issues.findOpenActionPlans(@issue_result.project(@issue).key()) - if plans.empty? -%> - <% if is_admin? %> - <%= message('issue.plan.error.plan_must_be_created_first_for_admin', - :params => ApplicationController.root_context + '/action_plans/index/' + @issue_result.project(@issue).key()) -%> - <% else %> - <%= message('issue.plan.error.plan_must_be_created_first_for_other') -%> - <% end %> -  <%= link_to_function message('cancel'), 'closeIssueForm(this)' -%> -<% - else - first_plan = plans[0] - options = plans.map { |plan| - label = plan.deadLine ? "#{h plan.name} (#{format_date(plan.deadLine)})" : h(plan.name) - [label, plan.key] - } - if @issue.actionPlanKey - options.unshift([escape_javascript(message('issue.unplan.submit')), '']) - end - plan_options = options_for_select(options, first_plan.key) -%> -
- - - - <%= dropdown_tag('plan', plan_options, {:show_search_box => false}, {:id => plans_select_box_id}) -%> - -   - <%= link_to_function message('cancel'), 'closeIssueForm(this)', :class => 'action' -%> - - -
- -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_rule.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_rule.html.erb deleted file mode 100644 index 588ecab7ef5..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_rule.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

<%= h @rule.name() -%>

- -
- <% if @rule.htmlDescription.strip.start_with?('

') %> - <%= Internal.text.interpretMacros(@rule.htmlDescription) %> - <% else %> -

<%= Internal.text.interpretMacros(@rule.htmlDescription) %>

- <% end %> -
- -<% if @rule.markdownNote() %> -
- <%= Api::Utils.markdown_to_html(@rule.markdownNote()) -%> -
-<% end %> - -

- <%= h @rule.key() -%> - <%= image_tag 'sep12.png', :class => 'spacer-right' -%> - <% if @characteristic && @sub_characteristic %> - <%= @characteristic.name -%> > <%= @sub_characteristic.name -%> - <% else %> - <%= message 'issue.technical_debt_deleted' %> - <% end %> -

diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_severity_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_severity_form.html.erb deleted file mode 100644 index 9a9ef58e26d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_severity_form.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -
- - - - - - -
- - - -  <%= link_to_function message('cancel'), 'closeIssueForm(this)' -%>  - -
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_show.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_show.html.erb deleted file mode 100644 index acbe92e6e71..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_show.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -
-
- <% - project = @issue_results.project(@issue) - component = @issue_results.component(@issue) - %> - - <% if project && @issue.componentKey() != project.key() %> -
- <%= h project.longName() -%> -
- <% end %> - - <% if component %> - <%= qualifier_icon(component) %> - <%= h component.longName() -%> - <% else %> - <%= h @issue.componentKey() %> [<%= message('issue.component_deleted') %>] - <% end %> - -
- -
- <%= render :partial => 'issue/issue', :locals => {:issue => @issue_results.first} -%> -
- - - <% if @snapshot && @issue.line && params[:source]!='false' && has_role?(:codeviewer, @snapshot.project) %> -
- <%= snapshot_html_source(@snapshot, {:line_range => (@issue.line-5)..(@issue.line+5), :highlighted_lines => [@issue.line]}) -%> -
- <% else %> - -
- <% end %> -
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_show_modal.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_show_modal.html.erb deleted file mode 100644 index 7272b75e9fc..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/_show_modal.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/show.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/show.html.erb deleted file mode 100644 index 8161c09ad7d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issue/show.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => 'issue/show' -%> \ No newline at end of file