Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolerd committed Aug 27, 2015
2 parents ca3ba01 + 5f7e5f4 commit 8c272b5
Show file tree
Hide file tree
Showing 25 changed files with 149 additions and 152 deletions.
14 changes: 12 additions & 2 deletions project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import send_from_directory
from flask import send_from_directory, render_template
import logging
import os
from project.application import create_app
Expand All @@ -16,7 +16,17 @@ def get_file(path):
# noinspection PyUnusedLocal
@app.errorhandler(413)
def request_entity_too_large(error):
return 'File Too Large', 413
return render_template("errors/413.html", error=error), 413


@app.errorhandler(404)
def page_not_found(error):
return render_template("errors/404.html", error=error), 404


@app.errorhandler(500)
def internal_server_error(error):
return render_template("errors/500.html", error=error), 500

if os.environ.get("WERKZEUG_RUN_MAIN") == "true":
logging.info(app.url_map)
2 changes: 1 addition & 1 deletion project/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,4 @@ def mainpage():
# noinspection PyUnusedLocal
@admin_app.errorhandler(403)
def handle_forbidden(error):
return render_template('admin/403.html'), 403
return render_template('admin/errors/403.html'), 403
6 changes: 3 additions & 3 deletions project/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def login():
return redirect(url_for('admin.mainpage'))

return render_template(
'login.html',
'admin/login.html',
title='Вход',
submit='Войти',
form=form,
Expand All @@ -37,7 +37,7 @@ def reset():
flash("Вам на почту отправлено письмо с дальнейшими инструкциями")
return redirect(url_for('auth.login'))
return render_template(
'login.html',
'admin/login.html',
title='Сброс пароля',
submit='Сбросить',
form=form,
Expand All @@ -64,7 +64,7 @@ def change_password():
flash('Ваш пароль успешно изменён')
return redirect(url_for('admin.mainpage'))
return render_template(
'login.html',
'admin/login.html',
title='Смена пароля',
submit='Сменить',
form=form,
Expand Down
10 changes: 9 additions & 1 deletion project/feed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from project.models import Vacancy, Category, City
from project.feed.forms import apply_form_factory
from project.lib.mail import send_mail_from_form, offer_cv_send_mail
from sqlalchemy.orm.exc import NoResultFound


@feed_app.route('/')
Expand All @@ -15,7 +16,14 @@ def vacancies():
def get_vacancy(name_in_url):
if name_in_url == 'offer-cv':
return render_template('feed/offerCV.html')
vacancy = Vacancy.query.filter(Vacancy.name_in_url == name_in_url).one()
try:
vacancy = (
Vacancy.query
.filter(Vacancy.name_in_url == name_in_url)
.one()
)
except NoResultFound:
abort(404)
if vacancy.condition_is_deleted or vacancy.condition_is_hidden:
abort(404)
vacancy.bl.visit()
Expand Down
2 changes: 2 additions & 0 deletions project/static/src/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
zoom: params.zoom,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
scrollwheel: false,
disableDoubleClickZoom: true,
}
var map = new google.maps.Map(mapCanvas, mapOptions);
var marker = new google.maps.Marker({
Expand Down
10 changes: 0 additions & 10 deletions project/templates/404.html

This file was deleted.

57 changes: 10 additions & 47 deletions project/templates/__base__.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,20 @@
<title>{% block title %}{% endblock %}</title>
</head>
<body>
{% block header %}
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">
<img alt="HRUAPROM" src="{{ url_for('static', filename='img/prom-ua-logo.png') }}">
</a>
</div>
<ul class="nav navbar-nav">
<li>
<a href="{{ url_for('feed.vacancies') }}">Вакансии</a>
</li>
<li>
<a href="{{ url_for('pages.projects') }}">Проекты</a>
</li>
<li>
<a href="{{ url_for('pages.about') }}">О компании</a>
</li>
<li>
<a href="{{ url_for('pages.contacts') }}">Контакты</a>
</li>
</ul>

</div>
</nav>
{% endblock %}
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block header %}{% endblock %}
{% block content %}{% endblock %}

<div class="container-fluid">
{% block content %}
{% endblock %}
</div>
{% block gallery %}
{% endblock %}
{% block footer %}
<footer class="footer ">
<div class="container container-footer">
<span class="footer-el footer-left"> {{ pagechunks.copyright|safe }} </span>
<span class="footer-el footer-center"> {{ pagechunks.social_networks|safe }} </span>
<span class="footer-el footer-right"> {{ pagechunks.contacts|safe }} </span>
</div>
</footer>
<footer class="footer ">
<div class="container container-footer">
<span class="footer-el footer-left"> {{ pagechunks.copyright|safe }} </span>
<span class="footer-el footer-center"> {{ pagechunks.social_networks|safe }} </span>
<span class="footer-el footer-right"> {{ pagechunks.contacts|safe }} </span>
</div>
</footer>
{% endblock %}

{% block postscripts %}{% endblock %}
</body>
</html>
25 changes: 0 additions & 25 deletions project/templates/admin/403.html

This file was deleted.

37 changes: 26 additions & 11 deletions project/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,39 @@
<link rel="stylesheet" href="{{ url_for('static', filename='dist/styles/admin.bundle.css') }}">
{% endblock %}


{% block content %}
<div class="container-fluid">{{ super() }}</div>
{% endblock %}

{% block header %}
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">
<img alt="HRUAPROM" src="{{ url_for('static', filename='img/prom-ua-logo.png') }}">
</a>
<a class="navbar-brand" href="/">
<img alt="HRUAPROM" src="{{ url_for('static', filename='img/prom-ua-logo.png') }}">
</a>
</div>

<ul class="nav navbar-nav">
<li><a href="{{ url_for('admin.mainpage') }}">Админ-панель</a></li>
</ul>

<p class="navbar-text navbar-right">
Привет, {{ session.user_login }}.
<a href="{{ url_for('auth.logout') }}">Выйти?</a>
</p>
<ul class="nav navbar-nav">
<li><a href="{{ url_for('admin.mainpage') }}">Админ-панель</a></li>
</ul>

<p class="navbar-text navbar-right">
Привет, {{ session.user_login }}.
<a href="{{ url_for('auth.logout') }}">Выйти?</a>
</p>
</div>
</nav>

{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}

{% endblock %}
5 changes: 5 additions & 0 deletions project/templates/admin/errors/403.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "admin/errors/base.html" %}
{% block errortext %}
<p>403 - Запрещено.</p>
<p>Вам сюда нельзя</p>
{% endblock %}
5 changes: 5 additions & 0 deletions project/templates/admin/errors/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "admin/base.html" %}
{% block content %}
<h2>Произошла ошибка.</h2>
{% block errortext %}{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "__base__.html" %}
{% extends "admin/base.html" %}

{% block styles %}
<link rel="stylesheet" href="{{ url_for('static', filename='dist/styles/admin.bundle.css') }}">
Expand Down
2 changes: 1 addition & 1 deletion project/templates/admin/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block title %}Админ-панель{% endblock %}
{% block content %}
<div class="container-fluid">
{% for name, url in sections %}
{% for name, url in sections | sort %}
<div class="panel panel-body">
<div class="panel-body">
<a href="{{ url }}">{{ name }}</a>
Expand Down
7 changes: 5 additions & 2 deletions project/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@
<li><a href="{{ url_for("pages.projects") }}">Проекты</a></li>
<li><a href="{{ url_for("pages.about") }}">О компании</a></li>
<li><a href="{{ url_for("pages.contacts") }}">Контакты</a></li>
<li><button class="btn btn-action-colored">Отправить резюме</button></li>
<li>
<a href="{{ url_for('feed.get_vacancy', name_in_url='offer-cv') }}">
<button class="btn btn-action-colored">Предложить резюме</button>
</a>
</li>
</ul>
</nav>
{% endblock %}
{% block postscripts %}
<script src="{{ url_for('static', filename='dist/js/hamburger.bundle.js') }}"></script>
{% endblock %}

6 changes: 6 additions & 0 deletions project/templates/errors/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "errors/base.html" %}
{% block errortext %}
<h2>Упс</h2>
<p>Такой страницы не существует.</p>
<p>Возможно Вы перешли по поломаной ссылке или допустили ошибку при наборе адреса страницы.</p>
{% endblock %}
7 changes: 7 additions & 0 deletions project/templates/errors/413.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "errors/base.html" %}

{% block errortext %}
<h2>Упс</h2>
<p>Файл слишком большой</p>
<p>Вы попытались загрузить файл, но, увы, он слишком большой.</p>
{% endblock %}
7 changes: 7 additions & 0 deletions project/templates/errors/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "errors/base.html" %}

{% block errortext %}
<h2>Упс</h2>
<p>Что-то пошло не так</p>
<p>К сожалению, мы не можем выполнить ваш запрос. Если ошибка будет повторяться, пожалуйста, сообщите о ней <a href="https://github.com/uaprom-summer-2015/Meowth/issues">сюда</a></p>
{% endblock %}
10 changes: 10 additions & 0 deletions project/templates/errors/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}{{ error.code }} {{ super() }}{% endblock %}
{% block content %}
<div class="container">
<div class="container container-sad-smile"><!--
--><div class="sad-smile"><span>:(</span></div><!--
--><div class="sad-smile-text">{% block errortext %}{% endblock %}</div><!--
--></div>
</div>
{% endblock content %}
10 changes: 1 addition & 9 deletions project/templates/pages/about.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{% extends "base.html" %}
{% from "pages/macros.html" import list_blocks %}
{% block content %}

<div class="container container-pageblock">
{{ list_blocks(blocks) }}
</div>

{% endblock %}
{% extends "pages/base.html" %}
{% block meta %}
{{ super() }}

Expand Down
9 changes: 9 additions & 0 deletions project/templates/pages/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "base.html" %}
{% from "pages/macros.html" import list_blocks %}
{% block content %}

<div class="container container-pageblock">
{{ list_blocks(blocks) }}
</div>

{% endblock %}
9 changes: 2 additions & 7 deletions project/templates/pages/contacts.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{% extends "base.html" %}
{% from "pages/macros.html" import list_blocks %}
{% extends "pages/base.html" %}
{% block content %}

<div class="container container-pageblock">
{{ list_blocks(blocks) }}
</div>

{{ super() }}
<div id="container-map" data-mlat="{{ map_coordinates["lat"] }}" data-mlng="{{ map_coordinates["lon"] }}" data-clat="{{ map_coordinates["lat"] }}" data-clng="{{ map_coordinates["lon"] }}" data-zoom="{{ map_coordinates["zoom"] }}"></div>
{% endblock %}
{% block meta %}
Expand Down
Loading

0 comments on commit 8c272b5

Please sign in to comment.