diff --git a/src/styles/shared-files.scss b/src/styles/shared-files.scss index 87a07803eef1827071846905a72c68bbf174db99..6cdfc123efcc9ba188f2e0b745b245fd8b73f5d2 100644 --- a/src/styles/shared-files.scss +++ b/src/styles/shared-files.scss @@ -1,4 +1,8 @@ +.list-files-bordered { + border-radius: 10px; + border: 1px solid var(--color-primary) ;; +} .list-shared-files{ &.masonry { flex-wrap: wrap; @@ -7,6 +11,19 @@ &>div { display: flex; padding-left: 16px; + margin-bottom: 16px; + } + } + solid-delete { + text-indent: -999em; + display: inline-block; + width: 24px; + position: relative; + &::before { + position: absolute; + top: 5px; + right: 5px; + text-indent: 0; } } @@ -37,6 +54,13 @@ } .shared-file-action-wrapper { vertical-align: middle; + padding: 5px 15px; + a, solid-link, solid-delete { + padding: 5px; + &::before { + font-size: 16px; + } + } } } \ No newline at end of file diff --git a/src/views-terrytories.js b/src/views-terrytories.js index 0746c168f3a6c1f600889a176c9f4cf3a95544b1..1f3ef78f801c430f6a103f2209a6a76fb8048077 100644 --- a/src/views-terrytories.js +++ b/src/views-terrytories.js @@ -99,6 +99,9 @@ import("./utils.js").then((utils) => { <solid-route name="${utils.TZCLD_URLS.my_territory_shared_files_space}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_shared_files_all}" use-id></solid-route> <solid-route name="${utils.TZCLD_URLS.my_territory_shared_file_add}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_grappe_shared_files_space}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_grappe_shared_files_all}" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_grappe_shared_file_add}" use-id></solid-route> </ul> </solid-router> </nav>`; @@ -334,12 +337,32 @@ import("./utils.js").then((utils) => { order-desc="date" paginate-by="8" loader-id="loader-${this.route}-tzcld-exchanges-files" + route-suffix="${utils.TZCLD_URLS.my_territory_shared_files_edit}" + item-width="half" > </tzcld-shared-files-display> <p class="text-right padding-right-xxlarge"><solid-link class="segment margin-top-xxlarge sm-full button text-xsmall text-bold text-uppercase text-center reversed color-secondary bordered button-icon icon icon-square-edit icon-margin-right-xsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_shared_file_add}">Ajouter un fichier ou un dossier</solid-link></p> </div> - <div class="segment third padding-xsmall whitespace-normal list-referents"> - + <div class="segment third padding-xsmall whitespace-normal list-files-bordered"> + <h2 class="tzcld-h2">Partagés avec la grappe</h2> + <div class="loader" id="loader-${this.route}-tzcld-exchanges-ref-files"> + <div></div> + <div></div> + <div></div> + <div></div> + </div> + <tzcld-shared-files-display + bind-resources="" + nested-field="tzcld_community_synthesis_followed.tzcld_referents_community_shared_files" + solid-resource="" + order-desc="date" + paginate-by="4" + loader-id="loader-${this.route}-tzcld-exchanges-ref-files" + route-suffix="${utils.TZCLD_URLS.my_territory_grappe_shared_files_edit}" + item-width="full" + > + </tzcld-shared-files-display> + <p class="text-right padding-right-xxlarge"><solid-link class="segment margin-top-xxlarge sm-full button text-xsmall text-bold text-uppercase text-center reversed color-secondary bordered button-icon icon icon-square-edit icon-margin-right-xsmall" bind-resources next="${utils.TZCLD_URLS.my_territory_grappe_shared_file_add}">Ajouter un fichier ou un dossier</solid-link></p> </div> </div> @@ -1192,7 +1215,11 @@ import("./utils.js").then((utils) => { return render; } - viewCommunitySharedFileEdit() { + viewCommunitySharedFileEdit(nested = false) { + let nested_value = 'tzcld_profile_identity.tzcld_admins_community_shared_files' ; + if (nested) { + nested_value = nested ; + } 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 sm-hidden text-left"> @@ -1200,7 +1227,7 @@ import("./utils.js").then((utils) => { </div> <div class="segment full padding-xsmall whitespace-normal"> - <div class="loader" id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_files_edit}"> + <div class="loader" id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_files_edit}-${nested}"> <div></div> <div></div> <div></div> @@ -1238,7 +1265,7 @@ import("./utils.js").then((utils) => { widget-author="solid-form-dropdown-autocompletion-label" order-asc-author="username" range-author="${this.rangeUser}" - loader-id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_files_edit}" + loader-id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_files_edit}-${nested}" bind-resources="" solid-resource="" patrtial @@ -1257,7 +1284,11 @@ import("./utils.js").then((utils) => { } - viewCommunitySharedFileAdd() { + viewCommunitySharedFileAdd(nested = false) { + let nested_value = 'tzcld_profile_identity.tzcld_admins_community_shared_files' ; + if (nested) { + nested_value = nested ; + } 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 sm-hidden text-left"> @@ -1265,7 +1296,7 @@ import("./utils.js").then((utils) => { </div> <div class="segment full padding-xsmall whitespace-normal"> - <div class="loader" id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_file_add}"> + <div class="loader" id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_file_add}-${nested}"> <div></div> <div></div> <div></div> @@ -1294,9 +1325,9 @@ import("./utils.js").then((utils) => { label-document="Document" label-name="Titre du edocument" - loader-id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_file_add}" + loader-id="loader-${this.route}-${utils.TZCLD_URLS.my_territory_shared_file_add}-${nested}" bind-resources="" - nested-field="tzcld_profile_identity.tzcld_admins_community_shared_files" + nested-field="${nested_value}" solid-resource="" patrtial submit-button="Enregistrer" @@ -1359,6 +1390,8 @@ import("./utils.js").then((utils) => { //console.table(props); this.route = this.getRoute(this.uniq); + + let nested_shared_ref_value = 'tzcld_community_synthesis_followed.tzcld_referents_community_shared_files' ; let render = ` ${this.routeurs()} @@ -1485,6 +1518,27 @@ import("./utils.js").then((utils) => { <div id="${utils.TZCLD_URLS.my_territory_shared_file_add}" data-view="${utils.TZCLD_URLS.my_territory_shared_file_add}" class="community-files" hidden> ${this.viewCommunitySharedFileAdd()} </div> + + <div id="${utils.TZCLD_URLS.my_territory_grappe_shared_files_space}" data-view="${utils.TZCLD_URLS.my_territory_grappe_shared_files_space}" class="community-files one" hidden> + <solid-router default-route="my_territory_shared_file_empty" route-prefix=""> + <solid-route name="my_territory_grappe_shared_file_empty" use-id></solid-route> + <solid-route name="${utils.TZCLD_URLS.my_territory_grappe_shared_files_edit}" use-id></solid-route> + </solid-router> + <div id="my_territory_grappe_shared_file_empty" data-view="my_territory_grappe_shared_file_empty" class="files one" hidden> + + </div> + <div id="${utils.TZCLD_URLS.my_territory_grappe_shared_files_edit}" data-view="${utils.TZCLD_URLS.my_territory_grappe_shared_files_edit}" class="community-files-edit one" hidden> + ${this.viewCommunitySharedFileEdit(nested_shared_ref_value)} + </div> + </div> + + <div id="${utils.TZCLD_URLS.my_territory_grappe_shared_files_all}" data-view="${utils.TZCLD_URLS.my_territory_grappe_shared_files_all}" class="community-files" hidden> + </div> + + <div id="${utils.TZCLD_URLS.my_territory_grappe_shared_file_add}" data-view="${utils.TZCLD_URLS.my_territory_grappe_shared_file_add}" class="community-files" hidden> + ${this.viewCommunitySharedFileAdd(nested_shared_ref_value)} + </div> + </div> diff --git a/src/widjets-display-shared-files.js b/src/widjets-display-shared-files.js index 9d2ddd90076e9919b4d0a80126b7b522ac3ea870..05e75f95309d5e53e03677a96a1487482c580995 100644 --- a/src/widjets-display-shared-files.js +++ b/src/widjets-display-shared-files.js @@ -18,6 +18,9 @@ import("./utils.js").then((utils) => { <div></div> <div></div> </div>`; + let route_name = this.element.attributes['route-suffix'].value ; + let item_width = this.element.attributes['item-width'].value ; + //let paginate_by = this.element.attributes['paginate-by'].value ; let tzcldprofile = { files: await this.resource["ldp:contains"] }; @@ -27,8 +30,12 @@ import("./utils.js").then((utils) => { } } let render = `<div class="segment block margin-top-small margin-bottom-small list-shared-files masonry">`; + //let i = 0; for(let file of tzcldprofile.files) { - + /*i++; + if (i > paginate_by) { + break ; + }*/ let icon_content = utils.getSVGFile() ; if(await file.document !="") { let extention_file = utils.getFileExt(await file.document) ; @@ -37,7 +44,7 @@ import("./utils.js").then((utils) => { } } - render += `<div class="segment half card-shared-file"> + render += `<div class="segment ${item_width} card-shared-file"> <div class="segment flex bg-color-white shadow border-rounded-xxsmall full text-top whitespace-normal"> <div class="segment auto shared-file-icon-wrapper padding-small"> ${icon_content} @@ -60,17 +67,18 @@ import("./utils.js").then((utils) => { render += `<div class="shared-file-meta-wrapper">${await user.name} <br/>${moment(await date.toString()).locale('fr').format('Do/MM/YYYY')}</div>`; render += `</div> - <div class="segment auto shared-file-action-wrapper padding-small whitespace-normal">`; + <div class="segment auto shared-file-action-wrapper whitespace-normal">`; if(await file.document !="") { render += `<a class="text-color-heading" target="_blank" href="${await file.document}"><span class="icontz-mdi_download-box-outline"></span></a><br/> <solid-ac-checker permission="acl:Write" data-src="${await file['@id']}"> - <solid-link data-src="${await file['@id']}" next="${utils.TZCLD_URLS.my_territory_shared_files_edit}"><span class="icontz-mdi_pencil-outline"></span></solid-link><br/> + <solid-link data-src="${await file['@id']}" next="${route_name}"><span class="icontz-mdi_pencil-outline text-color-heading"></span></solid-link><br/> <solid-delete data-src="${await file['@id']}" confirmation-submit-class="icontz-mdi_trash" confirmation-submit-text="ttttt" confirmation-type="confirm" confirmation-message="Merci de confirmer la suppression du fichier ${await file.name}." - ><span class="icontz-mdi_trash"></span></solid-delete> + class="icontz-mdi_trash text-color-heading" + ></solid-delete> </solid-ac-checker>`; } render += `</div>