a little more responsive

This commit is contained in:
vabene1111 2018-02-09 17:04:54 +01:00
parent e745f1cda2
commit 8c6019756f
7 changed files with 60 additions and 16 deletions

View File

@ -6,7 +6,12 @@ from .models import *
class RecipeTable(tables.Table): class RecipeTable(tables.Table):
id = tables.LinkColumn('edit_recipe', args=[A('id')]) id = tables.LinkColumn('edit_recipe', args=[A('id')])
name = tables.TemplateColumn("<a href='#' onClick='openRecipe({{record.id}})'>{{record.name}}</a>") name = tables.TemplateColumn(
"<a href='#' onClick='openRecipe({{record.id}})'>{{record.name}}</a>")
category = tables.Column(
attrs={'td': {'class': 'd-none d-lg-table-cell'}, 'th': {'class': 'd-none d-lg-table-cell'}})
all_tags = tables.Column(
attrs={'td': {'class': 'd-none d-lg-table-cell'}, 'th': {'class': 'd-none d-lg-table-cell'}})
class Meta: class Meta:
model = Recipe model = Recipe

View File

@ -17,6 +17,9 @@
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<style>
@media (max-width:1025px) { .container { width: 95% !important; margin-left: 20px !important; margin-right: 20px !important;max-width: 1200px !important;} }
</style>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg navbar-dark bg-primary">

View File

@ -4,8 +4,8 @@
<div class="row"> <div class="row">
<div class="table-responsive"> <div class="table-responsive">
{% block table %} {% block table %}
<table {% if table.attrs %} <table style='font-size: 24px' {% if table.attrs %}
{{ table.attrs.as_html }}{% else %}class="table table-bordered table-lg"{% endif %}> {{ table.attrs.as_html }}{% else %}class="table table-bordered table-xl"{% endif %}>
{% block table.thead %} {% block table.thead %}
{% if table.show_header %} {% if table.show_header %}
<thead> <thead>

View File

@ -6,6 +6,9 @@
{% block title %}{% trans "Cookbook" %}{% endblock %} {% block title %}{% trans "Cookbook" %}{% endblock %}
{% block content %} {% block content %}
<div class="row">
<div class="col md-12">
{% if filter %} {% if filter %}
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
@ -19,6 +22,9 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div>
</div>
<br/> <br/>
{% if recipes %} {% if recipes %}
@ -93,7 +99,7 @@
xhttp.send(); xhttp.send();
} }
function afterClick(){ function afterClick() {
$('#modal_recipe').modal('hide'); $('#modal_recipe').modal('hide');
return true; return true;
} }

View File

@ -0,0 +1,24 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<form>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"
placeholder="Enter email">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
{% endblock %}

View File

@ -5,6 +5,8 @@ from cookbook.views import api
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'), path('', views.index, name='index'),
path('test', views.test, name='test'),
path('new/recipe', new.recipe, name='new_recipe'), path('new/recipe', new.recipe, name='new_recipe'),
path('new/category', new.category, name='new_category'), path('new/category', new.category, name='new_category'),
path('new/keyword', new.keyword, name='new_keyword'), path('new/keyword', new.keyword, name='new_keyword'),

View File

@ -18,3 +18,7 @@ def index(request):
return render(request, 'index.html', {'recipes': table, 'filter': f}) return render(request, 'index.html', {'recipes': table, 'filter': f})
else: else:
return render(request, 'index.html') return render(request, 'index.html')
def test(request):
return render(request, 'test.html')