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

Gpg/reduced spec grants details #8495

Merged
merged 3 commits into from
Mar 5, 2021
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
61 changes: 30 additions & 31 deletions app/assets/v2/js/grants/_detail-component.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

let isStaff = document.contxt.is_staff || false;
const isStaff = document.contxt.is_staff || false;

let userCode = typeof user_code !== 'undefined' ? user_code : undefined;
let verificationTweet = typeof verification_tweet !== 'undefined' ? verification_tweet : undefined;
const userCode = typeof user_code !== 'undefined' ? user_code : undefined;
const verificationTweet = typeof verification_tweet !== 'undefined' ? verification_tweet : undefined;

Vue.component('v-select', VueSelect.VueSelect);
Vue.use(VueQuillEditor);
Expand All @@ -12,14 +12,14 @@ Quill.register('modules/ImageExtend', ImageExtend);
Vue.mixin({
methods: {
grantInCart: function() {
let vm = this;
let inCart = CartData.cartContainsGrantWithId(vm.grant.id);
const vm = this;
const inCart = CartData.cartContainsGrantWithId(vm.grant.id);

vm.$set(vm.grant, 'isInCart', inCart);
return vm.grant.isInCart;
},
addToCart: async function() {
let vm = this;
const vm = this;
const grantCartPayloadURL = `/grants/v1/api/${vm.grant.id}/cart_payload`;
const response = await fetchData(grantCartPayloadURL, 'GET');

Expand All @@ -31,7 +31,7 @@ Vue.mixin({

},
removeFromCart: function() {
let vm = this;
const vm = this;

vm.$set(vm.grant, 'isInCart', false);
CartData.removeIdFromCart(vm.grant.id);
Expand All @@ -41,15 +41,15 @@ Vue.mixin({

},
editGrantModal: function() {
let vm = this;
const vm = this;

vm.logoPreview = vm.grant.logo_url;

vm.$root.$emit('bv::toggle::collapse', 'sidebar-grant-edit');
},
saveGrant: function(event) {
event.preventDefault();
let vm = this;
const vm = this;

if (!vm.checkForm(event))
return;
Expand All @@ -59,7 +59,7 @@ Vue.mixin({
};

const apiUrlGrant = `/grants/v1/api/grant/edit/${vm.grant.id}/`;
let data = {
const data = {
'title': vm.grant.title,
'reference_url': vm.grant.reference_url,
'description': vm.$refs.myQuillEditor.quill.getText(),
Expand Down Expand Up @@ -129,9 +129,9 @@ Vue.mixin({
cancelGrant: function(event) {
event.preventDefault();

let vm = this;
const vm = this;

let cancel = window.prompt('Please write "CONFIRM" to cancel the grant.');
const cancel = window.prompt('Please write "CONFIRM" to cancel the grant.');

if (cancel !== 'CONFIRM') {
return;
Expand All @@ -153,10 +153,10 @@ Vue.mixin({

},
toggleFollowingGrant: async function(grantId) {
let vm = this;
const vm = this;

const favoriteUrl = `/grants/${grantId}/favorite`;
let response = await fetchData(favoriteUrl, 'POST');
const response = await fetchData(favoriteUrl, 'POST');

if (response.action === 'follow') {
vm.grant.favorite = true;
Expand All @@ -167,7 +167,7 @@ Vue.mixin({
return true;
},
flag: function() {
let vm = this;
const vm = this;


const comment = prompt('What is your reason for flagging this Grant?');
Expand Down Expand Up @@ -199,7 +199,7 @@ Vue.mixin({
});
},
userSearch(search, loading) {
let vm = this;
const vm = this;

if (search.length < 3) {
return;
Expand All @@ -209,9 +209,9 @@ Vue.mixin({

},
getUser: async function(loading, search, selected) {
let vm = this;
let myHeaders = new Headers();
let url = `/api/v0.1/users_search/?token=${currentProfile.githubToken}&term=${escape(search)}&suppress_non_gitcoiners=true`;
const vm = this;
const myHeaders = new Headers();
const url = `/api/v0.1/users_search/?token=${currentProfile.githubToken}&term=${escape(search)}&suppress_non_gitcoiners=true`;

myHeaders.append('X-Requested-With', 'XMLHttpRequest');
return new Promise(resolve => {
Expand All @@ -235,12 +235,12 @@ Vue.mixin({
});
},
changeColor() {
let vm = this;
const vm = this;

vm.grant.image_css = `background-color: ${vm.logoBackground};`;
},
onFileChange(e) {
let vm = this;
const vm = this;

if (!e.target) {
return;
Expand All @@ -252,7 +252,7 @@ Vue.mixin({
return;
}
vm.imgTransition = true;
let imgCompress = new Compressor(file, {
const imgCompress = new Compressor(file, {
quality: 0.6,
maxWidth: 2000,
success(result) {
Expand All @@ -267,7 +267,7 @@ Vue.mixin({
});
},
async twitterVerification() {
let vm = this;
const vm = this;

if (!vm.grant.twitter_handle_1 || vm.grant.twitter_handle_1 == '') {
_alert('Please add a twitter account to your grant!', 'error', 5000);
Expand Down Expand Up @@ -320,13 +320,13 @@ Vue.mixin({
}
},
tweetVerification() {
let vm = this;
const vm = this;
const tweetContent = `https://twitter.com/intent/tweet?text=${encodeURIComponent(vm.verification_tweet)}%20${encodeURIComponent(vm.user_code)}`;

window.open(tweetContent, '_blank');
},
checkForm: function(e) {
let vm = this;
const vm = this;

vm.submitted = true;
vm.errors = {};
Expand Down Expand Up @@ -405,7 +405,7 @@ Vue.mixin({
if (!user?.fields) {
return user;
}
let newTeam = {};
const newTeam = {};

newTeam['id'] = user.pk;
newTeam['avatar_url'] = `/dynamic/avatar/${user.fields.handle}`;
Expand All @@ -425,7 +425,7 @@ Vue.mixin({
return this.$refs.myQuillEditor.quill;
},
filteredMsg: function() {
let msgs = [
const msgs = [
'💪 keep up the great work',
'👍 i appreciate you',
'🙌 Great Job',
Expand Down Expand Up @@ -453,7 +453,7 @@ Vue.mixin({
);
},
isUserLogged() {
let vm = this;
const vm = this;

if (document.contxt.github_handle) {
return true;
Expand Down Expand Up @@ -487,7 +487,6 @@ Vue.component('grant-details', {
logo: null,
logoPreview: null,
logoBackground: null,
relatedGrants: [],
rows: 0,
perPage: 4,
currentPage: 1,
Expand Down Expand Up @@ -540,7 +539,7 @@ Vue.component('grant-details', {
};
},
mounted: function() {
let vm = this;
const vm = this;

vm.grant_twitter_handle_1 = vm.grant.twitter_handle_1;
vm.grant.description_rich_edited = vm.grant.description_rich;
Expand All @@ -553,7 +552,7 @@ Vue.component('grant-details', {
grant: {
deep: true,
handler: function(newVal, oldVal) {
let vm = this;
const vm = this;

if (this.dirty && this.submitted) {
this.checkForm();
Expand Down
Loading