فهرست منبع

Fix themed styling

George Baugh 2 سال پیش
والد
کامیت
3ff938788c
2فایلهای تغییر یافته به همراه10 افزوده شده و 5 حذف شده
  1. 4 4
      lib/Trog/Routes/HTML.pm
  2. 6 1
      lib/Trog/Themes.pm

+ 4 - 4
lib/Trog/Routes/HTML.pm

@@ -1544,7 +1544,7 @@ sub rss_style ($query) {
 }
 
 sub _build_themed_styles ($styles) {
-    my @styles = map { Trog::Themes::themed_style("$_") } @{ Trog::Utils::coerce_array($styles) };
+    my @styles = map { (Trog::Themes::themed_style("$_")) } @{ Trog::Utils::coerce_array($styles) };
     return \@styles;
 }
 
@@ -1562,9 +1562,9 @@ sub finish_render ( $template, $vars, %headers ) {
     $vars->{scripts}     //= [];
 
     # Theme-ize the paths
-    $vars->{stylesheets}  = [ map { s/^www\///; $_ } grep { -f $_ } @{ _build_themed_styles( $vars->{stylesheets} ) } ];
-    $vars->{print_styles} = [ map { s/^www\///; $_ } grep { -f $_ } @{ _build_themed_styles( $vars->{p_styles} ) } ];
-    $vars->{scripts}      = [ map { s/^www\///; $_ } grep { -f $_ } @{ _build_themed_scripts( $vars->{scripts} ) } ];
+    $vars->{stylesheets}  = [ @{ _build_themed_styles( $vars->{stylesheets} ) } ];
+    $vars->{print_styles} = [ @{ _build_themed_styles( $vars->{p_styles} ) } ];
+    $vars->{scripts}      = [ map { s/^www\///; $_ } @{ _build_themed_scripts( $vars->{scripts} ) } ];
 
     # Add in avatars.css, it's special
     push( @{ $vars->{stylesheets} }, "/styles/avatars.css" );

+ 6 - 1
lib/Trog/Themes.pm

@@ -43,8 +43,13 @@ sub themed ($resource) {
     return _dir_for_resource("$resource") . "/$resource";
 }
 
+# For style we want to load *both* style files and have the override come later.
 sub themed_style ($resource) {
-    return _dir_for_resource("styles/$resource") . "/styles/$resource";
+    my @styles = ("/styles/$resource");
+    my $styled = _dir_for_resource("styles/$resource");
+    $styled =~ s/^www\///;
+    push(@styles, "/$styled/styles/$resource") if $styled;
+    return @styles;
 }
 
 sub themed_script ($resource) {