MDL-59382 calendar: fix CiBoT warnings
authorRyan Wyllie <ryan@moodle.com>
Thu, 3 Aug 2017 01:07:01 +0000 (01:07 +0000)
committerRyan Wyllie <ryan@moodle.com>
Thu, 3 Aug 2017 01:07:01 +0000 (01:07 +0000)
calendar/amd/build/event_form.min.js
calendar/amd/src/calendar.js
calendar/amd/src/event_form.js
calendar/amd/src/modal_event_form.js
calendar/amd/src/summary_modal.js
lib/grouplib.php
theme/bootstrapbase/less/bootstrap/variables.less
theme/bootstrapbase/less/moodle.less
theme/bootstrapbase/less/moodle/modal.less
theme/bootstrapbase/less/moodle/variables.less [new file with mode: 0644]

index 8d2d5d6..49c3a88 100644 (file)
Binary files a/calendar/amd/build/event_form.min.js and b/calendar/amd/build/event_form.min.js differ
index a76db0e..1843984 100644 (file)
@@ -187,9 +187,15 @@ define([
 
         // TODO: Replace these with actual logic to update
         // the UI without having to force a page reload.
-        body.on(CalendarEvents.created, function() { window.location.reload(); });
-        body.on(CalendarEvents.deleted, function() { window.location.reload(); });
-        body.on(CalendarEvents.updated, function() { window.location.reload(); });
+        body.on(CalendarEvents.created, function() {
+            window.location.reload();
+        });
+        body.on(CalendarEvents.deleted, function() {
+            window.location.reload();
+        });
+        body.on(CalendarEvents.updated, function() {
+            window.location.reload();
+        });
 
         eventFormModalPromise.then(function(modal) {
             // When something within the calendar tells us the user wants
index 6fbd3ea..e62ee63 100644 (file)
@@ -131,7 +131,7 @@ define(['jquery', 'core/templates'], function($, Templates) {
         formElement.find(SELECTORS.EVENT_GROUP_ID)
             .find(SELECTORS.SELECT_OPTION)
             .each(function(index, element) {
-                var element = $(element);
+                element = $(element);
                 var value = element.attr('value');
                 var splits = value.split('-');
                 var courseId = splits[0];
index 64d675a..bad5ca4 100644 (file)
@@ -146,6 +146,7 @@ define([
         this.moreLessButton.attr('data-collapsed', 'true');
         Str.get_string('more', 'calendar').then(function(string) {
             this.moreLessButton.text(string);
+            return;
         }.bind(this));
     };
 
@@ -159,6 +160,7 @@ define([
         this.moreLessButton.attr('data-collapsed', 'false');
         Str.get_string('less', 'calendar').then(function(string) {
             this.moreLessButton.text(string);
+            return;
         }.bind(this));
     };
 
@@ -356,6 +358,8 @@ define([
                         $('body').trigger(CalendarEvents.created, [response.event]);
                     }
                 }
+
+                return;
             }.bind(this))
             .always(function() {
                 // Regardless of success or error we should always stop
index 1b44f8d..b758f45 100644 (file)
@@ -107,7 +107,9 @@ define(['jquery', 'core/str', 'core/notification', 'core/custom_interaction_even
         Modal.prototype.registerEventListeners.call(this);
 
         var confirmPromise = ModalFactory.create(
-            { type: ModalFactory.types.CONFIRM },
+            {
+                type: ModalFactory.types.CONFIRM
+            },
             this.getDeleteButton()
         ).then(function(modal) {
             modal.getRoot().on(ModalEvents.yes, function() {
index cd48e62..8893d13 100644 (file)
@@ -352,46 +352,45 @@ function groups_get_all_groups_for_courses($courses) {
 
     $results = $DB->get_records_sql($sql, $params);
 
-    /** 
-     * The results will come back as a flat dataset thanks to the left
-     * join so we will need to do some post processing to blow it out
-     * into a more usable data structure.
-     *
-     * This loop will extract the distinct groups from the result set
-     * and add it's list of members to the object as a property called
-     * 'members'. Then each group will be added to the result set indexed
-     * by it's course id.
-     *
-     * The resulting data structure for $groups should be:
-     * $groups = [
-     *      '1' = [
-     *          '1' => (object) [
-     *              'id' => 1,
-     *              <rest of group properties>
-     *              'members' => [
-     *                  '1' => (object) [
-     *                      <group member properties>
-     *                  ],
-     *                  '2' => (object) [
-     *                      <group member properties>
-     *                  ]
-     *              ]
-     *          ],
-     *          '2' => (object) [
-     *              'id' => 2,
-     *              <rest of group properties>
-     *              'members' => [
-     *                  '1' => (object) [
-     *                      <group member properties>
-     *                  ],
-     *                  '3' => (object) [
-     *                      <group member properties>
-     *                  ]
-     *              ]
-     *          ]
-     *      ]
-     * ]
-     */
+    // The results will come back as a flat dataset thanks to the left
+    // join so we will need to do some post processing to blow it out
+    // into a more usable data structure.
+    //
+    // This loop will extract the distinct groups from the result set
+    // and add it's list of members to the object as a property called
+    // 'members'. Then each group will be added to the result set indexed
+    // by it's course id.
+    //
+    // The resulting data structure for $groups should be:
+    // $groups = [
+    //      '1' = [
+    //          '1' => (object) [
+    //              'id' => 1,
+    //              <rest of group properties>
+    //              'members' => [
+    //                  '1' => (object) [
+    //                      <group member properties>
+    //                  ],
+    //                  '2' => (object) [
+    //                      <group member properties>
+    //                  ]
+    //              ]
+    //          ],
+    //          '2' => (object) [
+    //              'id' => 2,
+    //              <rest of group properties>
+    //              'members' => [
+    //                  '1' => (object) [
+    //                      <group member properties>
+    //                  ],
+    //                  '3' => (object) [
+    //                      <group member properties>
+    //                  ]
+    //              ]
+    //          ]
+    //      ]
+    // ]
+    //
     foreach ($results as $key => $result) {
         $groupid = $result->gid;
         $courseid = $result->courseid;
index 934de95..a9b4591 100644 (file)
 @zindexFixedNavbar:       1030;
 @zindexModalBackdrop:     1040;
 @zindexModal:             1050;
-@zindexModalContainer:    4050;
 
 // Sprite icons path
 // -------------------------
index 0a980d0..0bc21d0 100644 (file)
@@ -3,6 +3,9 @@
 @import "fontawesome/font-awesome";
 @import "fontawesome/moodle-path";
 
+// Import the Moodle variables.
+@import "moodle/variables.less";
+
 // Old Moodle stuff from base theme.
 // Massive, needs broken up.
 @import "moodle/core";
index 819acc1..32f89c1 100644 (file)
@@ -105,7 +105,7 @@ body {
 }
 
 .modal-backdrop {
-    z-index: 4049;
+    z-index: @zindexModalContainerBackdrop;
     background-color: #aaa;
     opacity: 0.4;
 }
diff --git a/theme/bootstrapbase/less/moodle/variables.less b/theme/bootstrapbase/less/moodle/variables.less
new file mode 100644 (file)
index 0000000..b86ad2f
--- /dev/null
@@ -0,0 +1,7 @@
+// Global variables for use within Moodle's less style sheets.
+// These should be unique and not override the variables defined
+// in Bootstrap.
+
+@zindexModalContainer: 4050;
+@zindexModalContainerBackdrop: 4049;
+