Commit e9d92f2c200b8ecd2f96bcc7ddf4c71335c401b5
1 parent
721d793b
Exists in
master
and in
23 other branches
[Mezuro] project result 'auto-load' almost works properly
Showing
5 changed files
with
21 additions
and
17 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
1 | class MezuroPluginProfileController < ProfileController | 1 | class MezuroPluginProfileController < ProfileController |
2 | 2 | ||
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../views') | ||
4 | + | ||
3 | def metrics | 5 | def metrics |
4 | project_content = profile.articles.find(params[:id]) | 6 | project_content = profile.articles.find(params[:id]) |
5 | module_name = params[:module_name] | 7 | module_name = params[:module_name] |
@@ -7,8 +9,7 @@ class MezuroPluginProfileController < ProfileController | @@ -7,8 +9,7 @@ class MezuroPluginProfileController < ProfileController | ||
7 | end | 9 | end |
8 | 10 | ||
9 | def autoreload | 11 | def autoreload |
10 | - page_content = profile.articles.find(params[:id]) | ||
11 | - project_name = params[:project_name] | ||
12 | - render :partial => 'content_viewer/autoreload', :locals => { :project_result => page_content.project_result(project_name) } | 12 | + @project_content = profile.articles.find(params[:id]) |
13 | + render :partial => 'content_viewer/autoreload' | ||
13 | end | 14 | end |
14 | end | 15 | end |
plugins/mezuro/public/javascripts/autoreload.js
@@ -5,15 +5,19 @@ function show_autoreload($){ | @@ -5,15 +5,19 @@ function show_autoreload($){ | ||
5 | var project_name = $('#autoreload').attr('data-project-name'); | 5 | var project_name = $('#autoreload').attr('data-project-name'); |
6 | var endpoint = '/profile/' + profile + '/plugins/mezuro/autoreload/' + project; | 6 | var endpoint = '/profile/' + profile + '/plugins/mezuro/autoreload/' + project; |
7 | 7 | ||
8 | - show_loading_message(project_name); | 8 | + jQuery('#autoreload').html('Loading ...'); // #FIXME |
9 | $.get(endpoint, {project_name: project_name}, show_page_with_results); | 9 | $.get(endpoint, {project_name: project_name}, show_page_with_results); |
10 | return false; | 10 | return false; |
11 | } | 11 | } |
12 | 12 | ||
13 | -function show_loading_message(project_name) { | ||
14 | - jQuery('#autoreload').html("Loading results for " + project_name + "..."); | ||
15 | -} | ||
16 | - | ||
17 | function show_page_with_results(content){ | 13 | function show_page_with_results(content){ |
18 | - jQuery('#autoreload').html(content); | 14 | + var done = true; // FIXME; test the content in some way |
15 | + if (done) { | ||
16 | + jQuery('#autoreload').html(content); | ||
17 | + } else { | ||
18 | + var wait = 10; // FIXME; how many seconds to wait? | ||
19 | + setTimeout(function() { | ||
20 | + show_autoreload(jQuery); | ||
21 | + }, wait * 1000); | ||
22 | + } | ||
19 | } | 23 | } |
plugins/mezuro/views/content_viewer/_autoreload.rhtml
1 | -<% if project_content.project.state == 'READY' %> | 1 | +<% if @project_content.project.state == 'READY' %> |
2 | 2 | ||
3 | <h3><%= _('LAST RESULT') %></h3> | 3 | <h3><%= _('LAST RESULT') %></h3> |
4 | - <% @project_result = project_content.project_result %> | 4 | + <% @project_result = @project_content.project_result %> |
5 | 5 | ||
6 | <table id="project_result_info"> | 6 | <table id="project_result_info"> |
7 | <tr> | 7 | <tr> |
@@ -20,10 +20,10 @@ | @@ -20,10 +20,10 @@ | ||
20 | 20 | ||
21 | <h5><%= _('Source tree') %></h5> | 21 | <h5><%= _('Source tree') %></h5> |
22 | 22 | ||
23 | - <%= render :partial => 'source_tree', :locals => { :source_tree => @project_result.source_tree } %> | 23 | + <%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => @project_result.source_tree } %> |
24 | 24 | ||
25 | - <div id='module-result' data-profile="<%= project_content.profile.identifier %>" data-project-id='<%= project_content.id %>'> | ||
26 | - <%= render :partial => 'module_result', :locals => { :module_result => project_content.module_result(project_content.project.name) } %> | 25 | + <div id='module-result' data-profile="<%= @project_content.profile.identifier %>" data-project-id='<%= @project_content.id %>'> |
26 | + <%= render :partial => 'content_viewer/module_result', :locals => { :module_result => @project_content.module_result(@project_content.project.name) } %> | ||
27 | </div> | 27 | </div> |
28 | 28 | ||
29 | <script type="text/javascript"> | 29 | <script type="text/javascript"> |
@@ -32,6 +32,6 @@ | @@ -32,6 +32,6 @@ | ||
32 | 32 | ||
33 | <% else %> | 33 | <% else %> |
34 | 34 | ||
35 | - Joao Silva estah dormindo ... | 35 | + <%= _("Loading results for %s ...") % project_content.project.name %> |
36 | 36 | ||
37 | <% end %>. | 37 | <% end %>. |
plugins/mezuro/views/content_viewer/_source_tree.rhtml
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
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| %> |
22 | - <%= render :partial => 'source_tree', :locals => { :source_tree => child } %> | 22 | + <%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => child } %> |
23 | <% end %> | 23 | <% end %> |
24 | </td> | 24 | </td> |
25 | </tr> | 25 | </tr> |
plugins/mezuro/views/content_viewer/show_project.rhtml
@@ -44,7 +44,6 @@ | @@ -44,7 +44,6 @@ | ||
44 | <% else %> | 44 | <% else %> |
45 | 45 | ||
46 | <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 %>'> | 46 | <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 %>'> |
47 | - <%= render :partial => 'autoreload', :locals => { :project_content => @project_content } %> | ||
48 | </div> | 47 | </div> |
49 | 48 | ||
50 | <script type="text/javascript"> | 49 | <script type="text/javascript"> |