From 066f9df18f737cc64070a90b0884a466f57d29f5 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 17 Mar 2015 17:01:19 +1030 Subject: [PATCH] Tweak user bio editing styles --- ember/app/components/user/user-bio.js | 8 ++++++-- ember/app/styles/flarum/user.less | 12 +++++++----- ember/app/templates/components/user/user-bio.hbs | 12 +++++++----- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ember/app/components/user/user-bio.js b/ember/app/components/user/user-bio.js index 8ff58a34c..f18558877 100644 --- a/ember/app/components/user/user-bio.js +++ b/ember/app/components/user/user-bio.js @@ -24,10 +24,14 @@ export default Ember.Component.extend({ this.set('editing', true); var component = this; + var height = this.$().height(); Ember.run.scheduleOnce('afterRender', this, function() { - this.$('textarea').focus().blur(function() { + var save = function(e) { + if (e.shiftKey) { return; } + e.preventDefault(); component.send('save', $(this).val()); - }); + }; + this.$('textarea').css('height', height).focus().bind('blur', save).bind('keydown', 'return', save); }); }, diff --git a/ember/app/styles/flarum/user.less b/ember/app/styles/flarum/user.less index 3ec630c5e..fa687b444 100644 --- a/ember/app/styles/flarum/user.less +++ b/ember/app/styles/flarum/user.less @@ -70,25 +70,27 @@ } } & .user-bio { - padding: 10px 10px 1px; margin: -10px -10px 10px; + border: 1px dashed transparent; + border-radius: @border-radius-base; &.editable:not(.editing) { cursor: text; &:hover { - border: 1px dashed rgba(255, 255, 255, 0.5); - border-radius: @border-radius-base; - padding: 9px 9px 0; + border-color: rgba(255, 255, 255, 0.5); } } + .bio-content { + padding: 10px 10px 1px; + } + &, & textarea { font-size: 14px; } & textarea { padding: 10px; - margin: -10px -10px 0; font-size: 14px; } } diff --git a/ember/app/templates/components/user/user-bio.hbs b/ember/app/templates/components/user/user-bio.hbs index a8c5fb346..6bee687ab 100644 --- a/ember/app/templates/components/user/user-bio.hbs +++ b/ember/app/templates/components/user/user-bio.hbs @@ -1,9 +1,11 @@ {{#if editing}} {{textarea value=user.bio class="form-control"}} {{else}} - {{#if user.bioHtml}} - {{{user.bioHtml}}} - {{else if isEditable}} -

Write something about yourself...

- {{/if}} +
+ {{#if user.bioHtml}} + {{{user.bioHtml}}} + {{else if isEditable}} +

Write something about yourself...

+ {{/if}} +
{{/if}}