Rename template variables in the Account and Admin Toggle templates to not use underscores.
This commit is contained in:
parent
6f4e3415ea
commit
f61e8faeb9
10 changed files with 88 additions and 13 deletions
|
|
@ -13,10 +13,13 @@ save you many hours of grief.
|
||||||
code, chances are you'll need to update it to make it work with
|
code, chances are you'll need to update it to make it work with
|
||||||
WebGUI 8.
|
WebGUI 8.
|
||||||
|
|
||||||
* WebGUI now requires the following modules
|
* As part of the migration to Template::Toolkit, we will be changing template
|
||||||
- Moose
|
variables from using dots to underscores. All templates using that namespace were
|
||||||
- CHI
|
automatically upgraded to use the new variables.
|
||||||
- Facebook::Graph
|
|
||||||
|
In this version, these templates were updated:
|
||||||
|
Account Macro template
|
||||||
|
Admin Toggle Macro template
|
||||||
|
|
||||||
7.9.8
|
7.9.8
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
|
||||||
14
docs/templates.txt
Normal file
14
docs/templates.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
This is a running list of template changes made during upgrades. If you have copied the default
|
||||||
|
templates, you will need to apply these changes manually to your copies.
|
||||||
|
|
||||||
|
7.8.0
|
||||||
|
|
||||||
|
* Account Macro template variables renamed:
|
||||||
|
account.url => account_url
|
||||||
|
account.text => account_text
|
||||||
|
|
||||||
|
* AdminToggle Macro template variables renamed:
|
||||||
|
toggle.url => toggle_url
|
||||||
|
toggle.text => toggle_text
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6,7 +6,16 @@ our $HELP = {
|
||||||
'admin toggle' => {
|
'admin toggle' => {
|
||||||
title => 'admin toggle title',
|
title => 'admin toggle title',
|
||||||
body => '',
|
body => '',
|
||||||
variables => [ { 'name' => 'toggle.url' }, { 'name' => 'toggle.text' } ],
|
variables => [
|
||||||
|
{
|
||||||
|
name => 'toggle_url',
|
||||||
|
description => 'toggle.url',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name => 'toggle_text',
|
||||||
|
description => 'toggle.text',
|
||||||
|
},
|
||||||
|
],
|
||||||
fields => [],
|
fields => [],
|
||||||
related => []
|
related => []
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,16 @@ our $HELP = {
|
||||||
title => 'account title',
|
title => 'account title',
|
||||||
body => '',
|
body => '',
|
||||||
fields => [],
|
fields => [],
|
||||||
variables => [ { 'name' => 'account.url' }, { 'name' => 'account.text' } ],
|
variables => [
|
||||||
|
{
|
||||||
|
name => 'account_url',
|
||||||
|
description => 'account.url',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name => 'account_text',
|
||||||
|
description => 'account.text',
|
||||||
|
}
|
||||||
|
],
|
||||||
related => []
|
related => []
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,12 @@ sub process {
|
||||||
my ($turnOn, $templateName) = @_;
|
my ($turnOn, $templateName) = @_;
|
||||||
my $i18n = WebGUI::International->new($session,'Macro_AdminToggle');
|
my $i18n = WebGUI::International->new($session,'Macro_AdminToggle');
|
||||||
my %var;
|
my %var;
|
||||||
$var{'toggle.text'} = $turnOn || $i18n->get(516);
|
$var{'toggle_text'} = $turnOn || $i18n->get(516);
|
||||||
if ($session->var->isAdminOn) {
|
if ($session->var->isAdminOn) {
|
||||||
$var{'toggle.url'} = '#'
|
$var{'toggle_url'} = '#'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$var{'toggle.url'} = $session->url->page('op=admin');
|
$var{'toggle_url'} = $session->url->page('op=admin');
|
||||||
}
|
}
|
||||||
my $template = $templateName ? WebGUI::Asset::Template->newByUrl($session, $templateName)
|
my $template = $templateName ? WebGUI::Asset::Template->newByUrl($session, $templateName)
|
||||||
: WebGUI::Asset::Template->newById($session, "PBtmpl0000000000000036");
|
: WebGUI::Asset::Template->newById($session, "PBtmpl0000000000000036");
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ sub process {
|
||||||
my @param = @_;
|
my @param = @_;
|
||||||
return $session->url->page("op=auth;method=init") if ($param[0] eq "linkonly");
|
return $session->url->page("op=auth;method=init") if ($param[0] eq "linkonly");
|
||||||
my $i18n = WebGUI::International->new($session,'Macro_a_account');
|
my $i18n = WebGUI::International->new($session,'Macro_a_account');
|
||||||
$var{'account.url'} = $session->url->page('op=auth;method=init');
|
$var{'account_url'} = $session->url->page('op=auth;method=init');
|
||||||
$var{'account.text'} = $param[0] || $i18n->get(46);
|
$var{'account_text'} = $param[0] || $i18n->get(46);
|
||||||
if ($param[1]) {
|
if ($param[1]) {
|
||||||
return WebGUI::Asset::Template->newByUrl($session, $param[1])->process(\%var);
|
return WebGUI::Asset::Template->newByUrl($session, $param[1])->process(\%var);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
use WebGUI::Upgrade::Script;
|
||||||
|
|
||||||
|
start_step "Rename Account Macro template variables";
|
||||||
|
|
||||||
|
my $sth = session->db->read( q|SELECT assetId, revisionDate FROM template where namespace="Macro/a_account"| );
|
||||||
|
ASSET: while ( my ($assetId, $revisionDate) = $sth->array ) {
|
||||||
|
my $asset = eval { WebGUI::Asset->newById( session, $assetId, $revisionDate ); };
|
||||||
|
next ASSET if Exception::Class->caught;
|
||||||
|
my $template = $asset->get('template');
|
||||||
|
$template =~ s/account\.url/account_url/msg;
|
||||||
|
$template =~ s/account\.text/account_text/msg;
|
||||||
|
$asset->update({
|
||||||
|
template => $template,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
done;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
use WebGUI::Upgrade::Script;
|
||||||
|
|
||||||
|
start_step "Rename AdminToggle Macro template variables";
|
||||||
|
|
||||||
|
my $sth = session->db->read( q|SELECT assetId, revisionDate FROM template where namespace="Macro/AdminToggle"| );
|
||||||
|
ASSET: while ( my ($assetId, $revisionDate) = $sth->array ) {
|
||||||
|
my $asset = eval { WebGUI::Asset->newById( session, $assetId, $revisionDate ); };
|
||||||
|
next ASSET if Exception::Class->caught;
|
||||||
|
my $template = $asset->get('template');
|
||||||
|
$template =~ s/toggle\.url/toggle_url/msg;
|
||||||
|
$template =~ s/toggle\.text/toggle_text/msg;
|
||||||
|
$asset->update({
|
||||||
|
template => $template,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
done;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ sub addTemplate {
|
||||||
className => 'WebGUI::Asset::Template',
|
className => 'WebGUI::Asset::Template',
|
||||||
url => 'admintoggle-test',
|
url => 'admintoggle-test',
|
||||||
namespace => 'Macro/AdminToggle',
|
namespace => 'Macro/AdminToggle',
|
||||||
template => "HREF=<tmpl_var toggle.url>\nLABEL=<tmpl_var toggle.text>",
|
template => "HREF=<tmpl_var toggle_url>\nLABEL=<tmpl_var toggle_text>",
|
||||||
id => 'AdminToggleTemplate--Z',
|
id => 'AdminToggleTemplate--Z',
|
||||||
usePacked => 0,
|
usePacked => 0,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ sub addTemplate {
|
||||||
className => 'WebGUI::Asset::Template',
|
className => 'WebGUI::Asset::Template',
|
||||||
url => 'a_account-test',
|
url => 'a_account-test',
|
||||||
namespace => 'Macro/a_account',
|
namespace => 'Macro/a_account',
|
||||||
template => "HREF=<tmpl_var account.url>\nLABEL=<tmpl_var account.text>",
|
template => "HREF=<tmpl_var account_url>\nLABEL=<tmpl_var account_text>",
|
||||||
id => 'testTemplatea_account1',
|
id => 'testTemplatea_account1',
|
||||||
usePacked => 1,
|
usePacked => 1,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue