2013-07-28 11:50:18 +00:00
|
|
|
<%= title l(:label_plugins) %>
|
2008-11-16 11:58:41 +00:00
|
|
|
|
|
|
|
|
<% if @plugins.any? %>
|
2008-11-16 17:12:02 +00:00
|
|
|
<table class="list plugins">
|
2008-11-16 15:22:48 +00:00
|
|
|
<% @plugins.each do |plugin| %>
|
2012-12-13 13:52:56 +00:00
|
|
|
<tr id="plugin-<%= plugin.id %>" class="<%= cycle('odd', 'even') %>">
|
2015-02-23 10:11:08 +00:00
|
|
|
<td class="name"><span class="name"><%= plugin.name %></span>
|
|
|
|
|
<%= content_tag('span', plugin.description, :class => 'description') unless plugin.description.blank? %>
|
|
|
|
|
<%= content_tag('span', link_to(plugin.url, plugin.url), :class => 'url') unless plugin.url.blank? %>
|
2011-09-17 13:15:43 +00:00
|
|
|
</td>
|
2015-02-23 10:11:08 +00:00
|
|
|
<td class="author"><%= plugin.author_url.blank? ? plugin.author : link_to(plugin.author, plugin.author_url) %></td>
|
2014-04-05 14:00:19 +00:00
|
|
|
<td class="version"><span class="icon"><%= plugin.version %></span></td>
|
2012-12-13 13:52:56 +00:00
|
|
|
<td class="configure"><%= link_to(l(:button_configure), plugin_settings_path(plugin)) if plugin.configurable? %></td>
|
2008-11-16 11:58:41 +00:00
|
|
|
</tr>
|
|
|
|
|
<% end %>
|
|
|
|
|
</table>
|
2014-04-06 11:03:57 +00:00
|
|
|
<p><a href="#" id="check-for-updates"><%= l(:label_check_for_updates) %></a></p>
|
2008-11-16 11:58:41 +00:00
|
|
|
<% else %>
|
|
|
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
|
|
|
<% end %>
|
2014-04-05 14:00:19 +00:00
|
|
|
|
|
|
|
|
<%= javascript_tag do %>
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
$("#check-for-updates").click(function(e){
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
$.ajax({
|
|
|
|
|
dataType: "jsonp",
|
2015-02-15 16:53:39 +00:00
|
|
|
url: "https://www.redmine.org/plugins/check_updates",
|
2014-04-05 14:00:19 +00:00
|
|
|
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");
|
2016-01-20 08:50:39 +00:00
|
|
|
s.removeClass("icon-ok icon-warning unknown");
|
2014-04-05 14:00:19 +00:00
|
|
|
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()) {
|
2016-01-20 08:50:39 +00:00
|
|
|
s.addClass("icon-ok");
|
2014-04-05 14:00:19 +00:00
|
|
|
} else if (plugin_data.c) {
|
|
|
|
|
s.addClass("icon-warning");
|
2014-04-05 14:05:36 +00:00
|
|
|
s.attr("title", "<%= escape_javascript l(:label_latest_compatible_version) %>: "+plugin_data.c);
|
2014-04-05 14:00:19 +00:00
|
|
|
}
|
|
|
|
|
});
|
2014-04-05 14:08:18 +00:00
|
|
|
$("table.plugins td.version span.unknown").addClass("icon-help").attr("title", "<%= escape_javascript l(:label_unknown_plugin) %>");
|
2014-04-05 14:00:19 +00:00
|
|
|
},
|
|
|
|
|
error: function(){
|
|
|
|
|
$('#ajax-indicator').hide();
|
|
|
|
|
alert("Unable to retrieve plugin informations from www.redmine.org");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
<% end if @plugins.any? %>
|