Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilliams1188 committed Oct 30, 2020
1 parent f7e4841 commit 143d052
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 41 deletions.
13 changes: 1 addition & 12 deletions client/edit-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,4 @@ $('.delete-project-button').click(function (event) {
let data = objectifyForm($('#wf-form-Edit-Project').serializeArray())
if (!data || !data.slug) return
deleteProject(data)
})

function addToolsFromTags(tags) {
let toolTags = tagsArray.filter(item => item.type === 'company').map(item => item.value)
let userTags = firebaseCollections['user_company'].map(item => item.companyId)
console.log({ toolTags, userTags })
let newTools = tags.filter(item => toolTags.includes(item) && !userTags.includes(item))
console.log(newTools)
return newTools.forEach(item => {
followCompany(item)
})
}
})
13 changes: 1 addition & 12 deletions client/edit-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,4 @@ $('.delete-project-button').click(function (event) {
let data = objectifyForm($('#wf-form-Edit-Workflow').serializeArray())
if (!data || !data.id) return
deleteWorkflow(data)
})

async function addToolsFromTags(tags) {
let toolTags = tagsArray.filter(item => item.type === 'company').map(item => item.value)
let userTags = firebaseCollections['user_company'].map(item => item.companyId)
console.log({ toolTags, userTags })
let newTools = tags.filter(item => toolTags.includes(item) && !userTags.includes(item))
console.log(newTools)
return newTools.forEach(item => {
followCompany(item)
})
}
})
11 changes: 11 additions & 0 deletions client/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,17 @@ function updateTutorial(id, object) {
.catch(error => handleError(error))
}

async function addToolsFromTags(tags) {
let toolTags = searchArray.filter(item => item.type === 'company').map(item => item.id)
let userTags = firebaseCollections['user_company'].map(item => item.companyId)
console.log({ toolTags, userTags })
let newTools = tags.filter(item => toolTags.includes(item) && !userTags.includes(item))
console.log(newTools)
return newTools.forEach(item => {
followCompany(item)
})
}

function getUserImage(userObject) {
// return `https://firebasestorage.googleapis.com/v0/b/makerpad-94656.appspot.com/o/profile_pictures%2F${username}?alt=media&token=acf25318-5b18-454e-85d5-b3d2e694b04a`
if (userObject.imageUrl) {
Expand Down
10 changes: 10 additions & 0 deletions client/markup.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,13 @@ async function getRandomUsers() {
})
}

async function renderTags(target, data, class) {
populateSearchArray().then(() => {
if (data.tags) data.tags.forEach(tag => {
let tagItem = searchArray.find(item => item.id === tag)
$(target).append(`
<a href="${tagItem.link}" class="${class}">${tag}</a>
`)
})
})
}
9 changes: 1 addition & 8 deletions client/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ async function renderProject() {
if (data.price) $('.project-price-text').text(data.price)
if (data['sale-url'] || data.price) $('#project-purchase-block').show()

populateSearchArray().then(() => {
if (data.tags) data.tags.forEach(tag => {
let tagItem = searchArray.find(item => item.id === tag)
$('#project-tags').append(`
<a href="${tagItem.link}" class="project-tag">${tag}</a>
`)
})
})
renderTags('#project-tags', data, 'project-tag')

})
.catch(error => handleError(error))
Expand Down
11 changes: 2 additions & 9 deletions client/workflows.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,8 @@ async function renderWorkflow() {
} catch (error) { }
}

getTags()
.then(() => {
if (data.tags) data.tags.forEach(tag => {
let tagItem = tagsArray.find(item => item.value === tag)
$('#workflow-tags').append(`
<a href="/${tagItem.type}/${tagItem.value}" class="workflow-tag">${tag}</a>
`)
})
})
renderTags('#workflow-tags', data, 'workflow-tag')

})
.catch(error => handleError(error))
}
Expand Down

0 comments on commit 143d052

Please sign in to comment.