Skip to content
Snippets Groups Projects
Commit 549bcb2b authored by jaden's avatar jaden
Browse files

simplify editableLabel into just an input field

parent de37b8fc
No related branches found
No related tags found
1 merge request!223Reports overhaul
......@@ -32,29 +32,17 @@ angular.module('reportApp').directive("editableLabel", [function(){
field: '@'
},
link: function(scope){
scope.editingGroupName = false;
scope.toggleEditingGroupName = () => {
scope.editingGroupName = !scope.editingGroupName;
};
},
template: `
<span ng-if='!editingGroupName' ng-click='toggleEditingGroupName()'>
<span>{{ obj[field] }}</span>
<span style='cursor: pointer;' class='glyphicon glyphicon-pencil'></span>
<span style='display: inline-block;'>
<input
style='display: inline;'
required
type='text'
class='form-control'
placeholder='A label...'
ng-model='obj[field]'/>
</span>
<form class='form-inline' role='form' style='display: inline;' ng-if='editingGroupName'>
<span class='input-group'>
<input
required
type='text'
class='form-control'
placeholder='A label...'
ng-model='obj[field]'/>
<span class='input-group-btn' ng-click='toggleEditingGroupName()'>
<button type='submit' class='btn btn-default'>Save</button>
</span>
</span>
</form>
`
};
}]);
......
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