fix: circle extensions loading
This commit is contained in:
parent
127afe287d
commit
e6ae9d036c
@ -53,6 +53,22 @@ for component of components
|
||||
routes.add(route);
|
||||
component.route = route;
|
||||
}
|
||||
if(component.extensions)
|
||||
for extension of component.extensions
|
||||
-
|
||||
if(typeof extension.route === 'undefined') {
|
||||
extension.route = extension.type;
|
||||
}
|
||||
if(extension.route) {
|
||||
extension.uniq = Math.random().toString(16).slice(2);
|
||||
let route = extension.route;
|
||||
if (routes.has(extension.route)) {
|
||||
route += "-" + extension.uniq;
|
||||
}
|
||||
routes.add(route);
|
||||
extension.route = route;
|
||||
}
|
||||
|
||||
-
|
||||
const defaultComponent = components.filter(e=>e.defaultRoute != undefined);
|
||||
let defaultRoute = "dashboard";
|
||||
|
@ -14,50 +14,31 @@
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-profile.pug
|
||||
//- Note:
|
||||
Instead of using flat events/resources or polls components, you
|
||||
may you to expend the way circle work to handle events & cie.
|
||||
Like:
|
||||
{
|
||||
"type": "circles",
|
||||
...
|
||||
"extensions": [
|
||||
{
|
||||
"type": "events",
|
||||
"endpoints": {...},
|
||||
...
|
||||
}
|
||||
]
|
||||
}
|
||||
-
|
||||
let extensions = new Set();
|
||||
if(component.extensions) {
|
||||
extensions = new Set(component.extensions.map(c=>c.type));
|
||||
}
|
||||
if extensions.has('events')
|
||||
div(
|
||||
id=`${component.route}-events`
|
||||
hidden
|
||||
data-view=`${component.route}-events`
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-events.pug
|
||||
if extensions.has('resources')
|
||||
div(
|
||||
id=`${component.route}-resources`
|
||||
hidden
|
||||
data-view=`${component.route}-resources`
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-resources.pug
|
||||
if extensions.has('polls')
|
||||
div(
|
||||
id=`${component.route}-polls`
|
||||
hidden
|
||||
data-view=`${component.route}-polls`
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-polls.pug
|
||||
for extension of component.extensions
|
||||
if extension.type == 'events'
|
||||
div(
|
||||
id=`${component.route}-events`
|
||||
hidden
|
||||
data-view=`${component.route}-events`
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-events.pug
|
||||
if extension.type == 'resources'
|
||||
div(
|
||||
id=`${component.route}-resources`
|
||||
hidden
|
||||
data-view=`${component.route}-resources`
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-resources.pug
|
||||
if extension.type == 'polls'
|
||||
div(
|
||||
id=`${component.route}-polls`
|
||||
hidden
|
||||
data-view=`${component.route}-polls`
|
||||
no-render
|
||||
)
|
||||
include partials/circle/page-circle-polls.pug
|
||||
|
||||
nav.jsRightMenu.text-disable-selection.sidebar.whitespace-normal(role='navigation')
|
||||
solid-router.segment.whitespace-normal.text-color-heading.text-bold(default-route=`${component.route}-chat`)
|
||||
@ -75,18 +56,19 @@ nav.jsRightMenu.text-disable-selection.sidebar.whitespace-normal(role='navigatio
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-information.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.information')
|
||||
if extensions.has('resources')
|
||||
solid-route.segment.full(name=`${component.route}-resources` use-id)
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-file.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.resources')
|
||||
if extensions.has('events')
|
||||
solid-route.segment.full(name=`${component.route}-events` use-id)
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-appointment.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.events')
|
||||
if extensions.has('polls')
|
||||
solid-route.segment.full(name=`${component.route}-polls` use-id)
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-list.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.polls')
|
||||
for extension of component.extensions
|
||||
if extension.type == 'resources'
|
||||
solid-route.segment.full(name=`${component.route}-resources` use-id)
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-file.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.resources')
|
||||
if extension.type == 'events'
|
||||
solid-route.segment.full(name=`${component.route}-events` use-id)
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-appointment.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.events')
|
||||
if extension.type == 'polls'
|
||||
solid-route.segment.full(name=`${component.route}-polls` use-id)
|
||||
li.segment.full.padding-medium
|
||||
span.icon.ci-list.icon-xlarge.margin-right-medium
|
||||
a(data-trans='circle.menuRight.polls')
|
||||
|
@ -1,10 +1,9 @@
|
||||
solid-event(
|
||||
class='w700'
|
||||
bind-resources
|
||||
nested-field="events"
|
||||
range-event-type=`${component.extensions.find(c => c.type=='events').endpoints.typeevents}`
|
||||
range-event-circle=`${component.endpoints.get}/`
|
||||
upload-dir=`${component.extensions.find(c => c.type=='events').endpoints.uploads}`
|
||||
id-prefix=`${component.route}`
|
||||
uniq=component.uniq
|
||||
range-event-type=`${extension.endpoints.typeevents}`
|
||||
range-event-circle=`${getComponent('circles').endpoints.get}/`
|
||||
upload-dir=`${extension.endpoints.uploads}`
|
||||
id-prefix='default'
|
||||
uniq=extension.uniq
|
||||
)
|
||||
|
@ -1,9 +1,9 @@
|
||||
solid-poll(
|
||||
class='w700'
|
||||
id-prefix='circles'
|
||||
bind-resources
|
||||
nested-field="polls"
|
||||
range-base-polls=`${component.get('polls').endpoints.pollRangeBase}`
|
||||
upload-dir=`${component.get('polls').endpoints.uploads}`
|
||||
uniq=component.uniq
|
||||
data-dest=extension.endpoints.post
|
||||
range-tags=extension.endpoints.pollRangeTags
|
||||
range-circles=extension.endpoints.pollRangeCircles
|
||||
upload-dir=extension.endpoints.uploads
|
||||
uniq=extension.uniq
|
||||
)
|
@ -1,10 +1,15 @@
|
||||
solid-resource(
|
||||
class='w700'
|
||||
bind-resources
|
||||
nested-field="resources"
|
||||
range-resource-type=`${component.extensions.find(c => c.type=='resources').endpoints.resourcestypes}`
|
||||
range-resource-keyword=`${component.extensions.find(c => c.type=='resources').endpoints.resourceskeywords}`
|
||||
range-resource-circle=`${component.endpoints.get}/`
|
||||
upload-dir=`${component.extensions.find(c => c.type=='resources').endpoints.uploads}`
|
||||
id-prefix='circles'
|
||||
post-data-src=`${extension.endpoints.post}`
|
||||
range-resource-type=`${extension.endpoints.types}`
|
||||
post-data-type-src=`${extension.endpoints.postTypes}`
|
||||
range-resource-keyword=`${extension.endpoints.keywords}`
|
||||
post-data-keyword-src=`${extension.endpoints.postKeywords}`
|
||||
range-resource-circle=`${getComponent('circles').endpoints.get}/`
|
||||
associated-circle-label=""
|
||||
data-trans=`associated-circle-label=${extension.parameters && extension.parameters.associatedName ? extension.parameters.associatedName : 'circle.extensions.associated'}`
|
||||
upload-dir=`${extension.endpoints.uploads}`
|
||||
id-prefix='default'
|
||||
uniq=extension.uniq
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user