Committer: vad
LJSUP-14001: Filter for friendsgroups updatesneed_res_group call now allows to specify condition for resource:
js => ['js/1.js',
['js/2.js', {condition => 'IE'}], # <-- resource with condition
],
U trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/weblib.pl =================================================================== --- trunk/cgi-bin/weblib.pl 2012-11-01 12:27:48 UTC (rev 23240) +++ trunk/cgi-bin/weblib.pl 2012-11-01 13:45:42 UTC (rev 23241) @@ -1324,7 +1324,21 @@ foreach my $resource_class (qw/js css templates/){ next unless exists $group->{$resource_class}; foreach my $files ($group->{$resource_class}){ - LJ::need_res($_) for @$files; + foreach my $resource (@$files){ + if (ref $resource eq 'ARRAY'){ + ## need_res expects $cond as a first argument, + ## but for config files other order is preferable: + ## source file name at first place then condition at second + ## + ## support both + my ($file, $cond) = ref($resource->[0]) + ? ($resource->[1], $resource->[0]) + : ($resource->[0], $resource->[1]); + LJ::need_res($cond, $file); + } else { + LJ::need_res($resource); + } + } } }