Skip to content

Commit

Permalink
Item13033: upgrade to angular 1.4
Browse files Browse the repository at this point in the history
- make it work on Foswiki-2.0
- fixed page caching encoding
  • Loading branch information
MichaelDaum committed Jul 17, 2015
1 parent 5134c2a commit 5470ca5
Show file tree
Hide file tree
Showing 749 changed files with 21,430 additions and 15,250 deletions.
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/LoadingBar.pm
Expand Up @@ -13,7 +13,7 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'loadingBar',
version => '0.6.0',
version => '0.7.1',
author => 'Wes Cruver',
homepage => 'https://github.com/chieffancypants/angular-loading-bar',
css => ['loading-bar.css', ],
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/AngularPlugin/Localize.pm
Expand Up @@ -13,7 +13,7 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'ngLocalize',
version => '1.1.3',
version => '1.1.4',
author => 'Rahul Doshi',
homepage => 'https://github.com/doshprompt/angular-localization',
javascript => ['angular-localization.js', ],
Expand Down
18 changes: 14 additions & 4 deletions lib/Foswiki/Plugins/AngularPlugin/Service.pm
Expand Up @@ -10,7 +10,7 @@ use Foswiki::Plugins::AngularPlugin ();
use Foswiki::Contrib::JsonRpcContrib::Error ();
use JSON ();
use Error qw( :try );
use Data::Dump qw(dump);
#use Data::Dump qw(dump);

sub new {
my $class = shift;
Expand Down Expand Up @@ -43,13 +43,18 @@ sub tmpl {

Foswiki::Func::pushTopicContext($web, $topic);

if (Foswiki::Func::getContext()->{NatSkinPluginEnabled}) {
require Foswiki::Plugins::NatSkinPlugin;
Foswiki::Plugins::NatSkinPlugin::init();
}

my $cache = $session->{cache};
if ($cache) {
my $cachedPage = $cache->getPage($web, $topic);
if ($cachedPage) {
#print STDERR "found angular tmpl in cache for $web.$topic\n";
Foswiki::Func::popTopicContext();
return $this->json->decode($cachedPage->{data});
return $this->json->decode(Encode::decode_utf8($cachedPage->{data}));
}
#print STDERR "computing angular tmpl for $web.$topic\n";
}
Expand Down Expand Up @@ -140,8 +145,14 @@ sub getZoneObject {
}

my @zone = ();
my $excludeFromZone = $Foswiki::cfg{AngularPlugin}{ExcludeFromZone};

foreach my $item (grep { $_->{text} } @total) {
if ($excludeFromZone && $item->{id} =~ /$excludeFromZone/g) {
#print STDERR "excluding $item->{id}\n";
next;
}
#print STDERR "id=$item->{id}\n";
my @requires = map { $_->{id} } @{$item->{requires}};

my $text = $meta->renderTML($meta->expandMacros($item->{text}));
Expand Down Expand Up @@ -177,8 +188,7 @@ sub expandTemplate {
}

# cleanup stuff
$result =~ s/<nop>//g;
$result =~ s/<\/?noautolink>//g;
$result =~ s/<\/?(?:dirtyarea|nop|noautolink|sticky|literal)>//g;
$result =~ s/<!--[^\[<].*?-->//g;
$result =~ s/^\s*$//gms;
$result =~ s/<p><\/p>\s*([^<>]+?)\s*(?=<p><\/p>)/<p class='p'>$1<\/p>\n\n/gs;
Expand Down

0 comments on commit 5470ca5

Please sign in to comment.