Update front end to display and edit toot digest settings

develop
mj-saunders 2018-05-26 10:31:35 +00:00
parent 22962f88c5
commit 9b84f30547
4 changed files with 47 additions and 0 deletions

View File

@ -63,6 +63,20 @@ sub fill_content {
}
}
if ($main::FORM{enabledigest} and "x".$main::FORM{enabledigest} eq "x".$feed->{data}->{ID}){
$feed->{data}->{digest_enabled} = 1;
$feed->save();
}
if ($main::FORM{disabledigest} and "x".$main::FORM{disabledigest} eq "x".$feed->{data}->{ID}){
$feed->{data}->{digest_enabled} = 0;
$feed->save();
}
if ($main::FORM{action} and "x".$main::FORM{action} eq "xsavedigest"){
$feed->{data}->{digest_limit} = $main::FORM{digestlimit};
$feed->{data}->{digest_signature} = $main::FORM{digestsig};
$feed->save();
}
my @param_entries;
my @filters = $feed->filters();
my $feeddata = $feed->fetch_entries();
@ -106,6 +120,10 @@ sub fill_content {
$output->param("url", $feed->{data}->{url});
$output->param("feed_id", $feed->{data}->{ID});
$output->param("format", $feed->{data}->{format});
$output->param("digestenabled", $feed->{data}->{digest_enabled});
$output->param("digestlimit", $feed->{data}->{digest_limit});
$output->param("digestsig", $feed->{data}->{digest_signature});
return 1;
}
sub prerender {

View File

@ -4,3 +4,8 @@
.red {
background-color: #FF8080;
}
#diglim {
font-family: Consolas, Lucida Console, monospace;
width: 3em;
}

View File

@ -67,4 +67,15 @@ function RSSTootalizerOnReady(){
for (i=0; i<filters.length; i++){
appendFilter(filters[i].ID, filters[i].field, filters[i].regex, filters[i].type, filters[i].match);
}
$("a.enabledigest").on("click", function(){
var btn = $(this);
var l = "index.pl?mode=EditFeed&id="+btn.data("id")+"&enabledigest="+btn.data("id");
document.location.href=l;
});
$("a.disabledigest").on("click", function(){
var btn = $(this);
var l = "index.pl?mode=EditFeed&id="+btn.data("id")+"&disabledigest="+btn.data("id");
document.location.href=l;
});
}

View File

@ -70,6 +70,19 @@
</div>
</form>
<form id="form_digest" method="POST">
<input type="hidden" name="action" value="savedigest">
<h3>Toot Digest</h3>
<div>
For highly active feeds you may want to toot multiple posts together rather than separately avoiding a flood.<br />
<i>To avoid repetition of 'Format' for each post within a digest, use the Signature field for information that should appear only once i.e. hashtags.</i><br />
<input type="text" id="diglim" maxlength=2 value="<TMPL_VAR NAME="digestlimit">" name="digestlimit"> posts will be combined into a digest.<br />
<input type="text" placeholder="Signed #RSSTootalizer" maxlength=100 value="<TMPL_VAR NAME="digestsig">" name="digestsig" class="btn-block"><br />
<input type="Submit" value="Save digest" class="btn btn-primary">
<TMPL_IF NAME="digestenabled"><a class="btn btn-danger disabledigest" data-id="<TMPL_VAR NAME="feed_id">" href="#">Disable</a><TMPL_ELSE><a class="btn btn-default enabledigest" data-id="<TMPL_VAR NAME="feed_id">" href="#">Enable</a></TMPL_IF><br />
</div>
</form>
</div>
</div>
</div>