From 0b2a3843bde6a4638a87be24b53d6c1a909c9985 Mon Sep 17 00:00:00 2001 From: Carlos Morais Date: Wed, 15 Feb 2012 22:59:21 -0200 Subject: [PATCH] Refactoring views --- plugins/mezuro/public/javascripts/autoreload.js | 2 +- plugins/mezuro/public/style.css | 2 +- plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb | 2 +- plugins/mezuro/views/content_viewer/_project_result.rhtml | 67 ++++++++++++++++++++++++------------------------------------------- plugins/mezuro/views/content_viewer/_source_tree.rhtml | 6 +++--- plugins/mezuro/views/content_viewer/show_project.rhtml | 29 ++++++++++++++++++++--------- 6 files changed, 50 insertions(+), 58 deletions(-) diff --git a/plugins/mezuro/public/javascripts/autoreload.js b/plugins/mezuro/public/javascripts/autoreload.js index 0715091..89aeb11 100644 --- a/plugins/mezuro/public/javascripts/autoreload.js +++ b/plugins/mezuro/public/javascripts/autoreload.js @@ -20,4 +20,4 @@ function show_page_with_results(content){ show_autoreload(jQuery); }, wait * 1000); } -} +} \ No newline at end of file diff --git a/plugins/mezuro/public/style.css b/plugins/mezuro/public/style.css index 4de2797..ed1e524 100644 --- a/plugins/mezuro/public/style.css +++ b/plugins/mezuro/public/style.css @@ -1,3 +1,3 @@ .link { cursor: pointer; -} +} \ No newline at end of file diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb index 33e0b6e..175bcf5 100644 --- a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb +++ b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb @@ -2,7 +2,7 @@ <% begin - @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.new.project(@article.title) + @project = @article.title.nil? ? nil : Kalibro::Client::ProjectClient.project(@article.title) rescue @project = nil end diff --git a/plugins/mezuro/views/content_viewer/_project_result.rhtml b/plugins/mezuro/views/content_viewer/_project_result.rhtml index 5d44274..c852653 100644 --- a/plugins/mezuro/views/content_viewer/_project_result.rhtml +++ b/plugins/mezuro/views/content_viewer/_project_result.rhtml @@ -1,48 +1,29 @@ -<% if ! @project_content.project.error.nil? %> -

<%= _('ERROR') %>

-

- <%= "State when error ocurred: #{@project_content.project.state}" %> -
- <% error = @project_content.project.error %> - <%= error.message %> -

-

-<% elsif @project_content.project.state.end_with?('ING') %> - - <%= _("Loading results for %s ...") % @project_content.project.name %> +<% @project_result = content.project_result %> -<% elsif @project_content.project.state == 'READY' %> - -

<%= _('LAST RESULT') %>

- <% @project_result = @project_content.project_result %> +

<%= _('LAST RESULT') %>

- - - - - - - - - - - - - -
<%= _('Date') %><%= @project_result.date %>
<%= _('Load time') %><%= @project_result.formatted_load_time %>
<%= _('Analysis time') %><%= @project_result.formatted_analysis_time %>
+ + + + + + + + + + + + + +
<%= _('Date') %><%= @project_result.date %>
<%= _('Load time') %><%= @project_result.formatted_load_time %>
<%= _('Analysis time') %><%= @project_result.formatted_analysis_time %>
-
<%= _('Source tree') %>
+

<%= _('Source tree') %>

+<%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => @project_result.source_tree } %> - <%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => @project_result.source_tree } %> +
+ <%= render :partial => 'content_viewer/module_result', :locals => { :module_result => content.module_result(content.project.name) } %> +
-
- <%= render :partial => 'content_viewer/module_result', :locals => { :module_result => @project_content.module_result(@project_content.project.name) } %> -
- - - -<% end %>. + \ No newline at end of file diff --git a/plugins/mezuro/views/content_viewer/_source_tree.rhtml b/plugins/mezuro/views/content_viewer/_source_tree.rhtml index 773375c..fa561cf 100644 --- a/plugins/mezuro/views/content_viewer/_source_tree.rhtml +++ b/plugins/mezuro/views/content_viewer/_source_tree.rhtml @@ -5,9 +5,9 @@ + id="<%= module_name %>_plus" onclick="toggle('<%= module_name %>')"/> - + id="<%= module_name %>_minus" onclick="toggle('<%= module_name %>')" style="display: none"/> @@ -15,7 +15,7 @@ - + <% source_tree.children.each do |child| %> diff --git a/plugins/mezuro/views/content_viewer/show_project.rhtml b/plugins/mezuro/views/content_viewer/show_project.rhtml index 985fb9e..3d46306 100644 --- a/plugins/mezuro/views/content_viewer/show_project.rhtml +++ b/plugins/mezuro/views/content_viewer/show_project.rhtml @@ -1,7 +1,6 @@ -<% @project_content = @page - @project = @project_content.project %> +<% @project = @page.project %> - +
@@ -30,9 +29,21 @@
-
-
- - +<% if ! @project.error.nil? %> +

<%= _('ERROR') %>

+

+ <%= "State when error ocurred: #{@project.state}" %> +
+ <% error = @project.error %> + <%= error.message %> +

+

+<% elsif @project.state.end_with?('ING') %> +

<%= _('Service is ') + @project.state.downcase + ' ' + @project.name + '...' %>

+<% elsif @project.state == 'READY' %> + <%= render :partial => 'content_viewer/project_result', :locals => { :content => @page } %> +<% end %> \ No newline at end of file -- libgit2 0.21.2
<%= _('Name') %> <%= @project.name %>