diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-04-05 14:00:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-04-05 14:00:19 +0000 |
commit | 43d70360512379c4a544892f3589ae1bc9861f7b (patch) | |
tree | 6dd317e4f9e6f16b1fdbdbfbb9b99eaf78663d83 /app/views | |
parent | 4920bb9d4d9a13d97c21a621d3659967b57b93f4 (diff) | |
download | redmine-43d70360512379c4a544892f3589ae1bc9861f7b.tar.gz redmine-43d70360512379c4a544892f3589ae1bc9861f7b.zip |
Adds "Check for updates" for installed plugins (#3177).
git-svn-id: http://svn.redmine.org/redmine/trunk@13042 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin/plugins.html.erb | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/app/views/admin/plugins.html.erb b/app/views/admin/plugins.html.erb index 7cd4fe763..3c708544c 100644 --- a/app/views/admin/plugins.html.erb +++ b/app/views/admin/plugins.html.erb @@ -9,11 +9,55 @@ <%= 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"><%=h plugin.version %></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">Check for updates</a> <% 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", "Latest compatible version: "+plugin_data.c); + } + }); + $("table.plugins td.version span.unknown").addClass("icon-help").attr("title", "Unknown plugin"); + }, + error: function(){ + $('#ajax-indicator').hide(); + alert("Unable to retrieve plugin informations from www.redmine.org"); + } + }); + }); +}); +<% end if @plugins.any? %> |