1
0
Fork 0
forked from deblan/gist
gist/src/Gist/Resources/views/View/view.html.twig
2016-09-24 16:07:35 +02:00

90 lines
3.9 KiB
Twig

{% extends 'base.html.twig' %}
{% block css %}
{% if gist.cipher %}
<link type="text/css" rel="Stylesheet" href="{{ web_path }}components/SyntaxHighlighter/styles/shCoreRDark.css" />
<link type="text/css" rel="Stylesheet" href="{{ web_path }}components/SyntaxHighlighter/styles/shThemeRDark.css" />
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/geshi/vibrant-ink.css" />
{% endif %}
{{ parent() }}
{% endblock %}
{% block title %}{{ gist.title ? gist.title : 'gist.untitled'|trans }} - {{ commit|slice(0, 10) }}{% endblock %}
{% block body %}
<div class="row">
<div class="col-md-12">
<ul class="nav nav-tabs">
<li class="active">
<a href="{{ path('view', {gist: gist.file}) }}" class="cipher-link">
{{ 'gist.action.view'|trans }}
</a>
</li>
<li>
<a href="{{ path('revisions', {gist: gist.file}) }}" class="cipher-link">
{{ 'gist.action.history'|trans }}
<span class="badge">{{ history|length }}</span>
</a>
</li>
</ul>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right actions">
<span class="btn btn-warning btn-xs">
{{ commit|slice(0, 10) }}
</span>
{% if not gist.cipher %}
<a href="{{ path('raw', app.request.attributes.get('_route_params')) }}" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-eye-open"></span>
{{ 'gist.action.raw'|trans }}
</a>
<a href="{{ path('download', app.request.attributes.get('_route_params')) }}" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-save-file"></span>
{{ 'gist.action.download'|trans }}
</a>
{% endif %}
<a href="{{ path('clone', app.request.attributes.get('_route_params')) }}" class="btn btn-success btn-sm cipher-link">
<span class="glyphicon glyphicon-copy"></span>
{{ 'gist.action.clone'|trans }}
</a>
</div>
{{ gist.title ? gist.title : 'gist.untitled'|trans }}
</div>
<div class="panel-body">
<div class="tab-content">
<div id="view" class="tab-pane active in">
<div id="viewer">
{% if gist.cipher %}
<pre class="brush: {{ gist.type }}; syntaxhighlighter">{{ raw_content|raw }}</pre>
{% else %}
{{ content|raw }}
{% endif %}
</div>
<p id="embed" class="pull-right">
{{ 'gist.action.embed'|trans }}
<input type="text" class="form-control" id="embed-input" value="{{ '<div%key%id="gist-' ~ gist.file ~ '-' ~ commit ~ '" class="gist-container"></div><script src="' ~ app.request.getSchemeAndHttpHost() ~ path('embedjs', app.request.attributes.get('_route_params')) ~ '" async></script>' }}" />
</p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
{{ parent() }}
{% if gist.cipher %}
{{ include('View/cipherJs.html.twig') }}
{% endif %}
{% endblock %}