Fix home and login pages for Buefy theme

not sure what broke those so bad...they're still not "great"
This commit is contained in:
Lance Edgar 2019-08-04 20:43:31 -05:00
parent 5a25ffe6e4
commit 1b1d37b9df
4 changed files with 48 additions and 8 deletions

View file

@ -16,9 +16,13 @@
</style>
</%def>
<%def name="render_this_page()">
${self.page_content()}
</%def>
<%def name="page_content()">
<div class="logo">
${h.image(image_url, "{} logo".format(capture(base_meta.app_title)), id='logo', width=500)}
${h.image(image_url, "{} logo".format(capture(base_meta.app_title)))}
<h1>Welcome to ${base_meta.app_title()}</h1>
</div>
</%def>

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8; -*-
<%inherit file="/page.mako" />
<%inherit file="/form.mako" />
<%namespace name="base_meta" file="/base_meta.mako" />
<%def name="title()">Login</%def>
@ -11,11 +11,20 @@
<%def name="extra_styles()">
${parent.extra_styles()}
${h.stylesheet_link(request.static_url('tailbone:static/css/login.css'))}
% if use_buefy:
<style type="text/css">
.logo img {
display: block;
margin: 3rem auto;
}
</style>
% else:
${h.stylesheet_link(request.static_url('tailbone:static/css/login.css'))}
% endif
</%def>
<%def name="logo()">
${h.image(image_url, "{} logo".format(capture(base_meta.app_title)), id='logo', width=500)}
${h.image(image_url, "{} logo".format(capture(base_meta.app_title)))}
</%def>
<%def name="login_form()">
@ -24,11 +33,35 @@
</div>
</%def>
<%def name="render_this_page()">
${self.page_content()}
</%def>
<%def name="page_content()">
${self.logo()}
<div class="logo">
${self.logo()}
</div>
${self.login_form()}
% if use_buefy:
## note, we make 3 columns just to get 1 in the center
<div class="columns">
<div class="column"></div>
<div class="column">
<div class="card">
<div class="card-content">
<tailbone-form></tailbone-form>
</div>
</div>
</div>
<div class="column"></div>
</div>
% else:
${self.login_form()}
% endif
## TODO: obviously should remove this
% if request.rattail_config.demo():
<p class="tips">
Login with <strong>chuck / admin</strong> for full demo access

View file

@ -98,7 +98,9 @@ class AuthenticationView(View):
self.request.session.flash("{} is already logged in".format(self.request.user), 'error')
return self.redirect(referrer)
form = forms.Form(schema=UserLogin(), request=self.request)
use_buefy = self.get_use_buefy()
form = forms.Form(schema=UserLogin(), request=self.request,
use_buefy=use_buefy)
form.save_label = "Login"
form.auto_disable_save = False
form.auto_disable = False # TODO: deprecate / remove this
@ -125,6 +127,7 @@ class AuthenticationView(View):
'form': form,
'referrer': referrer,
'image_url': image_url,
'use_buefy': use_buefy,
}
def authenticate_user(self, username, password):

View file

@ -78,7 +78,7 @@ class CommonView(View):
image_url = self.rattail_config.get(
'tailbone', 'main_image_url',
default=self.request.static_url('tailbone:static/img/home_logo.png'))
return {'image_url': image_url}
return {'image_url': image_url, 'use_buefy': self.get_use_buefy()}
def robots_txt(self):
"""