To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / views / admin / plugins.html.erb @ 1591:63650ae64bf2

History | View | Annotate | Download (2.56 KB)

1
<%= title l(:label_plugins) %>
2

    
3
<% if @plugins.any? %>
4
<table class="list plugins">
5
    <% @plugins.each do |plugin| %>
6
        <tr id="plugin-<%= plugin.id %>" class="<%= cycle('odd', 'even') %>">
7
        <td class="name"><span class="name"><%=h plugin.name %></span>
8
            <%= content_tag('span', h(plugin.description), :class => 'description') unless plugin.description.blank? %>
9
            <%= content_tag('span', link_to(h(plugin.url), plugin.url), :class => 'url') unless plugin.url.blank? %>
10
        </td>
11
        <td class="author"><%= plugin.author_url.blank? ? h(plugin.author) : link_to(h(plugin.author), plugin.author_url) %></td>
12
        <td class="version"><span class="icon"><%= plugin.version %></span></td>
13
        <td class="configure"><%= link_to(l(:button_configure), plugin_settings_path(plugin)) if plugin.configurable? %></td>
14
        </tr>
15
    <% end %>
16
</table>
17
<p><a href="#" id="check-for-updates"><%= l(:label_check_for_updates) %></a></p>
18
<% else %>
19
<p class="nodata"><%= l(:label_no_data) %></p>
20
<% end %>
21

    
22
<%= javascript_tag do %>
23
$(document).ready(function(){
24
  $("#check-for-updates").click(function(e){
25
    e.preventDefault();
26
    $.ajax({
27
      dataType: "jsonp",
28
      url: "http://www.redmine.org/plugins/check_updates",
29
      data: <%= raw_json plugin_data_for_updates(@plugins) %>,
30
      timeout: 3000,
31
      beforeSend: function(){
32
        $('#ajax-indicator').show();
33
      },
34
      success: function(data){
35
        $('#ajax-indicator').hide();
36
        $("table.plugins td.version span").addClass("unknown");
37
        $.each(data, function(plugin_id, plugin_data){
38
          var s = $("tr#plugin-"+plugin_id+" td.version span");
39
          s.removeClass("icon-checked icon-warning unknown");
40
          if (plugin_data.url) {
41
            if (s.parent("a").length>0) {
42
              s.unwrap();
43
            }
44
            s.addClass("found");
45
            s.wrap($("<a></a>").attr("href", plugin_data.url).attr("target", "_blank"));
46
          }
47
          if (plugin_data.c == s.text()) {
48
            s.addClass("icon-checked");
49
          } else if (plugin_data.c) {
50
            s.addClass("icon-warning");
51
            s.attr("title", "<%= escape_javascript l(:label_latest_compatible_version) %>: "+plugin_data.c);
52
          }
53
        });
54
        $("table.plugins td.version span.unknown").addClass("icon-help").attr("title", "<%= escape_javascript l(:label_unknown_plugin) %>");
55
      },
56
      error: function(){
57
        $('#ajax-indicator').hide();
58
        alert("Unable to retrieve plugin informations from www.redmine.org");
59
      }
60
    });
61
  });
62
});
63
<% end if @plugins.any? %>