Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.
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
27 changes: 6 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
type="text"
ref="noteName"
v-model="note.name"
placeholder="Your note name">
placeholder="Your note name"
required>
</b-input>
</b-field>

Expand All @@ -20,7 +21,8 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
type="text"
ref="noteDescription"
v-model="note.description"
placeholder="Your description">
placeholder="Your description"
required>
</b-input>
</b-field>

Expand All @@ -44,7 +46,8 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
style="width: 186px"
type="text"
v-model="file.name"
placeholder="Your file name">
placeholder="Your file name"
required>
</b-input>
<p class="control is-pulled-right" v-if="files.length > 1">
<button class="button is-danger" @click="deleteFile(file)">
Expand All @@ -55,7 +58,7 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated

<b-field horizontal label="Language">
<v-select style="width: 186px" label="name" :options="sortedLanguagesByUse" placeholder="Select a language"
v-model="file.language" :reduce="selectedLanguage => selectedLanguage.name">
v-model="file.language" :reduce="selectedLanguage => selectedLanguage.name" :clearable="false">
<template v-slot:option="option">
{{ option.name | capitalize }}
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,18 @@ export default {
computed: {
...mapGetters(['gistsSelected', 'notes']),
isDisabled() {
return this.files.some(file => !/\S/.test(file.content));
const isGistDisabled = () => (
!/\S/.test(this.note.description) ||
this.files.some(file => !/\S/.test(file.name)) ||
this.files.some(file => !/\S/.test(file.language)) ||
this.files.some(file => !/\S/.test(file.content))
);

const isNoteDisabled = () => (
isGistDisabled() || !/\S/.test(this.note.name)
);

return this.gistsSelected ? isGistDisabled() : isNoteDisabled();
},
sortedLanguagesByUse() {
this.languages.forEach((language) => { language.frequency = 0; });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
type="text"
ref="noteDescription"
v-model="noteUpdated.description"
placeholder="Your description">
placeholder="Your description"
required>
</b-input>
</b-field>

Expand All @@ -38,7 +39,8 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
style="width: 186px"
type="text"
v-model="file.name"
placeholder="Your file name">
placeholder="Your file name"
required>
</b-input>
<p class="control is-pulled-right" v-if="files.length > 1">
<button class="button is-danger" @click="deleteFile(file)">
Expand All @@ -48,7 +50,7 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
</b-field>

<b-field horizontal label="Language">
<b-select placeholder="Select a language" v-model="file.language">
<b-select placeholder="Select a language" v-model="file.language" :clearable="false">
<option
v-for="language in languages"
:value="language.name">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,18 @@ export default {
computed: {
...mapGetters(['gistsSelected']),
isDisabled() {
return this.files.some(file => !/\S/.test(file.content));
const isGistDisabled = () => (
!/\S/.test(this.noteUpdated.description) ||
this.files.some(file => !/\S/.test(file.name)) ||
this.files.some(file => !/\S/.test(file.language)) ||
this.files.some(file => !/\S/.test(file.content))
);

const isNoteDisabled = () => (
isGistDisabled() || !/\S/.test(this.noteUpdated.name)
);

return this.gistsSelected ? isGistDisabled() : isNoteDisabled();
},
},
};
Expand Down