# HG changeset patch # User Vincent Tondellier # Date 1482095830 -3600 # Node ID 12da024402d2ea99b5a0ced18bb3c4521fda67e8 # Parent 56f9cb30ded9d448dc6d3e29c46dc70b20846af7 Add a footer with the version number diff -r 56f9cb30ded9 -r 12da024402d2 lib/CrashTest.pm --- a/lib/CrashTest.pm Sun Dec 18 21:53:46 2016 +0100 +++ b/lib/CrashTest.pm Sun Dec 18 22:17:10 2016 +0100 @@ -46,7 +46,7 @@ $self->plugin("CrashTest::Helper::XmlEscape"); $self->plugin("CrashTest::Helper::Stats"); $self->plugin("CrashTest::Helper::BugLinks", $self->config->{WebInterface}->{BugTrackerLinks}); - + $self->plugin("CrashTest::Helper::Version"); $self->helper(crash_reports => sub { state $crash_reports = CrashTest::Model::CrashReport->new (app => $self); }); $self->helper(crash_groups => sub { state $crash_groups = CrashTest::Model::CrashGroup->new (app => $self); }); diff -r 56f9cb30ded9 -r 12da024402d2 lib/CrashTest/Helper/Version.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/CrashTest/Helper/Version.pm Sun Dec 18 22:17:10 2016 +0100 @@ -0,0 +1,47 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +package CrashTest::Helper::Version; + +use Mojo::Base 'Mojolicious::Plugin'; +use FindBin; + +sub register { + my ($self, $mojo, $params) = @_; + + $mojo->helper(crashtest_version => sub { state $version = $self->_version(@_); }); +} + +sub _version { + my ($self, $c) = @_; + + # release version + if($CrashTest::Helper::Version::VERSION) { + return $CrashTest::Helper::Version::VERSION; + } + + # calling hg is slow, avoid in dev mode + if($c->app->mode eq 'development') { + return "devel"; + } + + # production on a checkout + if(-d "$FindBin::Bin/../.hg") { + return "rev hg." . qx; + } + + return ""; +} + +1; + diff -r 56f9cb30ded9 -r 12da024402d2 lib/CrashTest/files/templates/layouts/main.html.ep --- a/lib/CrashTest/files/templates/layouts/main.html.ep Sun Dec 18 21:53:46 2016 +0100 +++ b/lib/CrashTest/files/templates/layouts/main.html.ep Sun Dec 18 22:17:10 2016 +0100 @@ -23,6 +23,11 @@ %= include("layouts/_messages") <%= content %> + +
+ % if ( $self->app->mode eq 'development'){ %= javascript '/assets/js/jquery.js'