From 6b6bae7cc56448f2a3fe0f985a3d38320cca1eca Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 8 Jul 2015 17:43:14 -0400 Subject: [PATCH] font awesome checkboxes for acp --- public/less/admin/admin.less | 1 + public/less/admin/general/dashboard.less | 12 ----------- public/less/admin/modules/checkboxes.less | 22 ++++++++++++++++++++ public/src/admin/admin.js | 25 ++++++++++++++++++++++- 4 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 public/less/admin/modules/checkboxes.less diff --git a/public/less/admin/admin.less b/public/less/admin/admin.less index c316ae6e19..2b7801863d 100644 --- a/public/less/admin/admin.less +++ b/public/less/admin/admin.less @@ -16,6 +16,7 @@ @import "./modules/alerts"; @import "./modules/selectable"; +@import "./modules/checkboxes"; .admin { padding-top: 70px; diff --git a/public/less/admin/general/dashboard.less b/public/less/admin/general/dashboard.less index 099717efc5..cf44ceb176 100644 --- a/public/less/admin/general/dashboard.less +++ b/public/less/admin/general/dashboard.less @@ -132,16 +132,4 @@ .motd textarea { width: 100%; } - - #toggle-realtime { - text-align: center; - .fa { - font-size: 21px; - vertical-align: -2px; - } - - .fa-toggle-on { - color: @brand-success; - } - } } \ No newline at end of file diff --git a/public/less/admin/modules/checkboxes.less b/public/less/admin/modules/checkboxes.less new file mode 100644 index 0000000000..f05f1427ca --- /dev/null +++ b/public/less/admin/modules/checkboxes.less @@ -0,0 +1,22 @@ +[type=checkbox] { + display: none; +} + +label { + cursor: pointer; +} + +.checkbox label { + padding-left: 2px; +} + +.admin { + .fa-toggle-on, .fa-toggle-off { + font-size: 21px; + vertical-align: -3px; + } + + .fa-toggle-on { + color: @brand-success; + } +} \ No newline at end of file diff --git a/public/src/admin/admin.js b/public/src/admin/admin.js index f2919ada72..c5cd21d748 100644 --- a/public/src/admin/admin.js +++ b/public/src/admin/admin.js @@ -1,5 +1,5 @@ "use strict"; -/*global define, socket, app, ajaxify, utils, Mousetrap, Hammer, RELATIVE_PATH*/ +/*global define, socket, app, ajaxify, utils, bootbox, Mousetrap, Hammer, RELATIVE_PATH*/ (function() { $(document).ready(function() { @@ -20,6 +20,7 @@ selectMenuItem(data.url); setupHeaderMenu(); setupRestartLinks(); + setupCheckboxes(); }); $('[component="logout"]').on('click', app.logout); @@ -168,4 +169,26 @@ }); }); } + + function setupCheckboxes() { + $('[type=checkbox]').each(function() { + var checkbox = $(this), + checked = checkbox.is(':checked'); + + if (checked) { + checkbox.after(''); + } + else { + checkbox.after(''); + } + }); + + $('[type=checkbox]').change(function() { + var checked = $(this).is(':checked'); + + $(this).siblings('[class*=fa-]').toggleClass('fa-toggle-off', !checked) + .toggleClass('fa-toggle-on', checked); + }); + } + }()); \ No newline at end of file