share/views/public/js/rbbt/actions.js in rbbt-rest-1.8.140 vs share/views/public/js/rbbt/actions.js in rbbt-rest-1.8.142

- old
+ new

@@ -87,11 +87,11 @@ this.options.action_list = controller.find('> .action_menu') this.options.complete = function(jqXHR, textStatus){ var action_controller = tool.options.controller var action_list_item = action_controller.find('.action_menu > .loading, .action_menu > .active') - var action_div = action_controller.next('.action_loader'); + var action_div = tool._loader(); if (jqXHR.status == 202){ if (action_div.attr('reload-attempts') != '0'){ action_controller.removeClass('active').addClass('loading'); @@ -99,22 +99,22 @@ var stat = response.find('span.status').html() var message = response.find('.step_messages li:first').html() var progress = response.find('.step.progress') text = [$('<div class="header">').html(stat), $('<div class="content">').html(message)] - action_controller.find('> .action_progress').html("").append(text).append(progress); + action_controller.siblings('.action_progress').html("").append(text).append(progress); update_rbbt() } }else{ - action_controller.find('> .action_progress').html(""); + action_controller.siblings('.action_progress').html(""); action_controller.removeClass('loading').removeClass('disabled'); action_list_item.removeClass('loading').removeClass('disabled'); action_controller.find('.controls > .reload').removeClass('disabled'); } - var action_div = action_controller.next('.action_loader').first(); + var action_div = tool._loader(); action_controller.find('.controls > .url').removeClass('disabled'); if (action_div.find('> .action_card > .action_parameters').length > 0){ action_controller.find('.controls > .parameters').removeClass('disabled'); action_controller.find('.controls > .pin').removeClass('disabled'); }else{ @@ -145,10 +145,13 @@ var action_list = action_list_item.parent('.action_menu'); var link = action_list_item.find('> a') link = action_list_item + var action_controller = this.options.controller; + action_controller.find('.controls > .reload').addClass('disabled'); + this._load_action(link); var action = link.html() if (this.options.saved[action] !== undefined){ $(this.element).find('> .controls > .pin').addClass('saved') @@ -171,11 +174,11 @@ }, _pin_parameters: function(){ var controller = $(this.element) var action = $(this.element).find('.action_menu .active a').first().html() - var loader = $(this.element).next('.action_loader').first(); + var loader = this._loader(); this.options.saved[action] = loader.attr('form-params') controller.find('> .controls > .pin').addClass('saved') this._dump() }, @@ -188,22 +191,22 @@ this._pin_parameters(); } }, _loader: function(){ - return $(this.element).next('.action_loader') + return $(this.element).siblings('.action_loader').first(); }, _url: function(){ var url = this._loader().attr('target-href'); if (undefined === url){ return url} return unescape(remove_parameter(url, '_')) }, _open_url: function(){ - var action_controller = this.element - var action_div = action_controller.next('.action_loader').first(); + var action_controller = this.element; + var action_div = this._loader(); if (this._url() !== undefined){ window.location = this._url(); } @@ -214,12 +217,16 @@ _reload_action: function(e){ if($(e).hasClass('disabled')){ return false} var action_list_item = $(e); var action_list = action_list_item.parent('.controls'); var action_controller = action_list.parent('.action_controller'); - var action_div = action_controller.next('.action_loader').first(); + var action_div = this._loader(); + action_div.html(""); + + action_controller.find('.controls > .reload').addClass('disabled'); + if (action_div.attr('target-href') != undefined){ update_embedded(action_div, true, this.options.complete) } return false @@ -227,11 +234,11 @@ _display_parameters: function(e){ if(! $(e).hasClass('active')){ return false} var link = $(e); var action_controller = link.parents('.action_controller').first() - var action_loader = action_controller.next('.action_loader').first(); + var action_loader = this._loader(); var action_parameters = action_loader.find('.action_parameters').first(); var action_description = action_loader.find('.action_description').first(); var action_content = action_parameters.next('.action_content').first(); action_parameters.toggleClass('active'); @@ -245,11 +252,11 @@ _display_description: function(e){ if(! $(e).hasClass('active')){ return false} var link = $(e); var action_controller = link.parents('.action_controller').first() - var action_loader = action_controller.next('.action_loader').first(); + var action_loader = this._loader(); var action_parameters = action_loader.find('.action_parameters').first(); var action_description = action_loader.find('.action_description').first(); var action_content = action_parameters.next('.action_content').first(); action_description.toggleClass('active'); @@ -264,12 +271,14 @@ _load_action: function(link){ var action_list_item = link.parent('.button'); action_list_item = link var action_list = action_list_item.parent('.action_menu'); var action_controller = action_list.parents('.action_controller').first(); - var action_div = action_controller.next('.action_loader'); + var action_div = this._loader(); var href = link.attr('href') href = add_parameter(href, '_layout', 'false') + + action_div.html(""); var action = link.html() var saved = this.options.saved[action] if (undefined !== saved){