Dev.SN
Dev.SN ♥ developers
https://dev.soylentnews.org/

Title    On Toggling the Visibility of Subscriptions
Date    Thursday April 09 2020, @04:37PM
Author    martyb
Topic   
from the dept.
https://dev.soylentnews.org/article.pl?sid=20/04/09/2037216

martyb writes:

Loading the recent_subs page currently shows all subscriptions. Here is the template(default;admin;recent_subs) before making any changes.

NOTE: Slashcode converts tabs and runs of spaces into something like: "       "

[% PROCESS titlebar title="Recent Subscription Payments" %]
<div class="generalbody">
[% IF startat > 0;
    next_startat = startat - 30;
    IF next_startat < 0; next_startat = 0; END; %]
    <form action="[% gSkin.rootdir %]/admin.pl" method="get">
    <input type="hidden" name="op" value="recent_subs">
    <input type="hidden" name="startat" value="[% next_startat | strip_attribute %]">
    <input type="submit" value="<< Next Sub Payments">
    </form>
[% END %]

<table>
    <tr>
        <th>spid</th>
        <th>user</th>
        <th>email</th>
        <th>ts</th>
        <th>payment_net</th>
        <th>payment_gross</th>
        <th>pages</th>
        <th>trans_id</th>
        <th>method</th>
        <th>submethod</th>
    </tr>

    [% FOREACH sub = subs %]
    <tr>
        <td align="right">[% sub.spid %]</td>
        <td align="left"><a href="[% constants.real_rootdir
            %]/~[% sub.nickname | fixnickforlink | strip_paramattr %]">[%
            sub.nickname | strip_literal %] ([% sub.uid %])</a></td>
        <td align="left">[% sub.email | strip_literal %]</td>
        <td align="left">[% sub.ts | strip_literal %]</td>
        <td align="right" class="subs_net">[% sub.payment_net | strip_literal %]</td>
        <td align="right">[% sub.payment_gross | strip_literal %]</td>
        <td align="right">[% sub.pages | strip_literal %]</td>
        <td align="left">[% sub.transaction_id | strip_literal %]</td>
        <td align="left">[% sub.method | strip_literal %]</td>
        <td align="left">[% sub.submethod | strip_literal %]</td>
    </tr>
    [% END %]

</table>

[% prev_startat = startat + 30; %]
<form action="[% gSkin.rootdir %]/admin.pl" method="get">
<input type="hidden" name="op" value="recent_subs">
<input type="hidden" name="startat" value="[% prev_startat | strip_attribute %]">
<input type="submit" value="Prev Sub Payments >>">
</form>
</div>

link.


Original Submission

Partial solution:

    [% PROCESS titlebar title="Recent Subscription Payments" %]
    <div class="generalbody">
    [% IF startat > 0;
        next_startat = startat - 30;
        IF next_startat < 0; next_startat = 0; END; %]
        <form action="[% gSkin.rootdir %]/admin.pl" method="get">
        <input type="hidden" name="op" value="recent_subs">
        <input type="hidden" name="startat" value="[% next_startat | strip_attribute %]">
        <input type="submit" value="<< Next Sub Payments">
        </form>
    [% END %]

    <!-- We'll need a checkbox to toggle visibility: -->
    <input type="checkbox" id="show_grant" name="show_grant" value="checked">

   <!-- And styles for each column;  (should be moved into default.css) ->
   <!-- NB: the "align=" tag attribute is deprecated. -->
   <style type="text/css">
      .spid:      { align:   right; }
      .nick:      { align:   left;  }
      .email:     { align:   left;  }
      .ts:        { align:   left;  }
      .net:       { align:   right; }
      .gross:     { align:   right; }
      .pages:     { align:   right; }
      .transid:   { align:   left;  }
      .method:    { align:   left;  }
      .submethod: { align:   left;  }

      .paid:      { display: table-row; }
      .grant:     { display: none; }
      .grant:     { display: table-row; }

<!-- Need code in here, I think, to make use of  -->
<!-- checkbox value to set the  style for .grant -->

   </style>

    <table>
        <thead>
        <tr>
            <th>spid</th>
            <th>user</th>
            <th>email</th>
            <th>ts</th>
            <th>payment_net</th>
            <th>payment_gross</th>
            <th>pages</th>
            <th>trans_id</th>
            <th>method</th>
            <th>submethod</th>
        </tr>
        </thead>

        <tbody>
        [% FOREACH sub = subs %]

    [% gross_amount [% sub.payment_gross | strip_literal %];
        [% IF gross_amount > 0 subscribe_type = "paid"; ELSE; subscribe_type = "grant"; END;%]
        <tr class="[% subscribe_type %]">
            <td class="spid">[% sub.spid %]</td>
            <td class="nick"><a href="[% constants.real_rootdir
                %]/~[% sub.nickname | fixnickforlink | strip_paramattr %]">[%
                sub.nickname | strip_literal %] ([% sub.uid %])</a></td>
            <td class="email">[% sub.email | strip_literal %]</td>
            <td class="ts">[% sub.ts | strip_literal %]</td>
            <td class="net">[% sub.payment_net | strip_literal %]</td>
            <td class="gross">[% sub.payment_gross | strip_literal %]</td>
            <td class="pages">[% sub.pages | strip_literal %]</td>
            <td class="transid">[% sub.transaction_id | strip_literal %]</td>
            <td class="method">[% sub.method | strip_literal %]</td>
            <td class="submethod">[% sub.submethod | strip_literal %]</td>
        </tr>
        [% END %]
        </tbody>

    </table>

    [% prev_startat = startat + 30; %]
    <form action="[% gSkin.rootdir %]/admin.pl" method="get">
    <input type="hidden" name="op" value="recent_subs">
    <input type="hidden" name="startat" value="[% prev_startat | strip_attribute %]">
    <input type="submit" value="Prev Sub Payments >>">
    </form>
    </div>

Links

  1. "martyb" - https://dev.soylentnews.org/~martyb/
  2. "link" - https://dev.soylentnews.org/admin.pl?op=recent_subs
  3. "Original Submission" - https://dev.soylentnews.org/submit.pl?op=viewsub&subid=110441

© Copyright 2022 - Soylent News, All Rights Reserved

printed from Dev.SN, On Toggling the Visibility of Subscriptions on 2022-06-30 03:38:14