Commit 0b2a3843bde6a4638a87be24b53d6c1a909c9985

Authored by Carlos Morais
1 parent 94033330

Refactoring views

plugins/mezuro/public/javascripts/autoreload.js
@@ -20,4 +20,4 @@ function show_page_with_results(content){ @@ -20,4 +20,4 @@ function show_page_with_results(content){
20 show_autoreload(jQuery); 20 show_autoreload(jQuery);
21 }, wait * 1000); 21 }, wait * 1000);
22 } 22 }
23 -} 23 -}
  24 +}
24 \ No newline at end of file 25 \ No newline at end of file
plugins/mezuro/public/style.css
1 .link { 1 .link {
2 cursor: pointer; 2 cursor: pointer;
3 -} 3 -}
  4 +}
4 \ No newline at end of file 5 \ No newline at end of file
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 <% 3 <%
4 begin 4 begin
5 - @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.new.project(@article.title) 5 + @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.project(@article.title)
6 rescue 6 rescue
7 @project = nil 7 @project = nil
8 end 8 end
plugins/mezuro/views/content_viewer/_project_result.rhtml
1 -<% if ! @project_content.project.error.nil? %>  
2 - <h3><%= _('ERROR') %></h3>  
3 - <p>  
4 - <%= "State when error ocurred: #{@project_content.project.state}" %>  
5 - <br/>  
6 - <% error = @project_content.project.error %>  
7 - <%= error.message %>  
8 - <ul><% error.stack_trace.each do |trace| %>  
9 - <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li>  
10 - <% end %></ul>  
11 - </p>  
12 -<% elsif @project_content.project.state.end_with?('ING') %>  
13 -  
14 - <%= _("Loading results for %s ...") % @project_content.project.name %> 1 +<% @project_result = content.project_result %>
15 2
16 -<% elsif @project_content.project.state == 'READY' %>  
17 -  
18 - <h3><%= _('LAST RESULT') %></h3>  
19 - <% @project_result = @project_content.project_result %> 3 +<h3><%= _('LAST RESULT') %></h3>
20 4
21 - <table id="project_result_info">  
22 - <tr>  
23 - <td><%= _('Date') %></td>  
24 - <td><%= @project_result.date %></td>  
25 - </tr>  
26 - <tr>  
27 - <td><%= _('Load time') %></td>  
28 - <td><%= @project_result.formatted_load_time %></td>  
29 - </tr>  
30 - <tr>  
31 - <td><%= _('Analysis time') %></td>  
32 - <td><%= @project_result.formatted_analysis_time %></td>  
33 - </tr>  
34 - </table> 5 +<table>
  6 + <tr>
  7 + <td><%= _('Date') %></td>
  8 + <td><%= @project_result.date %></td>
  9 + </tr>
  10 + <tr>
  11 + <td><%= _('Load time') %></td>
  12 + <td><%= @project_result.formatted_load_time %></td>
  13 + </tr>
  14 + <tr>
  15 + <td><%= _('Analysis time') %></td>
  16 + <td><%= @project_result.formatted_analysis_time %></td>
  17 + </tr>
  18 +</table>
35 19
36 - <h5><%= _('Source tree') %></h5> 20 +<h4><%= _('Source tree') %></h4>
  21 +<%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => @project_result.source_tree } %>
37 22
38 - <%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => @project_result.source_tree } %> 23 +<div id='module-result' data-profile="<%= content.profile.identifier %>" data-content='<%= content.id %>'>
  24 + <%= render :partial => 'content_viewer/module_result', :locals => { :module_result => content.module_result(content.project.name) } %>
  25 +</div>
39 26
40 - <div id='module-result' data-profile="<%= @project_content.profile.identifier %>" data-project-id='<%= @project_content.id %>'>  
41 - <%= render :partial => 'content_viewer/module_result', :locals => { :module_result => @project_content.module_result(@project_content.project.name) } %>  
42 - </div>  
43 -  
44 - <script type="text/javascript">  
45 - jQuery(results);  
46 - </script>  
47 -  
48 -<% end %>. 27 +<script type="text/javascript">
  28 + jQuery(results);
  29 +</script>
49 \ No newline at end of file 30 \ No newline at end of file
plugins/mezuro/views/content_viewer/_source_tree.rhtml
@@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
5 <tr> 5 <tr>
6 <td width="10%"> 6 <td width="10%">
7 <img alt="+" src="/plugins/mezuro/images/plus.png" class="link" 7 <img alt="+" src="/plugins/mezuro/images/plus.png" class="link"
8 - id="<%= module_name %>_plus" onclick="toggle('<%= module_name %>')" style="display: none"/> 8 + id="<%= module_name %>_plus" onclick="toggle('<%= module_name %>')"/>
9 <img alt="-" src="/plugins/mezuro/images/minus.png" class="link" 9 <img alt="-" src="/plugins/mezuro/images/minus.png" class="link"
10 - id="<%= module_name %>_minus" onclick="toggle('<%= module_name %>')"/> 10 + id="<%= module_name %>_minus" onclick="toggle('<%= module_name %>')" style="display: none"/>
11 </td> 11 </td>
12 <td> 12 <td>
13 <a href="#" class="module-result-link" data-module-name="<%= module_name %>"> 13 <a href="#" class="module-result-link" data-module-name="<%= module_name %>">
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </a> 15 </a>
16 </td> 16 </td>
17 </tr> 17 </tr>
18 - <tr id="<%= module_name %>_hidden"> 18 + <tr id="<%= module_name %>_hidden" style="display: none">
19 <td></td> 19 <td></td>
20 <td style="text-align: left"> 20 <td style="text-align: left">
21 <% source_tree.children.each do |child| %> 21 <% source_tree.children.each do |child| %>
plugins/mezuro/views/content_viewer/show_project.rhtml
1 -<% @project_content = @page  
2 - @project = @project_content.project %> 1 +<% @project = @page.project %>
3 2
4 -<table id="project_info"> 3 +<table>
5 <tr> 4 <tr>
6 <td><%= _('Name') %></td> 5 <td><%= _('Name') %></td>
7 <td><%= @project.name %></td> 6 <td><%= @project.name %></td>
@@ -30,9 +29,21 @@ @@ -30,9 +29,21 @@
30 29
31 <br /> 30 <br />
32 31
33 -<div id='autoreload' data-profile="<%= @project_content.profile.identifier %>" data-project-id='<%= @project_content.id %>' data-project-name='<%= @project.name %>' data-project-state='<%= @project.state %>'>  
34 -</div>  
35 -  
36 -<script type="text/javascript">  
37 - jQuery(show_autoreload);  
38 -</script> 32 +<% if ! @project.error.nil? %>
  33 + <h3><%= _('ERROR') %></h3>
  34 + <p>
  35 + <%= "State when error ocurred: #{@project.state}" %>
  36 + <br/>
  37 + <% error = @project.error %>
  38 + <%= error.message %>
  39 + <ul>
  40 + <% error.stack_trace.each do |trace| %>
  41 + <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li>
  42 + <% end %>
  43 + </ul>
  44 + </p>
  45 +<% elsif @project.state.end_with?('ING') %>
  46 + <h3><%= _('Service is ') + @project.state.downcase + ' ' + @project.name + '...' %></h3>
  47 +<% elsif @project.state == 'READY' %>
  48 + <%= render :partial => 'content_viewer/project_result', :locals => { :content => @page } %>
  49 +<% end %>
39 \ No newline at end of file 50 \ No newline at end of file