share/views/public/js/rbbt/actions.js in rbbt-rest-1.4.13 vs share/views/public/js/rbbt/actions.js in rbbt-rest-1.5.0

- old
+ new

@@ -58,103 +58,104 @@ } this._update_flag() }, _toogle_track: function(){ - if (this.element.find('ul.controls > li.url.bookmarked').length > 0){ + if (this.element.find('.controls > .url.bookmarked').length > 0){ this._untrack(this._url()); }else{ this._track(); } }, _create: function() { var tool = this var controller = tool.element; - controller.on('click', '> ul.actions li', function(e){ tool._activate_action(this); return false}); - controller.on('click', '> ul.controls > li.reload', function(e){ tool._reload_action(this); return false}); - controller.on('click', '> ul.controls > li.parameters', function(e){ tool._display_parameters(this); return false}); - controller.on('click', '> ul.controls > li.description', function(e){ tool._display_description(this); return false}); - controller.on('click', '> ul.controls > li.pin', function(e){ tool._toggle_pin(this); return false}); - controller.on('click', '> ul.controls > li.url', function(e){ tool._toogle_track(this); return false}); - $('#top_menu .user ul.jobs').on('click', 'a.remove_element', function(){ + controller.on('click', '> .actions .button', function(e){ tool._activate_action(this); return false}); + controller.on('click', '> .controls > .reload', function(e){ tool._reload_action(this); return false}); + controller.on('click', '> .controls > .parameters', function(e){ tool._display_parameters(this); return false}); + controller.on('click', '> .controls > .description', function(e){ tool._display_description(this); return false}); + controller.on('click', '> .controls > .pin', function(e){ tool._toggle_pin(this); return false}); + controller.on('click', '> .controls > .url', function(e){ tool._toogle_track(this); return false}); + $('#top_menu .user .jobs').on('click', 'a.remove_element', function(){ var link = $(this).next('a') tool._untrack(link.attr('href')) }) this.options.controller = controller - this.options.action_controls = controller.find('> ul.controls') - this.options.action_list = controller.find('> ul.actions') + this.options.action_controls = controller.find('> .controls') + this.options.action_list = controller.find('> .actions') this.options.complete = function(jqXHR, textStatus){ var action_controller = tool.options.controller - var action_list_item = action_controller.find('li.loading, li.active') + var action_list_item = action_controller.find('.actions > .loading, .actions > .active') var action_div = action_controller.next('.action_loader'); if (jqXHR.status == 202){ if (action_div.attr('reload-attempts') != '0'){ action_controller.removeClass('active').addClass('loading'); - action_list_item.removeClass('active').addClass('loading'); var response = $(jqXHR.responseText) var stat = response.find('span.status').html() - var message = response.find('ul.step_messages li:first').html() + var message = response.find('.step_messages li:first').html() if (undefined === message){ action_div.html("<span class='loading'>Loading [" + stat + "] ...</span>"); }else{ action_div.html("<span class='loading'>Loading [" + stat + ": " + message + "] ...</span>"); }; } }else{ - action_controller.removeClass('loading').addClass('active'); - action_list_item.removeClass('loading').addClass('active'); + action_controller.removeClass('loading').removeClass('disabled'); + action_list_item.removeClass('loading').removeClass('disabled'); - action_controller.find('ul.controls > li.reload').addClass('active'); + action_controller.find('.controls > .reload').removeClass('disabled'); } var action_div = action_controller.next('.action_loader').first(); - action_controller.find('ul.controls > li.url').addClass('active'); + action_controller.find('.controls > .url').removeClass('disabled'); if (action_div.find('> .action_card > .action_parameters').length > 0){ - action_controller.find('ul.controls > li.parameters').addClass('active'); - action_controller.find('ul.controls > li.pin').addClass('active'); + action_controller.find('.controls > .parameters').removeClass('disabled'); + action_controller.find('.controls > .pin').removeClass('disabled'); }else{ - action_controller.find('ul.controls > li.parameters').removeClass('active'); - action_controller.find('ul.controls > li.pin').removeClass('active'); + action_controller.find('.controls > .parameters').addClass('disabled'); + action_controller.find('.controls > .pin').addClass('disabled'); } if (action_div.find('> .action_card > .action_description').length > 0){ - action_controller.find('ul.controls > li.description').addClass('active'); + action_controller.find('.controls > .description').addClass('disabled'); }else{ - action_controller.find('ul.controls > li.description').removeClass('active'); + action_controller.find('.controls > .description').addClass('disabled'); } } this._load(); this._update_jobs(); }, _update_flag: function(){ if ($.inArray(this._url(), this.options.bookmarked) != -1){ - $(this.element).find('> ul.controls > li.url').addClass('bookmarked') + $(this.element).find('> .controls > .url').addClass('bookmarked') }else{ - $(this.element).find('> ul.controls > li.url').removeClass('bookmarked') + $(this.element).find('> .controls > .url').removeClass('bookmarked') } }, _activate_action: function(e){ var action_list_item = $(e) - var action_list = action_list_item.parent('ul.actions'); + var action_list = action_list_item.parent('.actions'); var link = action_list_item.find('> a') + link = action_list_item + this._load_action(link); var action = link.html() if (this.options.saved[action] !== undefined){ - $(this.element).find('> ul.controls > li.pin').addClass('saved') + $(this.element).find('> .controls > .pin').addClass('saved') }else{ - $(this.element).find('> ul.controls > li.pin').removeClass('saved') + $(this.element).find('> .controls > .pin').removeClass('saved') } this._update_flag() action_list.addClass('active'); @@ -162,26 +163,26 @@ return false }, _unpin_parameters: function(){ var controller = $(this.element) - var action = controller.find('ul.actions li.active a').first().html() + var action = controller.find('.actions .active a').first().html() this.options.saved[action] = undefined - controller.find('> ul.controls > li.pin').removeClass('saved') + controller.find('> .controls > .pin').removeClass('saved') }, _pin_parameters: function(){ var controller = $(this.element) - var action = $(this.element).find('ul.actions li.active a').first().html() + var action = $(this.element).find('.actions .active a').first().html() var loader = $(this.element).next('.action_loader').first(); this.options.saved[action] = loader.attr('form-params') - controller.find('> ul.controls > li.pin').addClass('saved') + controller.find('> .controls > .pin').addClass('saved') this._dump() }, _toggle_pin: function(){ - var action = $(this.element).find('ul.actions li.active a').first().html() + var action = $(this.element).find('.actions .active a').first().html() if (this.options.saved[action] != undefined){ this._unpin_parameters(); }else{ this._pin_parameters(); @@ -211,11 +212,11 @@ _reload_action: function(e){ if(! $(e).hasClass('active')){ return false} var action_list_item = $(e); - var action_list = action_list_item.parent('ul.controls'); + 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(); if (action_div.attr('target-href') != undefined){ update_embedded(action_div, true, this.options.complete) @@ -259,15 +260,17 @@ return false }, _load_action: function(link){ - var action_list_item = link.parent('li'); - var action_list = action_list_item.parent('ul'); + var action_list_item = link.parent('.button'); + action_list_item = link + var action_list = action_list_item.parent('.menu'); var action_controller = action_list.parents('.action_controller').first(); var action_div = action_controller.next('.action_loader'); var href = link.attr('href') + href = add_parameter(href, '_layout', 'false') var action = link.html() var saved = this.options.saved[action] if (undefined !== saved){ @@ -275,14 +278,15 @@ } if( ! action_div.hasClass('reloading') ) { action_div.removeClass('active'); - action_controller.find('ul.controls > li.reload').removeClass('active'); - action_controller.find('ul.controls > li.parameters').removeClass('active'); - action_list.find('li').removeClass('active').removeClass('loading'); - action_list_item.addClass('loading'); + action_controller.find('.controls > .reload').removeClass('active'); + action_controller.find('.controls > .parameters').removeClass('active'); + action_list.find('.button').removeClass('active').removeClass('loading'); + action_list_item.addClass('active'); action_controller.addClass('loading'); + replace_object(action_div, href, true, this.options.complete); return false } }