diff --git a/resources/assets/js/directives.js b/resources/assets/js/directives.js
index 28c4f6e17..0ff7c0fcc 100644
--- a/resources/assets/js/directives.js
+++ b/resources/assets/js/directives.js
@@ -4,36 +4,6 @@ import markdown from "marked";
export default function (ngApp, events) {
- /**
- * Toggle Switches
- * Has basic on/off functionality.
- * Use string values of 'true' & 'false' to dictate the current state.
- */
- ngApp.directive('toggleSwitch', function () {
- return {
- restrict: 'A',
- template: `
-
- `,
- scope: true,
- link: function (scope, element, attrs) {
- scope.name = attrs.name;
- scope.value = attrs.value;
- scope.isActive = scope.value == true && scope.value != 'false';
- scope.value = (scope.value == true && scope.value != 'false') ? 'true' : 'false';
-
- scope.switch = function () {
- scope.isActive = !scope.isActive;
- scope.value = scope.isActive ? 'true' : 'false';
- }
-
- }
- };
- });
-
/**
* Common tab controls using simple jQuery functions.
*/
diff --git a/resources/assets/js/global.js b/resources/assets/js/global.js
index 0f2bbbf20..537a43a4e 100644
--- a/resources/assets/js/global.js
+++ b/resources/assets/js/global.js
@@ -149,6 +149,18 @@ $(function () {
window.open($(this).attr('href'));
});
+ // Toggle Switches
+ let $switches = $('[toggle-switch]');
+ if ($switches.length > 0) {
+ $switches.click(event => {
+ let $switch = $(event.target);
+ let input = $switch.find('input').first()[0];
+ let checked = input.value !== 'true';
+ input.value = checked ? 'true' : 'false';
+ $switch.toggleClass('active', checked);
+ });
+ }
+
// Detect IE for css
if(navigator.userAgent.indexOf('MSIE')!==-1
|| navigator.appVersion.indexOf('Trident/') > 0
diff --git a/resources/assets/sass/_forms.scss b/resources/assets/sass/_forms.scss
index 4e643dcda..62a7b4001 100644
--- a/resources/assets/sass/_forms.scss
+++ b/resources/assets/sass/_forms.scss
@@ -267,9 +267,4 @@ input.outline {
.image-picker img {
background-color: #BBB;
-}
-
-div[toggle-switch] {
- height: 18px;
- width: 150px;
}
\ No newline at end of file
diff --git a/resources/views/components/toggle-switch.blade.php b/resources/views/components/toggle-switch.blade.php
new file mode 100644
index 000000000..b20b74d5e
--- /dev/null
+++ b/resources/views/components/toggle-switch.blade.php
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php
index 8ad219507..2e9d5ce8c 100644
--- a/resources/views/settings/index.blade.php
+++ b/resources/views/settings/index.blade.php
@@ -23,16 +23,16 @@