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> </style>
</%def> </%def>
<%def name="render_this_page()">
${self.page_content()}
</%def>
<%def name="page_content()"> <%def name="page_content()">
<div class="logo"> <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> <h1>Welcome to ${base_meta.app_title()}</h1>
</div> </div>
</%def> </%def>

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8; -*- ## -*- coding: utf-8; -*-
<%inherit file="/page.mako" /> <%inherit file="/form.mako" />
<%namespace name="base_meta" file="/base_meta.mako" /> <%namespace name="base_meta" file="/base_meta.mako" />
<%def name="title()">Login</%def> <%def name="title()">Login</%def>
@ -11,11 +11,20 @@
<%def name="extra_styles()"> <%def name="extra_styles()">
${parent.extra_styles()} ${parent.extra_styles()}
% 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'))} ${h.stylesheet_link(request.static_url('tailbone:static/css/login.css'))}
% endif
</%def> </%def>
<%def name="logo()"> <%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>
<%def name="login_form()"> <%def name="login_form()">
@ -24,11 +33,35 @@
</div> </div>
</%def> </%def>
<%def name="render_this_page()">
${self.page_content()}
</%def>
<%def name="page_content()"> <%def name="page_content()">
<div class="logo">
${self.logo()} ${self.logo()}
</div>
% 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()} ${self.login_form()}
% endif
## TODO: obviously should remove this
% if request.rattail_config.demo(): % if request.rattail_config.demo():
<p class="tips"> <p class="tips">
Login with <strong>chuck / admin</strong> for full demo access 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') self.request.session.flash("{} is already logged in".format(self.request.user), 'error')
return self.redirect(referrer) 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.save_label = "Login"
form.auto_disable_save = False form.auto_disable_save = False
form.auto_disable = False # TODO: deprecate / remove this form.auto_disable = False # TODO: deprecate / remove this
@ -125,6 +127,7 @@ class AuthenticationView(View):
'form': form, 'form': form,
'referrer': referrer, 'referrer': referrer,
'image_url': image_url, 'image_url': image_url,
'use_buefy': use_buefy,
} }
def authenticate_user(self, username, password): def authenticate_user(self, username, password):

View file

@ -78,7 +78,7 @@ class CommonView(View):
image_url = self.rattail_config.get( image_url = self.rattail_config.get(
'tailbone', 'main_image_url', 'tailbone', 'main_image_url',
default=self.request.static_url('tailbone:static/img/home_logo.png')) 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): def robots_txt(self):
""" """