Merge remote-tracking branch 'origin/master' into feature/hubl-2

This commit is contained in:
Jean-Baptiste Pasquier 2020-12-03 13:46:52 +01:00
commit 455d94cba0
No known key found for this signature in database
GPG Key ID: CC04B91B949C163A
4 changed files with 37 additions and 41 deletions

View File

@ -11,21 +11,17 @@ export const HublReactivity = {
this.subscribe();
}
},
dataSrc: {
type: String,
default: '',
callback: async function (value) {
this.resourceId = null;
if (this.nestedField) {
const resource = store.get(value) || await store.getData(value, this.context);
const nestedResource = await resource[this.nestedField]
this.resourceId = nestedResource ? nestedResource['@id'] : null;
} else {
this.resourceId = value;
}
this.subscribe();
}
},
},
async fetchData(value) {
this.resourceId = null;
if (this.nestedField) {
const resource = store.get(value) || await store.getData(value, this.context);
const nestedResource = await resource[this.nestedField]
this.resourceId = nestedResource ? nestedResource['@id'] : null;
} else {
this.resourceId = value;
}
this.subscribe();
},
subscribe() {
if (this.resourceId && this.targetSrc) {

View File

@ -59,11 +59,11 @@ html(lang="en")
include views/page-dashboard.pug
if publicDirectory && endpoints.get.users
#members(hidden, data-view="members").no-sidebar.with-padding
#members(hidden, data-view="members", no-render).no-sidebar.with-padding
include views/page-directory.pug
if endpoints.get.joboffers
#job-offers(hidden, data-view="job-offers").no-sidebar.with-padding
#job-offers(hidden, data-view="job-offers", no-render).no-sidebar.with-padding
hubl-reactivity(data-src=`${endpoints.post.joboffers}current/` target-src=`${endpoints.get.joboffers}`)
hubl-reactivity(data-src=`${endpoints.post.joboffers}expired/` target-src=`${endpoints.get.joboffers}`)
hubl-reactivity(data-src=`${endpoints.post.joboffers}` target-src=`${endpoints.get.joboffers}`)
@ -76,7 +76,7 @@ html(lang="en")
include views/page-job-offers.pug
if endpoints.get.projects
#project(hidden, data-view="project").with-sidebar
#project(hidden, data-view="project", no-render).with-sidebar
hubl-reactivity(data-src=`${endpoints.post.projects}joinable/` target-src=`${endpoints.get.projects}`)
hubl-reactivity(data-src=`${endpoints.post.projects}` target-src=`${endpoints.get.projects}`)
hubl-reactivity(bind-user nested-field="projects" target-src=`${endpoints.post.projects}`)
@ -87,7 +87,7 @@ html(lang="en")
include views/page-project.pug
if endpoints.get.circles
#circle(hidden, data-view="circle").with-sidebar
#circle(hidden, data-view="circle", no-render).with-sidebar
hubl-reactivity(data-src=`${endpoints.post.circles}joinable/` target-src=`${endpoints.get.circles}`)
hubl-reactivity(data-src=`${endpoints.post.circles}` target-src=`${endpoints.get.circles}`)
hubl-reactivity(bind-user nested-field="circles" target-src=`${endpoints.post.circles}`)
@ -97,29 +97,29 @@ html(lang="en")
hubl-reactivity(bind-user nested-field="circles" target-src=`${endpoints.circles || endpoints.get.circles}joinable/`)
include views/page-circle.pug
if endpoints.get.users
#messages(hidden, data-view="messages").with-sidebar
#messages(hidden, data-view="messages", no-render).with-sidebar
include views/page-messages.pug
if endpoints.get.polls
#polls(hidden, data-view="polls").with-sidebar
#polls(hidden, data-view="polls", no-render).with-sidebar
include views/page-polls.pug
if endpoints.get.events
#events(hidden, data-view="events")
#events(hidden, data-view="events", no-render)
include views/page-events.pug
if endpoints.get.resources
#resources(hidden, data-view="resources")
#resources(hidden, data-view="resources", no-render)
include views/page-resources.pug
#admin(hidden, data-view="admin").with-sidebar
#admin(hidden, data-view="admin", no-render).with-sidebar
include views/page-admin.pug
#about(data-view="about").no-sidebar.with-padding
#about(data-view="about", no-render).no-sidebar.with-padding
include views/page-about.pug
if endpoints.get.skills && endpoints.post.uploads && endpoints.post.users
#profile(hidden, data-view="profile").no-sidebar
#profile(hidden, data-view="profile", no-render).no-sidebar
include views/page-profile.pug
if analytics

View File

@ -1,6 +1,8 @@
document.addEventListener("DOMContentLoaded", () => {
const resizeChat = () => {
let isMobile = window.innerHeight < 993;
let isMobile = window.innerWidth < 993;
let isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
let isFirefoxMobile = navigator.platform.toLowerCase().indexOf("mobile") > -1 || navigator.platform.toLowerCase().indexOf("tablet") > -1;
let chatBox = Array.from(document.querySelectorAll("solid-xmpp-chat"))
.map((el) => el.shadowRoot ? el.shadowRoot.getElementById("conversejs") : false)
.filter((el) => el)
@ -19,10 +21,8 @@ document.addEventListener("DOMContentLoaded", () => {
let viewportChat = Array.from(
document.querySelectorAll("#viewport .chat-view")
);
let headerOffset = document.querySelector('#header').offsetHeight;
let intermediateOffset = Array.from(document.querySelectorAll(".content-box__header")).filter(el=>el.offsetParent!==null?el:null)[0].offsetHeight;
viewportChat.forEach(
(c) => (c.style.height = isMobile ? "calc(100vh - "+String(headerOffset+intermediateOffset)+"px - 57px)" : "calc(100vh - "+String(headerOffset+intermediateOffset)+"px)")
(c) => (c.style.height = isMobile ? (isFirefox && isFirefoxMobile) ? "calc(100vh - 106px - 57px)" : "calc(100vh - 106px)" : "calc(100vh - 64px - 83px)")
);
}
}

View File

@ -1,11 +1,11 @@
// if('serviceWorker' in navigator) {
// var refreshing;
// navigator.serviceWorker.addEventListener('controllerchange', () => {
// if (refreshing) {
// return;
// }
// refreshing = true;
// window.location.reload();
// });
// navigator.serviceWorker.register('/sw.js');
// }
if('serviceWorker' in navigator) {
var refreshing;
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (refreshing) {
return;
}
refreshing = true;
window.location.reload();
});
navigator.serviceWorker.register('/sw.js');
}