Continued refactoring.

This commit is contained in:
Alexis Lahouze 2013-12-03 21:34:40 +01:00
parent 55005ffffc
commit 008498f84c
4 changed files with 34 additions and 15 deletions

19
frontend/__init__.py Normal file
View File

@ -0,0 +1,19 @@
from flask import Blueprint, redirect, render_template, jsonify
frontend = Blueprint('frontend', __name__, template_folder='templates', static_folder='static')
@frontend.route('/')
def root():
return redirect('index.html')
@frontend.route('/index.html')
def index():
return render_template('index.html')
@frontend.route('/scheduler.html')
def scheduler():
return render_template('scheduler.html')
@frontend.errorhandler(BaseException)
def default_errorhandler(error):
return jsonify(title="Error", text="Error %s" % str(error)), 500

View File

@ -99,7 +99,7 @@
</div> </div>
<div class="btn-group" ng-show="isDisplaying(entry) && isSaved(entry)"> <div class="btn-group" ng-show="isDisplaying(entry) && isSaved(entry)">
<a class="btn btn-mini" ng-click="editEntry(entry)" href="#" title="edit"><i class="icon-edit"><span style="display: none">Edit</span></i></a> <a class="btn btn-mini" ng-click="editEntry(entry)" href="#" title="edit"><i class="icon-edit"><span style="display: none">Edit</span></i></a>
<a class="btn btn-mini" bs-modal="'{{ url_for('static', filename='templates/entry_remove.html') }}'" href="#" title="remove"><i class="icon-trash"><span style="display: none">Remove</span></i></a> <a class="btn btn-mini" bs-modal="'{{ url_for('frontend.static', filename='templates/entry_remove.html') }}'" href="#" title="remove"><i class="icon-trash"><span style="display: none">Remove</span></i></a>
<a class="btn btn-mini" ng-click="pointEntry(entry)" ng-class="pointedEntryClass(entry)" href="#" title="point"><i class="icon-pencil"><span style="display: none">Point</span></i></a> <a class="btn btn-mini" ng-click="pointEntry(entry)" ng-class="pointedEntryClass(entry)" href="#" title="point"><i class="icon-pencil"><span style="display: none">Point</span></i></a>
</div> </div>
<div class="btn-group" ng-show="isDisplaying(entry) && !isSaved(entry)"> <div class="btn-group" ng-show="isDisplaying(entry) && !isSaved(entry)">
@ -127,8 +127,8 @@
<!-- Custom Javascript library for entries --> <!-- Custom Javascript library for entries -->
{% block js %} {% block js %}
<script type="text/javascript" src="{{ url_for('static', filename='js/months.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='js/months.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/accounts.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='js/accounts.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/entries.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='js/entries.js') }}"></script>
{% endblock %} {% endblock %}

View File

@ -30,10 +30,10 @@
<link href="//cdnjs.cloudflare.com/ajax/libs/nvd3/1.0.0-beta/nv.d3.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/nvd3/1.0.0-beta/nv.d3.css" rel="stylesheet">
<!-- Pines Notify JQuery plugin --> <!-- Pines Notify JQuery plugin -->
<link href="{{ url_for('static', filename='third-party/pines-notify/jquery.pnotify.default.css') }}" rel="stylesheet"> <link href="{{ url_for('frontend.static', filename='third-party/pines-notify/jquery.pnotify.default.css') }}" rel="stylesheet">
<!-- main css --> <!-- main css -->
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet"> <link href="{{ url_for('frontend.static', filename='css/main.css') }}" rel="stylesheet">
</head> </head>
<body style="padding-bottom:21px; padding-top: 40px"> <body style="padding-bottom:21px; padding-top: 40px">
@ -55,8 +55,8 @@
<li class="dropdown-submenu" ng-class="accountClass(account)" ng-repeat="account in accounts"> <li class="dropdown-submenu" ng-class="accountClass(account)" ng-repeat="account in accounts">
<a ng-click="selectAccount(account)" href="#">[[account.name]](<span ng-class="valueClass(account, account.current)">[[account.current]]</span>&nbsp;/&nbsp;<span ng-class="valueClass(account, account.pointed)">[[account.pointed]]</span>) <a ng-click="selectAccount(account)" href="#">[[account.name]](<span ng-class="valueClass(account, account.current)">[[account.current]]</span>&nbsp;/&nbsp;<span ng-class="valueClass(account, account.pointed)">[[account.pointed]]</span>)
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#" ng-click="editAccount(account)" bs-modal="'{{ url_for('static', filename='templates/account_edit.html') }}'">Modifier</a></li> <li><a href="#" ng-click="editAccount(account)" bs-modal="'{{ url_for('frontend.static', filename='templates/account_edit.html') }}'">Modifier</a></li>
<li><a href="#" bs-modal="'{{ url_for('static', filename='templates/account_remove.html') }}'">Supprimer</a></li> <li><a href="#" bs-modal="'{{ url_for('frontend.static', filename='templates/account_remove.html') }}'">Supprimer</a></li>
</ul> </ul>
</a> </a>
</li> </li>
@ -64,7 +64,7 @@
<li class="divider"></li> <li class="divider"></li>
<!-- New account button --> <!-- New account button -->
<li><a bs-modal="'{{ url_for('static', filename='templates/account_new.html') }}'" href="#">Ajouter un compte</a></li> <li><a bs-modal="'{{ url_for('frontend.static', filename='templates/account_new.html') }}'" href="#">Ajouter un compte</a></li>
</ul> </ul>
</li> </li>
</ul><!-- nav --> </ul><!-- nav -->
@ -97,10 +97,10 @@
<!-- NVD3 framework --> <!-- NVD3 framework -->
<!--script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/nvd3/1.0.0-beta/nv.d3.js"></script--> <!--script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/nvd3/1.0.0-beta/nv.d3.js"></script-->
<script type="text/javascript" src="{{ url_for('static', filename='third-party/nv.d3/nv.d3.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='third-party/nv.d3/nv.d3.js') }}"></script>
<!-- Pines Notify JQuery plugin --> <!-- Pines Notify JQuery plugin -->
<script type="text/javascript" src="{{ url_for('static', filename='third-party/pines-notify/jquery.pnotify.min.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='third-party/pines-notify/jquery.pnotify.min.js') }}"></script>
<!-- Custom Javascript library for entries --> <!-- Custom Javascript library for entries -->
{% block js %}{% endblock %} {% block js %}{% endblock %}

View File

@ -71,7 +71,7 @@
</div> </div>
<div class="btn-group" ng-show="isDisplaying(operation)"> <div class="btn-group" ng-show="isDisplaying(operation)">
<a class="btn btn-mini" ng-click="editOperation(operation)" href="#operation_[[operation.id]]" title="edit"><i class="icon-edit"><span style="display: none">Edit</span></i></a> <a class="btn btn-mini" ng-click="editOperation(operation)" href="#operation_[[operation.id]]" title="edit"><i class="icon-edit"><span style="display: none">Edit</span></i></a>
<a class="btn btn-mini" bs-modal="'{{ url_for('static', filename='templates/operation_remove.html') }}'" href="#operation_[[operation.id]]" title="remove"><i class="icon-trash"><span style="display: none">Remove</span></i></a> <a class="btn btn-mini" bs-modal="'{{ url_for('frontend.static', filename='templates/operation_remove.html') }}'" href="#operation_[[operation.id]]" title="remove"><i class="icon-trash"><span style="display: none">Remove</span></i></a>
</div> </div>
</td> </td>
</tr> </tr>
@ -81,8 +81,8 @@
{% endblock %} {% endblock %}
{% block js %} {% block js %}
<script type="text/javascript" src="{{ url_for('static', filename='js/months.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='js/months.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/accounts.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='js/accounts.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/scheduler.js') }}"></script> <script type="text/javascript" src="{{ url_for('frontend.static', filename='js/scheduler.js') }}"></script>
{% endblock %} {% endblock %}