| 1 | 
           efrain | 
           1 | 
           {{!
  | 
        
        
            | 
            | 
           2 | 
               This file is part of Moodle - http://moodle.org/
  | 
        
        
            | 
            | 
           3 | 
              | 
        
        
            | 
            | 
           4 | 
               Moodle is free software: you can redistribute it and/or modify
  | 
        
        
            | 
            | 
           5 | 
               it under the terms of the GNU General Public License as published by
  | 
        
        
            | 
            | 
           6 | 
               the Free Software Foundation, either version 3 of the License, or
  | 
        
        
            | 
            | 
           7 | 
               (at your option) any later version.
  | 
        
        
            | 
            | 
           8 | 
              | 
        
        
            | 
            | 
           9 | 
               Moodle is distributed in the hope that it will be useful,
  | 
        
        
            | 
            | 
           10 | 
               but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
        
        
            | 
            | 
           11 | 
               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
        
        
            | 
            | 
           12 | 
               GNU General Public License for more details.
  | 
        
        
            | 
            | 
           13 | 
              | 
        
        
            | 
            | 
           14 | 
               You should have received a copy of the GNU General Public License
  | 
        
        
            | 
            | 
           15 | 
               along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  | 
        
        
            | 
            | 
           16 | 
           }}
  | 
        
        
            | 
            | 
           17 | 
           {{!
  | 
        
        
            | 
            | 
           18 | 
               @template core_calendar/upcoming_mini
  | 
        
        
            | 
            | 
           19 | 
              | 
        
        
            | 
            | 
           20 | 
               Calendar upcoming view for blocks.
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
               The purpose of this template is to render the upcoming view for blocks.
  | 
        
        
            | 
            | 
           23 | 
              | 
        
        
            | 
            | 
           24 | 
               Classes required for JS:
  | 
        
        
            | 
            | 
           25 | 
               * none
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
               Data attributes required for JS:
  | 
        
        
            | 
            | 
           28 | 
               * none
  | 
        
        
            | 
            | 
           29 | 
              | 
        
        
            | 
            | 
           30 | 
               Example context (json):
  | 
        
        
            | 
            | 
           31 | 
               {
  | 
        
        
            | 
            | 
           32 | 
               }
  | 
        
        
            | 
            | 
           33 | 
           }}
  | 
        
        
            | 
            | 
           34 | 
           <div class="card-text content calendarwrapper"{{!
  | 
        
        
            | 
            | 
           35 | 
               }} id="month-upcoming-mini-{{uniqid}}"{{!
  | 
        
        
            | 
            | 
           36 | 
               }} data-context-id="{{defaulteventcontext}}"{{!
  | 
        
        
            | 
            | 
           37 | 
               }} data-courseid="{{courseid}}"{{!
  | 
        
        
            | 
            | 
           38 | 
               }} data-categoryid="{{categoryid}}"{{!
  | 
        
        
            | 
            | 
           39 | 
           }}>
  | 
        
        
            | 
            | 
           40 | 
               {{> core/overlay_loading}}
  | 
        
        
            | 
            | 
           41 | 
               {{#events}}
  | 
        
        
            | 
            | 
           42 | 
                   <div{{!
  | 
        
        
            | 
            | 
           43 | 
                       }} class="event d-flex border-bottom pt-2 pb-3"{{!
  | 
        
        
            | 
            | 
           44 | 
                       }} data-eventtype-{{normalisedeventtype}}="1"{{!
  | 
        
        
            | 
            | 
           45 | 
                       }} data-region="event-item"{{!
  | 
        
        
            | 
            | 
           46 | 
                   }}>
  | 
        
        
            | 
            | 
           47 | 
                       <div class="activityiconcontainer small courseicon mr-3">
  | 
        
        
            | 
            | 
           48 | 
                           {{#icon}}
  | 
        
        
            | 
            | 
           49 | 
                           {{#iconurl}}
  | 
        
        
            | 
            | 
           50 | 
                               <img alt="{{alttext}}" title="{{alttext}}" src="{{{ iconurl }}}" class="icon {{iconclass}}">
  | 
        
        
            | 
            | 
           51 | 
                           {{/iconurl}}
  | 
        
        
            | 
            | 
           52 | 
                           {{^iconurl}}
  | 
        
        
            | 
            | 
           53 | 
                               {{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}
  | 
        
        
            | 
            | 
           54 | 
                           {{/iconurl}}
  | 
        
        
            | 
            | 
           55 | 
                           {{/icon}}
  | 
        
        
            | 
            | 
           56 | 
                       </div>
  | 
        
        
            | 
            | 
           57 | 
                       <div class="overflow-auto">
  | 
        
        
            | 
            | 
           58 | 
                           <h6 class="d-flex mb-1">
  | 
        
        
            | 
            | 
           59 | 
                               <a{{!
  | 
        
        
            | 
            | 
           60 | 
                                   }} class="text-truncate"{{!
  | 
        
        
            | 
            | 
           61 | 
                                   }} data-type="event"{{!
  | 
        
        
            | 
            | 
           62 | 
                                   }} data-action="view-event"{{!
  | 
        
        
            | 
            | 
           63 | 
                                   }} data-event-id="{{id}}"{{!
  | 
        
        
            | 
            | 
           64 | 
                                   }} href="{{viewurl}}"{{!
  | 
        
        
            | 
            | 
           65 | 
                                   }} title="{{name}}"{{!
  | 
        
        
            | 
            | 
           66 | 
                               }}>{{{name}}}</a>
  | 
        
        
            | 
            | 
           67 | 
                           </h6>
  | 
        
        
            | 
            | 
           68 | 
                           <div class="date small">{{{formattedtime}}}</div>
  | 
        
        
            | 
            | 
           69 | 
                       </div>
  | 
        
        
            | 
            | 
           70 | 
                   </div>
  | 
        
        
            | 
            | 
           71 | 
               {{/events}}
  | 
        
        
            | 
            | 
           72 | 
               {{^events}}
  | 
        
        
            | 
            | 
           73 | 
                   {{#str}}noupcomingevents, calendar{{/str}}
  | 
        
        
            | 
            | 
           74 | 
               {{/events}}
  | 
        
        
            | 
            | 
           75 | 
           </div>
  | 
        
        
            | 
            | 
           76 | 
           {{#js}}
  | 
        
        
            | 
            | 
           77 | 
           require([
  | 
        
        
            | 
            | 
           78 | 
               'jquery',
  | 
        
        
            | 
            | 
           79 | 
               'core_calendar/selectors',
  | 
        
        
            | 
            | 
           80 | 
               'core_calendar/events',
  | 
        
        
            | 
            | 
           81 | 
           ], function(
  | 
        
        
            | 
            | 
           82 | 
               $,
  | 
        
        
            | 
            | 
           83 | 
               CalendarSelectors,
  | 
        
        
            | 
            | 
           84 | 
               CalendarEvents
  | 
        
        
            | 
            | 
           85 | 
           ) {
  | 
        
        
            | 
            | 
           86 | 
               var root = $('#month-upcoming-mini-{{uniqid}}');
  | 
        
        
            | 
            | 
           87 | 
              | 
        
        
            | 
            | 
           88 | 
               $('body').on(CalendarEvents.filterChanged, function(e, data) {
  | 
        
        
            | 
            | 
           89 | 
                   M.util.js_pending("month-upcoming-mini-{{uniqid}}-filterChanged");
  | 
        
        
            | 
            | 
           90 | 
              | 
        
        
            | 
            | 
           91 | 
                   // A filter value has been changed.
  | 
        
        
            | 
            | 
           92 | 
                   // Find all matching cells in the popover data, and hide them.
  | 
        
        
            | 
            | 
           93 | 
                   var target = $("#month-upcoming-mini-{{uniqid}}").find(CalendarSelectors.eventType[data.type]);
  | 
        
        
            | 
            | 
           94 | 
              | 
        
        
            | 
            | 
           95 | 
                   var transitionPromise = $.Deferred();
  | 
        
        
            | 
            | 
           96 | 
                   if (data.hidden) {
  | 
        
        
            | 
            | 
           97 | 
                       transitionPromise.then(function() {
  | 
        
        
            | 
            | 
           98 | 
                           return target.slideUp('fast').promise();
  | 
        
        
            | 
            | 
           99 | 
                       });
  | 
        
        
            | 
            | 
           100 | 
                   } else {
  | 
        
        
            | 
            | 
           101 | 
                       transitionPromise.then(function() {
  | 
        
        
            | 
            | 
           102 | 
                           return target.slideDown('fast').promise();
  | 
        
        
            | 
            | 
           103 | 
                       });
  | 
        
        
            | 
            | 
           104 | 
                   }
  | 
        
        
            | 
            | 
           105 | 
              | 
        
        
            | 
            | 
           106 | 
                   transitionPromise.then(function() {
  | 
        
        
            | 
            | 
           107 | 
                       M.util.js_complete("month-upcoming-mini-{{uniqid}}-filterChanged");
  | 
        
        
            | 
            | 
           108 | 
              | 
        
        
            | 
            | 
           109 | 
                       return;
  | 
        
        
            | 
            | 
           110 | 
                   });
  | 
        
        
            | 
            | 
           111 | 
              | 
        
        
            | 
            | 
           112 | 
                   transitionPromise.resolve();
  | 
        
        
            | 
            | 
           113 | 
               });
  | 
        
        
            | 
            | 
           114 | 
           });
  | 
        
        
            | 
            | 
           115 | 
           {{/js}}
  |