Chris@1464
|
1 <%= title l(:label_plugins) %>
|
Chris@0
|
2
|
Chris@0
|
3 <% if @plugins.any? %>
|
Chris@0
|
4 <table class="list plugins">
|
Chris@0
|
5 <% @plugins.each do |plugin| %>
|
Chris@1464
|
6 <tr id="plugin-<%= plugin.id %>" class="<%= cycle('odd', 'even') %>">
|
Chris@1464
|
7 <td class="name"><span class="name"><%=h plugin.name %></span>
|
Chris@0
|
8 <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %>
|
Chris@909
|
9 <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %>
|
Chris@909
|
10 </td>
|
Chris@0
|
11 <td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
|
Chris@1517
|
12 <td class="version"><span class="icon"><%= plugin.version %></span></td>
|
Chris@1464
|
13 <td class="configure"><%= link_to(l(:button_configure), plugin_settings_path(plugin)) if plugin.configurable? %></td>
|
Chris@0
|
14 </tr>
|
Chris@0
|
15 <% end %>
|
Chris@0
|
16 </table>
|
Chris@1517
|
17 <p><a href="#" id="check-for-updates"><%= l(:label_check_for_updates) %></a></p>
|
Chris@0
|
18 <% else %>
|
Chris@0
|
19 <p class="nodata"><%= l(:label_no_data) %></p>
|
Chris@0
|
20 <% end %>
|
Chris@1517
|
21
|
Chris@1517
|
22 <%= javascript_tag do %>
|
Chris@1517
|
23 $(document).ready(function(){
|
Chris@1517
|
24 $("#check-for-updates").click(function(e){
|
Chris@1517
|
25 e.preventDefault();
|
Chris@1517
|
26 $.ajax({
|
Chris@1517
|
27 dataType: "jsonp",
|
Chris@1517
|
28 url: "http://www.redmine.org/plugins/check_updates",
|
Chris@1517
|
29 data: <%= raw_json plugin_data_for_updates(@plugins) %>,
|
Chris@1517
|
30 timeout: 3000,
|
Chris@1517
|
31 beforeSend: function(){
|
Chris@1517
|
32 $('#ajax-indicator').show();
|
Chris@1517
|
33 },
|
Chris@1517
|
34 success: function(data){
|
Chris@1517
|
35 $('#ajax-indicator').hide();
|
Chris@1517
|
36 $("table.plugins td.version span").addClass("unknown");
|
Chris@1517
|
37 $.each(data, function(plugin_id, plugin_data){
|
Chris@1517
|
38 var s = $("tr#plugin-"+plugin_id+" td.version span");
|
Chris@1517
|
39 s.removeClass("icon-checked icon-warning unknown");
|
Chris@1517
|
40 if (plugin_data.url) {
|
Chris@1517
|
41 if (s.parent("a").length>0) {
|
Chris@1517
|
42 s.unwrap();
|
Chris@1517
|
43 }
|
Chris@1517
|
44 s.addClass("found");
|
Chris@1517
|
45 s.wrap($("<a></a>").attr("href", plugin_data.url).attr("target", "_blank"));
|
Chris@1517
|
46 }
|
Chris@1517
|
47 if (plugin_data.c == s.text()) {
|
Chris@1517
|
48 s.addClass("icon-checked");
|
Chris@1517
|
49 } else if (plugin_data.c) {
|
Chris@1517
|
50 s.addClass("icon-warning");
|
Chris@1517
|
51 s.attr("title", "<%= escape_javascript l(:label_latest_compatible_version) %>: "+plugin_data.c);
|
Chris@1517
|
52 }
|
Chris@1517
|
53 });
|
Chris@1517
|
54 $("table.plugins td.version span.unknown").addClass("icon-help").attr("title", "<%= escape_javascript l(:label_unknown_plugin) %>");
|
Chris@1517
|
55 },
|
Chris@1517
|
56 error: function(){
|
Chris@1517
|
57 $('#ajax-indicator').hide();
|
Chris@1517
|
58 alert("Unable to retrieve plugin informations from www.redmine.org");
|
Chris@1517
|
59 }
|
Chris@1517
|
60 });
|
Chris@1517
|
61 });
|
Chris@1517
|
62 });
|
Chris@1517
|
63 <% end if @plugins.any? %>
|