mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-66477 message: Use the generic drawer for the message drawer
This commit is contained in:
parent
a2517225dc
commit
8aca1807ae
2
message/amd/build/message_drawer.min.js
vendored
2
message/amd/build/message_drawer.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("core_message/message_drawer",["jquery","core/custom_interaction_events","core/pubsub","core_message/message_drawer_view_contact","core_message/message_drawer_view_contacts","core_message/message_drawer_view_conversation","core_message/message_drawer_view_group_info","core_message/message_drawer_view_overview","core_message/message_drawer_view_search","core_message/message_drawer_view_settings","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_events","core/pending"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o={PANEL_BODY_CONTAINER:"[data-region=\"panel-body-container\"]",PANEL_HEADER_CONTAINER:"[data-region=\"panel-header-container\"]",VIEW_CONTACT:"[data-region=\"view-contact\"]",VIEW_CONTACTS:"[data-region=\"view-contacts\"]",VIEW_CONVERSATION:"[data-region=\"view-conversation\"]",VIEW_GROUP_INFO:"[data-region=\"view-group-info\"]",VIEW_OVERVIEW:"[data-region=\"view-overview\"]",VIEW_SEARCH:"[data-region=\"view-search\"]",VIEW_SETTINGS:"[data-region=\"view-settings\"]",ROUTES:"[data-route]",ROUTES_BACK:"[data-route-back]",HEADER_CONTAINER:"[data-region=\"header-container\"]",BODY_CONTAINER:"[data-region=\"body-container\"]",FOOTER_CONTAINER:"[data-region=\"footer-container\"]"},p=function(a,b,c){var d=b.find(o.HEADER_CONTAINER).find(c);if(!d.length){d=b.find(o.PANEL_HEADER_CONTAINER).find(c)}var e=b.find(o.BODY_CONTAINER).find(c);if(!e.length){e=b.find(o.PANEL_BODY_CONTAINER).find(c)}var f=b.find(o.FOOTER_CONTAINER).find(c);return[a,d.length?d:null,e.length?e:null,f.length?f:null]},q=[[l.VIEW_CONTACT,o.VIEW_CONTACT,d.show,d.description],[l.VIEW_CONTACTS,o.VIEW_CONTACTS,e.show,e.description],[l.VIEW_CONVERSATION,o.VIEW_CONVERSATION,f.show,f.description],[l.VIEW_GROUP_INFO,o.VIEW_GROUP_INFO,g.show,g.description],[l.VIEW_OVERVIEW,o.VIEW_OVERVIEW,h.show,h.description],[l.VIEW_SEARCH,o.VIEW_SEARCH,i.show,i.description],[l.VIEW_SETTINGS,o.VIEW_SETTINGS,j.show,j.description]],r=function(a,b){q.forEach(function(c){k.add(a,c[0],p(a,b,c[1]),c[2],c[3])})},s=function(a,b){if(!b.attr("data-shown")){k.go(a,l.VIEW_OVERVIEW);b.attr("data-shown",!0)}b.removeClass("hidden");b.attr("aria-expanded",!0);b.attr("aria-hidden",!1)},t=function(a){a.addClass("hidden");a.attr("aria-expanded",!1);a.attr("aria-hidden",!0)},u=function(a){return!a.hasClass("hidden")},v=function(d,e,f){b.define(e,[b.events.activate]);var g=/^data-route-param-?(\d*)$/;e.on(b.events.activate,o.ROUTES,function(b,c){for(var e=a(b.target).closest(o.ROUTES),f=e.attr("data-route"),h=[],j=0;j<e[0].attributes.length;j++){h.push(e[0].attributes[j])}var l=h.filter(function(a){var b=a.nodeName,c=g.test(b);return c});l.sort(function(c,a){var b=g.exec(c.nodeName),d=g.exec(a.nodeName),e=1<b.length?b[1]:0,f=1<d.length?d[1]:0;if(e<f){return-1}else if(f<e){return 1}else{return 0}});var m=l.map(function(a){return a.nodeValue}),n=[d,f].concat(m);k.go.apply(null,n);c.originalEvent.preventDefault()});e.on(b.events.activate,o.ROUTES_BACK,function(a,b){k.back(d);b.originalEvent.preventDefault()});e.on("hide.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("hidden.bs.collapse",function(){c.resolve()})});e.on("show.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("shown.bs.collapse",function(){c.resolve()})});if(!f){c.subscribe(m.SHOW,function(){s(d,e)});c.subscribe(m.HIDE,function(){t(e)});c.subscribe(m.TOGGLE_VISIBILITY,function(){if(u(e)){t(e)}else{s(d,e)}})}c.subscribe(m.SHOW_CONVERSATION,function(a){s(d,e);k.go(d,l.VIEW_CONVERSATION,a)});c.subscribe(m.CREATE_CONVERSATION_WITH_USER,function(a){s(d,e);k.go(d,l.VIEW_CONVERSATION,null,"create",a)});c.subscribe(m.SHOW_SETTINGS,function(){s(d,e);k.go(d,l.VIEW_SETTINGS)});c.subscribe(m.PREFERENCES_UPDATED,function(a){var b=a.filter(function(a){return"message_entertosend"==a.type}),c=b.length?b[0]:null;if(c){var d=e.find(o.FOOTER_CONTAINER).find(o.VIEW_CONVERSATION);d.attr("data-enter-to-send",c.value)}})};return{init:function init(b,c,d,e){b=a(b);r(c,b);v(c,b,d);if(d){s(c,b);if(e){var f=e.params||[];f=[c,e.path].concat(f);k.go.apply(null,f)}}}}});
|
||||
define ("core_message/message_drawer",["jquery","core/custom_interaction_events","core/pubsub","core_message/message_drawer_view_contact","core_message/message_drawer_view_contacts","core_message/message_drawer_view_conversation","core_message/message_drawer_view_group_info","core_message/message_drawer_view_overview","core_message/message_drawer_view_search","core_message/message_drawer_view_settings","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_events","core/pending","core/drawer"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p={PANEL_BODY_CONTAINER:"[data-region=\"panel-body-container\"]",PANEL_HEADER_CONTAINER:"[data-region=\"panel-header-container\"]",VIEW_CONTACT:"[data-region=\"view-contact\"]",VIEW_CONTACTS:"[data-region=\"view-contacts\"]",VIEW_CONVERSATION:"[data-region=\"view-conversation\"]",VIEW_GROUP_INFO:"[data-region=\"view-group-info\"]",VIEW_OVERVIEW:"[data-region=\"view-overview\"]",VIEW_SEARCH:"[data-region=\"view-search\"]",VIEW_SETTINGS:"[data-region=\"view-settings\"]",ROUTES:"[data-route]",ROUTES_BACK:"[data-route-back]",HEADER_CONTAINER:"[data-region=\"header-container\"]",BODY_CONTAINER:"[data-region=\"body-container\"]",FOOTER_CONTAINER:"[data-region=\"footer-container\"]"},q=function(a,b,c){var d=b.find(p.HEADER_CONTAINER).find(c);if(!d.length){d=b.find(p.PANEL_HEADER_CONTAINER).find(c)}var e=b.find(p.BODY_CONTAINER).find(c);if(!e.length){e=b.find(p.PANEL_BODY_CONTAINER).find(c)}var f=b.find(p.FOOTER_CONTAINER).find(c);return[a,d.length?d:null,e.length?e:null,f.length?f:null]},r=[[l.VIEW_CONTACT,p.VIEW_CONTACT,d.show,d.description],[l.VIEW_CONTACTS,p.VIEW_CONTACTS,e.show,e.description],[l.VIEW_CONVERSATION,p.VIEW_CONVERSATION,f.show,f.description],[l.VIEW_GROUP_INFO,p.VIEW_GROUP_INFO,g.show,g.description],[l.VIEW_OVERVIEW,p.VIEW_OVERVIEW,h.show,h.description],[l.VIEW_SEARCH,p.VIEW_SEARCH,i.show,i.description],[l.VIEW_SETTINGS,p.VIEW_SETTINGS,j.show,j.description]],s=function(a,b){r.forEach(function(c){k.add(a,c[0],q(a,b,c[1]),c[2],c[3])})},t=function(a,b){if(!b.attr("data-shown")){k.go(a,l.VIEW_OVERVIEW);b.attr("data-shown",!0)}var c=o.getDrawerRoot(b);if(c){o.show(c)}},u=function(a){var b=o.getDrawerRoot(a);if(b){o.hide(b)}},v=function(a){var b=o.getDrawerRoot(a);if(b){return o.isVisible(b)}return!0},w=function(d,e,f){b.define(e,[b.events.activate]);var g=/^data-route-param-?(\d*)$/;e.on(b.events.activate,p.ROUTES,function(b,c){for(var e=a(b.target).closest(p.ROUTES),f=e.attr("data-route"),h=[],j=0;j<e[0].attributes.length;j++){h.push(e[0].attributes[j])}var l=h.filter(function(a){var b=a.nodeName,c=g.test(b);return c});l.sort(function(c,a){var b=g.exec(c.nodeName),d=g.exec(a.nodeName),e=1<b.length?b[1]:0,f=1<d.length?d[1]:0;if(e<f){return-1}else if(f<e){return 1}else{return 0}});var m=l.map(function(a){return a.nodeValue}),n=[d,f].concat(m);k.go.apply(null,n);c.originalEvent.preventDefault()});e.on(b.events.activate,p.ROUTES_BACK,function(a,b){k.back(d);b.originalEvent.preventDefault()});e.on("hide.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("hidden.bs.collapse",function(){c.resolve()})});e.on("show.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("shown.bs.collapse",function(){c.resolve()})});if(!f){c.subscribe(m.SHOW,function(){t(d,e)});c.subscribe(m.HIDE,function(){u(e)});c.subscribe(m.TOGGLE_VISIBILITY,function(){if(v(e)){u(e)}else{t(d,e)}})}c.subscribe(m.SHOW_CONVERSATION,function(a){t(d,e);k.go(d,l.VIEW_CONVERSATION,a)});c.subscribe(m.CREATE_CONVERSATION_WITH_USER,function(a){t(d,e);k.go(d,l.VIEW_CONVERSATION,null,"create",a)});c.subscribe(m.SHOW_SETTINGS,function(){t(d,e);k.go(d,l.VIEW_SETTINGS)});c.subscribe(m.PREFERENCES_UPDATED,function(a){var b=a.filter(function(a){return"message_entertosend"==a.type}),c=b.length?b[0]:null;if(c){var d=e.find(p.FOOTER_CONTAINER).find(p.VIEW_CONVERSATION);d.attr("data-enter-to-send",c.value)}})};return{init:function init(b,c,d,e){b=a(b);s(c,b);w(c,b,d);if(d){t(c,b);if(e){var f=e.params||[];f=[c,e.path].concat(f);k.go.apply(null,f)}}}}});
|
||||
//# sourceMappingURL=message_drawer.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -36,6 +36,7 @@ define(
|
||||
'core_message/message_drawer_routes',
|
||||
'core_message/message_drawer_events',
|
||||
'core/pending',
|
||||
'core/drawer',
|
||||
],
|
||||
function(
|
||||
$,
|
||||
@ -51,7 +52,8 @@ function(
|
||||
Router,
|
||||
Routes,
|
||||
Events,
|
||||
Pending
|
||||
Pending,
|
||||
Drawer
|
||||
) {
|
||||
|
||||
var SELECTORS = {
|
||||
@ -134,9 +136,10 @@ function(
|
||||
root.attr('data-shown', true);
|
||||
}
|
||||
|
||||
root.removeClass('hidden');
|
||||
root.attr('aria-expanded', true);
|
||||
root.attr('aria-hidden', false);
|
||||
var drawerRoot = Drawer.getDrawerRoot(root);
|
||||
if (drawerRoot) {
|
||||
Drawer.show(drawerRoot);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -145,19 +148,24 @@ function(
|
||||
* @param {Object} root The message drawer container.
|
||||
*/
|
||||
var hide = function(root) {
|
||||
root.addClass('hidden');
|
||||
root.attr('aria-expanded', false);
|
||||
root.attr('aria-hidden', true);
|
||||
var drawerRoot = Drawer.getDrawerRoot(root);
|
||||
if (drawerRoot) {
|
||||
Drawer.hide(drawerRoot);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the drawer is visible.
|
||||
*
|
||||
* @param {Object} root The message drawer container.
|
||||
* @return {bool}
|
||||
* @return {boolean}
|
||||
*/
|
||||
var isVisible = function(root) {
|
||||
return !root.hasClass('hidden');
|
||||
var drawerRoot = Drawer.getDrawerRoot(root);
|
||||
if (drawerRoot) {
|
||||
return Drawer.isVisible(drawerRoot);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -33,15 +33,10 @@
|
||||
{}
|
||||
|
||||
}}
|
||||
|
||||
<div
|
||||
id="message-drawer-{{uniqid}}"
|
||||
class="message-app drawer hidden"
|
||||
aria-expanded="false"
|
||||
aria-hidden="true"
|
||||
data-region="message-drawer"
|
||||
role="region"
|
||||
>
|
||||
{{< core/drawer}}
|
||||
{{$rootId}}message-drawer-{{uniqid}}{{/rootId}}
|
||||
{{$drawerContent}}
|
||||
<div id="message-drawer-{{uniqid}}" class="message-app" data-region="message-drawer" role="region">
|
||||
<div class="header-container position-relative" data-region="header-container">
|
||||
{{> core_message/message_drawer_view_contacts_header }}
|
||||
{{> core_message/message_drawer_view_conversation_header }}
|
||||
@ -62,7 +57,10 @@
|
||||
{{> core_message/message_drawer_view_conversation_footer }}
|
||||
{{> core_message/message_drawer_view_overview_footer }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/drawerContent}}
|
||||
{{/core/drawer}}
|
||||
|
||||
{{#js}}
|
||||
require(['jquery', 'core_message/message_drawer'], function($, MessageDrawer) {
|
||||
var root = $('#message-drawer-{{uniqid}}');
|
||||
|
@ -418,7 +418,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
$message-drawer-width: 320px;
|
||||
$message-send-bg: $gray-300 !default;
|
||||
$message-send-color: color-yiq($message-send-bg) !default;
|
||||
$message-send-time-color: mix($message-send-color, $message-send-bg, 100%) !default;
|
||||
@ -428,24 +427,9 @@ $message-received-color-muted: mix($message-received-color, $message-received-bg
|
||||
$message-app-bg: mix($message-send-bg, $message-received-bg, 50%) !default;
|
||||
$message-day-color: color-yiq($message-app-bg) !default;
|
||||
|
||||
.message-app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: $message-app-bg;
|
||||
@include transition();
|
||||
|
||||
.icon-back-in-drawer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.drawer {
|
||||
z-index: $zindex-sticky;
|
||||
position: fixed;
|
||||
top: $navbar-height;
|
||||
right: 0;
|
||||
height: calc(100% - #{$navbar-height});
|
||||
width: $message-drawer-width;
|
||||
box-shadow: -2px 2px 4px rgba(0, 0, 0, .08);
|
||||
.drawer {
|
||||
.message-app {
|
||||
height: 100%;
|
||||
.icon-back-in-app {
|
||||
display: none;
|
||||
}
|
||||
@ -453,16 +437,21 @@ $message-day-color: color-yiq($message-app-bg) !default;
|
||||
display: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.message-app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: $message-app-bg;
|
||||
|
||||
.icon-back-in-drawer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.main {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
display: block;
|
||||
right: $message-drawer-width * -1;
|
||||
}
|
||||
|
||||
.header-container {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
@ -14649,33 +14649,21 @@ a.ygtvspacer:hover {
|
||||
visibility: visible;
|
||||
transition: right 0.25s; } }
|
||||
|
||||
.drawer .message-app {
|
||||
height: 100%; }
|
||||
.drawer .message-app .icon-back-in-app {
|
||||
display: none; }
|
||||
.drawer .message-app .icon-back-in-drawer {
|
||||
display: inherit; }
|
||||
|
||||
.message-app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #eff1f3;
|
||||
transition: all 0.2s ease-in-out; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.message-app {
|
||||
transition: none; } }
|
||||
background-color: #eff1f3; }
|
||||
.message-app .icon-back-in-drawer {
|
||||
display: none; }
|
||||
.message-app.drawer {
|
||||
z-index: 1020;
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
height: calc(100% - 50px);
|
||||
width: 320px;
|
||||
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.08); }
|
||||
.message-app.drawer .icon-back-in-app {
|
||||
display: none; }
|
||||
.message-app.drawer .icon-back-in-drawer {
|
||||
display: inherit; }
|
||||
.message-app.main {
|
||||
min-height: 400px; }
|
||||
.message-app.hidden {
|
||||
display: block;
|
||||
right: -320px; }
|
||||
.message-app .header-container {
|
||||
flex-shrink: 0; }
|
||||
.message-app .body-container {
|
||||
|
@ -14911,33 +14911,21 @@ a.ygtvspacer:hover {
|
||||
visibility: visible;
|
||||
transition: right 0.25s; } }
|
||||
|
||||
.drawer .message-app {
|
||||
height: 100%; }
|
||||
.drawer .message-app .icon-back-in-app {
|
||||
display: none; }
|
||||
.drawer .message-app .icon-back-in-drawer {
|
||||
display: inherit; }
|
||||
|
||||
.message-app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #eff1f3;
|
||||
transition: all 0.2s ease-in-out; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.message-app {
|
||||
transition: none; } }
|
||||
background-color: #eff1f3; }
|
||||
.message-app .icon-back-in-drawer {
|
||||
display: none; }
|
||||
.message-app.drawer {
|
||||
z-index: 1020;
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
height: calc(100% - 50px);
|
||||
width: 320px;
|
||||
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.08); }
|
||||
.message-app.drawer .icon-back-in-app {
|
||||
display: none; }
|
||||
.message-app.drawer .icon-back-in-drawer {
|
||||
display: inherit; }
|
||||
.message-app.main {
|
||||
min-height: 400px; }
|
||||
.message-app.hidden {
|
||||
display: block;
|
||||
right: -320px; }
|
||||
.message-app .header-container {
|
||||
flex-shrink: 0; }
|
||||
.message-app .body-container {
|
||||
|
Loading…
x
Reference in New Issue
Block a user