Add version and current year to the layout

Fixes #78
This commit is contained in:
Julien Kassar
2015-02-27 13:26:28 -05:00
parent e3dba5e77f
commit a01a5cf9e0
2 changed files with 23 additions and 14 deletions

View File

@@ -58,6 +58,14 @@ def stream_template(template_name, **context):
return rv return rv
@app.context_processor
def utility_processor():
def now(format='%m/%d/%Y %H:%M:%S'):
"""returns the formated datetime"""
return datetime.now().strftime(format)
return dict(now=now)
@app.errorhandler(400) @app.errorhandler(400)
def bad_request(e): def bad_request(e):
return render_template('400.html'), 400 return render_template('400.html'), 400
@@ -229,7 +237,7 @@ def report(node, report_id):
"""Displays a single report including all the events associated with that """Displays a single report including all the events associated with that
report and their status. report and their status.
The report_id may be the puppetdb's report hash or the The report_id may be the puppetdb's report hash or the
configuration_version. This allows for better integration configuration_version. This allows for better integration
into puppet-hipchat. into puppet-hipchat.
""" """

View File

@@ -4,22 +4,22 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Puppetboard</title> <title>Puppetboard</title>
{% if config.OFFLINE_MODE %} {% if config.OFFLINE_MODE %}
<link href="{{ url_for('static', filename='css/semantic.min.css')}}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/semantic.min.css') }}" rel="stylesheet">
<style> <style>
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url({{ url_for('static', filename='fonts/Open_Sans.woff')}}) format('woff'); src: local('Open Sans'), local('OpenSans'), url({{ url_for('static', filename='fonts/Open_Sans.woff') }}) format('woff');
} }
</style> </style>
<link href="{{ url_for('static', filename='css/jquery.tablesorter.filter.formatter.css')}}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/jquery.tablesorter.filter.formatter.css') }}" rel="stylesheet">
{% else %} {% else %}
<link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/css/semantic.min.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/css/semantic.min.css" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> <link href='//fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.2/css/filter.formatter.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.2/css/filter.formatter.css" rel="stylesheet">
{% endif %} {% endif %}
<link href="{{ url_for('static', filename='css/puppetboard.css')}}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/puppetboard.css') }}" rel="stylesheet">
</head> </head>
<body> <body>
@@ -38,6 +38,7 @@
<a {% if endpoint == request.endpoint %} class="active item" {% else %} class="item" {% endif %} <a {% if endpoint == request.endpoint %} class="active item" {% else %} class="item" {% endif %}
href="{{ url_for(endpoint) }}">{{ caption }}</a> href="{{ url_for(endpoint) }}">{{ caption }}</a>
{%- endfor %} {%- endfor %}
<div class="item" style="float:right"><a href="https://github.com/puppet-community/puppetboard" target="_blank">v0.0.4</a></div>
</nav> </nav>
<div class="ui grid padding-bottom"> <div class="ui grid padding-bottom">
<div class="one wide column"></div> <div class="one wide column"></div>
@@ -53,17 +54,17 @@
<footer class="ui absolute fixed bottom"> <footer class="ui absolute fixed bottom">
<div> <div>
Copyright © 2013-2014 <a href="https://github.com/daenney">Daniele Sluijters</a>. <span style="float:right">Live from PuppetDB.</span> Copyright &copy; 2013-{{ now('%Y') }} <a href="https://github.com/daenney" target="_blank">Daniele Sluijters</a>. <span style="float:right">Live from PuppetDB.</span>
</div> </div>
</footer> </footer>
{% if config.OFFLINE_MODE %} {% if config.OFFLINE_MODE %}
<script src="{{ url_for('static', filename='js/jquery.min.js')}}"></script> <script src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/semantic.min.js')}}"></script> <script src="{{ url_for('static', filename='js/semantic.min.js') }}"></script>
{% if config.LOCALISE_TIMESTAMP %} {% if config.LOCALISE_TIMESTAMP %}
<script src="{{ url_for('static', filename='js/moment.min.js')}}"></script> <script src="{{ url_for('static', filename='js/moment.min.js') }}"></script>
{% endif %} {% endif %}
<script src="{{url_for('static', filename='js/jquery.tablesorter.min.js')}}"></script> <script src="{{ url_for('static', filename='js/jquery.tablesorter.min.js') }}"></script>
{% else %} {% else %}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/javascript/semantic.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/javascript/semantic.min.js"></script>
@@ -75,9 +76,9 @@
{% if config.LOCALISE_TIMESTAMP %} {% if config.LOCALISE_TIMESTAMP %}
<script src="{{ url_for('static', filename='js/timestamps.js')}}"></script> <script src="{{ url_for('static', filename='js/timestamps.js')}}"></script>
{% endif %} {% endif %}
<script src="{{url_for('static', filename='js/lists.js')}}"></script> <script src="{{ url_for('static', filename='js/lists.js') }}"></script>
<script src="{{url_for('static', filename='js/tables.js')}}"></script> <script src="{{ url_for('static', filename='js/tables.js') }}"></script>
<script src="{{url_for('static', filename='js/scroll.top.js')}}"></script> <script src="{{ url_for('static', filename='js/scroll.top.js') }}"></script>
{% block script %} {% endblock script %} {% block script %} {% endblock script %}
</body> </body>