refactor: move some tpls to core

This commit is contained in:
Barış Soner Uşaklı
2022-11-11 13:12:43 -05:00
parent 5c220d928b
commit 39434061a9
10 changed files with 321 additions and 0 deletions

7
src/views/confirm.tpl Normal file
View File

@@ -0,0 +1,7 @@
<div class="alert alert-success">
<strong>[[notifications:email-confirmed]]</strong>
<p>[[notifications:email-confirmed-message]]</p>
<p>
<a href="{config.relative_path}/">[[notifications:back_to_home, {config.siteTitle}]]</a>
</p>
</div>

View File

@@ -0,0 +1,58 @@
<!-- IMPORT partials/breadcrumbs.tpl -->
<div class="row ip-blacklist">
<div class="col-lg-12">
<p class="lead">
[[ip-blacklist:lead]]
</p>
<p>
[[ip-blacklist:description]]
</p>
<div class="row">
<div class="col-sm-6 d-flex flex-column">
<div class="card mb-3 flex-grow-1">
<div class="card-header">[[ip-blacklist:active-rules]]</div>
<div class="card-body d-flex flex-column">
<textarea id="blacklist-rules" class="flex-grow-1 mb-3 w-100 d-block border px-2 py-1">{rules}</textarea>
<div>
<button type="button" class="btn btn-warning" data-action="test">
<i class="fa fa-bomb"></i> [[ip-blacklist:validate]]
</button>
<button type="button" class="btn btn-primary" data-action="apply">
<i class="fa fa-save"></i> [[ip-blacklist:apply]]
</button>
</div>
</div>
</div>
<div class="card flex-shrink-1">
<div class="card-header">[[ip-blacklist:hints]]</div>
<div class="card-body">
<p>
[[ip-blacklist:hint-1]]
</p>
<p>
[[ip-blacklist:hint-2]]
</p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-body">
<div><canvas id="blacklist:hourly" height="250"></canvas></div>
</div>
<div class="card-footer"><small>[[ip-blacklist:analytics.blacklist-hourly]]</small></div>
</div>
<div class="card">
<div class="card-body">
<div><canvas id="blacklist:daily" height="250"></canvas></div>
</div>
<div class="card-footer"><small>[[ip-blacklist:analytics.blacklist-daily]]</small></div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<div component="topic/deleted/message" class="alert alert-warning{{{ if !deleted }}} hidden{{{ end }}} clearfix">
<span class="float-start">[[topic:deleted_message]]</span>
<span class="float-end">
{{{ if deleter }}}
<a href="{config.relative_path}/user/{deleter.userslug}">
<strong>{deleter.username}</strong>
</a>
<small class="timeago" title="{deletedTimestampISO}"></small>
{{{ end }}}
</span>
</div>

View File

@@ -0,0 +1,9 @@
<div component="topic/merged/message" class="alert alert-warning clearfix">
<span class="float-start">[[topic:merged_message, {config.relative_path}/topic/{mergeIntoTid}, {merger.mergedIntoTitle}]]</span>
<span class="float-end">
<a href="{config.relative_path}/user/{merger.userslug}">
<strong>{merger.username}</strong>
</a>
<small class="timeago" title="{mergedTimestampISO}"></small>
</span>
</div>

108
src/views/post-queue.tpl Normal file
View File

@@ -0,0 +1,108 @@
<!-- IMPORT partials/breadcrumbs.tpl -->
<div class="btn-toolbar justify-content-end">
<div class="me-2">
<!-- IMPORT partials/category-filter-right.tpl -->
</div>
{{{ if !singlePost }}}
<div class="btn-group bottom-sheet" component="post-queue/bulk-actions">
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" autocomplete="off" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-clone"></i> [[post-queue:bulk-actions]] <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="#" data-action="accept-all">[[post-queue:accept-all]]</a></li>
<li><a class="dropdown-item" href="#" data-action="accept-selected">[[post-queue:accept-selected]]</a></li>
<li class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#" data-action="reject-all">[[post-queue:reject-all]]</a></li>
<li><a class="dropdown-item" href="#" data-action="reject-selected">[[post-queue:reject-selected]]</a></li>
</ul>
</div>
{{{ end }}}
</div>
<hr/>
<div class="row">
<div class="col-12">
<div class="post-queue preventSlideout posts-list">
{{{ if !posts.length }}}
{{{ if isAdmin }}}
<div class="card card-body">
<p>
[[post-queue:description, {config.relative_path}/admin/settings/post#post-queue]]
</p>
</div>
{{{ end }}}
{{{ end }}}
{{{ each posts }}}
<div class="card mb-3" data-id="{posts.id}">
<div class="card-header">
{{{ if !singlePost }}}
<input type="checkbox" class="form-check-input" autocomplete="off" />
{{{ end }}}
<strong>{{{ if posts.data.tid }}}[[post-queue:reply]]{{{ else }}}[[post-queue:topic]]{{{ end }}}</strong>
<span class="timeago float-end" title={posts.data.timestampISO}></span>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-2 col-12">
<strong>[[post-queue:user]]</strong>
<div>
{{{ if posts.user.userslug}}}
<a href="{config.relative_path}/uid/{posts.user.uid}">{buildAvatar(posts.user, "24px", true, "not-responsive")} {posts.user.username}</a>
{{{ else }}}
{posts.user.username}
{{{ end }}}
</div>
</div>
<div class="col-lg-3 col-12">
<strong>[[post-queue:category]]{{{ if posts.data.cid}}} <i class="fa fa-fw fa-edit" data-bs-toggle="tooltip" title="[[post-queue:category-editable]]"></i>{{{ end }}}</strong>
<div class="topic-category" {{{if posts.data.cid}}}data-editable="editable"{{{end}}}">
<a href="{config.relative_path}/category/{posts.category.slug}">
<div class="category-item d-inline-block">
{buildCategoryIcon(./category, "24px", "rounded-circle")}
{posts.category.name}
</div>
</a>
</div>
</div>
<div class="col-lg-7 col-12">
<strong>{{{ if posts.data.tid }}}[[post-queue:topic]]{{{ else }}}[[post-queue:title]] <i class="fa fa-fw fa-edit" data-bs-toggle="tooltip" title="[[post-queue:title-editable]]"></i>{{{ end }}}</strong>
<div class="topic-title text-break">
{{{ if posts.data.tid }}}
<a href="{config.relative_path}/topic/{posts.data.tid}">{posts.topic.title}</a>
{{{ end }}}
<span class="title-text">{posts.data.title}</span>
</div>
{{{if !posts.data.tid}}}
<div class="topic-title-editable hidden">
<input class="form-control" type="text" value="{posts.data.title}"/>
</div>
{{{end}}}
</div>
</div>
<hr/>
<div>
<strong>[[post-queue:content]] <i class="fa fa-fw fa-edit" data-bs-toggle="tooltip" title="[[post-queue:content-editable]]"></i></strong>
<div class="post-content text-break">{posts.data.content}</div>
<div class="post-content-editable hidden">
<textarea class="form-control w-100" style="height:300px;">{posts.data.rawContent}</textarea>
</div>
</div>
</div>
<div class="card-footer text-end">
<div>
{{{ if canAccept }}}
<button class="btn btn-danger btn-sm" data-action="reject"><i class="fa fa-fw fa-times"></i> [[post-queue:reject]]</button>
<button class="btn btn-info btn-sm" data-action="notify"><i class="fa fa-fw fa-bell-o"></i> [[post-queue:notify]]</button>
<button class="btn btn-success btn-sm" data-action="accept"><i class="fa fa-fw fa-check"></i> [[post-queue:accept]] </button>
{{{ else }}}
<button class="btn btn-danger btn-sm" data-action="reject"><i class="fa fa-fw fa-times"></i> [[post-queue:remove]]</button>
{{{ end }}}
</div>
</div>
</div>
{{{ end }}}
</div>
<!-- IMPORT partials/paginator.tpl -->
</div>
</div>

View File

@@ -0,0 +1,43 @@
<!-- IMPORT partials/breadcrumbs.tpl -->
<div class="row">
<div class="col-12 col-sm-8 offset-sm-2">
<p class="lead text-center">
{{{ if register }}}[[register:interstitial.intro-new]]{{{ else }}}[[register:interstitial.intro]]{{{ end }}}
</p>
{{{ if errors.length }}}
<div class="alert alert-warning">
<p>
[[register:interstitial.errors-found]]
</p>
<ul>
{{{each errors}}}
<li>{@value}</li>
{{{end}}}
</ul>
</div>
{{{ end }}}
</div>
</div>
<form role="form" method="post" action="{config.relative_path}/register/complete/?_csrf={config.csrf_token}" enctype="multipart/form-data">
{{{each sections}}}
<div class="row">
<div class="col-12 col-sm-8 offset-sm-2">
<div class="card">
<div class="card-body">
{@value}
</div>
</div>
</div>
</div>
{{{end}}}
<div class="row mt-3">
<div class="col-12 col-sm-8 offset-sm-2 d-grid">
<button class="btn btn-primary">[[topic:composer.submit]]</button>
<button class="btn btn-link" formaction="{config.relative_path}/register/abort?_csrf={config.csrf_token}">{{{ if register }}}[[register:cancel_registration]]{{{ else }}}[[modules:bootbox.cancel]]{{{ end }}}</button>
</div>
</div>
</form>

24
src/views/reset.tpl Normal file
View File

@@ -0,0 +1,24 @@
<!-- IMPORT partials/breadcrumbs.tpl -->
<div class="alert alert-info">
[[reset_password:enter_email]]
</div>
<div class="card card-body bg-light">
<div class="alert alert-success alert-dismissible hide" id="success">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
[[reset_password:password_reset_sent]]
</div>
<div class="alert alert-danger alert-dismissible hide" id="error">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
[[reset_password:invalid_email]]
</div>
<form onsubmit="return false;">
<div class="mb-3">
<input type="email" class="form-control form-control-lg" id="email" placeholder="[[reset_password:enter_email_address]]" autocomplete="off">
</div>
<div class="d-grid">
<button class="btn btn-primary btn-lg" id="reset" type="submit">[[reset_password:reset_password]]</button>
</div>
</form>
</div>

42
src/views/reset_code.tpl Normal file
View File

@@ -0,0 +1,42 @@
<!-- IMPORT partials/breadcrumbs.tpl -->
{{{ if valid }}}
<div class="card card-body bg-light">
{{{ if displayExpiryNotice }}}
<div class="alert alert-warning">
[[reset_password:password_expired]]
</div>
{{{ end }}}
<div class="alert alert-success alert-dismissible hidden" id="success">
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
<strong>[[reset_password:password_changed.title]]</strong>
<p>[[reset_password:password_changed.message]]</p>
</div>
<div class="alert alert-warning hidden" id="notice">
<strong></strong>
<p></p>
</div>
<form onsubmit="return false;" id="reset-form" class="row">
<div class="col-sm-6">
<label class="form-label" for="password">[[reset_password:new_password]]</label>
<input class="form-control" type="password" placeholder="[[reset_password:new_password]]" id="password" /><br />
</div>
<div class="col-sm-6">
<label class="form-label" for="repeat">[[reset_password:repeat_password]]</label>
<input class="form-control" type="password" placeholder="[[reset_password:repeat_password]]" id="repeat" /><br />
</div>
<div class="col-12">
<button class="btn btn-primary btn-block" id="reset" type="submit">[[reset_password:reset_password]]</button>
</div>
</form>
</div>
{{{ else }}}
<div class="card bg-danger">
<h5 class="card-header">
[[reset_password:wrong_reset_code.title]]
</h5>
<div class="card-body">
<p>[[reset_password:wrong_reset_code.message]]</p>
</div>
</div>
{{{ end }}}

4
src/views/tos.tpl Normal file
View File

@@ -0,0 +1,4 @@
<h3>[[register:terms_of_use]]</h3>
<hr/>
{termsOfUse}

15
src/views/unsubscribe.tpl Normal file
View File

@@ -0,0 +1,15 @@
{{{ if !error }}}
<div class="alert alert-success">
<strong>[[global:alert.success]]</strong>
<p>[[email:unsub.success, {payload.template}]]</p>
{{{ else }}}
<div class="alert alert-warning">
<strong>[[email:unsub.failure.title]]</strong>
<p>[[email:unsub.failure.message, {error}, {config.relative_path}/me/settings]]</p>
{{{ end }}}
<hr />
<p>
<a href="{config.relative_path}/">[[notifications:back_to_home, {config.siteTitle}]]</a>
</p>
</div>