Add 'falafel' theme, based on bobcat
but with more aggressive approach, includes no jQuery UI JS/CSS (and is somewhat broken accordingly, for now)
This commit is contained in:
parent
e18e2492af
commit
0a68ff6dd0
99
tailbone/static/themes/falafel/css/layout.css
Normal file
99
tailbone/static/themes/falafel/css/layout.css
Normal file
|
@ -0,0 +1,99 @@
|
|||
|
||||
/******************************
|
||||
* main layout
|
||||
******************************/
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
|
||||
/******************************
|
||||
* header
|
||||
******************************/
|
||||
|
||||
header .level {
|
||||
/* height: 60px; */
|
||||
line-height: 60px;
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
header .level #header-logo {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
header .level .global-title,
|
||||
header .level-left .global-title {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
header .level #current-context,
|
||||
header .level-left #current-context {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
header .level #current-context span,
|
||||
header .level-left #current-context span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
header .level .theme-picker {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
#content-title h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
/******************************
|
||||
* content
|
||||
******************************/
|
||||
|
||||
#page-body {
|
||||
padding: 0.4em;
|
||||
}
|
||||
|
||||
/******************************
|
||||
* context menu
|
||||
******************************/
|
||||
|
||||
#context-menu {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/******************************
|
||||
* "object helper" panel
|
||||
******************************/
|
||||
|
||||
.object-helper {
|
||||
border: 1px solid black;
|
||||
margin: 1em;
|
||||
padding: 1em;
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
.object-helper-content {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
/******************************
|
||||
* feedback
|
||||
******************************/
|
||||
|
||||
.feedback-dialog .red {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
59
tailbone/static/themes/falafel/js/tailbone.feedback.js
Normal file
59
tailbone/static/themes/falafel/js/tailbone.feedback.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
const FeedbackForm = {
|
||||
props: ['user_name', 'referrer'],
|
||||
template: '#feedback-template',
|
||||
methods: {
|
||||
sendFeedback() {
|
||||
|
||||
var textarea = $('.feedback-dialog textarea');
|
||||
var msg = $.trim(textarea.val());
|
||||
if (! msg) {
|
||||
alert("Please enter a message.");
|
||||
textarea.select();
|
||||
textarea.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// disable_button(dialog_button(event));
|
||||
|
||||
var form = $('.feedback-dialog').parents('form');
|
||||
// TODO: this was copied from default template, but surely we could
|
||||
// just serialize() the form instead?
|
||||
var data = {
|
||||
_csrf: form.find('input[name="_csrf"]').val(),
|
||||
referrer: location.href,
|
||||
user: form.find('input[name="user"]').val(),
|
||||
user_name: form.find('input[name="user_name"]').val(),
|
||||
message: msg
|
||||
};
|
||||
|
||||
var that = this;
|
||||
$.ajax(form.attr('action'), {
|
||||
method: 'POST',
|
||||
data: data,
|
||||
success: function(data) {
|
||||
that.$emit('close');
|
||||
alert("Message successfully sent.\n\nThank you for your feedback.");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new Vue({
|
||||
el: '#feedback-app',
|
||||
methods: {
|
||||
showFeedback() {
|
||||
this.$modal.open({
|
||||
parent: this,
|
||||
canCancel: ['escape', 'x'],
|
||||
component: FeedbackForm,
|
||||
hasModalCard: true,
|
||||
props: {
|
||||
referrer: location.href
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
329
tailbone/templates/themes/falafel/base.mako
Normal file
329
tailbone/templates/themes/falafel/base.mako
Normal file
|
@ -0,0 +1,329 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%namespace file="/grids/nav.mako" import="grid_index_nav" />
|
||||
<%namespace file="/feedback_dialog.mako" import="feedback_dialog" />
|
||||
<%namespace name="base_meta" file="/base_meta.mako" />
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>${base_meta.global_title()} » ${capture(self.title)|n}</title>
|
||||
${base_meta.favicon()}
|
||||
${self.header_core()}
|
||||
|
||||
% if background_color:
|
||||
<style type="text/css">
|
||||
body, .navbar, .footer {
|
||||
background-color: ${background_color};
|
||||
}
|
||||
</style>
|
||||
% endif
|
||||
|
||||
% if not request.rattail_config.production():
|
||||
<style type="text/css">
|
||||
body, .navbar, .footer {
|
||||
background-image: url(${request.static_url('tailbone:static/img/testing.png')});
|
||||
}
|
||||
</style>
|
||||
% endif
|
||||
|
||||
${self.head_tags()}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
|
||||
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
|
||||
% for topitem in menus:
|
||||
% if topitem.is_link:
|
||||
${h.link_to(topitem.title, topitem.url, target=topitem.target, class_='navbar-item')}
|
||||
% else:
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link">${topitem.title}</a>
|
||||
<div class="navbar-dropdown">
|
||||
% for subitem in topitem.items:
|
||||
% if subitem.is_sep:
|
||||
<hr class="navbar-divider">
|
||||
% else:
|
||||
${h.link_to(subitem.title, subitem.url, class_='navbar-item', target=subitem.target)}
|
||||
% endif
|
||||
% endfor
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
</div><!-- navbar-start -->
|
||||
<div class="navbar-end">
|
||||
|
||||
## User Menu
|
||||
% if request.user:
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
% if messaging_enabled:
|
||||
<a class="navbar-link ${'root-user' if request.is_root else ''}">${request.user}${" ({})".format(inbox_count) if inbox_count else ''}</a>
|
||||
% else:
|
||||
<a class="navbar-link ${'root-user' if request.is_root else ''}">${request.user}</a>
|
||||
% endif
|
||||
<div class="navbar-dropdown">
|
||||
% if request.is_root:
|
||||
${h.link_to("Stop being root", url('stop_root'), class_='navbar-item root-user')}
|
||||
% elif request.is_admin:
|
||||
${h.link_to("Become root", url('become_root'), class_='navbar-item root-user')}
|
||||
% endif
|
||||
% if messaging_enabled:
|
||||
${h.link_to("Messages{}".format(" ({})".format(inbox_count) if inbox_count else ''), url('messages.inbox'), class_='navbar-item')}
|
||||
% endif
|
||||
${h.link_to("Change Password", url('change_password'), class_='navbar-item')}
|
||||
${h.link_to("Logout", url('logout'), class_='navbar-item')}
|
||||
</div>
|
||||
</div>
|
||||
% else:
|
||||
${h.link_to("Login", url('login'), class_='navbar-item')}
|
||||
% endif
|
||||
|
||||
</div><!-- navbar-end -->
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<nav class="level">
|
||||
<div class="level-left">
|
||||
|
||||
## App Logo / Name
|
||||
<div class="level-item">
|
||||
<a class="home" href="${url('home')}">
|
||||
<div id="header-logo">${base_meta.header_logo()}</div>
|
||||
<span class="global-title">${base_meta.global_title()}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
## Current Context
|
||||
<div id="current-context" class="level-item">
|
||||
% if master:
|
||||
<span>»</span>
|
||||
% if master.listing:
|
||||
<span>${index_title}</span>
|
||||
% else:
|
||||
${h.link_to(index_title, index_url)}
|
||||
% if parent_url is not Undefined:
|
||||
<span>»</span>
|
||||
${h.link_to(parent_title, parent_url)}
|
||||
% elif instance_url is not Undefined:
|
||||
<span>»</span>
|
||||
${h.link_to(instance_title, instance_url)}
|
||||
% endif
|
||||
% if master.viewing and grid_index:
|
||||
${grid_index_nav()}
|
||||
% endif
|
||||
% endif
|
||||
% elif index_title:
|
||||
<span>»</span>
|
||||
<span>${index_title}</span>
|
||||
% endif
|
||||
</div>
|
||||
|
||||
</div><!-- level-left -->
|
||||
<div class="level-right">
|
||||
|
||||
## Theme Picker
|
||||
% if expose_theme_picker and request.has_perm('common.change_app_theme'):
|
||||
<div class="level-item">
|
||||
${h.form(url('change_theme'), method="post")}
|
||||
${h.csrf_token(request)}
|
||||
Theme:
|
||||
<div class="theme-picker">
|
||||
<div class="select">
|
||||
${h.select('theme', theme, options=theme_picker_options, id='theme-picker')}
|
||||
</div>
|
||||
</div>
|
||||
${h.end_form()}
|
||||
</div>
|
||||
% endif
|
||||
|
||||
## Help Button
|
||||
% if help_url is not Undefined and help_url:
|
||||
<div class="level-item">
|
||||
${h.link_to("Help", help_url, target='_blank', class_='button')}
|
||||
</div>
|
||||
% endif
|
||||
|
||||
## Feedback Button
|
||||
<div class="level-item" id="feedback-app">
|
||||
<button class="button is-primary" @click="showFeedback()">Feedback</button>
|
||||
</div>
|
||||
|
||||
## Feedback Dialog
|
||||
${feedback_dialog()}
|
||||
|
||||
</div><!-- level-right -->
|
||||
</nav><!-- level -->
|
||||
</header>
|
||||
|
||||
## Page Title
|
||||
<section id="content-title" class="hero is-primary">
|
||||
<div class="container">
|
||||
% if capture(self.content_title):
|
||||
|
||||
% if show_prev_next is not Undefined and show_prev_next:
|
||||
<div style="float: right;">
|
||||
% if prev_url:
|
||||
${h.link_to("« Older", prev_url, class_='button autodisable')}
|
||||
% else:
|
||||
${h.link_to("« Older", '#', class_='button', disabled='disabled')}
|
||||
% endif
|
||||
% if next_url:
|
||||
${h.link_to("Newer »", next_url, class_='button autodisable')}
|
||||
% else:
|
||||
${h.link_to("Newer »", '#', class_='button', disabled='disabled')}
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
|
||||
<h1 class="title">${self.content_title()}</h1>
|
||||
% endif
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
||||
## Page Body
|
||||
<section id="page-body">
|
||||
|
||||
% if request.session.peek_flash('error'):
|
||||
% for error in request.session.pop_flash('error'):
|
||||
<div class="notification is-warning">
|
||||
<!-- <button class="delete"></button> -->
|
||||
${error}
|
||||
</div>
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
% if request.session.peek_flash():
|
||||
% for msg in request.session.pop_flash():
|
||||
<div class="notification is-info">
|
||||
<!-- <button class="delete"></button> -->
|
||||
${msg}
|
||||
</div>
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
${self.body()}
|
||||
</section>
|
||||
|
||||
## Footer
|
||||
<footer class="footer">
|
||||
<div class="content">
|
||||
${base_meta.footer()}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</div><!-- content-wrapper -->
|
||||
|
||||
${h.javascript_link(request.static_url('tailbone:static/themes/falafel/js/tailbone.feedback.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<%def name="title()"></%def>
|
||||
|
||||
<%def name="content_title()">
|
||||
${self.title()}
|
||||
</%def>
|
||||
|
||||
<%def name="header_core()">
|
||||
|
||||
${self.core_javascript()}
|
||||
${self.extra_javascript()}
|
||||
${self.core_styles()}
|
||||
${self.extra_styles()}
|
||||
|
||||
## TODO: should this be elsewhere / more customizable?
|
||||
% if dform is not Undefined:
|
||||
<% resources = dform.get_widget_resources() %>
|
||||
% for path in resources['js']:
|
||||
${h.javascript_link(request.static_url(path))}
|
||||
% endfor
|
||||
% for path in resources['css']:
|
||||
${h.stylesheet_link(request.static_url(path))}
|
||||
% endfor
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="core_javascript()">
|
||||
${self.jquery()}
|
||||
|
||||
## Vue.js
|
||||
${h.javascript_link('https://unpkg.com/vue')}
|
||||
|
||||
## Buefy 0.7.3
|
||||
${h.javascript_link('https://unpkg.com/buefy@0.7.3/dist/buefy.min.js')}
|
||||
|
||||
## ${h.javascript_link(request.static_url('tailbone:static/js/lib/jquery.loadmask.min.js'))}
|
||||
## ${h.javascript_link(request.static_url('tailbone:static/js/lib/jquery.ui.timepicker.js'))}
|
||||
<script type="text/javascript">
|
||||
var session_timeout = ${request.get_session_timeout() or 'null'};
|
||||
var logout_url = '${request.route_url('logout')}';
|
||||
var noop_url = '${request.route_url('noop')}';
|
||||
% if expose_theme_picker and request.has_perm('common.change_app_theme'):
|
||||
$(function() {
|
||||
$('#theme-picker').change(function() {
|
||||
$(this).parents('form:first').submit();
|
||||
});
|
||||
});
|
||||
% endif
|
||||
</script>
|
||||
## ${h.javascript_link(request.static_url('tailbone:static/js/tailbone.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
## ${h.javascript_link(request.static_url('tailbone:static/js/tailbone.feedback.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
## ${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
</%def>
|
||||
|
||||
<%def name="jquery()">
|
||||
|
||||
## jQuery 1.12.4
|
||||
${h.javascript_link('https://code.jquery.com/jquery-1.12.4.min.js')}
|
||||
|
||||
## jQuery 1.11.4
|
||||
## ${h.javascript_link('https://code.jquery.com/ui/{}/jquery-ui.min.js'.format(request.rattail_config.get('tailbone', 'jquery_ui.version', default='1.11.4')))}
|
||||
|
||||
</%def>
|
||||
|
||||
<%def name="extra_javascript()"></%def>
|
||||
|
||||
<%def name="core_styles()">
|
||||
|
||||
## Bulma 0.7.4
|
||||
${h.stylesheet_link('https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.min.css')}
|
||||
|
||||
## Buefy 0.7.3
|
||||
${h.stylesheet_link('https://unpkg.com/buefy@0.7.3/dist/buefy.min.css')}
|
||||
|
||||
## ${self.jquery_theme()}
|
||||
## ${h.stylesheet_link(request.static_url('tailbone:static/css/jquery.loadmask.css'))}
|
||||
## ${h.stylesheet_link(request.static_url('tailbone:static/css/jquery.ui.timepicker.css'))}
|
||||
## ${h.stylesheet_link(request.static_url('tailbone:static/css/jquery.ui.tailbone.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/themes/bobcat/css/base.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/themes/falafel/css/layout.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/grids.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
## ${h.stylesheet_link(request.static_url('tailbone:static/css/filters.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/themes/bobcat/css/forms.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/diffs.css') + '?ver={}'.format(tailbone.__version__))}
|
||||
</%def>
|
||||
|
||||
<%def name="jquery_theme()">
|
||||
${h.stylesheet_link('https://code.jquery.com/ui/1.11.4/themes/dark-hive/jquery-ui.css')}
|
||||
</%def>
|
||||
|
||||
<%def name="extra_styles()"></%def>
|
||||
|
||||
<%def name="head_tags()"></%def>
|
||||
|
||||
<%def name="wtfield(form, name, **kwargs)">
|
||||
<div class="field-wrapper${' error' if form[name].errors else ''}">
|
||||
<label for="${name}">${form[name].label}</label>
|
||||
<div class="field">
|
||||
${form[name](**kwargs)}
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
69
tailbone/templates/themes/falafel/feedback_dialog.mako
Normal file
69
tailbone/templates/themes/falafel/feedback_dialog.mako
Normal file
|
@ -0,0 +1,69 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
|
||||
<%def name="feedback_dialog()">
|
||||
<div id="feedback-template" style="display: none;">
|
||||
${h.form(url('feedback'))}
|
||||
${h.csrf_token(request)}
|
||||
${h.hidden('user', value=request.user.uuid if request.user else None)}
|
||||
<div class="modal-card feedback-dialog">
|
||||
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">User Feedback</p>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
<p>
|
||||
Questions, suggestions, comments, complaints, etc.
|
||||
<span class="red">regarding this website</span> are
|
||||
welcome and may be submitted below.
|
||||
</p>
|
||||
|
||||
<b-field label="User Name">
|
||||
% if request.user:
|
||||
<b-input
|
||||
value="${six.text_type(request.user)}"
|
||||
disabled="true">
|
||||
</b-input>
|
||||
% else:
|
||||
<b-input
|
||||
name="user_name">
|
||||
</b-input>
|
||||
% endif
|
||||
</b-field>
|
||||
% if request.user:
|
||||
<b-input
|
||||
name="user_name"
|
||||
type="hidden"
|
||||
value="${six.text_type(request.user)}">
|
||||
</b-input>
|
||||
% endif
|
||||
|
||||
<b-field label="Referring URL">
|
||||
<b-input
|
||||
:value="referrer"
|
||||
disabled="true">
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-input
|
||||
name="referrer"
|
||||
type="hidden"
|
||||
:value="referrer">
|
||||
</b-input>
|
||||
|
||||
<b-field label="Message">
|
||||
<b-input
|
||||
name="message"
|
||||
type="textarea">
|
||||
</b-input>
|
||||
</b-field>
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot">
|
||||
<button type="button" class="button" @click="$parent.close()">Cancel</button>
|
||||
<button type="button" class="button is-primary" @click="sendFeedback()">Send</button>
|
||||
</footer>
|
||||
</div>
|
||||
${h.end_form()}
|
||||
</div>
|
||||
</%def>
|
Loading…
Reference in a new issue