Skip to content
Snippets Groups Projects
Commit d8237194 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

add fast form for title

parent f01e6ae0
No related branches found
No related tags found
1 merge request!438REDMINE_ISSUE-14072|Mode édition rapide des signalements
......@@ -2,7 +2,24 @@
<div>
<h1 class="ui header">
<div class="content">
{{ currentFeature.title || currentFeature.feature_id }}
<span
v-if="fastEditionMode && form"
class="form ui half-block"
>
<input
id="feature_detail_title_input"
:value="form.title"
type="text"
required
maxlength="128"
name="title"
@blur="updateStore"
>
</span>
<span v-else>
{{ currentFeature.title || currentFeature.feature_id }}
</span>
<div class="ui icon right floated compact buttons">
<router-link
v-if="displayToListButton"
......@@ -140,6 +157,7 @@
import { mapState, mapGetters } from 'vuex';
export default {
name: 'FeatureHeader',
......@@ -174,9 +192,9 @@ export default {
'isOnline',
]),
...mapState('feature', [
'currentFeature'
'currentFeature',
'form',
]),
...mapGetters([
'permissions',
]),
......@@ -220,9 +238,14 @@ export default {
}
});
},
saveFastEdition() {
this.$store.dispatch('feature/SEND_FEATURE', this.$route.name)
.then(() => console.log('sent'));
},
updateStore(e) {
this.$store.commit('feature/UPDATE_FORM_FIELD', { name: 'title', value: e.target.value });
}
}
};
......@@ -236,4 +259,13 @@ export default {
line-height: 0;
margin-right: 5px;
}
.half-block {
display: inline-block;
width: 50%;
}
#feature_detail_title_input {
font-weight: bold;
font-size: 2em;
padding: .25em;
}
</style>
\ No newline at end of file
......@@ -64,14 +64,5 @@ export default {
return [];
},
},
mounted() {
console.log('selectedStatus', this.selectedStatus);
},
methods: {
}
};
</script>
\ No newline at end of file
......@@ -40,7 +40,11 @@ const feature = {
};
},
UPDATE_FORM_FIELD(state, field) {
state.form[field.name].value = field.value;
if (state.form[field.name].value) {
state.form[field.name].value = field.value;
} else {
state.form[field.name] = field.value;
}
},
UPDATE_EXTRA_FORM(state, extra_form) {
const index = state.extra_forms.findIndex(el => el.label === extra_form.label);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment