kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-03-19 06:14 pm

[dw-free] Change "Recent Entries" title when viewing by tag

[commit: http://hg.dwscoalition.org/dw-free/rev/e2aad9331784]

http://bugs.dwscoalition.org/show_bug.cgi?id=1859

More informative page titles when browsing by tag.

Patch by [personal profile] hotlevel4.

Files modified:
  • bin/upgrading/s2layers/core2.s2
  • cgi-bin/LJ/S2/RecentPage.pm
--------------------------------------------------------------------------------
diff -r 49a2f188bde4 -r e2aad9331784 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Wed Mar 17 05:33:23 2010 +0000
+++ b/bin/upgrading/s2layers/core2.s2	Fri Mar 19 13:13:29 2010 -0500
@@ -677,6 +677,13 @@ class RecentPage extends Page
 
     function print_sticky_entry(StickyEntry s)
     "function to print the sticky entry";
+
+    var bool filter_active
+    "If true, some kind of filter is in effect. If this filter has a name, it will be included in [member[RecentPage.filter_name]]";
+
+    var string filter_name
+    "The name of the filter in effect, if it has a name. This is only used when [member[RecentPage.filter_active]] is true.";
+
 }
 
 class FriendsPage extends RecentPage
@@ -690,12 +697,6 @@ class FriendsPage extends RecentPage
 
     var string friends_mode
     "The 'mode' of this view. An empty string indicates a normal friends view, while 'network' indicates the network view.";
-
-    var bool filter_active
-    "If true, some kind of filter is in effect. If this filter has a name, it will be included in [member[FriendsPage.filter_name]]";
-
-    var string filter_name
-    "The name of the filter in effect, if it has a name. This is only used when 'custom' [member[FriendsPage.filter_active]] is true.";
 }
 
 class DayPage extends Page
@@ -1896,6 +1897,12 @@ property string text_view_recent {
     "size" = 15;
     example = "Recent Posts";
 }
+property string text_view_recent_tagged {
+    des = "Text used to link to a tag-filtered version of the 'Recent Entries' view";
+    maxlength = 40;
+    "size" = 15;
+    example = "Entries tagged with ";
+}
 property string text_view_friends {
     des = "Text used to link to the 'Reading' view";
     maxlength = 40;
@@ -1954,6 +1961,7 @@ property string text_view_tags {
 }
 
 set text_view_recent = "Recent Entries";
+set text_view_recent_tagged = "Entries tagged with ";
 set text_view_friends = "Reading";
 set text_view_friends_comm = "Reading";
 set text_view_friends_filter = "Reading (Custom filter)";
@@ -3216,7 +3224,12 @@ function Page::view_title() [notags] : s
     return lang_viewname($.view);
 }
 function RecentPage::view_title() : string {
-    return $*text_view_recent;
+    if ($.filter_active) {
+        return $*text_view_recent_tagged + $.filter_name;
+    }
+    else {
+        return $*text_view_recent;
+    }
 }
 function FriendsPage::view_title() : string {
     if ($.friends_mode == "") {
diff -r 49a2f188bde4 -r e2aad9331784 cgi-bin/LJ/S2/RecentPage.pm
--- a/cgi-bin/LJ/S2/RecentPage.pm	Wed Mar 17 05:33:23 2010 +0000
+++ b/cgi-bin/LJ/S2/RecentPage.pm	Fri Mar 19 13:13:29 2010 -0500
@@ -32,6 +32,8 @@ sub RecentPage
     $p->{'_type'} = "RecentPage";
     $p->{'view'} = "recent";
     $p->{'entries'} = [];
+    $p->{'filter_active'} = 0;
+    $p->{'filter_name'} = "";
 
     # Link to the friends page as a "group", for use with OpenID "Group Membership Protocol"
     {
@@ -59,6 +61,11 @@ sub RecentPage
     $p->{'data_links_order'} = [ qw(rss atom) ];
 
     $remote->preload_props( "opt_nctalklinks", "opt_cut_disable_journal") if $remote;
+
+    if ( $opts->{tags} ) {
+        $p->{'filter_active'} = 1;
+        $p->{'filter_name'} = join(", ", @{$opts->{tags}});
+    }
 
     my $get = $opts->{'getargs'};
 
--------------------------------------------------------------------------------