UI: Show title and description in sharing dialogs
This commit is contained in:
@@ -149,8 +149,8 @@
|
||||
|
||||
<section id="sharecollectionscene" class="container hidden">
|
||||
<h1>Sharing</h1>
|
||||
<p>Manage sharing for collection <span class="title" data-name="title">title</span>
|
||||
</p>
|
||||
<p>Manage sharing for collection <span class="title" data-name="title">title</span></p>
|
||||
<p data-name="description"></p>
|
||||
<div data-name="sharebytoken">
|
||||
<details open>
|
||||
<summary>By Token</summary>
|
||||
@@ -257,8 +257,10 @@
|
||||
<span class="error hidden" data-name="error"></span>
|
||||
</section>
|
||||
|
||||
<section id="newshare" class="container hidden">
|
||||
<section id="createeditsharescene" class="container hidden">
|
||||
<h1>New Share</h1>
|
||||
<p class="title" data-name="title"></p>
|
||||
<p data-name="description"></p>
|
||||
<form>
|
||||
<details open data-name="sharemapfields" class="hidden">
|
||||
<summary>Map Target</summary>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
import { Share, add_share_by_map, add_share_by_token, get_property_key, update_share_by_map, update_share_by_token } from "../api/sharing.js";
|
||||
import { CollectionType, Permission } from "../models/collection.js";
|
||||
import { extract_title } from "../utils/collection_utils.js";
|
||||
import { extract_title, update_title_and_description } from "../utils/collection_utils.js";
|
||||
import { collectionsCache } from "../utils/collections_cache.js";
|
||||
import { ErrorHandler } from "../utils/error.js";
|
||||
import { FormValidator, validate_href, validate_non_empty, validate_not_empty_or_equals } from "../utils/form_validator.js";
|
||||
@@ -48,7 +48,9 @@ export class CreateEditShareScene {
|
||||
this._edit = !!share;
|
||||
this._pathMapped = collection.href;
|
||||
|
||||
this._html_scene = get_element_by_id("newshare");
|
||||
this._html_scene = get_element_by_id("createeditsharescene");
|
||||
this._title = get_element(this._html_scene, "[data-name=title]");
|
||||
this._description = get_element(this._html_scene, "[data-name=description]");
|
||||
this._form = /** @type {HTMLFormElement} */ (get_element(this._html_scene, "form"));
|
||||
this._sharemapfields = get_element(this._html_scene, "[data-name=sharemapfields]");
|
||||
this._shareuser_input = /** @type {HTMLInputElement} */ (get_element(this._html_scene, "[data-name=shareuser]"));
|
||||
@@ -405,6 +407,8 @@ export class CreateEditShareScene {
|
||||
this._errorHandler.clearError();
|
||||
}
|
||||
this._on_permissions_change();
|
||||
|
||||
update_title_and_description(this._collection, this._title, this._description);
|
||||
}
|
||||
|
||||
hide() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
import { Collection, Permission } from "../models/collection.js";
|
||||
import { extract_title } from "../utils/collection_utils.js";
|
||||
|
||||
import { update_title_and_description } from "../utils/collection_utils.js";
|
||||
import { ErrorHandler } from "../utils/error.js";
|
||||
import { get_element, get_element_by_id } from "../utils/misc.js";
|
||||
import { displayPermissionsOrConversion } from "../utils/permissions.js";
|
||||
@@ -60,6 +61,7 @@ export class ShareCollectionScene {
|
||||
this._errorHandler = new ErrorHandler(this._error_form);
|
||||
|
||||
this._title = get_element(this._html_scene, "[data-name=title]");
|
||||
this._description = get_element(this._html_scene, "[data-name=description]");
|
||||
}
|
||||
|
||||
_oncancel() {
|
||||
@@ -114,7 +116,7 @@ export class ShareCollectionScene {
|
||||
if (this._share_by_map_div) this._share_by_map_div.classList.add("hidden");
|
||||
}
|
||||
|
||||
this._title.textContent = this._collection.displayname || this._collection.href;
|
||||
update_title_and_description(this._collection, this._title, this._description);
|
||||
update_share_list(this._user, this._password, this._collection, this._errorHandler);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,3 +29,21 @@ export function extract_title(collection) {
|
||||
} else
|
||||
return collection.href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../models/collection.js").Collection} collection
|
||||
* @param {HTMLElement} title_element
|
||||
* @param {HTMLElement} description_element
|
||||
*/
|
||||
export function update_title_and_description(
|
||||
collection,
|
||||
title_element,
|
||||
description_element) {
|
||||
title_element.textContent = collection.displayname || collection.href;
|
||||
if (collection.description && collection.description.length > 0) {
|
||||
description_element.classList.remove("hidden");
|
||||
description_element.textContent = collection.description;
|
||||
} else {
|
||||
description_element.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user