From bf0e40eda12bc5af9a59856fff78d76a97b39e07 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Sat, 23 May 2015 23:40:42 -0600 Subject: [PATCH] rewrites default private.hbs for new zelda styles closes #5073 - changes format to match new zelda layout - modifies the input_password helper to allow customization of class & placeholder --- core/client/app/styles/layouts/auth.css | 16 ------ core/server/helpers/input_password.js | 19 +++++-- core/server/views/private.hbs | 55 ++++++++++--------- .../server_helpers/input_password_spec.js | 30 +++++++++- 4 files changed, 73 insertions(+), 47 deletions(-) diff --git a/core/client/app/styles/layouts/auth.css b/core/client/app/styles/layouts/auth.css index 953f16779c..25351a5b60 100644 --- a/core/client/app/styles/layouts/auth.css +++ b/core/client/app/styles/layouts/auth.css @@ -42,19 +42,3 @@ color: color(var(--blue) lightness(-20%)); text-decoration: none; } - -.private-login h1 { - margin-bottom: 2rem; - text-indent: 0; -} -.private-login .form-group { - margin: 0; -} -.private-login input[type="password"] { - padding: 9px 7px; - border-radius: 3px 3px 0 0; -} -.private-login-button { - padding: 9px 1.8em; - border-radius: 0 0 3px 3px; -} diff --git a/core/server/helpers/input_password.js b/core/server/helpers/input_password.js index 445e24c1db..13d89b704c 100644 --- a/core/server/helpers/input_password.js +++ b/core/server/helpers/input_password.js @@ -10,12 +10,23 @@ var hbs = require('express-hbs'), utils = require('./utils'), input_password; -input_password = function () { - var output = utils.inputTemplate({ +input_password = function (options) { + options = options || {}; + options.hash = options.hash || {}; + + var className = (options.hash.class) ? options.hash.class : 'private-login-password', + extras = 'autofocus="autofocus"', + output; + + if (options.hash.placeholder) { + extras += ' placeholder="' + options.hash.placeholder + '"'; + } + + output = utils.inputTemplate({ type: 'password', name: 'password', - className: 'private-login-password', - extras: 'autofocus="autofocus"' + className: className, + extras: extras }); return new hbs.handlebars.SafeString(output); diff --git a/core/server/views/private.hbs b/core/server/views/private.hbs index 9de3177fc8..090a981db5 100644 --- a/core/server/views/private.hbs +++ b/core/server/views/private.hbs @@ -18,33 +18,36 @@ - -
-
-
-
-
- - {{#if error}} - - {{/if}} + diff --git a/core/test/unit/server_helpers/input_password_spec.js b/core/test/unit/server_helpers/input_password_spec.js index ef27f65918..c011de1a41 100644 --- a/core/test/unit/server_helpers/input_password_spec.js +++ b/core/test/unit/server_helpers/input_password_spec.js @@ -17,11 +17,39 @@ describe('{{input_password}} helper', function () { should.exist(handlebars.helpers.input_password); }); - it('returns the correct input', function () { + it('returns the correct input when no custom options are specified', function () { var markup = '', rendered = helpers.input_password(); should.exist(rendered); String(rendered).should.equal(markup); }); + + it('returns the correct input when a custom class is specified', function () { + var markup = '', + options = { + hash: { + class: 'test-class' + } + }, + rendered = helpers.input_password(options); + + should.exist(rendered); + + String(rendered).should.equal(markup); + }); + + it('returns the correct input when a custom placeholder is specified', function () { + var markup = '', + options = { + hash: { + placeholder: 'Test' + } + }, + rendered = helpers.input_password(options); + + should.exist(rendered); + + String(rendered).should.equal(markup); + }); });