diff .svn/pristine/83/83b3d0ddfed40c525ddd23b3c46841437c3bd66a.svn-base @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.svn/pristine/83/83b3d0ddfed40c525ddd23b3c46841437c3bd66a.svn-base	Tue Sep 09 09:29:00 2014 +0100
@@ -0,0 +1,63 @@
+<%= title l(:label_plugins) %>
+
+<% if @plugins.any? %>
+<table class="list plugins">
+    <% @plugins.each do |plugin| %>
+        <tr id="plugin-<%= plugin.id %>" class="<%= cycle('odd', 'even') %>">
+        <td class="name"><span class="name"><%=h plugin.name %></span>
+            <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %>
+            <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %>
+        </td>
+        <td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
+        <td class="version"><span class="icon"><%= plugin.version %></span></td>
+        <td class="configure"><%= link_to(l(:button_configure), plugin_settings_path(plugin)) if plugin.configurable? %></td>
+        </tr>
+    <% end %>
+</table>
+<p><a href="#" id="check-for-updates"><%= l(:label_check_for_updates) %></a></p>
+<% else %>
+<p class="nodata"><%= l(:label_no_data) %></p>
+<% end %>
+
+<%= javascript_tag do %>
+$(document).ready(function(){
+  $("#check-for-updates").click(function(e){
+    e.preventDefault();
+    $.ajax({
+      dataType: "jsonp",
+      url: "http://www.redmine.org/plugins/check_updates",
+      data: <%= raw_json plugin_data_for_updates(@plugins) %>,
+      timeout: 3000,
+      beforeSend: function(){
+        $('#ajax-indicator').show();
+      },
+      success: function(data){
+        $('#ajax-indicator').hide();
+        $("table.plugins td.version span").addClass("unknown");
+        $.each(data, function(plugin_id, plugin_data){
+          var s = $("tr#plugin-"+plugin_id+" td.version span");
+          s.removeClass("icon-checked icon-warning unknown");
+          if (plugin_data.url) {
+            if (s.parent("a").length>0) {
+              s.unwrap();
+            }
+            s.addClass("found");
+            s.wrap($("<a></a>").attr("href", plugin_data.url).attr("target", "_blank"));
+          }
+          if (plugin_data.c == s.text()) {
+            s.addClass("icon-checked");
+          } else if (plugin_data.c) {
+            s.addClass("icon-warning");
+            s.attr("title", "<%= escape_javascript l(:label_latest_compatible_version) %>: "+plugin_data.c);
+          }
+        });
+        $("table.plugins td.version span.unknown").addClass("icon-help").attr("title", "<%= escape_javascript l(:label_unknown_plugin) %>");
+      },
+      error: function(){
+        $('#ajax-indicator').hide();
+        alert("Unable to retrieve plugin informations from www.redmine.org");
+      }
+    });
+  });
+});
+<% end if @plugins.any? %>