aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>2012-10-05 15:33:52 +0200
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>2012-10-05 15:33:52 +0200
commitcbb017dc1dc58f3175d7d9fcab9643c4beafc74a (patch)
treeeb36405ade116925781df1ad08fc57792e5f36f6 /sonar-server/src/main
parent824b3b9facd472d989596a214edbbc660df2dc1d (diff)
downloadsonarqube-cbb017dc1dc58f3175d7d9fcab9643c4beafc74a.tar.gz
sonarqube-cbb017dc1dc58f3175d7d9fcab9643c4beafc74a.zip
SONAR-3676 Improve Links page
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb122
2 files changed, 83 insertions, 41 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
index 5e59296c6e3..adcabe47bd4 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
@@ -206,7 +206,7 @@ class ProjectController < ApplicationController
def set_links
project = get_current_project(params[:project_id])
- project.links.clear
+ project.custom_links.each {|link| link.delete}
params.each_pair do |param_key, value|
if (param_key.starts_with?('name_'))
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb
index 47479d9c8fc..e3bd566ee78 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/links.html.erb
@@ -1,5 +1,16 @@
<h1>Project Links</h1>
<br/>
+
+<style>
+#widget_links td, #widget_links th {
+ white-space: nowrap;
+ vertical-align: top;
+ text-align: left;
+ padding-left: 20px;
+ padding-right: 20px;
+}
+</style>
+
<div class="yui-g widget" id="widget_links">
<% form_for( 'set_links', :url => { :action => 'set_links', :project_id => @project.id } ) do |form|
@@ -8,66 +19,95 @@
links_by_key[link.link_type]=link
end
%>
- <div class="yui-u first">
- <table class="data">
- <thead><tr><th>Title</th><th>URL</th></tr></thead>
+ <div class="yui-u first">
+ <table class="data">
+ <thead><tr><th >Title</th><th width="100%">URL</th></tr></thead>
- <tr class="even">
- <td align="left" nowrap width="1%">
- <%= image_tag("links/homepage.png") -%> Home</td>
+ <tr class="even">
+ <td>
+ <%= image_tag("links/homepage.png") -%> <%= message('project_links.homepage') -%>
+ <br/>
+ <span class="note" style="margin-left: 20px">sonar.links.homepage</span>
+ </td>
<td>
- <input type="hidden" name="key_homepage" value="homepage" />
- <input type="hidden" name="name_homepage" value="Home" />
- <%= text_field_tag( "url_homepage", links_by_key['homepage'] ? links_by_key['homepage'].href : '', :readonly => true, :size => 30 ) -%>
+ <%
+ link = links_by_key['homepage'] ? links_by_key['homepage'].href : ''
+ if link.starts_with?("http")
+ link = "<a href=\"#{h link}\">#{h link}</a>"
+ end
+ %>
+ <%= link -%>
</td>
</tr>
<tr class="odd">
- <td align="left" nowrap width="1%">
- <%= image_tag("links/ci.png") -%> Continuous integration</td>
+ <td>
+ <%= image_tag("links/ci.png") -%> <%= message('project_links.ci') -%>
+ <br/>
+ <span class="note" style="margin-left: 20px">sonar.links.ci</span>
+ </td>
<td>
- <input type="hidden" name="key_ci" value="ci" />
- <input type="hidden" name="name_ci" value="Continuous integration" />
- <%= text_field_tag( "url_ci", links_by_key['ci'] ? links_by_key['ci'].href : '', :readonly => true, :size => 30 ) -%>
+ <%
+ link = links_by_key['ci'] ? links_by_key['ci'].href : ''
+ if link.starts_with?("http")
+ link = "<a href=\"#{h link}\">#{h link}</a>"
+ end
+ %>
+ <%= link -%>
</td>
</tr>
<tr class="even">
- <td align="left" nowrap width="1%">
- <%= image_tag("links/issue.png") -%> Issue tracker</td>
+ <td>
+ <%= image_tag("links/issue.png") -%> <%= message('project_links.issue') -%>
+ <br/>
+ <span class="note" style="margin-left: 20px">sonar.links.issue</span>
+ </td>
<td>
- <input type="hidden" name="key_issue" value="issue" />
- <input type="hidden" name="name_issue" value="Issues" />
- <%= text_field_tag( "url_issue", links_by_key['issue'] ? links_by_key['issue'].href : '', :readonly => true, :size => 30 ) -%>
+ <%
+ link = links_by_key['issue'] ? links_by_key['issue'].href : ''
+ if link.starts_with?("http")
+ link = "<a href=\"#{h link}\">#{h link}</a>"
+ end
+ %>
+ <%= link -%>
</td>
</tr>
<tr class="odd">
- <td align="left" nowrap width="1%">
- <%= image_tag("links/scm.png") -%> Sources</td>
+ <td>
+ <%= image_tag("links/scm.png") -%> <%= message('project_links.scm') -%>
+ <br/>
+ <span class="note" style="margin-left: 20px">sonar.links.scm</span>
+ </td>
<td>
- <input type="hidden" name="key_scm" value="scm" />
- <input type="hidden" name="name_scm" value="Sources" />
- <%= text_field_tag( "url_scm", links_by_key['scm'] ? links_by_key['scm'].href : '', :readonly => true, :size => 30 ) -%>
+ <%
+ link = links_by_key['scm'] ? links_by_key['scm'].href : ''
+ if link.starts_with?("http")
+ link = "<a href=\"#{h link}\">#{h link}</a>"
+ end
+ %>
+ <%= link -%>
</td>
</tr>
<tr class="even">
- <td align="left" nowrap width="1%">
- <%= image_tag("links/scm_dev.png") -%> Developer connection</td>
+ <td>
+ <%= image_tag("links/scm_dev.png") -%> <%= message('project_links.scm_dev') -%>
+ <br/>
+ <span class="note" style="margin-left: 20px">sonar.links.scm_dev</span>
+ </td>
<td>
- <input type="hidden" name="key_scm_dev" value="scm_dev" />
- <input type="hidden" name="name_scm_dev" value="Developer connection" />
- <%= text_field_tag( "url_scm_dev", links_by_key['scm_dev'] ? links_by_key['scm_dev'].href : '', :readonly => true, :size => 30 ) -%>
+ <%
+ link = links_by_key['scm_dev'] ? links_by_key['scm_dev'].href : ''
+ if link.starts_with?("http")
+ link = "<a href=\"#{h link}\">#{h link}</a>"
+ end
+ %>
+ <%= link -%>
</td>
</tr>
- </table>
- <br/>
- <%= submit_tag( "Save links" ) %>
- </div>
- <div class="yui-u">
- <table class="data">
- <thead><tr><th>Title</th><th>URL</th></tr></thead>
+
<% index = 0
@project.custom_links.each do |custom_link|
index += 1 %>
- <tr class="<%= cycle('even','odd') -%>">
+ <tr class="<%= cycle('odd','even') -%>">
<td align="left">
<%= image_tag("links/external.png") -%> <%= text_field_tag( "name_#{index}", h(custom_link.name), :size => 15 ) -%>
</td>
@@ -78,12 +118,14 @@
<% end %>
<% index += 1
for var in index..5 %>
- <tr class="<%= cycle('even','odd') -%>">
+ <tr class="<%= cycle('odd','even') -%>">
<td align="left"><%= image_tag("links/external.png") -%> <%= text_field_tag( "name_#{var}", '', :size => 15) %></td>
<td><%= text_field_tag( "url_#{var}", '', :size => 30 ) %></td>
</tr>
<% end %>
- </table>
- </div>
+ </table>
+ <br/>
+ <%= submit_tag( "Save links" ) %>
+ </div>
<% end %>
</div> \ No newline at end of file