Commit c32aa8a5d652a92d7b84f26576099ec20576ed8a
Committed by
Paulo Meireles
1 parent
817c7dae
Exists in
staging
and in
42 other branches
[mezuro] now all ajax process have loading flags
Showing
2 changed files
with
15 additions
and
3 deletions
Show diff stats
plugins/mezuro/public/javascripts/project_content.js
| 1 | +var processingTree = false; | ||
| 1 | jQuery(function (){ | 2 | jQuery(function (){ |
| 2 | jQuery('.source-tree-link').live("click", reloadModule); | 3 | jQuery('.source-tree-link').live("click", reloadModule); |
| 3 | showProjectContent(); | 4 | showProjectContent(); |
| @@ -9,6 +10,8 @@ function showProjectContent() { | @@ -9,6 +10,8 @@ function showProjectContent() { | ||
| 9 | 10 | ||
| 10 | function reloadModule(){ | 11 | function reloadModule(){ |
| 11 | var module_name = jQuery(this).attr('data-module-name'); | 12 | var module_name = jQuery(this).attr('data-module-name'); |
| 13 | + showLoadingProcess(); | ||
| 14 | + processingTree = true; | ||
| 12 | callAction('project_tree', {module_name: module_name }, showProjectTree); | 15 | callAction('project_tree', {module_name: module_name }, showProjectTree); |
| 13 | callAction('module_result', {module_name: module_name}, showModuleResult); | 16 | callAction('module_result', {module_name: module_name}, showModuleResult); |
| 14 | return false; | 17 | return false; |
| @@ -41,11 +44,14 @@ function showProjectResult(content) { | @@ -41,11 +44,14 @@ function showProjectResult(content) { | ||
| 41 | } | 44 | } |
| 42 | 45 | ||
| 43 | function showProjectTree(content){ | 46 | function showProjectTree(content){ |
| 47 | + processingTree = false; | ||
| 44 | jQuery('#project-tree').html(content); | 48 | jQuery('#project-tree').html(content); |
| 45 | } | 49 | } |
| 46 | 50 | ||
| 47 | function showModuleResult(content){ | 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 | function callAction(action, params, callback){ | 57 | function callAction(action, params, callback){ |
| @@ -58,3 +64,8 @@ function callAction(action, params, callback){ | @@ -58,3 +64,8 @@ function callAction(action, params, callback){ | ||
| 58 | function projectContentData(data){ | 64 | function projectContentData(data){ |
| 59 | return jQuery('#project-result').attr('data-' + data); | 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,7 +31,8 @@ | ||
| 31 | <br /> | 31 | <br /> |
| 32 | 32 | ||
| 33 | <div id="project-result" data-profile="<%= @page.profile.identifier %>" data-content="<%= @page.id %>"> | 33 | <div id="project-result" data-profile="<%= @page.profile.identifier %>" data-content="<%= @page.id %>"> |
| 34 | - <h3><%= _('Processing ') + @project.name + '...' %></h3> | ||
| 35 | </div> | 34 | </div> |
| 36 | <div id="project-tree"></div> | 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> |