mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Added focus directive to focus textarea for a private message model box
This commit is contained in:
@@ -193,3 +193,16 @@ habitrpg
|
||||
" </div>\n" +
|
||||
"</div>\n");
|
||||
}]);
|
||||
|
||||
habitrpg.directive('focusMe', function($timeout, $parse) {
|
||||
return {
|
||||
link: function(scope, element, attrs) {
|
||||
var model = $parse(attrs.focusMe);
|
||||
scope.$watch(model, function(value) {
|
||||
$timeout(function() {
|
||||
element[0].focus();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ script(type='text/ng-template', id='modals/private-message.html')
|
||||
.modal-header
|
||||
h4=env.t('pmHeading', {name: "{{profile.profile.name}}"})
|
||||
.modal-body
|
||||
textarea.form-control(type='text',rows='5',ui-keydown='{"meta-enter":"sendPrivateMessage(profile._id, _message)"}',ng-model='_message')
|
||||
textarea.form-control(type='text',rows='5',ui-keydown='{"meta-enter":"sendPrivateMessage(profile._id, _message)"}',ng-model='_message', focus-me)
|
||||
.modal-footer
|
||||
button.btn.btn-primary(ng-click='sendPrivateMessage(profile._id, _message)')=env.t("send")
|
||||
button.btn.btn-default(ng-click='$close()')=env.t('cancel')
|
||||
|
||||
Reference in New Issue
Block a user