Edit basic custom field style and visual behavior

stable
Xavier Julián 2015-02-20 08:57:49 +01:00 committed by David Barragán Merino
parent 74331bbbc0
commit e1c0e2e7af
2 changed files with 9 additions and 6 deletions

View File

@ -145,6 +145,7 @@ CustomAttributeValueDirective = ($template, $selectedText) ->
saveAttributeValue = -> saveAttributeValue = ->
attributeValue.value = $el.find("input").val() attributeValue.value = $el.find("input").val()
$el.find('.custom-field-single').removeClass('editable')
$scope.$apply -> $scope.$apply ->
$ctrl.updateAttributeValue(attributeValue).then -> $ctrl.updateAttributeValue(attributeValue).then ->
@ -167,6 +168,7 @@ CustomAttributeValueDirective = ($template, $selectedText) ->
event.preventDefault() event.preventDefault()
render(attributeValue, true) render(attributeValue, true)
$el.find("input[name='description']").focus().select() $el.find("input[name='description']").focus().select()
$el.find('.custom-field-single').addClass('editable')
## Actions (on edit mode) ## Actions (on edit mode)
submit = debounce 2000, (event) => submit = debounce 2000, (event) =>

View File

@ -23,19 +23,20 @@
@include slide(1000px, hidden, $min: 0); @include slide(1000px, hidden, $min: 0);
} }
.custom-field-single { .custom-field-single {
align-content: center;
align-items: center;
border-bottom: 1px solid $whitish; border-bottom: 1px solid $whitish;
display: flex; display: flex;
padding: 1rem; padding: 1rem;
&:last-child {
border-bottom: 0;
}
&:hover { &:hover {
.custom-field-options { .custom-field-options {
opacity: 1; opacity: 1;
} }
} }
&.editable {
.custom-field-options {
align-items: center;
display: flex;
}
}
.custom-field-options { .custom-field-options {
opacity: 0; opacity: 0;
transition: opacity .2s linear; transition: opacity .2s linear;
@ -63,7 +64,7 @@
} }
.custom-field-value { .custom-field-value {
flex: 1; flex: 1;
padding-right: 2rem; padding: 0 1rem 0 2rem;
} }
form { form {
label { label {