1
0
Fork 0
forked from deblan/gist

Compare commits

..

1 commit

Author SHA1 Message Date
3c84e7dd4d Cleaning and refactoring 2017-10-16 13:23:15 +02:00
19 changed files with 152 additions and 245 deletions

View file

@ -31,6 +31,7 @@ update:
@echo "-----------------------------------"
@echo
sh -c 'test -d app && $(GIT) add app && $(GIT) commit -m "Configuration"'
$(GIT) pull origin master
${MKDIR} -p data/git
$(COMPOSER) update

View file

@ -38,6 +38,7 @@ gist:
download: '下载'
clone: '克隆'
embed: '引用'
embed_copy: '复制'
add: '新建'
date:

View file

@ -38,6 +38,7 @@ gist:
download: 'Herunterladen'
clone: 'Klonen'
embed: 'Einfügen'
embed_copy: 'Kopieren'
add: 'Hinzufügen'
date:

View file

@ -39,6 +39,7 @@ gist:
download: 'Download'
clone: 'Clone'
embed: 'Embed'
embed_copy: 'Copy'
add: 'New'
date:

View file

@ -38,6 +38,7 @@ gist:
download: 'Descargar'
clone: 'Clonar'
embed: 'Insertar'
embed_copy: 'Dupdo'
add: 'Añadir'
date:

View file

@ -38,6 +38,7 @@ gist:
download: 'Télécharger'
clone: 'Clôner'
embed: 'Insérer'
embed_copy: 'Copier'
add: 'Ajouter'
date:

View file

@ -1,108 +0,0 @@
app:
title: '#!GIST'
title_prefix: '#!GIST - '
menu:
home:
title: 'Home'
about:
title: 'O projekcie'
my:
login:
title: 'Logowanie'
logout:
title: 'Wylogowanie'
register:
title: 'Rejestracja'
my:
title: 'Konta'
my:
title: 'Moje wklejki'
nothing: 'Nie ma jeszcze nic!'
api:
title: 'API'
warning: 'Trzymaj to w <strong>sekrecie!</strong>'
form:
generate: 'Wygeneruj nowy'
gist:
untitled: 'Bez tytułu'
404:
title: 'Oops!'
message: 'Wklejka nie została znaleziona...'
action:
view: 'Podgląd'
history: 'Commit(s)'
raw: 'RAW'
download: 'Pobierz'
clone: 'Sklonuj'
embed: 'Embed'
add: 'Nowa'
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>'
login:
login:
title: 'Logowanie'
invalid: 'Nie prawidłowy login lub hasło.'
form:
username:
placeholder: 'Login'
password:
placeholder: 'Hasło'
remember_me:
label: 'Pamiętaj'
register:
title: 'Nowe konto'
already_exists: 'Ta nazwa użytkownika jest już zarejestrowana!'
registred: 'Gratulacje, twoje konto zostało utworzone!'
form:
username:
placeholder: 'Login'
current_password:
placeholder: 'Obecne hasło'
password:
placeholder: 'Hasło'
form:
error:
password: 'Nie prawidłowe hasło.'
not_blank: 'To pole nie powinno być puste!'
title:
placeholder: 'Tytuł'
cipher:
label: 'Szyfrowanie: %value%'
choice:
anyway: 'Tak czy inaczej'
yes: 'Tak'
no: 'Nie'
submit: 'Wyślij'
filter: 'Filtr'
confirm: 'Potwierdzasz?'
success:
password: 'Hasło zostało zaktualizowane.'
gist: 'Wklejka została usunięta.'
type:
label: 'Język: %value%'
choice:
all: 'All'
html: 'HTML'
xml: 'XML'
css: 'CSS'
javascript: 'JAVASCRIPT'
php: 'PHP'
sql: 'SQL'
yaml: 'YAML'
perl: 'PERL'
c: 'C/C++'
asp: 'ASP'
python: 'PYTHON'
bash: 'BASH'
actionscript3: 'ACTION SCRIPT'
text: 'TEXT'

View file

@ -16,7 +16,6 @@
"bootstrap": "3.3.4",
"flag-icon-css": "0.7.1",
"iframe-resizer": "2.8.6",
"jsdiff": "~2.2.2",
"Prism": "~1.8.1"
"jsdiff": "~2.2.2"
}
}

View file

@ -131,7 +131,7 @@ class ViewController extends Controller
200,
array(
'Content-Disposition' => sprintf('filename=%s.%s', $gist->getFile(), $gist->getTypeAsExtension()),
'Content-Length' => mb_strlen($viewOptions['raw_content']),
'Content-Length' => filesize($file),
'Content-Type' => 'application/force-download',
)
);

View file

@ -3,14 +3,6 @@
{% block css %}
{{ parent() }}
<link rel="stylesheet" href="{{ web_path }}components/Prism/themes/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
<style type="text/css">
.panel-body {
padding: 0;
@ -20,6 +12,10 @@
margin-bottom: 0;
}
#viewer {
min-height: 120px;
}
.container-fluid {
padding: 0;
}
@ -101,7 +97,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 class="line-numbers"><code {% if gist.cipher %}data-cipher{% endif %} class="language-{{ gist.highlightType }}">{{ raw_content }}</code></pre>
</div>
</div>
</div>
@ -116,6 +112,5 @@
{% block js %}
{{ parent() }}
<script type="text/javascript" src="{{ web_path }}components/iframe-resizer/js/iframeResizer.contentWindow.min.js"></script>
<script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
<script src="{{ web_path }}components/iframe-resizer/js/iframeResizer.contentWindow.min.js"></script>
{% endblock %}

View file

@ -1,17 +1,5 @@
{% extends 'base.html.twig' %}
{% block css %}
{{ parent() }}
<link rel="stylesheet" href="{{ web_path }}app/css/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
{% endblock %}
{% block title %}{{ gist.title ? gist.title : 'gist.untitled'|trans }} - {{ 'gist.action.history'|trans }}{% endblock %}
{% block body %}
@ -79,8 +67,6 @@
{% block js %}
{{ parent() }}
<script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
{% if gist.cipher %}
<script src="{{ web_path }}components/jsdiff/diff.min.js"></script>

View file

@ -1,17 +1,5 @@
{% extends 'base.html.twig' %}
{% block css %}
{{ parent() }}
<link rel="stylesheet" href="{{ web_path }}app/css/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
{% endblock %}
{% block title %}{{ gist.title ? gist.title : 'gist.untitled'|trans }} - {{ commit|slice(0, 10) }}{% endblock %}
{% block body %}
@ -101,7 +89,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 class="line-numbers"><code {% if gist.cipher %}data-cipher{% endif %} class="language-{{ gist.highlightType }}">{{ raw_content }}</code></pre>
</div>
</div>
</div>
@ -116,6 +104,12 @@
<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>
<p>
<button id="embed-copy" class="btn btn-primary">
<span class="glyphicon glyphicon-floppy-saved"></span>
{{ 'gist.action.embed_copy'|trans }}
</button>
</p>
</div>
</div>
</div>
@ -123,9 +117,3 @@
</div>
</div>
{% endblock %}
{% block js %}
{{ parent() }}
<script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
{% endblock %}

View file

@ -13,6 +13,14 @@
<link rel="stylesheet" href="{{ web_path }}components/bootstrap/dist/css/bootstrap-theme.min.css">
{% endif %}
<link rel="stylesheet" href="{{ web_path }}components/Prism/themes/prism.css">
{% if theme_settings.name == 'dark' %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-okaidia.css">
{% else %}
<link rel="stylesheet" href="{{ web_path }}app/css/prism-solarizedlight.css">
{% endif %}
<link rel="stylesheet" href="{{ web_path }}app/css/app.css">
<link rel="stylesheet" href="{{ web_path }}app/css/themes/{{ theme_settings.name }}.css">
{% endblock %}
@ -120,6 +128,7 @@
<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/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
<script src="{{ web_path }}app/js/app.js"></script>
{% endblock %}
</body>

56
web/app/css/app.css Normal file
View file

@ -0,0 +1,56 @@
.navbar {
border-radius: 0;
}
#form_content {
display: block;
width: 100%;
padding: 10px;
}
#languages {
padding-bottom: 5px;
}
#languages .btn-group:first-child {
margin-right: 4px;
}
.panel-heading .actions {
margin-top: -5px;
}
.diff {
display: none;
}
#options {
margin-bottom: 17px;
}
.btn-delete {
background: #DE3336;
color: #fff;
}
.btn-error:active, .btn-error:hover, .btn-error:focus {
color: #000;
}
#embed .line-numbers-rows, #viewer .line-numbers-rows {
top: -2px;
}
#embed .line-numbers, #viewer .line-numbers {
padding-left: 50px;
}
#viewer pre, #viewer code, #revisions pre, #revisions code, #embed pre, #embed code {
background: none !important;
white-space: pre-wrap !important;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap !important;
white-space: -o-pre-wrap !important;
word-wrap: break-word !important;
border: 0 !important;
}

View file

@ -1,4 +1,4 @@
/* 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 */
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+actionscript+apacheconf+c+aspnet+bash+batch+cpp+csharp+ruby+css-extras+diff+docker+git+go+http+java+json+latex+less+lua+makefile+markdown+nginx+perl+php+php-extras+powershell+python+sass+sql+twig+vim+yaml&plugins=line-highlight+line-numbers+show-invisibles+autolinker+previewer-base+previewer-color+previewer-gradient+previewer-easing+previewer-time+previewer-angle+autoloader */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
@ -223,6 +223,39 @@ pre.line-numbers > code {
padding-right: 0.8em;
text-align: right;
}
.token.tab:not(:empty),
.token.cr,
.token.lf,
.token.space {
position: relative;
}
.token.tab:not(:empty):before,
.token.cr:before,
.token.lf:before,
.token.space:before {
color: hsl(24, 20%, 85%);
position: absolute;
}
.token.tab:not(:empty):before {
content: '\21E5';
}
.token.cr:before {
content: '\240D';
}
.token.crlf:before {
content: '\240D\240A';
}
.token.lf:before {
content: '\240A';
}
.token.space:before {
content: '\00B7';
}
.token a {
color: inherit;
}

View file

@ -2,57 +2,8 @@ body {
background: #333;
}
.navbar {
border-radius: 0;
}
.form-control {
color: #fff;
background: #2D2D2D;
border: #333;
}
#form_content {
display: block;
width: 100%;
padding: 10px;
}
#languages {
padding-bottom: 5px;
}
#languages .btn-group:first-child {
margin-right: 4px;
}
#viewer pre, #viewer code, #revisions pre, #revisions code, #embed pre, #embed code {
background: none !important;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
border: 0;
}
.panel-heading .actions {
margin-top: -5px;
}
.diff {
display: none;
}
#options {
margin-bottom: 17px;
}
.btn-delete {
background: #DE3336;
color: #fff;
}
.btn-error:active, .btn-error:hover, .btn-error:focus {
color: #000;
}

View file

@ -1,21 +1,3 @@
.navbar {
border-radius: 0;
}
#form_content {
display: block;
width: 100%;
padding: 10px;
}
#languages {
padding-bottom: 5px;
}
#languages .btn-group:first-child {
margin-right: 4px;
}
pre, code {
background: none !important;
white-space: pre-wrap !important;
@ -25,24 +7,3 @@ pre, code {
word-wrap: break-word !important;
border: 0;
}
.panel-heading .actions {
margin-top: -5px;
}
.diff {
display: none;
}
#options {
margin-bottom: 17px;
}
.btn-delete {
background: #DE3336;
color: #fff;
}
.btn-error:active, .btn-error:hover, .btn-error:focus {
color: #000;
}

View file

@ -141,6 +141,16 @@ var viewerEvents = function() {
var $render = $('#viewer code[data-cipher]');
$(document).ready(function() {
$('#embed-copy').click(function() {
var code = $('#viewer code').html();
code = code.replace(/<[^>]+>/g, '')
var $temp = $('<input>');
$('body').append($temp);
$temp.val(code).select();
document.execCommand('copy');
$temp.remove();
});
var key = getKey();
var $cipherEditor = $('.cipher-editor');

File diff suppressed because one or more lines are too long