MDL-65318 core_calendar: make event details consistent across pages
authorSimey Lameze <simey@moodle.com>
Fri, 12 Apr 2019 01:09:58 +0000 (09:09 +0800)
committerSimey Lameze <simey@moodle.com>
Thu, 2 May 2019 00:05:06 +0000 (08:05 +0800)
calendar/classes/external/event_exporter.php
calendar/templates/event_details.mustache
calendar/templates/event_item.mustache
calendar/templates/event_summary_body.mustache
theme/boost/scss/moodle/calendar.scss
theme/boost/style/moodle.css
theme/classic/style/moodle.css

index 51ee3e4..1f30a9d 100644 (file)
@@ -55,7 +55,7 @@ class event_exporter extends event_exporter_base {
             'type' => event_action_exporter::read_properties_definition(),
             'optional' => true,
         ];
-
+        $values['calendareventtype'] = ['type' => PARAM_TEXT];
         return $values;
     }
 
@@ -73,6 +73,7 @@ class event_exporter extends event_exporter_base {
 
         $event = $this->event;
         $context = $this->related['context'];
+        $values['calendareventtype'] = $event->get_type();
         if ($moduleproxy = $event->get_course_module()) {
             $modulename = $moduleproxy->get('modname');
             $moduleid = $moduleproxy->get('id');
@@ -82,6 +83,8 @@ class event_exporter extends event_exporter_base {
             $params = array('update' => $moduleid, 'return' => true, 'sesskey' => sesskey());
             $editurl = new \moodle_url('/course/mod.php', $params);
             $values['editurl'] = $editurl->out(false);
+            // Activity events are normalised to "look" like course events.
+            $values['calendareventtype'] = 'course';
         } else if ($event->get_type() == 'category') {
             $url = $event->get_category()->get_proxied_instance()->get_view_link();
         } else if ($event->get_type() == 'course') {
index 56f41f1..3b17a9e 100644 (file)
@@ -61,7 +61,7 @@
 </div>
 <div class="row mt-1">
     <div class="col-xs-1">{{#pix}} i/calendar, core, {{#str}} eventtype, core_calendar {{/str}} {{/pix}}</div>
-    <div class="col-xs-11">{{eventtype}}</div>
+    <div class="col-xs-11">{{calendareventtype}}</div>
 </div>
 {{#description}}
     <div class="row mt-1">
index 98431ea..a58f3ab 100644 (file)
@@ -15,7 +15,7 @@
     along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 }}
 {{!
-    @template calendar/event_item
+    @template core_calendar/event_item
 
     Calendar event item.
 
 
     Example context (json):
     {
+        "id": 1,
+        "name": "Sample event name",
+        "calendareventtype": "course",
+        "course": {
+            "id": 1
+        },
+        "canedit": true,
+        "candelete": true,
+        "isactionevent": true,
+        "icon": {
+            "key": "i/courseevent",
+            "component": "core",
+            "alttext": "Some course event"
+        },
+        "editurl": "#",
+        "url": "#"
     }
 }}
 <div{{!
     }} data-type="event"{{!
     }} data-course-id="{{course.id}}"{{!
     }} data-event-id="{{id}}"{{!
-    }} class="event"{{!
+    }} class="event m-t-1"{{!
     }} data-eventtype-{{calendareventtype}}="1"{{!
     }} data-event-title="{{name}}"{{!
     }} data-event-count="{{eventcount}}"{{!
     }}>
-    <div class="card">
-        <div class="box card-header clearfix p-y-1">
+    <div class="card rounded">
+        <div class="box card-header clearfix calendar_event_{{calendareventtype}}">
             <div class="commands float-sm-right">
                 {{#canedit}}
                     {{#candelete}}
             {{#icon}}<div class="d-inline-block mt-1 align-top">{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}</div>{{/icon}}
             <div class="d-inline-block">
                 <h3 class="name d-inline-block">{{{name}}}</h3>
-                <span class="date float-sm-right mr-1">{{{formattedtime}}}</span>
-                <div class="location">{{#location}}{{{location}}}{{/location}}</div>
             </div>
         </div>
-        <div class="description card-block calendar_event_{{eventtype}}">
-            <p>{{{description}}}</p>
-            {{#iscourseevent}}
-                <div><a href="{{url}}">{{course.fullname}}</a></div>
-            {{/iscourseevent}}
-            {{> core_calendar/event_subscription}}
-            {{#isactionevent}}
-                <a href="{{url}}">{{#str}} gotoactivity, core_calendar {{/str}}</a>
-            {{/isactionevent}}
-            {{#groupname}}
-                <div><a href="{{url}}">{{{course.fullname}}}</a></div>
-                <div>{{{groupname}}}</div>
-            {{/groupname}}
+        <div class="description card-body">
+            {{> core_calendar/event_details }}
         </div>
+        {{#isactionevent}}
+            <div class="card-footer text-right bg-transparent">
+                <a href="{{url}}" class="card-link">{{#str}} gotoactivity, core_calendar {{/str}}</a>
+            </div>
+        {{/isactionevent}}
     </div>
 </div>
index 22d8d27..2d333b4 100644 (file)
     }} data-edit-url="{{editurl}}"{{!
     }}>
     <div class="container-fluid">
-        <div class="row">
-            <div class="col-xs-1">{{#pix}} i/calendareventtime, core, {{#str}} when, core_calendar {{/str}} {{/pix}}</div>
-            <div class="col-xs-11">{{{formattedtime}}}</div>
-        </div>
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/calendar, core, {{#str}} eventtype, core_calendar {{/str}} {{/pix}}</div>
-            <div class="col-xs-11">{{eventtype}}</div>
-        </div>
-        {{#description}}
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/calendareventdescription, core, {{#str}} description {{/str}} {{/pix}}</div>
-            <div class="description-content col-xs-11">{{{.}}}</div>
-        </div>
-        {{/description}}
-        {{#location}}
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/location, core, {{#str}} location {{/str}} {{/pix}}</div>
-            <div class="location-content col-xs-11">{{{.}}}</div>
-        </div>
-        {{/location}}
-        {{#isactionevent}}
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/courseevent, core, {{#str}} course {{/str}} {{/pix}}</div>
-            <div class="col-xs-11"><a href="{{course.viewurl}}">{{{course.fullname}}}</a></div>
-        </div>
-        {{/isactionevent}}
-        {{#iscategoryevent}}
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/categoryevent, core, {{#str}} category {{/str}} {{/pix}}</div>
-            <div class="col-xs-11">{{{category.nestedname}}}</div>
-        </div>
-        {{/iscategoryevent}}
-        {{#iscourseevent}}
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/courseevent, core, {{#str}} course {{/str}} {{/pix}}</div>
-            <div class="col-xs-11"><a href="{{url}}">{{{course.fullname}}}</a></div>
-        </div>
-        {{/iscourseevent}}
-        {{#groupname}}
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/courseevent, core, {{#str}} course {{/str}} {{/pix}}</div>
-            <div class="col-xs-11"><a href="{{url}}">{{{course.fullname}}}</a></div>
-        </div>
-        <div class="row mt-1">
-            <div class="col-xs-1">{{#pix}} i/groupevent, core, {{#str}} group {{/str}} {{/pix}}</div>
-            <div class="col-xs-11">{{{groupname}}}</div>
-        </div>
-        {{/groupname}}
-        {{#subscription}}
-            {{#displayeventsource}}
-                <div class="row mt-1">
-                    <div class="col-xs-1">{{#pix}} i/rss, core, {{#str}} eventsource, core_calendar {{/str}} {{/pix}}</div>
-                    <div class="col-xs-11">
-                        {{#subscriptionurl}}
-                            <p><a href="{{subscriptionurl}}">{{#str}}subscriptionsource, core_calendar, {{{subscriptionname}}}{{/str}}</a></p>
-                        {{/subscriptionurl}}
-                        {{^subscriptionurl}}
-                            <p>{{#str}}subscriptionsource, core_calendar, {{{subscriptionname}}}{{/str}}</p>
-                        {{/subscriptionurl}}
-                    </div>
-                </div>
-            {{/displayeventsource}}
-        {{/subscription}}
+        {{> core_calendar/event_details }}
     </div>
 </div>
index 97a40a0..8326790 100644 (file)
@@ -427,14 +427,12 @@ table.calendartable caption {
     }
 }
 
-.summary-modal-container {
-    .description-content {
-        > p {
-            margin: 0;
-        }
-    }
+.location-content {
+    overflow-wrap: break-word;
+}
 
-    .location-content {
-        overflow-wrap: break-word;
+.description-content {
+    > p {
+        margin: 0;
     }
 }
index 304ba37..e5d4eeb 100644 (file)
@@ -11659,12 +11659,12 @@ table.calendartable caption {
 .day-popover-content:empty + .day-popover-alternate {
   display: block; }
 
-.summary-modal-container .description-content > p {
-  margin: 0; }
-
-.summary-modal-container .location-content {
+.location-content {
   overflow-wrap: break-word; }
 
+.description-content > p {
+  margin: 0; }
+
 /* course.less */
 /* COURSE CONTENT */
 .section-modchooser-link img {
index 6ddf392..41e8197 100644 (file)
@@ -11900,12 +11900,12 @@ table.calendartable caption {
 .day-popover-content:empty + .day-popover-alternate {
   display: block; }
 
-.summary-modal-container .description-content > p {
-  margin: 0; }
-
-.summary-modal-container .location-content {
+.location-content {
   overflow-wrap: break-word; }
 
+.description-content > p {
+  margin: 0; }
+
 /* course.less */
 /* COURSE CONTENT */
 .section-modchooser-link img {