Permalink
Browse files

added Flask-Bootstrap

  • Loading branch information...
rochacbruno committed Oct 14, 2015
1 parent 818152d commit 5645de0fb208fc9ee34e502d901c057c9a3f2445
View
@@ -1,3 +1,4 @@
https://github.com/mitsuhiko/flask/tarball/master
dataset
nose
nose
Flask-Bootstrap
View
@@ -2,6 +2,7 @@
from os import path
from flask import Flask
from .blueprints.noticias import noticias_blueprint
from flask_bootstrap import Bootstrap
def create_app(mode):
@@ -24,4 +25,5 @@ def create_app(mode):
app.register_blueprint(noticias_blueprint)
return app
Bootstrap(app)
return app
View
@@ -1,13 +1,29 @@
<html>
<head>
<title>{% block title %} {{title or "Notícias"}} {% endblock %}</title>
</head>
<body>
<img src="{{url_for('static', filename='generic_logo.gif')}}">
<nav>
<a href="{{url_for('noticias.index')}}">HOME</a> | <a href="{{url_for('noticias.cadastro')}}">CADASTRO</a>
</nav>
<hr />
{% block content %} {% endblock %}
</body>
</html>
{%- extends "bootstrap/base.html" %}
{% import "bootstrap/utils.html" as utils %}
{% block title %} {{title or "Notícias"}} {% endblock %}
{% block navbar -%}
<nav class="navbar navbar-default">
<a class="navbar-brand" href="#"><img src="{{url_for('static', filename='generic_logo.gif')}}" style="height:30px;"></a>
<ul class="nav navbar-nav">
<li><a href="{{url_for('noticias.index')}}">HOME</a> </li>
<li><a href="{{url_for('noticias.cadastro')}}">CADASTRO</a></li>
</ul>
</nav>
{%- endblock navbar %}
{% block content %}
<div class="container">
{%- with messages = get_flashed_messages(with_categories=True) %}
{%- if messages %}
<div class="row">
<div class="col-md-12">
{{utils.flashed_messages(messages)}}
</div>
</div>
{%- endif %}
{%- endwith %}
<div class="jumbotron">
{% block news %}
{% endblock %}
</div>
{%- endblock content%}
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block content %}
{% block news %}
<form method="post" action="{{ url_for('noticias.cadastro') }}" enctype="multipart/form-data">
<label>Titulo:<br />
<input type="text" name="titulo" id="titulo" />
@@ -3,7 +3,7 @@
Notícia {{id_nova_noticia}} inserida com sucesso
{% endblock %}
{% block content %}
{% block news %}
<h1>Notícia {{id_nova_noticia}} inserida com sucesso!</h1>
<a href="{{url_for('noticias.noticia', noticia_id=id_nova_noticia)}}"> Ler Notícia </a><br />
<a href="{{url_for('noticias.cadastro')}}"> Cadastrar nova notícia </a>
View
@@ -1,5 +1,6 @@
{% extends "base.html" %}
{% block content %}
{% block news %}
<h2>Todas as notícias</h2>
<ul>
{% for noticia in noticias %}
<li>
@@ -3,13 +3,13 @@
{{noticia.titulo}}
{% endblock%}
{% block content %}
{% block news %}
<h1>{{noticia.titulo}}</h1>
{% if noticia.imagem %}
<img src="{{ url_for('noticias.media', filename=noticia.imagem) }}" width="300" />
{% endif %}
<hr />
<p>
{{noticia.texto}}
{{noticia.texto|safe}}
</p>
{% endblock %}

0 comments on commit 5645de0

Please sign in to comment.