Commit c32aa8a5d652a92d7b84f26576099ec20576ed8a

Authored by Caio, Pedro
Committed by Paulo Meireles
1 parent 817c7dae

[mezuro] now all ajax process have loading flags

plugins/mezuro/public/javascripts/project_content.js
  1 +var processingTree = false;
1 2 jQuery(function (){
2 3 jQuery('.source-tree-link').live("click", reloadModule);
3 4 showProjectContent();
... ... @@ -9,6 +10,8 @@ function showProjectContent() {
9 10  
10 11 function reloadModule(){
11 12 var module_name = jQuery(this).attr('data-module-name');
  13 + showLoadingProcess();
  14 + processingTree = true;
12 15 callAction('project_tree', {module_name: module_name }, showProjectTree);
13 16 callAction('module_result', {module_name: module_name}, showModuleResult);
14 17 return false;
... ... @@ -41,11 +44,14 @@ function showProjectResult(content) {
41 44 }
42 45  
43 46 function showProjectTree(content){
  47 + processingTree = false;
44 48 jQuery('#project-tree').html(content);
45 49 }
46 50  
47 51 function showModuleResult(content){
48   - jQuery('#module-result').html(content);
  52 + if (processingTree != true){
  53 + jQuery('#module-result').html(content);
  54 + }
49 55 }
50 56  
51 57 function callAction(action, params, callback){
... ... @@ -58,3 +64,8 @@ function callAction(action, params, callback){
58 64 function projectContentData(data){
59 65 return jQuery('#project-result').attr('data-' + data);
60 66 }
  67 +
  68 +function showLoadingProcess(){
  69 + showProjectTree("<img src='/images/loading-small.gif'/>");
  70 + showModuleResult("<img src='/images/loading-small.gif'/>");
  71 +}
... ...
plugins/mezuro/views/content_viewer/show_project.rhtml
... ... @@ -31,7 +31,8 @@
31 31 <br />
32 32  
33 33 <div id="project-result" data-profile="<%= @page.profile.identifier %>" data-content="<%= @page.id %>">
34   - <h3><%= _('Processing ') + @project.name + '...' %></h3>
35 34 </div>
36 35 <div id="project-tree"></div>
37   -<div id="module-result"></div>
  36 +<div id="module-result">
  37 + <h3><%= _('Processing ') + @project.name + '...' %></h3>
  38 +</div>
... ...