forked from cory/tildefriends
Hide wiki things that don't apply when you're not logged in.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4617 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
b3c9ad2fcb
commit
367c489fc3
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "📝",
|
"emoji": "📝",
|
||||||
"previous": "&s6S7S8P4kxvqLRip/WX45Bw7h+GG79BjJRBZOnaDtaE=.sha256"
|
"previous": "&rj3P1MdTitVRBCznRAN+lmMz8dxPwil2PjQ31KdkPi4=.sha256"
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import * as tfrpc from '/static/tfrpc.js';
|
|||||||
class TfCollectionElement extends LitElement {
|
class TfCollectionElement extends LitElement {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
|
whoami: {type: String},
|
||||||
collection: {type: Object},
|
collection: {type: Object},
|
||||||
selected_id: {type: String},
|
selected_id: {type: String},
|
||||||
is_creating: {type: Boolean},
|
is_creating: {type: Boolean},
|
||||||
@ -69,7 +70,7 @@ class TfCollectionElement extends LitElement {
|
|||||||
<option value="" ?selected=${this.selected_id === ''} disabled hidden>(select)</option>
|
<option value="" ?selected=${this.selected_id === ''} disabled hidden>(select)</option>
|
||||||
${Object.values(this.collection ?? {}).map(x => html`<option value=${x.id} ?selected=${this.selected_id === x.id}>${x.name}</option>`)}
|
${Object.values(this.collection ?? {}).map(x => html`<option value=${x.id} ?selected=${this.selected_id === x.id}>${x.name}</option>`)}
|
||||||
</select>
|
</select>
|
||||||
<span ?hidden=${!this.is_renaming}>
|
<span ?hidden=${!this.is_renaming || !this.whoami}>
|
||||||
<span style="display: inline-flex; flex-direction: row; margin-left: 8px; margin-right: 8px">
|
<span style="display: inline-flex; flex-direction: row; margin-left: 8px; margin-right: 8px">
|
||||||
<label for="rename_name">🏷Rename to:</label>
|
<label for="rename_name">🏷Rename to:</label>
|
||||||
<input type="text" id="rename_name"></input>
|
<input type="text" id="rename_name"></input>
|
||||||
@ -77,15 +78,15 @@ class TfCollectionElement extends LitElement {
|
|||||||
<button @click=${() => self.is_renaming = false}>x</button>
|
<button @click=${() => self.is_renaming = false}>x</button>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<button @click=${() => self.is_renaming = true} ?disabled=${this.is_renaming || !this.selected_id}>🏷</button>
|
<button @click=${() => self.is_renaming = true} ?disabled=${this.is_renaming || !this.selected_id} ?hidden=${!this.whoami}>🏷</button>
|
||||||
<button @click=${self.on_tombstone} ?disabled=${!this.selected_id}>🪦</button>
|
<button @click=${self.on_tombstone} ?disabled=${!this.selected_id} ?hidden=${!this.whoami}>🪦</button>
|
||||||
<span ?hidden=${!this.is_creating}>
|
<span ?hidden=${!this.is_creating || !this.whoami}>
|
||||||
<label for="create_name">New ${this.type} name:</label>
|
<label for="create_name">New ${this.type} name:</label>
|
||||||
<input type="text" id="create_name"></input>
|
<input type="text" id="create_name"></input>
|
||||||
<button @click=${this.on_create}>Create ${this.type}</button>
|
<button @click=${this.on_create}>Create ${this.type}</button>
|
||||||
<button @click=${() => self.is_creating = false}>x</button>
|
<button @click=${() => self.is_creating = false}>x</button>
|
||||||
</span>
|
</span>
|
||||||
<button @click=${() => self.is_creating = true} ?hidden=${this.is_creating}>+</button>
|
<button @click=${() => self.is_creating = true} ?hidden=${this.is_creating || !this.whoami}>+</button>
|
||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -192,11 +192,12 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
let self = this;
|
let self = this;
|
||||||
return html`
|
return html`
|
||||||
<div>
|
<div>
|
||||||
<tf-id-picker .ids=${this.ids} selected=${this.whoami} @change=${this.on_whoami_changed}></tf-id-picker>
|
<tf-id-picker .ids=${this.ids} selected=${this.whoami} @change=${this.on_whoami_changed} ?hidden=${!this.ids?.length}></tf-id-picker>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<tf-collection
|
<tf-collection
|
||||||
.collection=${this.wikis}
|
.collection=${this.wikis}
|
||||||
|
whoami=${this.whoami}
|
||||||
selected_id=${this.wiki?.id}
|
selected_id=${this.wiki?.id}
|
||||||
@create=${this.on_wiki_create}
|
@create=${this.on_wiki_create}
|
||||||
@rename=${this.on_wiki_rename}
|
@rename=${this.on_wiki_rename}
|
||||||
@ -204,6 +205,7 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
@change=${this.on_wiki_changed}></tf-collection>
|
@change=${this.on_wiki_changed}></tf-collection>
|
||||||
${keyed(this.wiki_doc?.id, html`<tf-collection
|
${keyed(this.wiki_doc?.id, html`<tf-collection
|
||||||
.collection=${this.wiki_docs}
|
.collection=${this.wiki_docs}
|
||||||
|
whoami=${this.whoami}
|
||||||
selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''}
|
selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''}
|
||||||
@create=${this.on_wiki_doc_create}
|
@create=${this.on_wiki_doc_create}
|
||||||
@rename=${this.on_wiki_doc_rename}
|
@rename=${this.on_wiki_doc_rename}
|
||||||
|
Loading…
Reference in New Issue
Block a user