Commit df7c67cb authored by Bitcoin Please's avatar Bitcoin Please
Browse files

Added gravatar support.

parent 4abef2ef
......@@ -46,7 +46,7 @@ export default {
//
},
mounted: function () {
//
// return this.toast(['Done!', 'Blank mounted successfully!', 'success'])
},
}
</script>
......
......@@ -2,6 +2,7 @@
// import telr from '../../api/telr'
/* Import modules (getters). */
import getAvatar from './profile/getters/getAvatar'
import getEmail from './profile/getters/getEmail'
import getMasterSeed from './profile/getters/getMasterSeed'
import getNickname from './profile/getters/getNickname'
......@@ -50,6 +51,7 @@ const state = {
/* Getters. */
const getters = {
getAvatar,
getEmail,
getMasterSeed,
getNickname,
......
/* Import modules. */
const Nito = require('nitojs')
/**
* Get Avatar
*/
const getAvatar = (state, getter) => {
/* Validate state. */
if (!state || !getter.getEmail) {
return null
}
/* Set email address. */
const email = getter.getEmail
// console.log('AVATAR (email):', email)
/* Encode email address. */
const encoded = Nito.Crypto.hash(email, 'md5', true)
// console.log('AVATAR (encoded):', encoded)
/* Set avatar (url). */
const avatar = `http://www.gravatar.com/avatar/${encoded}.jpg?s=256`
// console.log('AVATAR:', avatar)
/* Return avatar. */
return avatar
}
/* Export module. */
export default getAvatar
......@@ -15,7 +15,7 @@
<div class="account-main">
<div class="author clearfix">
<a class="author-avatar" href="javascript://">
<img src="@/assets/img/dashboard-avatar.png" alt="">
<img src="getAvatar" alt="">
</a>
<div class="author-content">
......@@ -107,6 +107,7 @@ export default {
]),
...mapGetters('profile', [
'getAvatar',
'getEmail',
'getNickname',
]),
......
......@@ -15,7 +15,7 @@
<div class="author clearfix">
<a class="author-avatar" href="javascript://">
<img src="@/assets/img/dashboard-avatar.png" alt="">
<img :src="getAvatar" alt="">
</a>
<div class="author-content">
......@@ -34,7 +34,7 @@
</a>
</p>
<p>
Causes Cash member since June 2020
Causes Cash member since August 2020
</p>
</div>
</div>
......@@ -46,29 +46,11 @@
</div>
<div class="col-2">
<strong>First Name</strong>
<strong>Nickname</strong>
</div>
<div class="col-8">
Martinez
</div>
<div class="col-1">
<!-- offset fix -->
</div>
</div>
<div class="row my-3">
<div class="col-1">
<!-- offset fix -->
</div>
<div class="col-2">
<strong>Last Name</strong>
</div>
<div class="col-8">
Melvin
Satoshi N.
</div>
<div class="col-1">
......@@ -159,6 +141,7 @@ export default {
]),
...mapGetters('profile', [
'getAvatar',
'getEmail',
'getNickname',
]),
......
......@@ -46,7 +46,7 @@ export default {
//
},
mounted: function () {
//
// return this.toast(['Done!', 'Blank mounted successfully!', 'success'])
},
}
</script>
......
......@@ -422,6 +422,9 @@
</template>
<script>
/* Initialize vuex. */
import { mapActions } from 'vuex'
/* Import modules. */
import superagent from 'superagent'
......@@ -474,28 +477,32 @@ export default {
},
},
methods: {
...mapActions('utils', [
'toast',
]),
/**
* Create New
*/
async createNew() {
/* Validate title. */
if (!this.title || !this.slug) {
return alert('Enter a title')
return this.toast(['Oops!', 'Please enter a title', 'error'])
}
// /* Validate model. */
if (!this.model) {
return alert('Enter a model')
return this.toast(['Oops!', 'Please enter a model', 'error'])
}
/* Validate category. */
if (!this.category) {
return alert('Enter a category')
return this.toast(['Oops!', 'Please enter a category', 'error'])
}
/* Validate location. */
if (!this.location) {
return alert('Enter a location')
return this.toast(['Oops!', 'Please enter a location', 'error'])
}
const pkg = {
......@@ -521,7 +528,7 @@ export default {
this.category = null
this.location = null
alert('New campaign created successfully!')
this.toast(['Done!', 'New campaign created successfully!', 'success'])
}
},
......
......@@ -42,7 +42,7 @@ export default {
/* Handle campaign supporters. */
if (_campaign && _campaign.assurance) {
this.pledges = _campaign.assurance.pledges.filter(pledge => {
return pledge.isSpent === false
return (pledge.isFilled === true || pledge.isSpent === false)
})
/* Sort pledges (decending). */
......
......@@ -398,6 +398,10 @@ export default {
'updateCampaign',
]),
...mapActions('utils', [
'toast',
]),
/**
* Save
*/
......@@ -427,7 +431,7 @@ export default {
/* Handle result. */
if (result.ok && !result.error) {
alert('Campaign updated successfully!')
this.toast(['Done!', 'Campaign updated successfully!', 'success'])
}
},
......@@ -452,7 +456,25 @@ export default {
if (this.ownerSlug && this.slug) {
/* Set campaign. */
this.campaign = await this.getCampaign(this.ownerSlug, this.slug)
console.log('SOCIAL (campaign):', this.campaign)
console.log('MEDIA (campaign):', this.campaign)
/* Initilalize photos. */
if (this.campaign && this.campaign.media) {
/* Set media. */
const media = this.campaign.media
if (media.main) {
this.photo1Url = media.main
}
if (media.gallery && media.gallery[0]) {
this.photo2Url = media.gallery[0]
}
if (media.gallery && media.gallery[1]) {
this.photo3Url = media.gallery[1]
}
}
if (this.campaign.news) {
// FOR DEV ONLY
......
......@@ -107,6 +107,10 @@ export default {
'updateCampaign',
]),
...mapActions('utils', [
'toast',
]),
/**
* Save
*/
......@@ -148,7 +152,7 @@ export default {
/* Handle result. */
if (result.ok && !result.error) {
alert('Campaign updated successfully!')
this.toast(['Done!', 'Campaign updated successfully!', 'success'])
}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment