Skip to content

Commit

Permalink
[#22] make note titles optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rainu committed Dec 11, 2019
1 parent 5c3ac1e commit f59bd0e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 39 deletions.
8 changes: 4 additions & 4 deletions components/note/form/Camera.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<v-row>
<v-col cols="12">
<v-text-field v-model="note.title" :label="$t('note.title')" :rules="ruleRequired" required></v-text-field>
<v-text-field v-model="note.title" :label="$t('note.title')" :placeholder="$t('note.untitled')"></v-text-field>
</v-col>
</v-row>

Expand Down Expand Up @@ -110,7 +110,7 @@
}
if(this.data) {
note.title = this.data.title
note.title = this.data.title === this.$t('note.untitled') ? null : this.data.title
note.tags = this.data.tags
note.description = this.data.content.description
note.image = this.data.content.image
Expand Down Expand Up @@ -182,7 +182,7 @@
let data = {
content: {}
}
data.title = this.note.title
data.title = this.note.title ? this.note.title : this.$t('note.untitled')
data.tags = this.note.tags
data.content.description = this.note.description
data.content.image = this.note.image
Expand All @@ -209,7 +209,7 @@
}
},
data(newData) {
this.note.title = newData.title
this.note.title = newData.title === this.$t('note.untitled') ? null : newData.title
this.note.tags = newData.tags
this.note.description = newData.content.description
this.note.image = newData.content.image
Expand Down
30 changes: 15 additions & 15 deletions components/note/form/Credentials.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,12 @@
</v-row>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.title" :label="$t('note.title')" :rules="ruleRequired" required></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.url" :label="$t('note.credentials.url')" ></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-textarea v-model="note.description" :label="$t('note.credentials.description')" ></v-textarea>
<v-text-field v-model="note.title" :label="$t('note.title')" :placeholder="$t('note.untitled')" ></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="12" sm="6">
<v-text-field v-model="note.username" :label="$t('note.credentials.username')" :rules="ruleRequired" required></v-text-field>
<v-text-field v-model="note.username" :label="$t('note.credentials.username')" autofocus></v-text-field>
</v-col>
<v-col cols="12" sm="6">
<v-text-field :type="showPassword ? 'text' : 'password'"
Expand All @@ -35,6 +25,16 @@
required />
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-textarea v-model="note.description" :label="$t('note.credentials.description')" ></v-textarea>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.url" :label="$t('note.credentials.url')" ></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<TagPicker v-model="note.tags" :tags="availableTags"></TagPicker>
Expand Down Expand Up @@ -81,7 +81,7 @@
}
if(this.data) {
note.title = this.data.title
note.title = this.data.title === this.$t('note.untitled') ? null : this.data.title
note.tags = this.data.tags
note.url = this.data.content.url
note.description = this.data.content.description
Expand Down Expand Up @@ -124,7 +124,7 @@
let data = {
content: {}
}
data.title = this.note.title
data.title = this.note.title ? this.note.title : this.$t('note.untitled')
data.tags = this.note.tags
data.content.url = this.note.url
data.content.description = this.note.description
Expand All @@ -140,7 +140,7 @@
},
watch: {
data(newData) {
this.note.title = newData.title
this.note.title = newData.title === this.$t('note.untitled') ? null : newData.title
this.note.tags = newData.tags
this.note.url = newData.content.url
this.note.description = newData.content.description
Expand Down
10 changes: 5 additions & 5 deletions components/note/form/Picture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.title" :label="$t('note.title')" :rules="ruleRequired" required></v-text-field>
<v-text-field v-model="note.title" :label="$t('note.title')" :placeholder="$t('note.untitled')"></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field v-model="note.url" :label="$t('note.text.content')" :placeholder="$t('note.picture.url.placeholder')" :rules="ruleRequired" required></v-text-field>
<v-text-field v-model="note.url" :label="$t('note.text.content')" :placeholder="$t('note.picture.url.placeholder')" :rules="ruleRequired" required autofocus></v-text-field>
</v-col>
<v-col cols="12">
<TagPicker v-model="note.tags" :tags="availableTags"></TagPicker>
Expand Down Expand Up @@ -49,7 +49,7 @@
}
if(this.data) {
note.title = this.data.title
note.title = this.data.title === this.$t('note.untitled') ? null : this.data.title
note.tags = this.data.tags
note.url = this.data.content.url
}
Expand Down Expand Up @@ -85,7 +85,7 @@
let data = {
content: {}
}
data.title = this.note.title
data.title = this.note.title ? this.note.title : this.$t('note.untitled')
data.tags = this.note.tags
data.content.url = this.note.url
Expand All @@ -98,7 +98,7 @@
},
watch: {
data(newData) {
this.note.title = newData.title
this.note.title = newData.title === this.$t('note.untitled') ? null : newData.title
this.note.tags = newData.tags
this.note.url = newData.content.url
}
Expand Down
10 changes: 5 additions & 5 deletions components/note/form/Reminder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.title" :label="$t('note.title')" :rules="ruleRequired" required></v-text-field>
<v-text-field v-model="note.title" :label="$t('note.title')" :placeholder="$t('note.untitled')"></v-text-field>
</v-col>
</v-row>

Expand Down Expand Up @@ -70,7 +70,7 @@
</v-row>
<v-row>
<v-col cols="12">
<v-textarea v-model="note.content" :label="$t('note.reminder.content')" :auto-grow="true" :rules="ruleRequired" required></v-textarea>
<v-textarea v-model="note.content" :label="$t('note.reminder.content')" :auto-grow="true" :rules="ruleRequired" required autofocus></v-textarea>
</v-col>
</v-row>
<v-row>
Expand Down Expand Up @@ -121,7 +121,7 @@
}
if(this.data) {
note.title = this.data.title
note.title = this.data.title === this.$t('note.untitled') ? null : this.data.title
note.tags = this.data.tags
note.date = this.data.content.date
note.markdown = !!this.data.content.markdown
Expand Down Expand Up @@ -181,7 +181,7 @@
if(!this.valid) return
let data = {}
data.title = this.note.title
data.title = this.note.title ? this.note.title : this.$t('note.untitled')
data.tags = this.note.tags
data.content = {}
data.content.date = this.note.date
Expand Down Expand Up @@ -209,7 +209,7 @@
this.recalcNoteDate()
},
data(newData) {
this.note.title = newData.title
this.note.title = newData.title === this.$t('note.untitled') ? null : newData.title
this.note.tags = newData.tags
this.note.date = newData.content.date
this.note.markdown = !!newData.content.markdown
Expand Down
10 changes: 5 additions & 5 deletions components/note/form/Template.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.title" :label="$t('note.title')" :rules="[ruleRequired]" required></v-text-field>
<v-text-field v-model="note.title" :label="$t('note.title')" :placeholder="$t('note.untitled')"></v-text-field>
</v-col>
</v-row>

Expand Down Expand Up @@ -38,7 +38,7 @@

<v-row>
<v-col cols="12">
<v-textarea v-model="note.template" :label="$t('note.template.template')" ></v-textarea>
<v-textarea v-model="note.template" :label="$t('note.template.template')" autofocus></v-textarea>
</v-col>
</v-row>

Expand Down Expand Up @@ -230,7 +230,7 @@
}
if(this.data) {
note.title = this.data.title
note.title = this.data.title === this.$t('note.untitled') ? null : this.data.title
note.tags = this.data.tags
note.template = this.data.content.template
note.placeholder = cloneDataObject(this.data.content.placeholder)
Expand Down Expand Up @@ -359,7 +359,7 @@
let data = {
content: {}
}
data.title = this.note.title
data.title = this.note.title ? this.note.title : this.$t('note.untitled')
data.tags = this.note.tags
data.content.template = this.note.template
data.content.placeholder = cloneDataObject(this.note.placeholder)
Expand Down Expand Up @@ -393,7 +393,7 @@
},
watch: {
data(newData) {
this.note.title = newData.title
this.note.title = newData.title === this.$t('note.untitled') ? null : newData.title
this.note.tags = newData.tags
this.note.template = newData.content.template
Expand Down
10 changes: 5 additions & 5 deletions components/note/form/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field v-model="note.title" :label="$t('note.title')" :rules="ruleRequired" required></v-text-field>
<v-text-field v-model="note.title" :label="$t('note.title')" :placeholder="$t('note.untitled')"></v-text-field>
</v-col>
<v-col cols="12">
<v-textarea v-model="note.content" :label="$t('note.text.content')" :auto-grow="true" :rules="ruleRequired" required></v-textarea>
<v-textarea v-model="note.content" :label="$t('note.text.content')" :auto-grow="true" :rules="ruleRequired" required autofocus></v-textarea>
</v-col>
<v-col cols="6">
<v-switch v-model="note.markdown" :label="$t('note.text.markdown')" color="primary"></v-switch>
Expand Down Expand Up @@ -49,7 +49,7 @@
}
if(this.data) {
note.title = this.data.title
note.title = this.data.title === this.$t('note.untitled') ? null : this.data.title
note.tags = this.data.tags
note.markdown = !!this.data.content.markdown
note.content = note.markdown ? this.data.content.markdown : this.data.content.text
Expand Down Expand Up @@ -84,7 +84,7 @@
if(!this.valid) return
let data = {}
data.title = this.note.title
data.title = this.note.title ? this.note.title : this.$t('note.untitled')
data.tags = this.note.tags
data.content = {}
if(this.note.markdown) data.content.markdown = this.note.content
Expand All @@ -99,7 +99,7 @@
},
watch: {
data(newData) {
this.note.title = newData.title
this.note.title = newData.title === this.$t('note.untitled') ? null : newData.title
this.note.tags = newData.tags
this.note.markdown = !!newData.content.markdown
this.note.content = this.note.markdown ? newData.content.markdown : newData.content.text
Expand Down
1 change: 1 addition & 0 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
},
"note": {
"title": "Titel",
"untitled": "Unbenannt",
"help": {
"first-steps": {
"title": "Willkommen in {appName}",
Expand Down
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
},
"note": {
"title": "Title",
"untitled": "Untitled",
"help": {
"first-steps": {
"title": "Welcome to {appName}",
Expand Down

0 comments on commit f59bd0e

Please sign in to comment.