add startPage settings files

This commit is contained in:
2023-09-05 13:15:36 +02:00
parent 1ad22482a4
commit cc57a8b80a
5 changed files with 49 additions and 9 deletions

View File

@@ -24,8 +24,8 @@ class StartPageManager {
loadStartPagePreferences( startPageName ) { loadStartPagePreferences( startPageName ) {
let conf, options; let conf, options;
try { try {
conf = JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.json' ) ) ); options = JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.json' ) ) );
options = JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.config.json' ) ) ); conf = JSON.parse( fs.readFileSync( path.join( __dirname + '/../ui/home/templates/' + startPageName + '/startPage.config.json' ) ) );
return { 'conf': conf, 'options': options }; return { 'conf': conf, 'options': options };
} catch ( err ) { } catch ( err ) {
return {}; return {};

View File

@@ -0,0 +1,5 @@
{
"subtitle": "this is a test",
"description": "this is a test description",
"banner": "homeBanner.jpg"
}

View File

@@ -0,0 +1,31 @@
{
"subtitle": {
"id": "subtitle",
"type": "text",
"display": "Subtitle",
"can-be-empty": false
},
"description": {
"id": "description",
"type": "textarea",
"display": "Description",
"textarea-settings": {
"resize-y": true,
"resize-x": false,
"max-length": 0,
"min-length": 100
},
"can-be-empty": false
},
"banner": {
"id": "banner",
"type": "image",
"display": "Banner",
"image-settings": {
"upload-name": "homeBanner",
"accept-filetype": "image/jpeg",
"height": 200,
"width": 350
}
}
}

View File

@@ -21,7 +21,7 @@
<p>{{ event.description }}</p> <p>{{ event.description }}</p>
<b>{{ event.date }}</b> <b>{{ event.date }}</b>
</div> </div>
<img :src="event.logo" alt="event logo" class="ticket-logo"> <!-- <img :src="event.logo" alt="event logo" class="ticket-logo"> -->
</router-link> </router-link>
<router-link to="/admin/events/analytics" class="ticket" @click="setActiveTicket( event.eventID );" v-else="new Date( event.date ).getTime() > currentDate"> <router-link to="/admin/events/analytics" class="ticket" @click="setActiveTicket( event.eventID );" v-else="new Date( event.date ).getTime() > currentDate">
<div class="ticket-name"> <div class="ticket-name">
@@ -29,7 +29,7 @@
<p>{{ event.description }}</p> <p>{{ event.description }}</p>
<b>{{ event.date }}</b> <b>{{ event.date }}</b>
</div> </div>
<img :src="event.logo" alt="event logo" class="ticket-logo"> <!-- <img :src="event.logo" alt="event logo" class="ticket-logo"> -->
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -107,7 +107,7 @@
}, },
data () { data () {
return { return {
events: { 'test':{ 'name': 'TestEvent', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'freeSeats': 2, 'maxSeats': 2, 'date':'2023-08-15', 'startingPrice':15, 'location': 'TestLocation', 'eventID': 'test', 'currency': 'CHF', 'logo': new URL( '/src/assets/logo.png', import.meta.url ).href }, 'test2':{ 'name': 'TestEvent2', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'freeSeats': 2, 'maxSeats': 2, 'date':'2023-06-13', 'startingPrice':15, 'location': 'TestLocation', 'eventID': 'test2', 'currency': 'CHF', 'logo': new URL( '/src/assets/logo.png', import.meta.url ).href } }, events: { 'test':{ 'name': 'TestEvent', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'freeSeats': 2, 'maxSeats': 2, 'date':'2023-08-15', 'startingPrice':15, 'location': 'TestLocation', 'eventID': 'test', 'currency': 'CHF', 'logo': new URL( '/assets/logo.png', import.meta.url ).href } },
currentDate: new Date().getTime(), currentDate: new Date().getTime(),
eventList: { 'upcoming': { 'name': 'Upcoming', 'content': {} }, 'past': { 'name': 'Past', 'content': {} }, 'drafts': { 'name': 'Drafts', 'content': {} } }, eventList: { 'upcoming': { 'name': 'Upcoming', 'content': {} }, 'past': { 'name': 'Past', 'content': {} }, 'drafts': { 'name': 'Drafts', 'content': {} } },
currentlyOpenMenu: '', currentlyOpenMenu: '',

View File

@@ -16,7 +16,9 @@
</select> </select>
<!-- Start page settings -> Defined by startPage.json file --> <!-- Start page settings -> Defined by startPage.json file -->
<div class="start-page-settings"> <div class="start-page-settings">
<div class="setting" v-for="setting in startPageSettings">
{{ setting }}
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -35,8 +37,10 @@
fetch( '/admin/getAPI/getStartPageSettings?name=' + this.selectedTemplate ).then( res => { fetch( '/admin/getAPI/getStartPageSettings?name=' + this.selectedTemplate ).then( res => {
if ( res.status === 200 ) { if ( res.status === 200 ) {
res.json().then( json => { res.json().then( json => {
this.startPageSettings = json; this.startPageSettings = json[ 'options' ];
console.log( json ); for ( let option in this.startPageSettings ) {
this.startPageSettings[ option ][ 'value' ] = json[ 'conf' ][ option ];
}
} ); } );
} }
} ); } );
@@ -59,7 +63,7 @@
fetch( '/admin/getAPI/getSettings' ).then( res => { fetch( '/admin/getAPI/getSettings' ).then( res => {
if ( res.status === 200 ) { if ( res.status === 200 ) {
res.json().then( json => { res.json().then( json => {
this.selectedTemplate = String( json[ 'startPage' ] ); this.selectedTemplate = json[ 'startPage' ];
} ); } );
} }
} ); } );