From 058180cc3068a02f526198e6c95df83efc6d0e82 Mon Sep 17 00:00:00 2001 From: antoine37120 <ant.dupre@gmail.com> Date: Fri, 22 Sep 2023 10:41:40 +0200 Subject: [PATCH] feature: add views my_territory_all_exchanges, my_territory_exchange, my_territory_add_exchange --- src/utils.js | 3 + src/views-terrytories.js | 171 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 167 insertions(+), 7 deletions(-) diff --git a/src/utils.js b/src/utils.js index 605cc6c..46d1c66 100644 --- a/src/utils.js +++ b/src/utils.js @@ -7,6 +7,9 @@ export const TZCLD_URLS = { my_territory_auto_eval: 'tzcld-auto-evaluation', my_territory_follow: 'tzcld-suivit', my_territory_exchanges: 'tzcld-echnages', + my_territory_all_exchanges: 'tzcld-tous-les-echnages', + my_territory_exchange: 'tzcld-echnage', + my_territory_add_exchange: 'tzcld-add-echnage', } export function path() { diff --git a/src/views-terrytories.js b/src/views-terrytories.js index d3b383e..3b77e4f 100644 --- a/src/views-terrytories.js +++ b/src/views-terrytories.js @@ -28,17 +28,22 @@ import("./utils.js").then((utils) => { territoriesStepStates: "territories-step-states", territoriesOriginsMobilisation: "territories-origins-mobilisation", apiUrl: "api-url", + xmpp: "xmpp", }; } routeurs() { let render = ` <solid-router default-route="${utils.TZCLD_URLS.my_territories}" route-prefix="tzcld"> - <solid-route name="${utils.TZCLD_URLS.my_territory_space}"></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territories}"></solid-route> - <solid-route name="${utils.TZCLD_URLS.my_territory_infos}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_space}" use-id></solid-route> + <!--<solid-route name="${utils.TZCLD_URLS.my_territory_infos}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_exchanges}" use-id></solid-route> - <solid-route name="${utils.TZCLD_URLS.my_territory_auto_eval}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_all_exchanges}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_exchange}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_add_exchange}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_auto_eval}" use-id></solid-route>--> + </solid-router> `; @@ -48,7 +53,7 @@ import("./utils.js").then((utils) => { viewRightMenu(default_root) { let render = ` <nav class="jsRightMenu segment sm-hidden text-disable-selection sidebar whitespace-normal" role="navigation"> - <solid-router class="segment whitespace-normal text-color-heading text-bold" default-route="" > + <solid-router class="segment whitespace-normal text-color-heading text-bold" default-route="${utils.TZCLD_URLS.my_territory_infos}"> <ul> <li class="segment full sm-hidden padding-small text-normal jsOffsiteToggle"> <span class="icon icon-arrow-left icon-xsmall margin-left-xxsmall text-left"></span> @@ -87,6 +92,10 @@ import("./utils.js").then((utils) => { </li> </solid-route> </solid-ac-checker> + <solid-route name="${utils.TZCLD_URLS.my_territory_exchanges}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_all_exchanges}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_exchange}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_add_exchange}" use-id></solid-route> </ul> </solid-router> </nav>`; @@ -189,7 +198,7 @@ import("./utils.js").then((utils) => { </template> </solid-widget> - <solid-widget name="tzcld-exchanges-conversations-couter"> + <solid-widget name="tzcld-exchanges-conversations-counter"> <template> <div style="float:right"> <solid-display fields="" data-src="\${src || value}" nested-field="conversations" counter-template="\\\${counter}"></solid-display> @@ -261,7 +270,7 @@ import("./utils.js").then((utils) => { </div>`; return render; - }exchanges + } viewExchanges() { let render = ` <div class="segment block margin-right-xxsmall margin-left-xxsmall sm-margin-none padding-top-none sm-padding-xsmall"> @@ -290,10 +299,14 @@ import("./utils.js").then((utils) => { bind-resources="" nested-field="tzcld_community_shared_notes" action-counter="counter" - widget-counter="tzcld-exchanges-conversations-couter" + widget-counter="tzcld-exchanges-conversations-counter" solid-resource="" + order-desc="@id" + paginate-by="1" + next="${utils.TZCLD_URLS.my_territory_exchange}" > </solid-display> + <solid-link class="icon icon-secondary hover icon-info margin-left-xsmall margin-right-xxsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_add_exchange}">Ajouter une note</solid-link> </div> <div class="segment third padding-xsmall whitespace-normal"> <solid-display @@ -311,6 +324,137 @@ import("./utils.js").then((utils) => { return render; } + + viewAllExchanges() { + let render = ` + <div class="segment block margin-right-xxsmall margin-left-xxsmall sm-margin-none padding-top-none sm-padding-xsmall"> + + <solid-link class="icon icon-secondary hover icon-info margin-left-xsmall margin-right-xxsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_all_exchanges}">Ajouter une conversation</solid-link> + <div class="segment block padding-xsmall whitespace-normal"> + <div class="loader" id="loader-${this.route}-tzcld-all-exchanges"> + <div></div> + <div></div> + <div></div> + <div></div> + </div> + <solid-display + fields="segment1(segment2(title(title_prefix, date), user.name, longdesc), segment3(counter))" + class="segment block whitespace-normal" + class-segment1="segment hover bg-color-white shadow border-rounded-xxsmall full text-top whitespace-normal cursor-pointer" + class-segment2="segment block padding-xlarge text-left" + class-segment3="segment block padding-xlarge sm-padding-medium border-top border-color-grey text-center whitespace-normal" + widget-title="h2" + widget-title_prefix="span" + widget-date="tzcld-format-date-1" + widget-longdesc="div" + value-title_prefix="Note du " + label-user.name="De " + loader-id="loader-${this.route}-tzcld-all-exchanges" + widget-edit="communities-edit-button-${utils.community_uniq()}" + bind-resources="" + nested-field="tzcld_community_shared_notes" + action-counter="counter" + widget-counter="tzcld-exchanges-conversations-counter" + solid-resource="" + order-desc="@id" + paginate-by="20" + next="${utils.TZCLD_URLS.my_territory_exchange}" + > + </solid-display> + </div> + `; + + render += ` + </div>`; + + return render; + } + + + viewAddExchange() { + let render = ` + <div class="segment block margin-right-xxsmall margin-left-xxsmall sm-margin-none padding-top-none sm-padding-xsmall"> + + <div class="segment full padding-xsmall whitespace-normal"> + <div class="loader" id="loader-${this.route}-tzcld-add-exchange"> + <div></div> + <div></div> + <div></div> + <div></div> + </div> + <solid-form + fields="segment1(segment2(title(title_prefix, date), longdesc))" + class="segment block whitespace-normal" + class-segment1="segment hover bg-color-white shadow border-rounded-xxsmall full text-top whitespace-normal cursor-pointer" + class-segment2="segment block padding-xlarge text-left" + class-segment3="segment block padding-xlarge sm-padding-medium border-top border-color-grey text-center whitespace-normal" + widget-title="h2" + widget-title_prefix="span" + value-title_prefix="Nouvelle note" + loader-id="loader-${this.route}-tzcld-add-exchange" + bind-resources="" + nested-field="tzcld_community_shared_notes" + solid-resource="" + patrtial + > + </solid-form> + </div> + `; + + render += ` + </div>`; + + return render; + } + + viewExchange() { + let render = ` + <div class="segment block margin-right-xxsmall margin-left-xxsmall sm-margin-none padding-top-none sm-padding-xsmall"> + + <div class="segment block padding-xsmall whitespace-normal"> + <div class="loader" id="loader-${this.route}-tzcld-exchange"> + <div></div> + <div></div> + <div></div> + <div></div> + </div> + <solid-display + fields="segment1(segment2(title(title_prefix, date), user.name, longdesc))" + class="segment block whitespace-normal" + class-segment1="segment hover bg-color-white shadow border-rounded-xxsmall full text-top whitespace-normal cursor-pointer" + class-segment2="segment block padding-xlarge text-left" + class-segment3="segment block padding-xlarge sm-padding-medium border-top border-color-grey text-center whitespace-normal" + widget-title="h2" + widget-title_prefix="span" + widget-date="tzcld-format-date-1" + widget-longdesc="div" + value-title_prefix="Note du " + label-user.name="De " + loader-id="loader-${this.route}-tzcld-exchange" + widget-edit="communities-edit-button-${utils.community_uniq()}" + bind-resources="" + solid-resource="" + > + </solid-display> + </div> + <div class="segment block padding-large sm-padding-xsmall sm-padding-top-normal whitespace-normal bg-color-grey wrapper-resource-comments"> + <div class="segment three-quarter sm-full"> + <h3 class="text-color-heading text-semibold text-letter-spacing-large">${this.localize('title.comments')}</h3> + <solid-conversation + bind-resources + nested-field="conversations" + send-button-text="${this.localize('submit.comment')}" > + </solid-conversation> + </div> + </div> + `; + + render += ` + </div>`; + + return render; + } + viewMyCommunities() { let render = ` <div id="${utils.TZCLD_URLS.my_territories}" data-view="${utils.TZCLD_URLS.my_territories}" class="tzcld-my-communities"> @@ -646,6 +790,7 @@ import("./utils.js").then((utils) => { this.territoriesStepStates = props.territoriesStapeStates ; this.territoriesOriginsMobilisation = props.territoriesOriginsMobilisationn ; this.apiUrl = props.apiUrl ; + this.xmpp = props.xmpp ; //console.table(props); @@ -668,6 +813,18 @@ import("./utils.js").then((utils) => { ${this.viewExchanges()} </div> + <div id="${utils.TZCLD_URLS.my_territory_exchange}" data-view="${utils.TZCLD_URLS.my_territory_exchange}" class="community-exchanges" hidden> + ${this.viewExchange()} + </div> + + <div id="${utils.TZCLD_URLS.my_territory_add_exchange}" data-view="${utils.TZCLD_URLS.my_territory_add_exchange}" class="community-exchanges" hidden> + ${this.viewAddExchange()} + </div> + + <div id="${utils.TZCLD_URLS.my_territory_all_exchanges}" data-view="${utils.TZCLD_URLS.my_territory_all_exchanges}" class="community-exchanges" hidden> + ${this.viewAllExchanges()} + </div> + <div id="${utils.TZCLD_URLS.my_territory_auto_eval}" data-view="${utils.TZCLD_URLS.my_territory_auto_eval}" class="community-answers" hidden> ${this.viewCommunityAnswers()} </div> -- GitLab