Commit 6f4c48fa4369f6abdcdf882680db92ea677400bf

Authored by Carlos Morais
Committed by Paulo Meireles
1 parent d50904e0

Replace old views with new views directory

plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +<h1> <%= _(MezuroPlugin::ProjectContent.short_description) %> </h1>
  2 +
  3 +<%
  4 + begin
  5 + @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.new.project(@article.title)
  6 + rescue
  7 + @project = nil
  8 + end
  9 +%>
  10 +
  11 +<%= error_messages_for 'project_content' %>
  12 +
  13 +<%= hidden_field_tag 'project_content[profile_id]', profile.id %>
  14 +<%= hidden_field_tag 'id', @article.id %>
  15 +
  16 +<%= required_fields_message %>
  17 +
  18 +<%= required f.text_field(:name) %>
  19 +
  20 +<%= f.text_field :license %><br/>
  21 +
  22 +<%= f.text_field :description %><br/>
  23 +
  24 +<% @repository_types = Kalibro::Client::KalibroClient.new.supported_repository_types.sort %>
  25 +<% @selected = (@project.nil? ? @repository_types : @project.repository.type) %>
  26 +<%= required labelled_form_field _('Repository type'),
  27 + f.select(:repository_type, @repository_types, {:selected => @selected}) %><br/>
  28 +
  29 +<%= required f.text_field(:repository_url) %><br/>
  30 +
  31 +<% @configuration_names = Kalibro::Client::ConfigurationClient.new.configuration_names.sort %>
  32 +<% @selected = (@project.nil? ? @configuration_names[0] : @project.configuration_name) %>
  33 +<%= required labelled_form_field _('Configuration'),
  34 + f.select(:configuration_name, @configuration_names.sort, {:selected => @selected}) %><br/>
0 35 \ No newline at end of file
... ...
plugins/mezuro/views/content_viewer/show_project.rhtml 0 → 100644
... ... @@ -0,0 +1,113 @@
  1 +<% @project = Kalibro::Client::ProjectClient.new.project(@page.name) %>
  2 +
  3 +<h1> <%= @project.name %>'s Info</h1>
  4 +<table id="show_info">
  5 + <tr>
  6 + <td><%= _("Name") %></td>
  7 + <td><%= @project.name %></td>
  8 + </tr>
  9 + <tr>
  10 + <td><%= _("License") %></td>
  11 + <td><%= @project.license %></td>
  12 + </tr>
  13 + <tr>
  14 + <td><%= _("Description") %></td>
  15 + <td><%= @project.description %></td>
  16 + </tr>
  17 + <tr>
  18 + <td><%= _("Repository type") %></td>
  19 + <td><%= @project.repository.type %></td>
  20 + </tr>
  21 + <tr>
  22 + <td><%= _("Repository address") %></td>
  23 + <td><%= @project.repository.address %></td>
  24 + </tr>
  25 + <tr>
  26 + <td><%= _("Configuration") %></td>
  27 + <td><%= @project.configuration_name %></td>
  28 + </tr>
  29 +</table>
  30 +
  31 +<br />
  32 +
  33 +<% if @project.state == 'ERROR' %>
  34 + <h3>ERROR</h3>
  35 + <br />
  36 + <br />
  37 + <p>
  38 + <%= _("Possible causes:") %>
  39 + <ul>
  40 + <li><%= _("Server is down") %></li>
  41 + <li><%= _("Invalid URL") %> </li>
  42 + <li><%= _("Incorrect language") %> </li>
  43 + </ul>
  44 + </p>
  45 +<% end %>
  46 +
  47 +<% if @project.state.end_with? 'ING' %>
  48 + <div id="progress_message">
  49 + <%= _("The server is calculating metric results.<br/>Reload the page manually in a few moments.") %>
  50 + </div>
  51 +<% end %>
  52 +
  53 +
  54 +<% if @project.state == 'READY' %>
  55 +
  56 + <% if @project.configuration.nil? %>
  57 + <% metric_results = @client.last_module_result(@project.name).metric_results %>
  58 +
  59 + <h3> <%= _("Total Metrics") %> </h3>
  60 + <table id="total_metrics">
  61 + <% total_results = metric_results.each.select {|result| result.native_metric.scope == 'APPLICATION'} %>
  62 + <% total_results.each_with_index do |result, index| %>
  63 + <tr id="tr_<%= result.native_metric.code %>" class="d<%= index % 2 %>">
  64 + <td> <%= result.native_metric.name %> </td>
  65 + <td class="metric_box"> <%= result.value %> </td>
  66 + </tr>
  67 + <% end %>
  68 + </table>
  69 +
  70 + <h3> <%= _("Statistical Metrics") %> </h3>
  71 + <% statistical_results = metric_results.each.select {|result| result.native_metric.scope == 'CLASS'} %>
  72 + <% statistical_results.each do |result| %>
  73 + <div id="statistical_metrics">
  74 +
  75 + <table id="<%= @project.name %>_<%= result.native_metric.code %>_list">
  76 + <thead>
  77 + <th>
  78 + <img id="<%= @project.name %>_<%= result.native_metric.code %>_plus"
  79 + onclick="collapse('<%= @project.name %>_<%= result.native_metric.code %>')"
  80 + alt="+" src="/plugins/mezuro/images/plus.png" class="collapsable"/>
  81 + <img id="<%= @project.name %>_<%= result.native_metric.code %>_minus" style="display: none"
  82 + onclick="collapse('<%= @project.name %>_<%= result.native_metric.code %>')"
  83 + alt="-" src="/plugins/mezuro/images/minus.png" class="collapsable"/>
  84 + <%= "#{result.native_metric.name}" %>
  85 + </th>
  86 + <th class="metric_box">
  87 + <%= "#{result.average}"%>
  88 + </th>
  89 + </thead>
  90 + <% result.available_statistics.each_with_index do |statistic, index| %>
  91 + <tr class="d<%= index % 2 %> statistic" style="display: none">
  92 + <td><%= statistic %></td>
  93 + <td class="metric_box"><%= result.statistic(statistic) %></td>
  94 + </tr>
  95 + <% end %>
  96 + </table>
  97 + </div>
  98 + <% end %>
  99 +
  100 + <% else %>
  101 + <% metric_results = @client.last_module_result(@project.name).compiled_metric_results %>
  102 +
  103 + <h3> <%= _("Metrics") %> </h3>
  104 + <table id="metrics">
  105 + <% metric_results.each do |result| %>
  106 + <tr id="tr_<%= result.native_metric.code %>">
  107 + <td> <%= result.native_metric.name %> </td>
  108 + <td class="metric_box"> <%= result.value %> </td>
  109 + </tr>
  110 + <% end %>
  111 + </table>
  112 + <% end %>
  113 +<% end %>
... ...
plugins/mezuro/views/mezuro_plugin_myprofile/_form.html.erb
... ... @@ -1,20 +0,0 @@
1   -<%= error_messages_for 'project' %>
2   -
3   -<% labelled_form_for :project, @project, :url => @url do |f| %>
4   - <%= hidden_field_tag 'project[profile_id]', profile.id %>
5   - <%= hidden_field_tag 'id', @project.id %>
6   -
7   - <%= required_fields_message %>
8   -
9   - <%= required f.text_field(:name) %>
10   - <%= required f.text_field(:repository_url) %>
11   - <%= required f.text_field(:identifier) %>
12   - <%= f.check_box(:with_tab) %>
13   - <%= f.text_area(:description, :size => '30x3') %>
14   -
15   - <% button_bar do %>
16   - <%= submit_button(:save, @submit_button, :cancel => {:action => 'index'})%>
17   - <% end %>
18   -<% end %>
19   -
20   -<%= javascript_tag "$('project_name').focus();" %>
plugins/mezuro/views/mezuro_plugin_myprofile/edit.html.erb
... ... @@ -1,4 +0,0 @@
1   -<h1> <%= _("Edit project") %> </h1>
2   -<% @url = {:action => 'update'} %>
3   -<% @submit_button = _("Update project") %>
4   -<%= render :partial => 'form' %>
plugins/mezuro/views/mezuro_plugin_myprofile/index.html.erb
... ... @@ -1,28 +0,0 @@
1   -<h1> <%= _("%s's Mezuro projects") % profile.name %> </h1>
2   -
3   -<% if @projects.blank? %>
4   - <%= _("%s has no projects registered.") % profile.name %>
5   -<% else %>
6   - <table>
7   - <tr>
8   - <th><%= _('Project') %></th>
9   - <th><%= _('Actions') %></th>
10   - </tr>
11   -
12   - <% @projects.each do |project| %>
13   - <tr>
14   - <td><%= project.name %></td>
15   - <td class="article-controls">
16   - <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => project.id %>
17   - <%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => project.id },
18   - :method => :post,
19   - :confirm => _("Are you sure you want to remove this project?") %>
20   - </td>
21   - </tr>
22   - <% end %>
23   - </table>
24   -<% end %>
25   -
26   -<% button_bar do %>
27   - <%= button :new, _('Register a new project'), :action => 'new' %>
28   -<% end %>
plugins/mezuro/views/mezuro_plugin_myprofile/new.html.erb
... ... @@ -1,4 +0,0 @@
1   -<h1> <%= _("New project") %> </h1>
2   -<% @url = {:action => 'create'} %>
3   -<% @submit_button = _("Register project") %>
4   -<%= render :partial => 'form' %>
plugins/mezuro/views/profile/_project_tab.html.erb
... ... @@ -1,81 +0,0 @@
1   -<% @project = current_project %>
2   -<% @total_metrics = @project.total_metrics if @project != nil %>
3   -<% @statistical_metrics = @project.statistical_metrics if @project != nil %>
4   -<% @svn_error = @project.svn_error if (@project != nil && @project.svn_error) %>
5   -
6   -<h1> <%= @project.name %>'s Info</h1>
7   -<table id="show_info">
8   - <tr>
9   - <td><%= _("Name") %></td>
10   - <td><%= @project.name %></td>
11   - </tr>
12   - <% if (@project.description != nil && @project.description != "" ) %>
13   - <tr>
14   - <td><%= _("Description") %></td>
15   - <td><%= @project.description %></td>
16   - </tr>
17   - <% end %>
18   - <tr>
19   - <td><%= _("Repository address") %></td>
20   - <td><%= @project.repository_url %></td>
21   - </tr>
22   -</table>
23   -
24   -<br />
25   -
26   -
27   -<% if @svn_error %>
28   - <h3>ERROR</h3>
29   - <div id="svn_error">
30   - <%= @svn_error %>
31   - </div>
32   - <br />
33   - <br />
34   - <p>
35   - <%= _("Possible causes:") %>
36   - <ul>
37   - <li>
38   - <%= _("Server is down") %>
39   - </li>
40   - <li>
41   - <% _("URL invalid, in this case create another project with the correct URL
42   - (Sorry for the incovenience, we're working for a better solution)") %>
43   - </li>
44   - </ul>
45   - </p>
46   -<%else%>
47   - <h3> <%= _("Metric Results") %> </h3>
48   - <% if @project.metrics_calculated? %>
49   - <h3> <% _("Total Metrics") %> </h3>
50   - <table id="total_metrics">
51   - <% @total_metrics.each_with_index do |metric, index| %>
52   - <tr id="tr_<%= metric.name %>" class="d<%= index % 2 %>">
53   - <td class="metric_name"> <%= metric.name %> </td>
54   - <td class="metric_value"> <%= metric.value %> </td>
55   - </tr>
56   - <% end %>
57   - </table>
58   -
59   - <h3> <%= _("Statistical Metrics") %> </h3>
60   - <% @statistical_metrics.each_key do |metric_name| %>
61   - <div id="statistical_metrics">
62   - <%= "#{metric_name}_average: #{@statistical_metrics[metric_name]["average"]}" %>
63   - <ul>
64   - <% @statistical_metrics[metric_name].each do |stat_name, stat_value| %>
65   - <% if stat_name != "average" %>
66   - <li>
67   - <%= "#{metric_name}_#{stat_name}: #{stat_value}" %>
68   - </li>
69   - <% end %>
70   - <% end %>
71   - </ul>
72   - </div>
73   - <% end %>
74   -
75   - <% else %>
76   - <div id="progress_message">
77   - <%= _("Wait a moment while the metrics are calculated.<br/>
78   - Reload the page manually in a few moment. ") %>
79   - </div>
80   - <% end %>
81   -<% end %>