[dw-free] Subscription Filters: create a module to display them as links
[commit: http://hg.dwscoalition.org/dw-free/rev/2b0c2e98b22f]
http://bugs.dwscoalition.org/show_bug.cgi?id=1867
Add subscription filters to logged-in homepage, as part of the ReadingList
widget.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1867
Add subscription filters to logged-in homepage, as part of the ReadingList
widget.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/DW/Widget/ReadingList.pm
-------------------------------------------------------------------------------- diff -r 30df6fadab39 -r 2b0c2e98b22f bin/upgrading/en.dat --- a/bin/upgrading/en.dat Thu Oct 08 17:16:43 2009 +0000 +++ b/bin/upgrading/en.dat Thu Oct 08 17:20:29 2009 +0000 @@ -4537,6 +4537,10 @@ widget.readinglist.breakdown.header=You widget.readinglist.breakdown.personal=[[num]] personal journals +widget.readinglist.filters.nofilters=You currently have no subscription filters. Would you like to <a [[aopts]]>create some</a>? + +widget.readinglist.filters.title=Your Subscription Filters + widget.readinglist.readpage=Check out recent updates on your <a [[aopts]]>reading list</a>! widget.readinglist.title=Reading List diff -r 30df6fadab39 -r 2b0c2e98b22f cgi-bin/DW/Widget/ReadingList.pm --- a/cgi-bin/DW/Widget/ReadingList.pm Thu Oct 08 17:16:43 2009 +0000 +++ b/cgi-bin/DW/Widget/ReadingList.pm Thu Oct 08 17:20:29 2009 +0000 @@ -18,6 +18,7 @@ package DW::Widget::ReadingList; use strict; use base qw/ LJ::Widget /; +use DW::User::ContentFilters; sub render_body { my ( $class, %opts ) = @_; @@ -34,7 +35,20 @@ sub render_body { $ret .= "<p>" . $class->ml( 'widget.readinglist.breakdown.header' ) . "</p>"; $ret .= "<ul><li>" . $class->ml( 'widget.readinglist.breakdown.personal', { num => $count{personal} + 0 } ) . "</li>"; $ret .= "<li>" . $class->ml( 'widget.readinglist.breakdown.communities', { num => $count{community} + 0 } ) . "</li>"; - $ret .= "<li>" . $class->ml( 'widget.readinglist.breakdown.feeds', { num => $count{syndicated} + 0 } ) . "</li></ul>"; + $ret .= "<li>" . $class->ml( 'widget.readinglist.breakdown.feeds', { num => $count{syndicated} + 0 } ) . "</li></ul><br />"; + + my @filters = $remote->content_filters; + + if ( @filters ) { + $ret .= $class->ml( 'widget.readinglist.filters.title' ); + $ret .= "<ul>"; + foreach my $filter ( @filters ) { + $ret .= "<li><a href='" . $remote->journal_base . "/read/" . LJ::eurl( $filter->{name} ) . "'>" . $filter->{name} . "</a></li>\n"; + } + $ret .= "</ul>"; + } else { + $ret .= $class->ml( 'widget.readinglist.filters.nofilters', { aopts => "href='$LJ::SITEROOT/manage/subscriptions/filters'" } ); + } return $ret; } --------------------------------------------------------------------------------
no subject
You don't need this.
+ $ret .= "<li><a href='" . $remote->journal_base . "/read/" . LJ::eurl( $filter->{name} ) . "'>" . $filter->{name} . "</a></li>\n";
It's an object, please use the accessor methods ($filter->name).
no subject
no subject
no subject
no subject