Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source link to public page #152

Merged
merged 2 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/Auth/AuthRegister.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export default {

this.isLoading = true
ApiRequests.registerNewUser(postData).then(() => {
this.$toast.default(this.$t('register-success'))
if (window.srConfig.MAILS_ENABLED === true) {
this.$toast.default(this.$t('register-success-email'))
} else {
this.$toast.default(this.$t('register-success'))
}
this.$router.push('/login')
}).catch(e => {
this.isLoading = false
Expand Down
7 changes: 6 additions & 1 deletion src/components/Cocktail/CocktailPublicDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<PublicRecipe :cocktail="cocktail"></PublicRecipe>
<div class="public-footer">
Powered by <a href="https://barassistant.app">Bar Assistant</a>
<template v-if="cocktail.source">
&middot; <SourcePresenter :source="cocktail.source"></SourcePresenter>
</template>
<!-- &middot; <a href="#">Add to your bar</a> &middot; <a href="#">Print</a> -->
</div>
</div>
Expand All @@ -15,11 +18,13 @@
import ApiRequests from '@/ApiRequests'
import SiteLogo from '@/components/Layout/SiteLogo.vue'
import PublicRecipe from '@/components/Cocktail/PublicRecipe.vue'
import SourcePresenter from '../SourcePresenter.vue'

export default {
components: {
SiteLogo,
PublicRecipe
PublicRecipe,
SourcePresenter
},
data() {
return {
Expand Down
28 changes: 28 additions & 0 deletions src/components/SourcePresenter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<a :href="source" v-if="isLink" target="_blank">{{ $t('source') }}</a>
<span v-else>{{ $t('source') }}: {{ source }}</span>
</template>

<script>
export default {
props: {
source: {
type: String,
default: null,
}
},
computed: {
isLink() {
let url;

try {
url = new URL(this.source);
} catch (_) {
return false;
}

return url.protocol === "http:" || url.protocol === "https:";
}
}
}
</script>
1 change: 1 addition & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
"status-not-available": "Not available",
"passwords-not-match": "Passwords do not match",
"register-success": "You are now registered, you can now login with your information",
"register-success-email": "You are now registered, check your email for account confirmation",
"apply-filters": "Apply filters",
"show-less": "Show less",
"clear-filters": "Clear all filters",
Expand Down
Loading