mourningdove/views/tracking/subscribe-interface.tt

138 lines
4.9 KiB
Text
Raw Normal View History

2026-05-24 01:03:05 +00:00
[%# HTML fragment for the notification subscription interface
# converted from LJ::subscribe_interface in LJ/Web.pm
Authors:
Jen Griffin <kareila@livejournal.com>
Copyright (c) 2023 by Dreamwidth Studios, LLC.
This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself. For a copy of the license, please reference
'perldoc perlartistic' or 'perldoc perlgpl'.
-%]
[% dw.need_res( 'stc/esn.css', 'js/6alib/core.js', 'js/6alib/dom.js',
'js/6alib/checkallbutton.js', 'js/esn.js' ) %]
[% form.hidden( name = 'ntypeids', id = 'ntypeids', value = ntypeids ) %]
[% form.hidden( name = 'catids', id = 'catids', value = catids ) %]
[%- ui_notify = ".notify_me" | ml( sitenameabbrev = site.nameabbrev ) -%]
[%- table_style = settings_page ? 'style="clear: none;"' : '' -%]
<table class="Subscribe select-all" [% table_style %] cellpadding="0" cellspacing="0">
[% FOREACH cat IN catdata %]
<div class="CategoryRow-[% cat.catid %]">
[%- first_class = cat.catid == 0 ? " CategoryRowFirst" : "" -%]
[%- cat_title = ".category.${cat.title_key}" | ml -%]
<tr class="CategoryRow[% first_class %]" id="category-[% cat.title_key %]">
<td>
<span class="CategoryHeading">[% cat_title %]</span><br />
<span class="CategoryHeadingNote">[% ui_notify %]</span>
</td>
<td class="Caption">[% '.notify_me.by' | ml %]</td>
[% FOREACH cat.notify_headers %]
<td style='vertical-align: bottom;'>
[% form.checkbox( 'label' => title, 'class' => "CheckAll", 'disabled' => disabled,
'id' => "CheckAll-${cat.catid}-$ntypeid", 'noescape' => 1,
'data-select-all' => "${cat.catid}-$ntypeid", 'selected' => 0 ) %]
</td>
[% END %]
</tr>
[% FOREACH sub IN cat.pending_subs %]
[%- sub_classes = [ sub.inactive_class, sub.disabled_class, sub.altrow_class ] -%]
<tr class='[% sub_classes.join(" ") %]'>
[% IF sub.special_sub %]
<td>*[% sub.upgrade_notice %]</td>
<td>&nbsp;</td>
[% FOREACH class IN notify_classes %]
<td class='NotificationOptions'[% sub.hidden_style %]>
[% IF class != "LJ::NotificationMethod::Email" %]
[% form.checkbox( disabled = 1, selected = 0 ) %]
[% END %]
</td>
[% END %]
[% ELSIF sub.do_show %]
<td>
[% IF sub.subid %]
[%- deletesub_url = settings_page
? "${site.root}/manage/settings/?cat=notifications&"
: "?";
deletesub_url = deletesub_url _ "deletesub_${sub.subid}=1" -%]
<a href='[% deletesub_url %]' class='delete-button' subid=[% sub.subid %]
auth_token=[% sub.auth_token %]>[% dw.img( 'btn_trash', '' ) %]</a>
[% END %]
[% form.checkbox( name = sub.input_name, id = sub.input_name, label = sub.title,
selected = sub.selected, disabled = sub.disabled,
class = "SubscriptionInboxCheck", noescape = 1 ) %]
</td>
[% IF sub.subscribed %]
[% form.hidden( name = "${sub.input_name}-old", value = 1 ) %]
[% END %]
<td>&nbsp;</td>
[% FOREACH opt IN sub.notif_options %]
<td class='NotificationOptions' [% sub.hidden_style %]>
[% form.checkbox( 'name' => opt.notify_input_name, 'id' => opt.notify_input_name,
'selected' => opt.note_selected, 'disabled' => opt.disabled,
'class' => "SubscribeCheckbox-${cat.catid}-${opt.ntypeid}",
'data-selected-by' => "${cat.catid}-${opt.ntypeid}",
'noescape' => 1 ) %]
</td>
[% UNLESS opt.note_pending %]
[% form.hidden( 'data-selected-by' => "${cat.catid}-${opt.ntypeid}",
'name' => "${opt.notify_input_name}-old",
'value' => opt.has_subs ) %]
[% END %]
[% END %]
[% END %]
</tr>
[% END %]
[%- cols = 2 + notify_classes.size -%]
[% IF cat.empty_blurb;
track_img = dw.img( 'track', '', { align => 'absmiddle', alt => ui_notify } ) %]
<tr>
<td colspan='[% cols %]'>
<p>
<strong>[% '.nosubs.title' | ml %]</strong><br />
[% '.nosubs.text' | ml( img = track_img ) %]
</p>
</td>
</tr>
[% END %]
[% IF cat.special_subs %]
<tr>
<td colspan='[% cols %]' style='font-size: smaller;'>
* [% '.special_subs.note' | ml( sitenameabbrev = site.nameabbrev ) %]
</td>
</tr>
[% END %]
[% IF cat.show_upgrade_note %]
<tr>
<td colspan='[% cols %]' style='font-size: smaller;'>
&dagger; [% '.unavailable_subs.note' | ml %]
</td>
</tr>
[% END %]
</div>
[% END %]
</table>
[% IF settings_page %]
[% pagination %]
<div class='subscription_stats'>
[% '.subs.total' | ml( subscription_stats ) %]
</div>
[% END %]