Check auth to hide the form fields

feature/auth
Nicolas Le Manchet 10 years ago
parent 7174c6a686
commit 2347b41647

@ -8,6 +8,8 @@ define(function() {
"max-comments-top": "inf",
"max-comments-nested": 5,
"reveal-on-click": 5,
"auth": false,
"signin": "",
"avatar": true,
"avatar-bg": "#f0f0f0",
"avatar-fg": ["#9abf88", "#5698c4", "#e279a3", "#9163b6",

@ -3,7 +3,10 @@ define({
"postbox-author": "Name (optional)",
"postbox-email": "E-mail (optional)",
"postbox-website": "Website (optional)",
"postbox-submit": "Submit",
"postbox-submit": "submit",
"postbox-auth-required": "Authentication required to comment.",
"postbox-auth-sign-in": "Sign-in",
"postbox-auth-commenting-as": "Commenting as",
"num-comments": "One Comment\n{{ n }} Comments",
"no-comments": "No Comments Yet",

@ -24,7 +24,11 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
// submit form, initialize optional fields with `null` and reset form.
// If replied to a comment, remove form completely.
$("[type=submit]", el).on("click", function() {
submit = $("[type=submit]", el)
if (submit === null) {
return el;
}
submit.on("click", function() {
if (! el.validate()) {
return;
}

@ -1,14 +1,25 @@
div(class='isso-postbox')
mixin form(style)
div(class='form-wrapper')
div(class='textarea-wrapper')
div(class='textarea placeholder' contenteditable='true')
= i18n('postbox-text')
section(class='auth-section')
p(class='input-wrapper')
p(class='input-wrapper' style=style)
input(type='text' name='author' placeholder=i18n('postbox-author'))
p(class='input-wrapper')
p(class='input-wrapper' style=style)
input(type='email' name='email' placeholder=i18n('postbox-email'))
p(class='input-wrapper')
p(class='input-wrapper' style=style)
input(type='text' name='website' placeholder=i18n('postbox-website'))
p(class='post-action')
input(type='submit' value=i18n('postbox-submit'))
div(class='isso-postbox')
if conf.auth
if cookie.valid
p=i18n('postbox-auth-commenting-as') + ' ' + cookie.username
+form('visibility: hidden;')
else
p=i18n('postbox-auth-required')
a(href='#{conf.signin}') #{i18n('postbox-auth-sign-in')}
else
+form('')

@ -11,6 +11,7 @@ require(["app/lib/ready", "app/config", "app/i18n", "app/api", "app/isso", "app/
jade.set("i18n", i18n.translate);
jade.set("pluralize", i18n.pluralize);
jade.set("svg", svg);
jade.set("cookie", {'valid': true, 'username': 'Nicolas'})
domready(function() {

Loading…
Cancel
Save