From 809d337517646f62a1e371c347e6a1170b7394eb Mon Sep 17 00:00:00 2001 From: nin-jin Date: Thu, 9 Nov 2023 15:21:48 +0000 Subject: [PATCH] Different rights per meetup --- app/app.view.tree | 18 ++++++++++++++++-- app/app.view.ts | 19 ++++++++++++++++--- meetup/page/page.view.tree | 17 ++++++++++++----- meetup/page/page.view.ts | 19 +++++-------------- speech/page/page.view.tree | 12 ++++++++---- speech/page/page.view.ts | 11 +++-------- 6 files changed, 60 insertions(+), 36 deletions(-) diff --git a/app/app.view.tree b/app/app.view.tree index 0c73016..58419c7 100644 --- a/app/app.view.tree +++ b/app/app.view.tree @@ -4,6 +4,7 @@ $piterjs_app $mol_view meetup* => meetup* meetup_public*? => meetup_public*? person => person + editable => editable plugins / <= Theme $mol_theme_auto sub / @@ -62,15 +63,16 @@ $piterjs_app $mol_view Meetup* $piterjs_meetup_page meetup <= meetup* person <= person - editing <= editing? false + editing? <=> editing? false meetup_public? <=> meetup_public*? + rights? <=> rights_meetup? false Meetup_guests* $piterjs_meetup_guests meetup <= meetup* Meetup_stats* $piterjs_meetup_stats meetup <= meetup* Speech!id $piterjs_speech_page speech <= speech!id $piterjs_speech - editing <= editing? false + editing? <=> editing? false speech_public? <=> speech_public*? false Menu_meetup* $piterjs_meetup_snippet meetup <= meetup* @@ -88,6 +90,18 @@ $piterjs_app $mol_view Others $piterjs_others Rights $hyoo_meta_rights meta <= Domain + tools / + <= Rights_close $mol_check + checked? <=> rights? + sub / + <= Rights_close_icon $mol_icon_cross + Rights_meetup $hyoo_meta_rights + meta <= meetup_current + tools / + <= Rights_meetup_close $mol_check + checked? <=> rights_meetup? + sub / + <= Rights_meetup_close_icon $mol_icon_cross Wiki $hyoo_page side_main_id \zi5t5h_8aygdf yard <= Yard diff --git a/app/app.view.ts b/app/app.view.ts index c21a64b..b6e0c87 100644 --- a/app/app.view.ts +++ b/app/app.view.ts @@ -66,15 +66,16 @@ namespace $.$$ { if( this.intro() != null ) return [ this.Intro() ] const pages = [ this.Menu() , - ... this.meetup_id() ? [ this.Meetup( this.meetup_id() ) ] : [] , + ... this.rights() ? [ this.Rights() ] : [] , ... this.safe() ? [ this.Safe() ] : [], + ... this.meetup_id() ? [ this.Meetup( this.meetup_id() ) ] : [] , + ... this.rights_meetup() ? [ this.Rights_meetup() ] : [] , ... this.guests() ? [ this.Meetup_guests( this.meetup_id() ) ] : [] , ... this.stats() ? [ this.Meetup_stats( this.meetup_id() ) ] : [] , ... this.speech_id() ? [ this.Speech( this.speech_id() ) ] : [] , ... this.place_show() ? [ this.Place() ] : [] , ... this.video() ? [ this.Video() ] : [] , ... this.others() ? [ this.Others() ] : [] , - ... this.rights() ? [ this.Rights() ] : [] , ... this.wiki() ? this.Wiki().pages() : [], ] if( pages.length === 1 ) pages.push( this.Now() ) @@ -147,11 +148,23 @@ namespace $.$$ { return [ this.Online(), ... this.Domain().editable() ? [ this.Editing() ] : [ this.User() ], - ... this.editing() ? [ this.Rights_toggle() ] : [], + ... this.editable() ? [ this.Rights_toggle() ] : [], this.Lights(), ] } + editing( next?: boolean ) { + return this.$.$mol_state_session.value( `${this}.editing()`, next ) + } + + rights( next?: boolean ) { + return this.$.$mol_state_session.value( `${this}.rights()`, next ) + } + + rights_meetup( next?: boolean ) { + return this.$.$mol_state_session.value( `${this}.rights_meetup()`, next ) + } + @ $mol_mem user_id() { return this.Yard().peer().id diff --git a/meetup/page/page.view.tree b/meetup/page/page.view.tree index bfa0da1..e59502b 100644 --- a/meetup/page/page.view.tree +++ b/meetup/page/page.view.tree @@ -6,14 +6,15 @@ $piterjs_meetup_page $mol_page start? => start? joined_count => joined_count joined? => joined? + editable => editable Title $mol_string_button value? <=> title? - enabled <= editing false + enabled <= editing hint \Номер tools / <= Start $mol_date value_moment? <=> start? - enabled <= editing false + enabled <= editing align \bottom_left <= Close $mol_link arg * @@ -28,7 +29,7 @@ $piterjs_meetup_page $mol_page <= Description $mol_textarea hint \Резюме value? <=> description? - enabled <= editing false + enabled <= editing <= Links $mol_view sub <= links / <= Video $mol_link arg * @@ -54,14 +55,14 @@ $piterjs_meetup_page $mol_page Content <= Afterparty $mol_textarea hint \Адрес, ориентиры, чат value? <=> afterparty? - enabled <= editing false + enabled <= editing <= Capacity_block $mol_view sub / <= Capacity_field $mol_form_field name \Максимальная вместимость Content <= Capacity $mol_number hint \100 value? <=> capacity? 0 - enabled <= editing false + enabled <= editing <= Capacity_cut $mol_button_minor title \закрыть регистрацию click? <=> capacity_cut? null @@ -94,6 +95,12 @@ $piterjs_meetup_page $mol_page checked? <=> meetup_public? false Icon <= Public_icon $mol_icon_eye hint \Опубликовано + <= Editing $mol_check_icon + Icon <= Editing_icon $mol_icon_settings_outline + checked? <=> editing? false + <= Rights_toggle $mol_check_icon + checked? <=> rights? false + Icon <= Rights_toggle_icon $mol_icon_shield_account <= Guests_link $mol_link arg * guests \ hint \Список гостей diff --git a/meetup/page/page.view.ts b/meetup/page/page.view.ts index e102322..661eded 100644 --- a/meetup/page/page.view.ts +++ b/meetup/page/page.view.ts @@ -55,22 +55,13 @@ namespace $.$$ { const speech = this.meetup().speech_make() this.$.$mol_state_arg.value( 'speech', speech.id() ) } - - Public() { - if( !this.editing() ) return null! - return super.Public() - } - - Guests_link() { - if( !this.editing() ) return null! - return super.Guests_link() - } - Stats_link() { - if( !this.editing() ) return null! - return super.Stats_link() + @ $mol_mem + foot() { + if( !this.editable() ) return [] + return super.foot() } - + capacity( next?: number ) { return this.meetup().place().capacity_max( next ) } diff --git a/speech/page/page.view.tree b/speech/page/page.view.tree index b33970e..59c6806 100644 --- a/speech/page/page.view.tree +++ b/speech/page/page.view.tree @@ -5,14 +5,15 @@ $piterjs_speech_page $mol_page start? => start? slides? => slides? video? => video? + editable => editable Title $mol_string_button value? <=> title? - enabled <= editing false + enabled <= editing hint \Название tools / <= Start $mol_pick_time value_moment? <=> start? - enabled <= editing false + enabled <= editing <= Close $mol_link arg * speech null sub / @@ -28,7 +29,7 @@ $piterjs_speech_page $mol_page <= Description $mol_textarea hint \О чём value? <=> description? - enabled <= editing false + enabled <= editing <= Links $mol_view sub <= links / <= Slides $mol_string_link value? <=> slides? @@ -40,11 +41,14 @@ $piterjs_speech_page $mol_page title \Видео <= Speaker $piterjs_speaker_snippet speaker <= speaker $piterjs_speaker - editing <= editing false + editing <= editing foot / <= Public $mol_check_icon checked? <=> speech_public? false Icon <= Public_icon $mol_icon_eye + <= Editing $mol_check_icon + Icon <= Editing_icon $mol_icon_settings_outline + checked? <=> editing? false <= Poster_copy $mol_pick hint \Скачать постер trigger_content / diff --git a/speech/page/page.view.ts b/speech/page/page.view.ts index f41dc94..5464d57 100644 --- a/speech/page/page.view.ts +++ b/speech/page/page.view.ts @@ -14,14 +14,9 @@ namespace $.$$ { ] } - override Public() { - if( !this.editing() ) return null! - return super.Public() - } - - override Poster_copy() { - if( !this.editing() ) return null! - return super.Poster_copy() + override foot() { + if( !this.editable() ) return [] + return super.foot() } override poster_1_1_name() {