Browse Source

story-content: Changed tag form style and defaults.

1.0
Gisle Aune 6 years ago
parent
commit
df1295e7a6
  1. 5
      marko/page/story-content/components/edit-story-tags-modal/component.js
  2. 4
      marko/page/story-content/components/story-tag-options/component.js
  3. 6
      marko/page/story-content/components/story-tag-options/style.less

5
marko/page/story-content/components/edit-story-tags-modal/component.js

@ -19,6 +19,11 @@ module.exports = class {
} }
addTag(tag) { addTag(tag) {
if (tag.kind == "" || tag.name.length < 1) {
this.state.error = "You cannot add an empty tag"
return
}
this.state.error = null this.state.error = null
storyApi.addTag({id: this.input.story.id, tag}).then(({tags}) => { storyApi.addTag({id: this.input.story.id, tag}).then(({tags}) => {

4
marko/page/story-content/components/story-tag-options/component.js

@ -5,7 +5,7 @@ module.exports = class {
this.state = { this.state = {
values: { values: {
name: "", name: "",
kind: "Event",
kind: "Character",
}, },
tags: [], tags: [],
suggestions: [], suggestions: [],
@ -27,7 +27,7 @@ module.exports = class {
this.state.suggestions = [] this.state.suggestions = []
const suggestions = this.state.tags.filter(t => t.name.toLowerCase().includes(search)) const suggestions = this.state.tags.filter(t => t.name.toLowerCase().includes(search))
if (suggestions.length > 0 && suggestions.length < 10) {
if (suggestions.length > 0 && suggestions.length < 20) {
if (suggestions.length > 1 || suggestions[0].name !== name) { if (suggestions.length > 1 || suggestions[0].name !== name) {
this.state.suggestions = suggestions this.state.suggestions = suggestions
} }

6
marko/page/story-content/components/story-tag-options/style.less

@ -16,11 +16,11 @@ div.tag-options {
} }
div.suggestion-list { div.suggestion-list {
margin-top: 1em;
margin: 2em 0;
a.tag { a.tag {
display: inline-block; display: inline-block;
margin: 0.5em 0.5ch;
margin: 0.25em 0.5ch;
padding: 0.0625em 0.5ch; padding: 0.0625em 0.5ch;
outline: 1px solid; outline: 1px solid;
@ -34,7 +34,7 @@ div.tag-options {
} }
div.header { div.header {
display: inline-block;
display: block;
margin: 0.5em 0.5ch; margin: 0.5em 0.5ch;
padding: 0.0625em 0.5ch; padding: 0.0625em 0.5ch;

Loading…
Cancel
Save