Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

Commit

Permalink
Improved javascript to show notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
tonipinel committed May 26, 2015
1 parent 323e780 commit d573ab1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ FrontendCore.define('on-off-table', ['devicePackage' ], function () {

setTimeout( function() {

$('#table-loading').fadeOut('fast', function() {
$('#current-table').fadeIn();
});

$('.switch input').change( function() {

var sUrl = this.checked === true ? document.getElementById('enable-' + this.id).value : document.getElementById('disable-' + this.id).value ;

$.ajax({
url: sUrl,
type: 'post'
}).done( function( response ) {
FrontendCore.requireAndStart('notification');

setTimeout( function(){
FrontendMediator.publish( 'notification', { type : 'ok', message: response.message } );
}, 500);
}).fail( function( response ) {
FrontendCore.requireAndStart('notification');

setTimeout( function(){
FrontendMediator.publish( 'notification', { type : 'ko', message: response.message } );
}, 500);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="switch">
<input id="enable-{{ entity.iso }}-master" type="hidden" value="{{ url('admin_language_enable', { iso: entity.iso }) }}" />
<input id="disable-{{ entity.iso }}-master" type="hidden" value="{{ url('admin_language_disable', { iso: entity.iso }) }}" />
<input id="{{ entity.iso }}-master" name="language-master" type="radio" {% if entity.enabled %}checked="checked"{% endif %} />
<input id="{{ entity.iso }}-master" name="language-master" type="radio" {% if entity.iso == elcodi_config('store.default_language') %}checked="checked"{% endif %} />
<label for="{{ entity.iso }}-master"></label>
</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@


{% block content %}
<p id="table-loading" class="ta-c fz-xxl animated bounce-in"><i class="icon-circle-o-notch icon-spin" data-fc-modules="on-off-table"></i></p>
<div id="current-table" style="display: none">
<div class="loading">
{{ render(url('admin_language_list_component')) }}
</div>
{% endblock content %}

0 comments on commit d573ab1

Please sign in to comment.