[dw-free] Manage Subscription Filters: add 'View Filtered Reading Page' button
[commit: http://hg.dwscoalition.org/dw-free/rev/f8f43a4df828]
http://bugs.dwscoalition.org/show_bug.cgi?id=3392
Add "View" button to let you see what's on your filtered reading page when
editing a subscription filter.
Patch by
yvi.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3392
Add "View" button to let you see what's on your filtered reading page when
editing a subscription filter.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/js/subfilters.js
- htdocs/manage/subscriptions/filters.bml
- htdocs/tools/endpoints/contentfilters.bml
-------------------------------------------------------------------------------- diff -r fe8108115d6a -r f8f43a4df828 htdocs/js/subfilters.js --- a/htdocs/js/subfilters.js Tue Aug 09 11:09:05 2011 +0800 +++ b/htdocs/js/subfilters.js Tue Aug 09 15:33:22 2011 +0800 @@ -107,13 +107,13 @@ // short circuit, if we have no filter, just empty both if ( ! cfSelectedFilterId ) { $('#cf-in-list, #cf-notin-list').empty(); - $('#cf-rename, #cf-delete, #cf-edit').hide(); + $('#cf-rename, #cf-delete, #cf-view, #cf-edit').hide(); $('#cf-intro').show(); return; } // show our rename button - $('#cf-rename, #cf-delete, #cf-edit').show(); + $('#cf-rename, #cf-delete, #cf-view, #cf-edit').show(); $('#cf-intro').hide(); var filt = cfFilters[cfSelectedFilterId]; @@ -540,6 +540,18 @@ cfSaveChanges(); } +function cfViewFilter() { + var filt = cfFilters[cfSelectedFilterId]; + + $.getJSON( '/__rpc_contentfilters?mode=view_filter&user=' + DW.currentUser + '&name=' + filt.name, + function( data ) { + if ( !data.url ) + return; + + window.open(data.url); + } + ); +} function cfUpdateFilterSelect() { // regenerate HTML for the Filter: dropdown @@ -612,6 +624,7 @@ $('#cf-del-btn').bind( 'click', function(e) { cfRemoveMembers(); } ); $('#cf-new').bind( 'click', function(e) { cfNewFilter(); } ); $('#cf-rename').bind( 'click', function(e) { cfRenameFilter(); } ); + $('#cf-view').bind( 'click', function(e) { cfViewFilter(); } ); $('#cf-delete').bind( 'click', function(e) { cfDeleteFilter(); } ); $('#cf-showtypes').bind( 'change', function(e) { cfShowTypes( $(e.target).val() ); } ); diff -r fe8108115d6a -r f8f43a4df828 htdocs/manage/subscriptions/filters.bml --- a/htdocs/manage/subscriptions/filters.bml Tue Aug 09 11:09:05 2011 +0800 +++ b/htdocs/manage/subscriptions/filters.bml Tue Aug 09 15:33:22 2011 +0800 @@ -56,6 +56,7 @@ </div> <div id='cf-make-new'> <a href='javascript:void(0);' id='cf-delete'>Delete</a> + <input id='cf-view' type='button' value='View' /> <input id='cf-rename' type='button' value='Rename' /> <input id='cf-new' type='button' value='New' /> </div> diff -r fe8108115d6a -r f8f43a4df828 htdocs/tools/endpoints/contentfilters.bml --- a/htdocs/tools/endpoints/contentfilters.bml Tue Aug 09 11:09:05 2011 +0800 +++ b/htdocs/tools/endpoints/contentfilters.bml Tue Aug 09 15:33:22 2011 +0800 @@ -168,6 +168,12 @@ } $ret{ok} = 1; + } elsif ( $mode eq "view_filter" ) { + # called to get reading page url + return $err->( 'No name provided.' ) + unless $GET{name} =~ /\S/; + + $ret{url} = $u->journal_base . "/read/" . $GET{name}; } return JSON::objToJson( \%ret ); --------------------------------------------------------------------------------