Skip to content

Commit 10c7ad7

Browse files
committed
added example gallery toogle to siteconfiguration #99
1 parent 69372ec commit 10c7ad7

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.1.4 on 2021-05-07 14:28
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('main', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='siteconfiguration',
15+
name='example_gallery_enabled',
16+
field=models.BooleanField(default=True),
17+
),
18+
]

django/main/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
class SiteConfiguration(SingletonModel):
55
search_enabled = models.BooleanField(default=True)
6+
example_gallery_enabled = models.BooleanField(default=True)
67
homepage_snippet = models.TextField(blank=True)
78

89
def __str__(self):

django/main/schema.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
class SiteConfigurationNode(DjangoObjectType):
99
class Meta:
1010
model = SiteConfiguration
11-
fields = ['id', 'search_enabled', 'homepage_snippet']
11+
fields = [
12+
'id', 'search_enabled', 'example_gallery_enabled',
13+
'homepage_snippet'
14+
]
1215

1316
def resolve_homepage_snippet(self, info):
1417
language = self.language

vue/src/views/Home.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
</v-row>
3232
</v-container>
3333

34-
<v-container v-if="!networkError" class="center" fluid mb-12>
35-
<v-row justify="center" >
34+
<v-container v-if="!networkError && exampleGalleryEnabled" class="center" fluid mb-12>
35+
<v-row justify="center">
3636
<v-col class="introtxt text-center">
3737
<h2>{{ $t('h2.2') }}</h2>
3838
</v-col>
@@ -110,6 +110,7 @@ export default {
110110
networkError: false,
111111
snackbar: false,
112112
searchEnabled: true,
113+
exampleGalleryEnabled: true,
113114
homepageSnippet: ''
114115
};
115116
},
@@ -144,6 +145,7 @@ export default {
144145
query: gql`query getconfig($language: String) {
145146
config(language: $language) {
146147
searchEnabled,
148+
exampleGalleryEnabled,
147149
homepageSnippet
148150
}
149151
}`,
@@ -159,6 +161,7 @@ export default {
159161
const config = configResult.data.config;
160162
if (config) {
161163
this.searchEnabled = config.searchEnabled;
164+
this.exampleGalleryEnabled = config.exampleGalleryEnabled;
162165
this.homepageSnippet = config.homepageSnippet;
163166
}
164167
}

0 commit comments

Comments
 (0)