109 lines
3.6 KiB
HTML
109 lines
3.6 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ doc.title() }}{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
{% if current_user.is_authenticated and doc.user == current_user %}
|
|
{% set title = doc.title_from_link() %}
|
|
<div class="modal fade" id="title-modal" tabindex="-1" role="dialog">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">set {{ doc.type }} title</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<form method="POST" action="{{ doc.set_title_url }}">
|
|
<div class="modal-body">
|
|
<label for="form-title">title</label>
|
|
{% if title %}
|
|
<input name="title" id="form-title" class="form-control" value="{{ title }}">
|
|
{% else %}
|
|
<input name="title" id="form-title" class="form-control">
|
|
{% endif %}
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
<button type="submit" class="btn btn-primary">{{ 'Edit' if title else 'Add' }} title</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<ul class="nav nav-tabs">
|
|
<li class="nav-item">
|
|
<a class="nav-link active" href="{{ doc.url }}">View</a>
|
|
</li>
|
|
{% if doc.type == 'xanadoc' %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ doc.url }}/fulfil">In view</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ doc.url }}/realize">Realize</a>
|
|
</li>
|
|
{% endif %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ doc.history_url }}">History</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ doc.edit_url }}">Edit</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ request.url }}/raw">Raw</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<h1 class="mt-3">{{ self.title() }}
|
|
{% if current_user.is_authenticated and doc.user == current_user %}
|
|
<button class="btn btn-primary" data-toggle="modal" data-target="#title-modal">{{ 'edit' if title else 'add' }} title</button>
|
|
{% endif %}
|
|
</h1>
|
|
{% if version %}
|
|
<p>Revision as of {{ version.modified.strftime('%H:%M, %d %B %Y') }}</p>
|
|
{% endif %}
|
|
|
|
<div class="card mb-2" id="text">
|
|
<div class="card-block">
|
|
{% if span_length %}
|
|
{%- for start, line in add_highlight(text, span_start, span_length) if line -%}
|
|
<p class="card-text" data-start="{{ start }}">
|
|
{% for i in line %}
|
|
{%- if i.highlight -%}
|
|
{%- if i.highlight != '\n' and i.highlight != '\r\n' -%}
|
|
<span class="highlight">{{- nbsp_at_start(i.highlight) -}}</span>
|
|
{%- endif -%}
|
|
{%- else -%}
|
|
{{- nbsp_at_start(i.text) -}}
|
|
{%- endif -%}
|
|
{% endfor %}
|
|
</p>
|
|
{%- endfor -%}
|
|
{% else %}
|
|
{%- for start, line in iter_lines(text) if line != '\r\n' -%}
|
|
{# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %} {% endif
|
|
%}</p>#}
|
|
<p data-start="{{ start }}">{{ nbsp_at_start(line) }}</p>
|
|
{%- endfor -%}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% if not version and doc.type == 'sourcedoc' and not span_length %}
|
|
<button id="show-span-selector" class="btn btn-primary">show span selector</button>
|
|
<button id="select-all" class="btn btn-primary">get entire document span</button>
|
|
<p id="span-selector" class="d-none">span: <span id="span"></span></p>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
var doc_url = '{{ doc.external_url }}';
|
|
var doc_length = {{ text | length }};
|
|
</script>
|
|
<script src="{{ url_for('static', filename='js/sourcedoc.js') }}"></script>
|
|
{% endblock %}
|