PHP Classes

File: Application/Module/Core/Public/Js/admin_language.js

Recommend this page to a friend!
  Classes of Duong Huynh Nghia   Lego PHP   Application/Module/Core/Public/Js/admin_language.js   Download  
File: Application/Module/Core/Public/Js/admin_language.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lego PHP
Blog and shopping cart system
Author: By
Last change: Update JS & CSS for minifying
Date: 7 years ago
Size: 1,931 bytes
 

Contents

Class file image Download
ADMIN_LANGUAGE = { init: function () { $('.switch-box').bootstrapSwitch({ size: "small" }); $('.switch-box-default').on('switchChange.bootstrapSwitch', function (event, state) { if (state == true) { $('.switch-box-active').bootstrapSwitch('disabled', false); var r = $(this).parent().parent().parent().parent(); r.find('.switch-box-active').bootstrapSwitch('disabled', true); } else { } ADMIN_LANGUAGE.updateLanguages('#language-form-holder'); }); $('.switch-box-active').on('switchChange.bootstrapSwitch', function (event, state) { var r = $(this).parent().parent().parent().parent(); r.find('.switch-box-default').bootstrapSwitch('disabled', !state); ADMIN_LANGUAGE.updateLanguages('#language-form-holder'); }); }, updateLanguages: function (f) { var active_list = []; $('.switch-box-active').each(function (i, e) { var state = $(e).bootstrapSwitch('state'); state = (state) ? 1 : 0; active_list.push($(e).attr('rel') + '-' + state); }); var is_default = 0; $('.switch-box-default').each(function (i, e) { var state = $(e).bootstrapSwitch('state'); if (state == true) { is_default = $(e).attr('rel'); } }); $.ajax({ url: CORE.params['sBaseAdminUrl'] + 'core/language/updateAll', data: { is_default: is_default, is_active: active_list }, method: 'POST', dataType: 'JSON' }).done(function () { DEFAULT_UPDATE = false; }).error(function () { DEFAULT_UPDATE = false; }); } }; $(document).ready(function () { ADMIN_LANGUAGE.init(); });