Last active
August 29, 2015 13:55
-
-
Save laser/8714984 to your computer and use it in GitHub Desktop.
UI toolbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = { | |
createCheckbox: function (o) { | |
var t = ''; | |
t += '<label class="checkbox {{class}}">'; | |
t += helpers.viewUtil.createBareCheckbox(o); | |
t += '</label>'; | |
return Mustache.to_html(t, o); | |
}, | |
createBareCheckbox: function (o) { | |
o.checked = (o.value === true || o.value === "true") ? "checked" : ""; | |
var t = ''; | |
t += '<input type="checkbox" name="{{name}}" class="{{class}}" {{#checked}}checked{{/checked}} {{#disabled}}disabled{{/disabled}}>{{label}}'; | |
return Mustache.to_html(t, o); | |
}, | |
createDropDown: function (o) { | |
var t = ''; | |
t += '{{#label}}<label for="{{name}}" title="{{label}}" class="primary">{{label}}</label>{{/label}}'; | |
t += '{{{dropdown}}}'; | |
return Mustache.to_html(t, _.extend(o, { | |
"dropdown": helpers.viewUtil.createBareDropDown(o) | |
})); | |
}, | |
createIcon: function (o) { | |
var t = '<i class="{{#white}}icon-white{{/white}} {{#class}}{{class}}{{/class}}" {{#title}}title="{{title}}"{{/title}}></i>'; | |
return Mustache.to_html(t, o); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
y = { | |
template: (function () { | |
var t; | |
t = ''; | |
t += '<h1>{{i18n.welcome}}</h1>'; | |
t += '<form class="well well-titled">'; | |
t += ' <div class="well-title">{{i18n.title}}</div>'; | |
t += ' <div class="control-group">{{{ fields.email }}}</div>'; | |
t += ' <div class="control-group">{{{ fields.password }}}</div>'; | |
t += ' <div class="loginValidation">'; | |
t += ' <div class="control-group">{{{ fields.validation }}}</div>'; | |
t += ' <div><a id="getNewValidationCode" href="#">{{i18n.getNewValidationCode}}</a><div>'; | |
t += ' </div>'; | |
t += ' <div class="formSubmits">{{{ buttons.login }}}</div>'; | |
t += ' <div class="create-forgot">'; | |
t += ' <a href="#password" class="forgot">{{ i18n.forgotPassword }}</a>'; | |
t += ' </div>'; | |
t += '</form>'; | |
return t; | |
}()), | |
templateHelpers: function () { | |
var i18n, | |
fields, | |
buttons, | |
canPurchaseAccount; | |
i18n = { | |
"email": Helpers.i18nUtil.get("template_common", "email"), | |
"password": Helpers.i18nUtil.get("template_common", "label.password"), | |
"validation": Helpers.i18nUtil.get("ui", "loginLabelValidationCode"), | |
"getNewValidationCode": Helpers.i18nUtil.get("ui", "loginLabelGetNewValidationCode"), | |
"submit": Helpers.i18nUtil.get("ui", "loginButton"), | |
"createNewAccount": Helpers.i18nUtil.get("loginMenu.tpl", "createNewAccount"), | |
"forgotPassword": Helpers.i18nUtil.get("loginMenu.tpl", "forgotPassword"), | |
"title": Helpers.i18nUtil.get("ui", "loginTitle"), | |
"welcome": Helpers.i18nUtil.get("ui", "pageHeadLogin"), | |
"loginThroughIntranet": Helpers.i18nUtil.get("ui", "loginThroughIntranet") | |
}; | |
fields = { | |
"email": Helpers.viewUtil.createTextInput({ | |
"label": i18n.email, | |
"name": "email" | |
}), | |
"password": Helpers.viewUtil.createTextInput({ | |
"label": i18n.password, | |
"name": "password", | |
"type": "password" | |
}), | |
"validation": Helpers.viewUtil.createTextInput({ | |
"label": i18n.validation, | |
"name": "validationCode" | |
}) | |
}; | |
buttons = { | |
"login": Helpers.viewUtil.createAnchorButton({ | |
"primary": true, | |
"class": "submit", | |
"label": i18n.submit | |
}) | |
}; | |
canPurchaseAccount = this._canPurchaseAccount; | |
return { | |
"buttons": buttons, | |
"canPurchaseAccount": canPurchaseAccount, | |
"fields": fields, | |
"i18n": i18n, | |
"isAutologinUser": !this._emailLoginEnabled | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment