Commit 2d402a34 authored by Christophe Maudoux's avatar Christophe Maudoux

Disable Diff link if useless (#1661)

parent c9d70418
......@@ -17,7 +17,7 @@ use JSON;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::PSGI::Constants;
our $VERSION = '2.0.2';
our $VERSION = '2.0.3';
extends 'Lemonldap::NG::Common::Conf::AccessLib',
'Lemonldap::NG::Handler::PSGI::Router';
......@@ -137,13 +137,14 @@ sub init {
sub tplParams {
my ($self) = @_;
return ( VERSION => $VERSION, ALLOWBROWSER => $self->brw, ALLOWDIFF => $self->dif );
return ( VERSION => $VERSION, ALLOWBROWSER => $self->brw );
}
sub javascript {
my ($self) = @_;
return
'var formPrefix=staticPrefix+"forms/";var confPrefix=scriptname+"confs/";var viewPrefix=scriptname+"view/";'
. 'var allowDiff=' . $self->dif . ';'
. ( $self->links ? 'var links=' . to_json( $self->links ) . ';' : '' )
. (
$self->menuLinks
......
......@@ -67,7 +67,7 @@ sub addRoutes {
}
# Difference between confs
if ( $self->{viewerAllowDiff} ) {
if ( $self->{viewerAllowDiff} || $conf->{viewerAllowDiff} ) {
$self->addRoute(
view => { diff => { ':conf1' => { ':conf2' => 'viewDiff' } } } )
->addRoute( 'viewDiff.html', undef, ['GET'] );
......
......@@ -30,6 +30,7 @@ llapp.controller 'TreeCtrl', [
$scope.form = 'homeViewer'
$scope.currentCfg = {}
$scope.viewPrefix = window.viewPrefix
$scope.allowDiff = window.allowDiff
$scope.message = {}
$scope.result = ''
......
......@@ -4,7 +4,7 @@
<span ng-if="!currentCfg.next" trspan="currentConfiguration"></span>
<span ng-if="currentCfg.next" trspan="loadedConfiguration"></span>
<i ng-if="currentCfg.prev">(<a trspan="diffWithPrevious" target="_blank" href="{{scriptname}}/viewDiff.html#!/{{currentCfg.cfgNum}}" role="link"></a>)</i>
<i ng-if="currentCfg.prev && allowDiff">(<a trspan="diffWithPrevious" target="_blank" href="{{scriptname}}/viewDiff.html#!/{{currentCfg.cfgNum}}" role="link"></a>)</i>
</h3>
</div>
......
......@@ -36,6 +36,7 @@ This file contains:
$scope.form = 'homeViewer';
$scope.currentCfg = {};
$scope.viewPrefix = window.viewPrefix;
$scope.allowDiff = window.allowDiff;
$scope.message = {};
$scope.result = '';
$scope.translateTitle = function(node) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment