From 45b3f8878376ccc14ac58714ee70a69a30d10d0e Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 29 Nov 2016 00:36:35 -0500 Subject: [PATCH] Calendar uses new sidebar --- admin/calendar.php | 116 +++++++++--------- css/mods-for-hesk-new.css | 10 ++ .../mods-for-hesk-calendar-admin-readonly.js | 18 ++- js/calendar/mods-for-hesk-calendar.js | 16 ++- 4 files changed, 92 insertions(+), 68 deletions(-) diff --git a/admin/calendar.php b/admin/calendar.php index b2969ceb..d78c81b6 100644 --- a/admin/calendar.php +++ b/admin/calendar.php @@ -68,7 +68,7 @@ while ($row = hesk_dbFetchAssoc($rs)) { continue; } - $row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000;' : 'background: ' . $row['color']; + $row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000;' : 'border: solid 1px ' . $row['color'] . '; background: ' . $row['color']; $categories[] = $row; } @@ -78,67 +78,69 @@ require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); /* Print main manage users page */ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> -
-
-
-
-
-
-

- -

-
- +
-
-
-

- -

-
- -
+ +
  • +
    +
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    +
  • +
  • +
    +
    -
  • -
    -
    + + +
    + +
    +
    +
    +

    diff --git a/css/mods-for-hesk-new.css b/css/mods-for-hesk-new.css index 2a69b998..56082174 100644 --- a/css/mods-for-hesk-new.css +++ b/css/mods-for-hesk-new.css @@ -236,4 +236,14 @@ div.ticket-info { color: #b8c7ce; padding: 12px 5px 12px 15px; display: block; +} + +.event-category:hover { + border: solid 1px #fff !important; + cursor: pointer; +} + +.event-category[data-checked="0"] { + background: #777 !important; + color: #aaa !important; } \ No newline at end of file diff --git a/js/calendar/mods-for-hesk-calendar-admin-readonly.js b/js/calendar/mods-for-hesk-calendar-admin-readonly.js index 406a87c6..4fe3686b 100644 --- a/js/calendar/mods-for-hesk-calendar-admin-readonly.js +++ b/js/calendar/mods-for-hesk-calendar-admin-readonly.js @@ -100,7 +100,7 @@ $(document).ready(function() { } }); - $('input[name="category-toggle"]').change(updateCategoryVisibility); + $('div[data-name="category-toggle"]').click(updateCategoryVisibility); }); function buildEvent(id, dbObject) { @@ -186,13 +186,19 @@ function calculateTextColor(color) { } function updateCategoryVisibility() { - $('input[name="category-toggle"]').each(function() { - $this = $(this); + if ($(this).attr('data-checked') == '1') { + $(this).attr('data-checked', 0); + } else { + $(this).attr('data-checked', 1); + } + + $('div[data-name="category-toggle"]').each(function() { + var $this = $(this); - if ($this.is(':checked')) { - $('.category-' + $this.val()).show(); + if ($this.attr('data-checked') == '1') { + $('.category-' + $this.attr('data-category-value')).show(); } else { - $('.category-' + $this.val()).hide(); + $('.category-' + $this.attr('data-category-value')).hide(); } }); } \ No newline at end of file diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js index 3b8f3162..cdbff838 100644 --- a/js/calendar/mods-for-hesk-calendar.js +++ b/js/calendar/mods-for-hesk-calendar.js @@ -253,7 +253,7 @@ $(document).ready(function() { }); }); - $('input[name="category-toggle"]').change(updateCategoryVisibility); + $('div[data-name="category-toggle"]').click(updateCategoryVisibility); }); function addToCalendar(id, event, successMessage) { @@ -431,13 +431,19 @@ function displayEditModal(date) { } function updateCategoryVisibility() { - $('input[name="category-toggle"]').each(function() { + if ($(this).attr('data-checked') == '1') { + $(this).attr('data-checked', 0); + } else { + $(this).attr('data-checked', 1); + } + + $('div[data-name="category-toggle"]').each(function() { var $this = $(this); - if ($this.is(':checked')) { - $('.category-' + $this.val()).show(); + if ($this.attr('data-checked') == '1') { + $('.category-' + $this.attr('data-category-value')).show(); } else { - $('.category-' + $this.val()).hide(); + $('.category-' + $this.attr('data-category-value')).hide(); } }); }