Skip to content

Commit

Permalink
v.0.3.0 Features and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpcat237 committed May 16, 2020
1 parent e0a124f commit 41b89d5
Show file tree
Hide file tree
Showing 6 changed files with 9,002 additions and 18 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 0.3.0 (2020.05.17)

#### Features
- Lowercase and replace spaces with _ in new tag
- Improve regex for title extraction
- Update dependencies

#### Fixes
- Prevent saving tag without URL and title
- Prevent selecting multiple times same tag
- Clean filtered tags after reopening without link

# 0.2.0 (2020.05.10)

#### Features
Expand Down
30 changes: 29 additions & 1 deletion app/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,15 @@
methods: {
addNewTag() {
const tag = {
name: this.tagField,
name: this.cleanNewTag(this.tagField),
}
this.tagsAdded.push(tag)
this.tagField = ""
},
addSelectedTag(tag) {
if (this.isTagExists(tag)) {
return
}
this.tagsAdded.push(tag)
this.tagField = ""
},
Expand All @@ -145,12 +148,23 @@
this.tagsAdded = []
this.$store.dispatch('cleanTags')
},
cleanNewTag(tag) {
return tag.toLowerCase().trim().replace(" ","_")
},
getLinkDetails() {
if (this.urlField === "") {
return
}
this.$store.dispatch('getLink', this.urlField)
},
isTagExists(tag) {
for (let i = 0; i < this.tagsAdded.length; i++) {
if (this.tagsAdded[i].name === tag.name) {
return true
}
}
return false
},
listenForShared() {
if (!application.android) {
return
Expand Down Expand Up @@ -187,6 +201,15 @@
}
},
saveLnk() {
if (this.urlField === '' || this.titleField === '') {
alert({
title: "Alert",
message: "URL and title fields are required",
okButtonText: "OK"
})
return;
}
const data = {
description: this.description,
isPrivate: false,
Expand Down Expand Up @@ -215,6 +238,11 @@
this.$store.dispatch('filterTags', this.tagField)
},
},
beforeUpdate() {
if (this.urlField === '') {
this.tagsAdded = []
}
},
created() {
this.listenForShared()
},
Expand Down
7 changes: 6 additions & 1 deletion app/store/modules/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export default {
.get(url)
.then(function(response) {
if (response.data.length > 0) {
let matches = response.data.match("<title>(.*?)</title>")
let matches = response.data.match("<title[^>]*>(.*?)</title>")
if (matches === null) {
console.log('Error looking for title in body')
return
}
if (matches.length > 0) {
let link = {
id: "",
Expand Down Expand Up @@ -86,6 +90,7 @@ export default {
}
},
error => {
console.log('Error saving link ' + error)
commit('updateData', { key: 'errorMessage', value: 'Error saving link' })
commit('updateData', { key: 'savedLink', value: true })
}
Expand Down

0 comments on commit 41b89d5

Please sign in to comment.