Skip to content

Commit

Permalink
Fix forum integration
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed Jun 26, 2018
1 parent 5593f83 commit f05d3f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
17 changes: 15 additions & 2 deletions mixins/currentMicrositeNavItems.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import localConfig from '@/local.config'

/**
* A mixin for the current collection microsite nav items.
*/
Expand All @@ -7,6 +9,17 @@ export const currentMicrositeNavItems = {
return this.$store.state.currentCollection
},

forumUrl () {
const baseUrl = localConfig.flarum.url
if (
baseUrl &&
this.currentCollection.info.forum &&
this.currentCollection.info.forum.tag
) {
return baseUrl + '/t/' + this.currentCollection.info.forum.tag
}
},

currentMicrositeNavItems () {
const isMicrositePath = this.$route.path.indexOf('/collection') === 0

Expand Down Expand Up @@ -63,11 +76,11 @@ export const currentMicrositeNavItems = {
]

// Add the forum URL if configured
if (this.currentCollection.info.forum.url) {
if (typeof this.forumUrl !== 'undefined') {
items.push({
label: 'Discuss',
external: true,
link: this.currentCollection.info.forum.url
link: this.forumUrl
})
}

Expand Down
5 changes: 1 addition & 4 deletions pages/admin/collection/_short_name/forum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ export default {
: 'To select a related forum topic Flarum integration ' +
'should be enabled in application\'s the main ' +
'configuration file',
values: this.forumTags ? this.forumTags : [],
onChanged: (model, newVal) => {
model.info.forum.url = `${localConfig.flarum.url}/t/${newVal}`
}
values: this.forumTags ? this.forumTags : []
},
{
model: 'info.forum.url',
Expand Down
7 changes: 5 additions & 2 deletions pages/collection/_short_name/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
</b-container>
</section>

<section id="social-proof" class="opaque-navbar">
<section
v-if="localConfig.flarum.url && collection.info.forum.tag"
id="social-proof"
class="opaque-navbar">
<b-container>
<b-row>
<b-col
Expand Down Expand Up @@ -118,7 +121,7 @@
<b-btn
:variant="darkMode ? 'dark' : 'outline-dark'"
class="mt-md-2"
:href="collection.info.forum.url">
:href="`${localConfig.flarum.url}/t/${collection.info.forum.tag}`">
Visit the forum
</b-btn>
</div>
Expand Down

0 comments on commit f05d3f1

Please sign in to comment.