131 lines
7.9 KiB
HTML
131 lines
7.9 KiB
HTML
{if="empty($batch_mode)"}
|
|
<!DOCTYPE html>
|
|
<html{if="$language !== 'auto'"} lang="{$language}"{/if}>
|
|
<head>
|
|
{$pageName="editlink"}
|
|
{include="includes"}
|
|
</head>
|
|
<body {if="!empty($_GET['source']) && $_GET['source']=='bookmarklet'"}class="from-bookmarklet"{/if}>
|
|
{include="page.header"}
|
|
{else}
|
|
{ignore}Lil hack: when included in a loop in batch mode, `$value` is assigned by RainTPL with template vars.{/ignore}
|
|
{function="extract($value) ? '' : ''"}
|
|
{/if}
|
|
{$asyncLoadClass=$link_is_new && $async_metadata && empty($link.title) ? 'loading-wrapper loading-input' : ''}
|
|
{if="!isset($index)"}
|
|
{$index=""}
|
|
{/if}
|
|
{$batchModeValue=empty($batch_mode) ? '0' : '1'}
|
|
{$readLaterChecked=strpos(' ' . $link.tags . ' ', ' readlater ') != false || strpos(' ' . $link.tags . ' ', ' toread ') != false}
|
|
{$noteDefaultChecked=$link_is_new && empty($link.url)}
|
|
{$noteChecked=strpos(' ' . $link.tags . ' ', ' note ') != false || $noteDefaultChecked}
|
|
{$effectiveTags=$link.tags}
|
|
{if="$noteDefaultChecked && strpos(' ' . $effectiveTags . ' ', ' note ') == false"}
|
|
{$effectiveTags=trim($effectiveTags . ' note')}
|
|
{/if}
|
|
{$privateChecked=$link.private == true || $link_is_new}
|
|
<div id="editlinkform{$index}" class="editlinkform container page-edit">
|
|
<div class="row editlinkform-row">
|
|
<div class="col-md-6 col-md-offset-3 editlinkform-col">
|
|
<form method="post" name="linkform" class="card bookmark-editor-card bookmark-editor-form" action="{$base_path}/admin/shaare" data-batch-mode="{$batchModeValue}">
|
|
{if="isset($link.id)"}
|
|
<input type="hidden" name="lf_id" value="{$link.id}">
|
|
{/if}
|
|
<input type="hidden" name="token" value="{$token}">
|
|
<input type="hidden" name="source" value="{$source}">
|
|
{if="$http_referer"}
|
|
<input type="hidden" name="returnurl" value="{$http_referer}">
|
|
{/if}
|
|
|
|
<div class="card-header bookmark-editor-header">
|
|
<div class="bookmark-editor-title-wrap">
|
|
<h1 class="bookmark-editor-title">{if="!$link_is_new"}Edit Bookmark{else}New Bookmark{/if}</h1>
|
|
{if="!$link_is_new"}
|
|
<p class="bookmark-editor-meta">{'created on'|t} {$link.created|format_date}</p>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="form-group bookmark-field-group">
|
|
<label class="form-label" for="lf_url{$index}">{'URL'|t}</label>
|
|
<input type="text" class="form-control lf_input" name="lf_url" id="lf_url{$index}" value="{$link.url}" placeholder="https://...">
|
|
</div>
|
|
<div class="form-group bookmark-field-group">
|
|
<label class="form-label" for="lf_title{$index}">{'Title'|t}</label>
|
|
<div class="{$asyncLoadClass}">
|
|
<input type="text" class="form-control lf_input{if="empty($batch_mode) && $link.title==''"} autofocus{/if}" name="lf_title" id="lf_title{$index}" value="{$link.title}" placeholder="Page title">
|
|
<div class="icon-container"><i class="loader"></i></div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group bookmark-field-group">
|
|
<label class="form-label" for="lf_description{$index}">{'Description'|t} (Markdown)</label>
|
|
<div class="{if="$retrieve_description"}{$asyncLoadClass}{/if}">
|
|
<textarea class="form-control bookmark-editor-source{if="empty($batch_mode) && $link.description==''"} autofocus{/if}" name="lf_description" id="lf_description{$index}" placeholder="Add a description..." rows="6">{$link.description}</textarea>
|
|
<div id="lf_description_editor{$index}" class="bookmark-markdown-editor" aria-label="Markdown editor"></div>
|
|
<div class="icon-container"><i class="loader"></i></div>
|
|
</div>
|
|
{if="$formatter==='markdown'"}
|
|
<div class="sublabel bookmark-editor-sublabel">
|
|
{'Description will be rendered with'|t} <a href="http://daringfireball.net/projects/markdown/syntax" target="_blank" rel="noopener">{'Markdown syntax'|t}</a>.
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
<div class="form-group bookmark-field-group">
|
|
<label class="form-label" for="lf_tags{$index}">{'Tags'|t}</label>
|
|
<div class="{if="$retrieve_description"}{$asyncLoadClass}{/if}">
|
|
<input type="text" class="bookmark-tags-hidden-input" id="lf_tags{$index}" name="lf_tags" value="{$effectiveTags}" data-tag-options="{loop="$tags"}{$key},{/loop}" autocomplete="off" />
|
|
<div class="bookmark-tags-input" data-tags-container="lf_tags{$index}">
|
|
<div class="bookmark-tags-list" id="bookmark-tags-list{$index}"></div>
|
|
<input type="text" class="bookmark-tags-text-input" id="bookmark-tags-text{$index}" placeholder="Type a tag and press Enter or Space" autocomplete="off" />
|
|
</div>
|
|
<div class="icon-container"><i class="loader"></i></div>
|
|
</div>
|
|
</div>
|
|
|
|
{if="isset($edit_link_plugin)"}
|
|
{loop="$edit_link_plugin"}
|
|
{if="!strstr(strtolower($value), 'lf_readlater') && !strstr(strtolower($value), 'lf_private')"}
|
|
<div class="form-group">
|
|
{$value}
|
|
</div>
|
|
{/if}
|
|
{/loop}
|
|
{/if}
|
|
|
|
<div class="bookmark-toggle-grid">
|
|
<label class="bookmark-toggle-item" for="lf_readlater{$index}">
|
|
<input type="checkbox" id="lf_readlater{$index}" class="bookmark-toggle-readlater" {if="$readLaterChecked"}checked="checked"{/if}>
|
|
<span>{'Read it later'|t}</span>
|
|
</label>
|
|
<label class="bookmark-toggle-item" for="lf_note{$index}">
|
|
<input type="checkbox" id="lf_note{$index}" class="bookmark-toggle-note" {if="$noteChecked"}checked="checked"{/if}>
|
|
<span>Note</span>
|
|
</label>
|
|
<label class="bookmark-toggle-item" for="lf_private{$index}">
|
|
<input type="checkbox" {if="$privateChecked"}checked="checked"{/if} name="lf_private" id="lf_private{$index}" />
|
|
<span>{'Private'|t}</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer bookmark-editor-footer">
|
|
{if="!empty($batch_mode)"}
|
|
<button type="button" name="cancel-batch-link" class="btn btn-secondary">{'Cancel'|t}</button>
|
|
{/if}
|
|
{if="!$link_is_new"}
|
|
<a href="{$base_path}/admin/shaare/delete?id={$link.id}&token={$token}"
|
|
onclick="return confirm('Delete this bookmark?');"
|
|
class="btn btn-danger">{'Delete'|t}</a>
|
|
{/if}
|
|
<button type="submit" name="save_edit" class="btn btn-primary">{'Save'|t}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{if="empty($batch_mode)"}
|
|
{include="page.footer"}
|
|
{if="$link_is_new && $async_metadata"}<script src="{$base_path}/{function="ltrim($asset_path, '/')"}/js/metadata.min.js?v={$version_hash}"></script>{/if}
|
|
{/if}
|
|
</body>
|
|
</html>
|