zulip/static/templates/settings/linkifier_settings_admin.hbs

82 lines
3.7 KiB
Handlebars
Raw Normal View History

<div id="filter-settings" class="settings-section" data-name="filter-settings">
<div class="admin-table-wrapper">
<p>
{{#tr this}}
Configure regular expression patterns that will be
automatically linkified when used in Zulip message bodies or
topics. For example to automatically linkify commit IDs and
issue numbers (e.g. #123) to the corresponding items in a GitHub
project, you could use the following:
{{/tr}}
</p>
<ul>
<li>
<code>#(?P&lt;id&gt;[0-9]+)</code>
{{t "and" }}
<code>https://github.com/zulip/zulip/issues/%(id)s</code>
</li>
<li>
<code>(?P&lt;id&gt;[0-9a-f]{40})</code>
{{t "and" }}
<code>https://github.com/zulip/zulip/commit/%(id)s</code>
</li>
</ul>
<p>
{{#tr this}}
Or, to automatically linkify GitHub's <code>org/repo#1234</code> syntax:
{{/tr}}
</p>
<ul>
<li>
<code>(?P&lt;org&gt;[a-zA-Z0-9_-]+)/(?P&lt;repo&gt;[a-zA-Z0-9_-]+)#(?P&lt;id&gt;[0-9]+)</code>
{{t "and" }}
<code>https://github.com/%(org)s/%(repo)s/issues/%(id)s</code>
</li>
</ul>
<p>
{{#tr this}}
More details are available <a href="/help/add-a-custom-linkification-filter" target="_blank">in the Help Center article</a>.
{{/tr}}
</p>
{{#if is_admin}}
<form class="form-horizontal admin-filter-form">
<div class="add-new-filter-box grey-box">
<div class="new-filter-form wrapper">
<div class="settings-section-title new-filter-section-title">{{t "Add a new linkifier" }}</div>
<div class="alert" id="admin-filter-status"></div>
<div class="control-group">
<label for="filter_pattern" class="control-label">{{t "Pattern" }}</label>
<input type="text" id="filter_pattern" name="pattern" placeholder="#(?P<id>[0-9]+)" />
<div class="alert" id="admin-filter-pattern-status"></div>
</div>
<div class="control-group">
<label for="filter_format_string" class="control-label">{{t "URL format string" }}</label>
<input type="text" id="filter_format_string" name="url_format_string" placeholder="https://github.com/zulip/zulip/issues/%(id)s" />
<div class="alert" id="admin-filter-format-status"></div>
</div>
<button type="submit" class="button rounded sea-green">
{{t 'Add linkifier' }}
</button>
</div>
</div>
</form>
{{/if}}
<input type="text" class="search" placeholder="{{t 'Filter linkifiers' }}" aria-label="{{t 'Filter linkifiers' }}"/>
<div class="progressive-table-wrapper" data-simplebar>
<table class="table table-condensed table-striped wrapped-table admin_filters_table">
<thead>
<th class="active" data-sort="pattern">{{t "Pattern" }}</th>
<th data-sort="url">{{t "URL format string" }}</th>
{{#if is_admin}}
<th class="actions">{{t "Actions" }}</th>
{{/if}}
</thead>
<tbody id="admin_filters_table" {{#unless is_admin}}class="required-text" data-empty="{{t 'No linkifiers set.' }}"{{/unless}}></tbody>
</table>
</div>
</div>
</div>