]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1563: Display installed plugins
authorGodin <mandrikov@gmail.com>
Wed, 27 Oct 2010 14:19:51 +0000 (14:19 +0000)
committerGodin <mandrikov@gmail.com>
Wed, 27 Oct 2010 14:19:51 +0000 (14:19 +0000)
SONAR-1889: Display new available plugins

sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_common.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_downloads.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_status.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/available.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb

diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_common.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/_common.html.erb
new file mode 100644 (file)
index 0000000..c6784e0
--- /dev/null
@@ -0,0 +1,10 @@
+<script type="text/javascript">
+  function showPlugin(key) {
+    if ($('detail-' + key).visible()) {
+      $('detail-' + key).hide();
+    } else {
+      $('detail-' + key).show();
+    }
+    return false;
+  }
+</script>
index 8f9d1e8a836879f8ebd4bc4f9bad4f198394b507..ee23bea2b3c7c59d86074e6b9dda4184675d0981 100644 (file)
@@ -1,9 +1,6 @@
+<%= render :partial => 'updatecenter/common' %>
+
 <script>
-  function showPlugin(key) {
-    $('show-' + key).hide();
-    $('detail-' + key).show();
-    return false;
-  }
   function checkTermsConditions(key) {
     var tc=$('tc-' + key)
     if (tc!=null && !tc.checked) {
   }
 </script>
 
-
-<% if @downloads.size>0 %>
-<form action="<%= ApplicationController.root_context -%>/plugins/cancel" method="post" class="warning">
+<% if @downloads.size > 0 %>
+<form action="<%= ApplicationController.root_context -%>/updatecenter/cancel" method="post" class="warning">
 <p>Sonar needs to be restarted in order to install the following plugins: <ul>
-  <% @downloads.each do |download| -%>
+  <% @downloads.each do |download| %>
     <li><%= download -%></li>
   <% end %>
   </ul>
   <input type="submit" value="Cancel downloads"></input>
 </p>
 </form>
-<% end %>
\ No newline at end of file
+<% end %>
index 01179af82e8500e9cc784a7f6f5eb2e626a4785f..a6defc2d88bf34baffaadc35891b074d79e35af3 100644 (file)
@@ -4,4 +4,4 @@
   <% else %>
     Updated on <%= @center.getDate() %>. <%= link_to 'Refresh', :action => action, :reload => true %>
   <% end %>
-</p>
\ No newline at end of file
+</p>
index f7cafd53e42edc6e254c2dacd42828ee39cafb77..fcdfa93b3d69e0c85b609e3f2b9b14b783d0b77f 100644 (file)
 
 <%= render :partial => 'updatecenter/downloads' %>
 
+<table class="data width100">
+  <thead>
+  </thead>
+  <tbody>
 <% if @center %>
   <% @updates_by_category.keys.sort_by{|c| c.downcase }.each do |category|
        updates=@updates_by_category[category]
   %>
-    <table class="data width100" id="category-<%= u category -%>">
-      <thead>
-        <tr>
-          <th colspan="2"><h2><%= category -%></h2></th>
-        </tr>
-      </thead>
-      <tbody>
-        <% updates.each do |update|
-             plugin=update.getPlugin()
-        %>
-        <tr class="<%= cycle('even','odd', :name => category) -%>">
-          <td width="10%" nowrap>
-            <b><%= h(plugin.getName()) -%></b>
-          </td>
-          <td>
-            <%= plugin.getDescription() %> <a href="#" onClick="showPlugin('<%= plugin.getKey() -%>');" id="show-<%= plugin.getKey() -%>">More</a>
-            <div id="detail-<%= plugin.getKey() -%>" style="display:none">
-              <% if plugin.getLicense() %>
-                <p>
-                  License: <%= h(plugin.getLicense()) %>
-                </p>
-              <% end %>
-              <% if plugin.getOrganization() %>
-                <p>
-                  By: <%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external'  %>
-                </p>
-              <% end %>
-              <% if plugin.getHomepageUrl() || plugin.getIssueTrackerUrl() %>
+    <tr>
+      <td colspan="2"><h2><%= category -%></td>
+    </tr>
+    <% updates.sort_by{|c| c.getPlugin().getName()}.each do |update|
+      plugin=update.getPlugin()
+    %>
+      <tr class="<%= cycle('even','odd', :name => category) -%>">
+        <td width="10%" nowrap>
+          <b><a href="#plugin" onClick="showPlugin('<%= plugin.getKey() -%>');"><%= h(plugin.getName()) -%></a></b>
+        </td>
+        <td>
+          <%= plugin.getDescription() %>
+          <div id="detail-<%= plugin.getKey() -%>" style="display:none">
+            <% if plugin.getLicense() %>
               <p>
-                <% if plugin.getHomepageUrl() %>
-                  <%= link_to 'Plugin details', plugin.getHomepageUrl(), :class=>'external' %>  |
-                <% end %>
-                <% if plugin.getIssueTrackerUrl() %>
-                  <%= link_to "Issue Tracker", plugin.getIssueTrackerUrl(), :class=>'external' %>
-                <% end %>
+                License: <%= h(plugin.getLicense()) %>
               </p>
-              <%
-                end
-                if update.isCompatible()
-              %>
+            <% end %>
+            <% if plugin.getOrganization() %>
               <p>
-                Version: <%= update.getRelease().getVersion() -%>
+                By: <%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external'  %>
               </p>
-              <div>
-                <% if plugin.getTermsConditionsUrl() %>
-                <input type="checkbox" id="tc-<%= plugin.getKey() -%>"></input> I accept the <%= link_to 'Terms and Conditions', plugin.getTermsConditionsUrl(), :class => 'external' %>
-                <% end %>
-                <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/install?from=available&key=<%= plugin.getKey() -%>&version=<%= update.getRelease().getVersion() -%>" style="display: inline-block">
-                  <input type="submit" value="Install" onClick="return checkTermsConditions('<%= plugin.getKey() -%>')"></input>
-                </form>
-             
-              </div>
-              <% elsif update.requiresSonarUpgrade
-              %>
-                <p>
-                  Version: <%= update.getRelease().getVersion() -%> (not compatible, needs Sonar upgrade)
-                </p>
-              <%
-                end
-              %>
+            <% end %>
+            <% if plugin.getHomepageUrl() || plugin.getIssueTrackerUrl() %>
+            <p>
+              <% if plugin.getHomepageUrl() %>
+                <%= link_to 'Plugin details', plugin.getHomepageUrl(), :class=>'external' %>  |
+              <% end %>
+              <% if plugin.getIssueTrackerUrl() %>
+                <%= link_to "Issue Tracker", plugin.getIssueTrackerUrl(), :class=>'external' %>
+              <% end %>
+            </p>
+            <%
+              end
+              if update.isCompatible()
+            %>
+            <p>
+              Version: <%= update.getRelease().getVersion() -%>
+            </p>
+            <div>
+              <% if plugin.getTermsConditionsUrl() %>
+              <input type="checkbox" id="tc-<%= plugin.getKey() -%>"></input> I accept the <%= link_to 'Terms and Conditions', plugin.getTermsConditionsUrl(), :class => 'external' %>
+              <% end %>
+              <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/install?from=available&key=<%= plugin.getKey() -%>&version=<%= update.getRelease().getVersion() -%>" style="display: inline-block">
+                <input type="submit" value="Install" onClick="return checkTermsConditions('<%= plugin.getKey() -%>')"></input>
+              </form>           
             </div>
-          </td>
-        </tr>
-        <% end %>
-      </tbody>
-    </table><br/>
+            <% elsif update.requiresSonarUpgrade
+            %>
+              <p>
+                Version: <%= update.getRelease().getVersion() -%> (not compatible, needs Sonar upgrade)
+              </p>
+            <%
+              end
+            %>
+          </div>
+        </td>
+      </tr>
+    <% end %>
   <% end %>
 <% end %>
+</tbody>
+</table><br/>
+
 <%= render :partial => 'updatecenter/status', :locals => {:action => 'available' } %>
-</div>
\ No newline at end of file
+</div>
index 1363d9060ee2e33d60ac1ce6c33bb31624f2a98d..79c813a2e52ca4b2c2515bfbb738c7349421c230 100644 (file)
@@ -1,19 +1,3 @@
-<style type="text/css">
-.plugin {
-  margin-top: 22px;
-  padding: 5px;
-  border: 1px solid #ddd;
-}
-
-.plugin h3 {
-  margin-left: 5px;
-}
-
-.plugin p {
-  padding: 5px;
-}
-</style>
-
 <ul class="tabs">
 <li>
 <a href="<%= url_for :action => 'index' -%>" class="selected">Installed</a>
 
 <div class="tabs-panel">
 
+<%= render :partial => 'updatecenter/common' %>
+
 <h2>User-installed plugins</h2>
-<table class="width100" id="user-plugins">
-  <tr>
-    <td width="1%" nowrap class="column first">
-      <table class="data">
-        <thead>
-          <tr>
-            <th>Plugin</th>
-            <th>Version</th>
-            <th>Description</th>
-          </tr>
-        </thead>
-        <tbody>
-          <% if @user_plugins.empty? %>
-            <tr class="even"><td colspan="5">No plugins</td></tr>
-          <% else
-            @user_plugins.each do |plugin|
-          %>
-            <tr class="select <%= cycle('even', 'odd', :name => 'user') -%>" id="select_<%= plugin.plugin_key -%>">
-              <td><a href="#" onclick="showPlugin('<%= plugin.plugin_key -%>')"><%= h(plugin.name) -%></a></td>
-              <td><%= plugin.version || '-' -%></td>
-              <td><%= plugin.description -%></td>
-            </tr>
-            <% end %>
-          <% end %>
-        </tbody>
-      </table>
-    </td>
-    <td class="column">
-      <% @user_plugins.each do |plugin| %>
-      <div class="plugin" id="plugin_<%= plugin.plugin_key -%>" style="display: none;">
-        <h3><%= h(plugin.name) -%> <%= plugin.version || '-' -%></h3>
-        <p><%= plugin.description -%></p>
+<table class="data">
+  <thead>
+    <tr>
+      <th>Plugin</th>
+      <th>Version</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <% if @user_plugins.empty? %>
+      <tr class="even"><td colspan="5">No plugins</td></tr>
+    <% else
+      @user_plugins.each do |plugin|
+    %>
+      <tr class="select <%= cycle('even', 'odd', :name => 'user') -%>" id="select_<%= plugin.plugin_key -%>">
+        <td><b><a href="#" onclick="showPlugin('<%= plugin.plugin_key -%>')"><%= h(plugin.name) -%></a></b></td>
+        <td><%= plugin.version || '-' -%></td>
+        <td>
+        <%= plugin.description -%>
+        
+        <div id="detail-<%= plugin.plugin_key -%>" style="display:none">
         <p>
-        <% if plugin.homepage %>
-                 <%= link_to 'Homepage', plugin.homepage, :class => 'external' -%><br/>
-               <% end %>
-        License: <%= plugin.license -%><br/>
-        <% if plugin.organization %>
-          Author: <%= link_to_if plugin.organization_url, plugin.organization, plugin.organization_url, :class=>'external' -%><br/>
-        <% end %>
-        </p>
-      </div>
+          License: <%= plugin.license -%><br/>
+          <% if plugin.organization %>
+            By: <%= link_to_if plugin.organization_url, plugin.organization, plugin.organization_url, :class=>'external' -%><br/>
+          <% end %>
+          <% if plugin.homepage %>
+         <%= link_to 'Details', plugin.homepage, :class => 'external' -%><br/>
+       <% end %>
+        </p>  
+        </div>
+        </td>
+      </tr>
       <% end %>
-    </td>
-  </tr>
+    <% end %>
+  </tbody>
 </table>
 
 <div class="break30"> </div>
@@ -89,7 +66,7 @@
     @core_plugins.each do |plugin|
   %>
          <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.plugin_key -%>">
-                 <td width="1%" nowrap><b><%= plugin.name -%></b></td>
+         <td width="1%" nowrap><b><%= plugin.name -%></b></td>
       <td><%= plugin.description %></td>
     </tr>
   <% end %>
 
 </div>
 
-<script type="text/javascript">
-  function showPlugin(id) {
-    $$('.plugin').each(function(element) {
-      element.hide();
-    });
-    $$('.select').each(function(element) {
-      element.removeClassName('selected');
-    });
-    $('plugin_' + id).show();
-    $('select_' + id).addClassName('selected');
-    return false;
-  }
-</script>