From 14f4701faac6ed5d25076428989c2f0f335b9816 Mon Sep 17 00:00:00 2001 From: Maarten Vanraes Date: Mon, 9 May 2016 00:20:36 +0200 Subject: Module: add a title attribute --- lib/ManaTools/Module.pm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/ManaTools/Module.pm b/lib/ManaTools/Module.pm index b1a237cb..ee2a8bb9 100644 --- a/lib/ManaTools/Module.pm +++ b/lib/ManaTools/Module.pm @@ -74,6 +74,33 @@ has 'name' => ( #============================================================= +=head2 title + + title attribute defines the Module title, override this + attribute by using + has '+title' => ( + ... + ) + into your module implementation. + +=cut + +#============================================================= +has 'title' => ( + is => 'rw', + isa => 'Str', + lazy => 1, + builder => '_titleInitializer', +); + +sub _titleInitializer { + my $self = shift; + + return ($self->loc->N("%s - Management Tool", $self->name())); +} + +#============================================================= + =head2 launch launch attribute defines the Module as external command @@ -211,7 +238,7 @@ sub BUILD { my $self = shift; ## set title - yui::YUI::app()->setApplicationTitle($self->name) if $self->name; + yui::YUI::app()->setApplicationTitle($self->title) if $self->title; ## set icon yui::YUI::app()->setApplicationIcon($self->icon) if $self->icon; } -- cgit v1.2.1