Compare commits
22 commits
Author | SHA1 | Date | |
---|---|---|---|
Simon Vieille | c9fee1ea42 | ||
Simon Vieille | 196da8cb45 | ||
Simon Vieille | cb286ce704 | ||
Simon Vieille | 6d84cf319c | ||
Simon Vieille | e5f996705e | ||
Simon Vieille | 7c32234626 | ||
Simon Vieille | 7195609086 | ||
Simon Vieille | 3972513905 | ||
Simon Vieille | 0ff9d4a526 | ||
Simon Vieille | a8a3eadc71 | ||
Simon Vieille | f2e30bbd8f | ||
Simon Vieille | faab3c4252 | ||
Simon Vieille | f6136404c9 | ||
Simon Vieille | 426cf0e1f1 | ||
Simon Vieille | d67ac40e3d | ||
Simon Vieille | 4ee4311c1a | ||
Simon Vieille | 9eb8a73462 | ||
Simon Vieille | 7f77b92554 | ||
Simon Vieille | 0eb689b5dc | ||
Simon Vieille | 971812f2d8 | ||
Simon Vieille | fbac488f62 | ||
Simon Vieille | f36783b2ce |
26
ISSUE_TEMPLATE.md
Normal file
26
ISSUE_TEMPLATE.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
## Environment
|
||||
|
||||
* GIST version or GIT commit: ...
|
||||
* PHP Version: ...
|
||||
* GIT version. ...
|
||||
* HTTPD (Nginx, Apache2): ...
|
||||
* DBMS (MySQL, SQLite, PostgreSQL): ...
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
...
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
#### Observed Results
|
||||
|
||||
...
|
||||
|
||||
#### Expected Results
|
||||
|
||||
...
|
25
Makefile
25
Makefile
|
@ -3,39 +3,50 @@ NPM ?= npm
|
|||
GIT ?= git
|
||||
MKDIR ?= mkdir
|
||||
PHP ?= php
|
||||
RM ?= rm
|
||||
|
||||
all: update
|
||||
all: update clean-cache
|
||||
|
||||
composer:
|
||||
@echo "Installing PHP dependencies"
|
||||
@echo "---------------------------"
|
||||
@echo
|
||||
|
||||
$(COMPOSER) install $(COMPOSER_INSTALL_FLAGS)
|
||||
${COMPOSER} install
|
||||
|
||||
npm:
|
||||
@echo "Installing CSS/JS dependencies"
|
||||
@echo "------------------------------"
|
||||
@echo
|
||||
|
||||
$(NPM) install
|
||||
${NPM} install
|
||||
${NPM} update
|
||||
|
||||
update:
|
||||
@echo "Updating application's dependencies"
|
||||
@echo "-----------------------------------"
|
||||
@echo
|
||||
|
||||
$(GIT) pull origin master
|
||||
${GIT} pull origin master
|
||||
${MKDIR} -p data/git
|
||||
${MKDIR} -p data/cache
|
||||
$(COMPOSER) update
|
||||
$(NPM) install
|
||||
${COMPOSER} update
|
||||
${NPM} install
|
||||
${NPM} update
|
||||
|
||||
clean-cache:
|
||||
@echo "Removing cache"
|
||||
@echo "--------------"
|
||||
@echo
|
||||
|
||||
${RM} -fr cache/*
|
||||
|
||||
run:
|
||||
@echo "Run development server"
|
||||
@echo "----------------------"
|
||||
@echo
|
||||
|
||||
$(PHP) -S 127.0.0.1:8080 -t web
|
||||
${PHP} -S 127.0.0.1:8080 -t web
|
||||
|
||||
propel:
|
||||
@echo "Propel migration"
|
||||
|
|
18
README.md
18
README.md
|
@ -4,8 +4,20 @@ GIST
|
|||
GIST is an open-source application to share code.
|
||||
https://www.deblan.io/post/517/gist-est-dans-la-place
|
||||
|
||||
[Read the wiki for more information](https://gitnet.fr/deblan/gist/wiki/_pages).
|
||||
**[Read the wiki for more information](https://gitnet.fr/deblan/gist/wiki/_pages).**
|
||||
|
||||
![Gist](https://upload.deblan.org/u/2015-11/565b93a5.png "Gist")
|
||||
### Editor
|
||||
|
||||
![Gist](https://upload.deblan.org/u/2016-06/57655dec.png "Gist")
|
||||
![Gist](https://upload.deblan.org/u/2018-08/5b7ab7a6.png "Gist editor")
|
||||
|
||||
### Result
|
||||
|
||||
![Gist](https://upload.deblan.org/u/2018-08/5b7ab7d4.png "Gist result")
|
||||
|
||||
### Account
|
||||
|
||||
![Gist](https://upload.deblan.org/u/2018-08/5b7aba2d.png "Gist account")
|
||||
|
||||
### Embeded Gist
|
||||
|
||||
![Gist](https://upload.deblan.org/u/2018-08/5b7ab81c.png "Embeded Gist")
|
||||
|
|
|
@ -44,7 +44,7 @@ date:
|
|||
format: 'Y-m-d h:i:s'
|
||||
|
||||
footer:
|
||||
text: '<p>Powered by <a href="https://gitnet.fr/deblan/gist">GIST</a>, it''s open source :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
|
||||
text: '<p>Powered by <a href="https://gitnet.fr/deblan/gist">GIST</a>, it''s open source :) - <a href="https://gitnet.fr/deblan/gist/wiki/1.4-API/">API</a></p>'
|
||||
|
||||
login:
|
||||
login:
|
||||
|
@ -98,6 +98,7 @@ form:
|
|||
php: 'PHP'
|
||||
sql: 'SQL'
|
||||
yaml: 'YAML'
|
||||
markdown: 'MARKDOWN'
|
||||
perl: 'PERL'
|
||||
c: 'C/C++'
|
||||
asp: 'ASP'
|
||||
|
|
|
@ -44,7 +44,7 @@ date:
|
|||
format: 'Y-m-d h:i:s'
|
||||
|
||||
footer:
|
||||
text: '<p>Powered by <a href="https://gitnet.fr/deblan/gist">GIST</a>, it''s open source :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
|
||||
text: '<p>Powered by <a href="https://gitnet.fr/deblan/gist">GIST</a>, it''s open source :) - <a href="https://gitnet.fr/deblan/gist/wiki/1.4-API/">API</a></p>'
|
||||
|
||||
login:
|
||||
login:
|
||||
|
@ -98,6 +98,7 @@ form:
|
|||
php: 'PHP'
|
||||
sql: 'SQL'
|
||||
yaml: 'YAML'
|
||||
markdown: 'MARKDOWN'
|
||||
perl: 'PERL'
|
||||
c: 'C/C++'
|
||||
asp: 'ASP'
|
||||
|
|
|
@ -45,7 +45,7 @@ date:
|
|||
format: 'Y-m-d h:i:s'
|
||||
|
||||
footer:
|
||||
text: '<p>Powered by <a href="https://gitnet.fr/deblan/gist">GIST</a>, it''s open source :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
|
||||
text: '<p>Powered by <a href="https://gitnet.fr/deblan/gist">GIST</a>, it''s open source :) - <a href="https://gitnet.fr/deblan/gist/wiki/1.4-API/">API</a></p>'
|
||||
|
||||
login:
|
||||
login:
|
||||
|
@ -99,6 +99,7 @@ form:
|
|||
php: 'PHP'
|
||||
sql: 'SQL'
|
||||
yaml: 'YAML'
|
||||
markdown: 'MARKDOWN'
|
||||
perl: 'PERL'
|
||||
c: 'C/C++'
|
||||
asp: 'ASP'
|
||||
|
|
|
@ -44,7 +44,7 @@ date:
|
|||
format: 'd/m/Y H\hi s\s'
|
||||
|
||||
footer:
|
||||
text: '<p>Impulsado por <a href="https://gitnet.fr/deblan/gist">GIST</a>, es libre :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
|
||||
text: '<p>Impulsado por <a href="https://gitnet.fr/deblan/gist">GIST</a>, es libre :) - <a href="https://gitnet.fr/deblan/gist/wiki/1.4-API/">API</a></p>'
|
||||
|
||||
login:
|
||||
login:
|
||||
|
@ -98,6 +98,7 @@ form:
|
|||
php: 'PHP'
|
||||
sql: 'SQL'
|
||||
yaml: 'YAML'
|
||||
markdown: 'MARKDOWN'
|
||||
perl: 'PERL'
|
||||
c: 'C/C++'
|
||||
asp: 'ASP'
|
||||
|
|
|
@ -44,7 +44,7 @@ date:
|
|||
format: 'd/m/Y H\hi s\s'
|
||||
|
||||
footer:
|
||||
text: '<p>Propulsé par <a href="https://gitnet.fr/deblan/gist">GIST</a>, c''est libre :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
|
||||
text: '<p>Propulsé par <a href="https://gitnet.fr/deblan/gist">GIST</a>, c''est libre :) - <a href="https://gitnet.fr/deblan/gist/wiki/1.4-API/">API</a></p>'
|
||||
|
||||
login:
|
||||
login:
|
||||
|
@ -98,6 +98,7 @@ form:
|
|||
php: 'PHP'
|
||||
sql: 'SQL'
|
||||
yaml: 'YAML'
|
||||
markdown: 'MARKDOWN'
|
||||
perl: 'PERL'
|
||||
c: 'C/C++'
|
||||
asp: 'ASP'
|
||||
|
|
|
@ -45,7 +45,7 @@ date:
|
|||
format: 'Y-m-d h:i:s'
|
||||
|
||||
footer:
|
||||
text: '<p>Napędzane przez <a href="https://gitnet.fr/deblan/gist">GIST</a>, to jest open source :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
|
||||
text: '<p>Napędzane przez <a href="https://gitnet.fr/deblan/gist">GIST</a>, to jest open source :) - <a href="https://gitnet.fr/deblan/gist/wiki/1.4-API/">API</a></p>'
|
||||
|
||||
login:
|
||||
login:
|
||||
|
@ -99,6 +99,7 @@ form:
|
|||
php: 'PHP'
|
||||
sql: 'SQL'
|
||||
yaml: 'YAML'
|
||||
markdown: 'MARKDOWN'
|
||||
perl: 'PERL'
|
||||
c: 'C/C++'
|
||||
asp: 'ASP'
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"bootstrap": "^3.3.4",
|
||||
"diff": "^2.2.2",
|
||||
"bootstrap": "^3.4.1",
|
||||
"diff": "^3.5.0",
|
||||
"flag-icon-css": "^0.8.6",
|
||||
"iframe-resizer": "^2.8.6",
|
||||
"jquery": "^1.9.1"
|
||||
"iframe-resizer": "^2.8.10",
|
||||
"jquery": ">=3.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,27 @@ abstract class Controller
|
|||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $types = [
|
||||
'html',
|
||||
'css',
|
||||
'javascript',
|
||||
'php',
|
||||
'sql',
|
||||
'xml',
|
||||
'yaml',
|
||||
'markdown',
|
||||
'perl',
|
||||
'c',
|
||||
'asp',
|
||||
'python',
|
||||
'bash',
|
||||
'actionscript3',
|
||||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* __construct.
|
||||
*
|
||||
|
@ -88,6 +109,7 @@ abstract class Controller
|
|||
return array(
|
||||
'gist' => $gist,
|
||||
'type' => $gist->getType(),
|
||||
'types' => $this->types,
|
||||
'history' => $history,
|
||||
'commit' => $commit,
|
||||
'raw_content' => $content,
|
||||
|
@ -196,8 +218,13 @@ abstract class Controller
|
|||
|
||||
if (empty($params['no_cache'])) {
|
||||
$ttl = 3600 * 24 * 7;
|
||||
$etag = sha1($response->getContent());
|
||||
|
||||
$response->setTtl($ttl);
|
||||
$response->setClientTtl($ttl);
|
||||
$response->setExpires(new \DateTime('now +7 days'));
|
||||
$response->setLastModified(new \DateTime('now'));
|
||||
$response->setEtag($etag, true);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
|
|
@ -60,6 +60,7 @@ class EditController extends Controller
|
|||
array(
|
||||
'gist' => isset($gist) ? $gist : null,
|
||||
'form' => $form->createView(),
|
||||
'no_cache' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -109,6 +110,7 @@ class EditController extends Controller
|
|||
}
|
||||
|
||||
$viewOptions['form'] = $form->createView();
|
||||
$viewOptions['no_cache'] = true;
|
||||
|
||||
return $this->createResponse('Edit/clone.html.twig', $viewOptions);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ class LoginController extends Controller
|
|||
'form' => $form->createView(),
|
||||
'error' => isset($error) ? $error : '',
|
||||
'success' => isset($success) ? $success : '',
|
||||
'no_cache' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -102,6 +103,7 @@ class LoginController extends Controller
|
|||
[
|
||||
'form' => $form->createView(),
|
||||
'error' => isset($error) ? $error : '',
|
||||
'no_cache' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ class MyController extends Controller
|
|||
'filterForm' => $filterForm->createView(),
|
||||
'passwordForm' => $passwordForm->createView(),
|
||||
'deleted' => !empty($deleted),
|
||||
'no_cache' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,17 @@ class ViewController extends Controller
|
|||
$viewOptions = $this->getViewOptions($request, $gist, $commit);
|
||||
|
||||
if (is_array($viewOptions)) {
|
||||
if ($request->query->has('type')) {
|
||||
$type = $request->query->get('type');
|
||||
|
||||
if (in_array($type, $this->types)) {
|
||||
$viewOptions['gist']->setType($type);
|
||||
$viewOptions['type_overrided'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$viewOptions['no_cache'] = true;
|
||||
|
||||
return $this->createResponse('View/view.html.twig', $viewOptions);
|
||||
} else {
|
||||
return $this->notFoundResponse();
|
||||
|
@ -53,6 +64,15 @@ class ViewController extends Controller
|
|||
$viewOptions = $this->getViewOptions($request, $gist, $commit);
|
||||
|
||||
if (is_array($viewOptions)) {
|
||||
if ($request->query->has('type')) {
|
||||
$type = $request->query->get('type');
|
||||
|
||||
if (in_array($type, $this->types)) {
|
||||
$viewOptions['gist']->setType($type);
|
||||
$viewOptions['type_overrided'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->createResponse('View/embed.html.twig', $viewOptions);
|
||||
} else {
|
||||
return $this->notFoundResponse();
|
||||
|
@ -72,13 +92,19 @@ class ViewController extends Controller
|
|||
{
|
||||
$viewOptions = $this->getViewOptions($request, $gist, $commit);
|
||||
|
||||
return new Response(
|
||||
$this->render('View/embedJs.html.twig', $viewOptions),
|
||||
200,
|
||||
array(
|
||||
'Content-Type' => 'text/javascript',
|
||||
)
|
||||
);
|
||||
if ($request->query->has('type')) {
|
||||
$type = $request->query->get('type');
|
||||
|
||||
if (in_array($type, $this->types)) {
|
||||
$viewOptions['gist']->setType($type);
|
||||
$viewOptions['type_overrided'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$response = $this->createResponse('View/embedJs.html.twig', $viewOptions);
|
||||
$response->headers->set('Content-Type', 'text/javascript');
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -97,6 +97,7 @@ class CreateGistForm extends AbstractForm
|
|||
'sql' => '',
|
||||
'xml' => '',
|
||||
'yaml' => '',
|
||||
'markdown' => '',
|
||||
'perl' => '',
|
||||
'c' => '',
|
||||
'asp' => '',
|
||||
|
|
|
@ -75,6 +75,7 @@ class Gist extends BaseGist
|
|||
'bash' => 'sh',
|
||||
'actionscript3' => 'as',
|
||||
'text' => 'txt',
|
||||
'markdown' => 'md',
|
||||
);
|
||||
|
||||
return str_replace(array_keys($data), array_values($data), $this->getType());
|
||||
|
|
|
@ -31,6 +31,12 @@
|
|||
{% block nav %}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% set routeParams = app.request.attributes.get('_route_params') %}
|
||||
|
||||
{% if type_overrided is defined %}
|
||||
{% set routeParams = routeParams|merge({type: gist.type}) %}
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="embed">
|
||||
<div class="panel panel-default">
|
||||
|
@ -47,7 +53,7 @@
|
|||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li>
|
||||
<a target="_blank" href="{{ path('view', app.request.attributes.get('_route_params')) }}" class="cipher-link">
|
||||
<a target="_blank" href="{{ path('view', routeParams) }}" class="cipher-link">
|
||||
<span class="btn btn-warning btn-xs">
|
||||
{{ commit|slice(0, 10) }}
|
||||
</span>
|
||||
|
@ -55,18 +61,18 @@
|
|||
</li>
|
||||
{% if not gist.cipher %}
|
||||
<li>
|
||||
<a href="{{ path('raw', app.request.attributes.get('_route_params')) }}">
|
||||
<a target="_blank" href="{{ path('raw', routeParams) }}">
|
||||
{{ 'gist.action.raw'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('download', app.request.attributes.get('_route_params')) }}">
|
||||
<a target="_blank" href="{{ path('download', routeParams) }}">
|
||||
{{ 'gist.action.download'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{{ path('clone', app.request.attributes.get('_route_params')) }}" class="cipher-link">
|
||||
<a target="_blank" href="{{ path('clone', routeParams) }}" class="cipher-link">
|
||||
{{ 'gist.action.clone'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -75,20 +81,20 @@
|
|||
</div>
|
||||
<div class="visible-md visible-lg">
|
||||
<div class="text-right actions">
|
||||
<a target="_blank" href="{{ path('view', app.request.attributes.get('_route_params')) }}" class="cipher-link"><span class="btn btn-warning btn-xs">{{ commit|slice(0, 10) }}</span></a>
|
||||
<a target="_blank" href="{{ path('view', routeParams) }}" class="cipher-link"><span class="btn btn-warning btn-xs">{{ commit|slice(0, 10) }}</span></a>
|
||||
|
||||
{% if not gist.cipher %}
|
||||
<a href="{{ path('raw', app.request.attributes.get('_route_params')) }}" class="btn btn-default btn-sm">
|
||||
<a target="_blank" href="{{ path('raw', routeParams) }}" 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">
|
||||
<a target="_blank" href="{{ path('download', routeParams) }}" 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">
|
||||
<a target="_blank" href="{{ path('clone', routeParams) }}" class="btn btn-success btn-sm cipher-link">
|
||||
<span class="glyphicon glyphicon-copy"></span>
|
||||
{{ 'gist.action.clone'|trans }}
|
||||
</a>
|
||||
|
@ -101,7 +107,7 @@
|
|||
<div class="tab-content">
|
||||
<div id="view" class="tab-pane active in">
|
||||
<div id="viewer">
|
||||
<pre><code {% if gist.cipher %}data-cipher{% endif %} class="language-{{ gist.highlightType }}">{{ raw_content }}</code></pre>
|
||||
<pre><code {% if gist.cipher %}data-cipher{% endif %} class="line-numbers language-{{ gist.highlightType }}">{{ raw_content }}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
{% set routeParams = app.request.attributes.get('_route_params') %}
|
||||
|
||||
{% if type_overrided is defined %}
|
||||
{% set routeParams = routeParams|merge({type: gist.type}) %}
|
||||
{% endif %}
|
||||
|
||||
(function() {
|
||||
var iFrameResizeLoaded = function() {
|
||||
var div = document.getElementById('gist-{{ gist.file }}-{{ commit }}');
|
||||
var iframeId = 'gist-' + (Math.floor(Math.random() * (10000 - 1)) + 1).toString();
|
||||
var iframe = document.createElement('iframe');
|
||||
var url = '{{ app.request.getSchemeAndHttpHost() ~ path('embed', app.request.attributes.get('_route_params')) }}';
|
||||
var url = '{{ app.request.getSchemeAndHttpHost() ~ path('embed', routeParams) }}';
|
||||
|
||||
if (div.getAttribute('data-key')) {
|
||||
url = [url, div.getAttribute('data-key')].join('');
|
||||
|
|
|
@ -15,6 +15,12 @@
|
|||
{% block title %}{{ gist.title ? gist.title : 'gist.untitled'|trans }} - {{ commit|slice(0, 10) }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% set routeParams = app.request.attributes.get('_route_params') %}
|
||||
|
||||
{% if type_overrided is defined %}
|
||||
{% set routeParams = routeParams|merge({type: gist.type}) %}
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="nav nav-tabs">
|
||||
|
@ -45,7 +51,7 @@
|
|||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li>
|
||||
<a target="_blank" href="{{ path('view', app.request.attributes.get('_route_params')) }}" class="cipher-link">
|
||||
<a target="_blank" href="{{ path('view', routeParams) }}" class="cipher-link">
|
||||
<span class="btn btn-warning btn-xs">
|
||||
{{ commit|slice(0, 10) }}
|
||||
</span>
|
||||
|
@ -53,18 +59,18 @@
|
|||
</li>
|
||||
{% if not gist.cipher %}
|
||||
<li>
|
||||
<a href="{{ path('raw', app.request.attributes.get('_route_params')) }}">
|
||||
<a href="{{ path('raw', routeParams) }}">
|
||||
{{ 'gist.action.raw'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('download', app.request.attributes.get('_route_params')) }}">
|
||||
<a href="{{ path('download', routeParams) }}">
|
||||
{{ 'gist.action.download'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{{ path('clone', app.request.attributes.get('_route_params')) }}" class="cipher-link">
|
||||
<a href="{{ path('clone', routeParams) }}" class="cipher-link">
|
||||
{{ 'gist.action.clone'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -78,17 +84,17 @@
|
|||
</span>
|
||||
|
||||
{% if not gist.cipher %}
|
||||
<a href="{{ path('raw', app.request.attributes.get('_route_params')) }}" class="btn btn-default btn-sm">
|
||||
<a href="{{ path('raw', routeParams) }}" 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">
|
||||
<a href="{{ path('download', routeParams) }}" 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">
|
||||
<a href="{{ path('clone', routeParams) }}" class="btn btn-success btn-sm cipher-link">
|
||||
<span class="glyphicon glyphicon-copy"></span>
|
||||
{{ 'gist.action.clone'|trans }}
|
||||
</a>
|
||||
|
@ -101,7 +107,34 @@
|
|||
<div class="tab-content">
|
||||
<div id="view" class="tab-pane active in">
|
||||
<div id="viewer">
|
||||
<pre><code {% if gist.cipher %}data-cipher{% endif %} class="language-{{ gist.highlightType }}">{{ raw_content }}</code></pre>
|
||||
<pre><code {% if gist.cipher %}data-cipher{% endif %} class="line-numbers language-{{ gist.highlightType }}">{{ raw_content }}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-toolbar">
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
{{ ('form.type.choice.' ~ gist.type)|trans }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
{% for item in types %}
|
||||
{% if gist.type != item %}
|
||||
<li>
|
||||
{% set params = app.request.attributes.get('_route_params')|merge({type: item}) %}
|
||||
|
||||
<a href="{{ path('view', params) }}">
|
||||
<label for="type-{{ loop.index }}">
|
||||
{{ ('form.type.choice.' ~ item)|trans }}
|
||||
</label>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -115,7 +148,7 @@
|
|||
<div class="tab-content">
|
||||
<div class="tab-pane active in">
|
||||
<pre><code class="language-html">{{ '<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>' }}</code></pre>
|
||||
<script src="' ~ app.request.getSchemeAndHttpHost() ~ path('embedjs', routeParams) ~ '" async></script>' }}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
return key;
|
||||
}
|
||||
</script>
|
||||
<script src="{{ web_path }}components/jquery/jquery.min.js"></script>
|
||||
<script src="{{ web_path }}components/jquery/dist/jquery.min.js"></script>
|
||||
<script src="{{ web_path }}components/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<script src="{{ web_path }}app/js/cipher.js"></script>
|
||||
<script src="{{ web_path }}app/js/app.js"></script>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+actionscript+c+aspnet+bash+cpp+csharp+css-extras+diff+perl+php+php-extras+python+sql+yaml&plugins=line-highlight+line-numbers+autolinker+previewer-base+previewer-color+previewer-gradient+previewer-easing+previewer-time+previewer-angle */
|
||||
/* PrismJS 1.15.0
|
||||
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+actionscript+c+csharp+bash+cpp+aspnet+css-extras+diff+markup-templating+markdown+perl+php+php-extras+sql+python+yaml&plugins=line-highlight+line-numbers */
|
||||
/**
|
||||
* prism.js default theme for JavaScript, CSS and HTML
|
||||
* Based on dabblet (http://dabblet.com)
|
||||
|
@ -105,7 +106,7 @@ pre[class*="language-"] {
|
|||
.token.url,
|
||||
.language-css .token.string,
|
||||
.style .token.string {
|
||||
color: #a67f59;
|
||||
color: #9a6e3a;
|
||||
background: hsla(0, 0%, 100%, .5);
|
||||
}
|
||||
|
||||
|
@ -115,7 +116,8 @@ pre[class*="language-"] {
|
|||
color: #07a;
|
||||
}
|
||||
|
||||
.token.function {
|
||||
.token.function,
|
||||
.token.class-name {
|
||||
color: #DD4A68;
|
||||
}
|
||||
|
||||
|
@ -182,13 +184,18 @@ pre[data-line] {
|
|||
bottom: .4em;
|
||||
}
|
||||
|
||||
pre.line-numbers {
|
||||
.line-numbers .line-highlight:before,
|
||||
.line-numbers .line-highlight:after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
pre[class*="language-"].line-numbers {
|
||||
position: relative;
|
||||
padding-left: 3.8em;
|
||||
counter-reset: linenumber;
|
||||
}
|
||||
|
||||
pre.line-numbers > code {
|
||||
pre[class*="language-"].line-numbers > code {
|
||||
position: relative;
|
||||
white-space: inherit;
|
||||
}
|
||||
|
@ -223,245 +230,4 @@ pre.line-numbers > code {
|
|||
padding-right: 0.8em;
|
||||
text-align: right;
|
||||
}
|
||||
.token a {
|
||||
color: inherit;
|
||||
}
|
||||
.prism-previewer,
|
||||
.prism-previewer:before,
|
||||
.prism-previewer:after {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.prism-previewer,
|
||||
.prism-previewer:after {
|
||||
left: 50%;
|
||||
}
|
||||
.prism-previewer {
|
||||
margin-top: -48px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-left: -16px;
|
||||
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity .25s;
|
||||
-o-transition: opacity .25s;
|
||||
transition: opacity .25s;
|
||||
}
|
||||
.prism-previewer.flipped {
|
||||
margin-top: 0;
|
||||
margin-bottom: -48px;
|
||||
}
|
||||
.prism-previewer:before,
|
||||
.prism-previewer:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.prism-previewer:before {
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
left: -5px;
|
||||
bottom: -5px;
|
||||
border-radius: 10px;
|
||||
border: 5px solid #fff;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5) inset, 0 0 10px rgba(0, 0, 0, 0.75);
|
||||
}
|
||||
|
||||
.prism-previewer:after {
|
||||
top: 100%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin: 5px 0 0 -7px;
|
||||
border: 7px solid transparent;
|
||||
border-color: rgba(255, 0, 0, 0);
|
||||
border-top-color: #fff;
|
||||
}
|
||||
.prism-previewer.flipped:after {
|
||||
top: auto;
|
||||
bottom: 100%;
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
border-top-color: rgba(255, 0, 0, 0);
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.prism-previewer.active {
|
||||
opacity: 1;
|
||||
}
|
||||
.prism-previewer-color {
|
||||
background-image: linear-gradient(45deg, #bbb 25%, transparent 25%, transparent 75%, #bbb 75%, #bbb), linear-gradient(45deg, #bbb 25%, #eee 25%, #eee 75%, #bbb 75%, #bbb);
|
||||
background-size: 10px 10px;
|
||||
background-position: 0 0, 5px 5px;
|
||||
}
|
||||
.prism-previewer-color:before {
|
||||
background-color: inherit;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
.prism-previewer-gradient {
|
||||
background-image: linear-gradient(45deg, #bbb 25%, transparent 25%, transparent 75%, #bbb 75%, #bbb), linear-gradient(45deg, #bbb 25%, #eee 25%, #eee 75%, #bbb 75%, #bbb);
|
||||
background-size: 10px 10px;
|
||||
background-position: 0 0, 5px 5px;
|
||||
|
||||
width: 64px;
|
||||
margin-left: -32px;
|
||||
}
|
||||
.prism-previewer-gradient:before {
|
||||
content: none;
|
||||
}
|
||||
.prism-previewer-gradient div {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
left: -5px;
|
||||
right: -5px;
|
||||
bottom: -5px;
|
||||
border-radius: 10px;
|
||||
border: 5px solid #fff;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5) inset, 0 0 10px rgba(0, 0, 0, 0.75);
|
||||
}
|
||||
.prism-previewer-easing {
|
||||
margin-top: -76px;
|
||||
margin-left: -30px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: #333;
|
||||
}
|
||||
.prism-previewer-easing.flipped {
|
||||
margin-bottom: -116px;
|
||||
}
|
||||
.prism-previewer-easing svg {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
.prism-previewer-easing circle {
|
||||
fill: hsl(200, 10%, 20%);
|
||||
stroke: white;
|
||||
}
|
||||
.prism-previewer-easing path {
|
||||
fill: none;
|
||||
stroke: white;
|
||||
stroke-linecap: round;
|
||||
stroke-width: 4;
|
||||
}
|
||||
.prism-previewer-easing line {
|
||||
stroke: white;
|
||||
stroke-opacity: 0.5;
|
||||
stroke-width: 2;
|
||||
}
|
||||
@-webkit-keyframes prism-previewer-time {
|
||||
0% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
50% {
|
||||
stroke-dasharray: 100, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: -100;
|
||||
}
|
||||
}
|
||||
|
||||
@-o-keyframes prism-previewer-time {
|
||||
0% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
50% {
|
||||
stroke-dasharray: 100, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: -100;
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes prism-previewer-time {
|
||||
0% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
50% {
|
||||
stroke-dasharray: 100, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: -100;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes prism-previewer-time {
|
||||
0% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
50% {
|
||||
stroke-dasharray: 100, 500;
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: -100;
|
||||
}
|
||||
}
|
||||
|
||||
.prism-previewer-time:before {
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
.prism-previewer-time:after {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.prism-previewer-time svg {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
-webkit-transform: rotate(-90deg);
|
||||
-moz-transform: rotate(-90deg);
|
||||
-ms-transform: rotate(-90deg);
|
||||
-o-transform: rotate(-90deg);
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.prism-previewer-time circle {
|
||||
fill: transparent;
|
||||
stroke: hsl(200, 10%, 20%);
|
||||
stroke-opacity: 0.9;
|
||||
stroke-width: 32;
|
||||
stroke-dasharray: 0, 500;
|
||||
stroke-dashoffset: 0;
|
||||
-webkit-animation: prism-previewer-time linear infinite 3s;
|
||||
-moz-animation: prism-previewer-time linear infinite 3s;
|
||||
-o-animation: prism-previewer-time linear infinite 3s;
|
||||
animation: prism-previewer-time linear infinite 3s;
|
||||
}
|
||||
.prism-previewer-angle:before {
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
.prism-previewer-angle:after {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.prism-previewer-angle svg {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
-webkit-transform: rotate(-90deg);
|
||||
-moz-transform: rotate(-90deg);
|
||||
-ms-transform: rotate(-90deg);
|
||||
-o-transform: rotate(-90deg);
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.prism-previewer-angle[data-negative] svg {
|
||||
-webkit-transform: scaleX(-1) rotate(-90deg);
|
||||
-moz-transform: scaleX(-1) rotate(-90deg);
|
||||
-ms-transform: scaleX(-1) rotate(-90deg);
|
||||
-o-transform: scaleX(-1) rotate(-90deg);
|
||||
transform: scaleX(-1) rotate(-90deg);
|
||||
}
|
||||
.prism-previewer-angle circle {
|
||||
fill: transparent;
|
||||
stroke: hsl(200, 10%, 20%);
|
||||
stroke-opacity: 0.9;
|
||||
stroke-width: 32;
|
||||
stroke-dasharray: 0, 500;
|
||||
}
|
||||
|
|
|
@ -56,3 +56,11 @@ body {
|
|||
.btn-error:active, .btn-error:hover, .btn-error:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
pre.line-numbers {
|
||||
padding-left: 50px !important;
|
||||
}
|
||||
|
||||
.line-numbers-rows {
|
||||
top: -4px !important;
|
||||
}
|
||||
|
|
|
@ -46,3 +46,11 @@ pre, code {
|
|||
.btn-error:active, .btn-error:hover, .btn-error:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
pre.line-numbers {
|
||||
padding-left: 50px !important;
|
||||
}
|
||||
|
||||
.line-numbers-rows {
|
||||
top: -4px !important;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue