fix meta-login on login page, remove y/n on ban/unban buttons, and add id randomization on child forms to allow for validation.

This commit is contained in:
KeyserSosa
2009-02-03 15:53:13 -08:00
parent 45043d5419
commit d1ff5a77d3
7 changed files with 35 additions and 15 deletions

View File

@@ -71,6 +71,7 @@ class Reddit(Wrapped):
submit_box = True
searchbox = True
extension_handling = True
enable_login_cover = True
def __init__(self, space_compress = True, nav_menus = None, loginbox = True,
infotext = '', content = None, title = '', robots = None,
@@ -360,6 +361,8 @@ class FormPage(BoringPage):
class LoginPage(BoringPage):
enable_login_cover = False
"""a boring page which provides the Login/register form"""
def __init__(self, **context):
context['loginbox'] = False

View File

@@ -300,16 +300,28 @@ $.fn.new_thing_child = function(what, use_listing) {
var where = (use_listing) ? $.listing(id) :
this.thing().find(".child:first");
var new_form;
if (typeof(what) == "string")
return where.prepend(what).children(":first");
new_form = where.prepend(what).children(":first");
else
return what.hide()
new_form = what.hide()
.prependTo(where)
.show()
.find('input[name=parent]').attr('value', id).end();
return (new_form).randomize_ids();
};
$.fn.randomize_ids = function() {
var new_id = (Math.random() + "").split('.')[1]
$(this).find("*[id]").each(function() {
$(this).attr('id', $(this).attr("id") + new_id);
}).end()
.find("label").each(function() {
$(this).attr('for', $(this).attr("for") + new_id);
});
return $(this);
}
$.replace_things = function(things, keep_children, reveal, stubs) {
/* Given the api-html structured things, insert them into the DOM

View File

@@ -135,9 +135,9 @@
host_id = host.host.replace('.', '-')
load = host.load()
load_level = min(max(int(load+0.5), 0),5)
empty_cls = '' if len(host.services) else 'empty'
%>
<tr class="load${load_level} title-region ${empty_cls}" id="${host_id}">
%if len(host.services):
<tr class="load${load_level} title-region" id="${host_id}">
<th>
${host.host} load: ${load}
</th>
@@ -188,7 +188,8 @@
${age if service.pid > 0 else 'down'}
</td>
</tr>
%endfor
%endfor
%endif
%endfor
</table>
</div>

View File

@@ -51,14 +51,14 @@ ${captchagen(thing.iden, thing.error)}
<span class="cap-reply">
%endif
%if label:
<label for="captcha">${_("human?")}</label>
<label for="captcha_">${_("human?")}</label>
%endif
%if tabular:
</td>
<td>
%endif
<input name="iden" type="hidden" value="${iden}"/>
<input class="captcha cap-text"
<input class="captcha cap-text" id="captcha_"
name="captcha" type="text" size="${size}" />
<script type="text/javascript">
emptyInput($('input.captcha'), "${_('type the letters from the image above')}");

View File

@@ -90,16 +90,18 @@ thing id-${what._fullname}
%if thing.can_ban and ban:
%if thing.show_spam:
<li>
${ynbutton(_("unban"), _("unbanned"), "unban")}
${self.state_button("unban", _("unban"),
"return change_state(this, 'unban');", _("unbanned"))}
</li>
%else:
<li>
${ynbutton(_("ban"), _("banned"), "ban")}
${self.state_button("ban", _("ban"),
"return change_state(this, 'ban');", _("banned"))}
</li>
%endif
%if thing.show_reports:
<li>
${state_button("ignore", _("ignore"), \
${self.state_button("ignore", _("ignore"), \
"change_state(this, 'ignore');", _("ignored"))}
</li>
%endif

View File

@@ -49,7 +49,9 @@
</div>
%if not c.user_is_loggedin:
${self.loginpopup(login_panel, login_form)}
%if thing.enable_login_cover:
${self.loginpopup(login_panel, login_form)}
%endif
${self.langpopup()}
%endif

View File

@@ -52,14 +52,14 @@
</div>
<div id="header-bottom-${'left' if c.lang_rtl else 'right'}">
## %if thing.searchbox:
## ${SearchForm().render()}
## %endif
%if not c.user_is_loggedin:
%if thing.enable_login_cover:
<span class="user">
${text_with_js(_("want to join? %(register)s in seconds"),
register=(_("register"), "return showcover(false);"))}
</span>
${separator("|")}
%endif
%else:
<span class="user">
${plain_link(c.user.name, "/user/%s/" % c.user.name, _sr_path=False)}
@@ -78,9 +78,9 @@
%>
${img_link(_("messages"), mail_img, path="/message/inbox/",
_id = "mail" )}
${separator("|")}
%endif
${separator("|")}
${thing.corner_buttons().render()}
%if c.user_is_loggedin:
${separator("|")}