1
0
mirror of https://gitnet.fr/deblan/gist.git synced 2021-08-14 08:30:49 +02:00

API: UI and command 'list' renamed with 'gists'

This commit is contained in:
Simon Vieille 2017-09-21 17:56:37 +02:00
parent ab58bdb82d
commit 4d2cf30de1
8 changed files with 78 additions and 39 deletions

View File

@ -20,6 +20,11 @@ app:
my:
title: '我的 Gist'
nothing: '这家伙很懒,暂时没有内容'
api:
title: 'API'
warning: 'Keep it <strong>secret!</strong>'
form:
generate: 'Regenerate'
gist:
untitled: '未命名'

View File

@ -20,6 +20,11 @@ app:
my:
title: 'Meine Gists'
nothing: 'Nichts zu finden (momentan)!'
api:
title: 'API'
warning: 'Keep it <strong>secret!</strong>'
form:
generate: 'Regenerate'
gist:
untitled: 'Ohne Titel'

View File

@ -20,6 +20,12 @@ app:
my:
title: 'My gists'
nothing: 'Nothing yet!'
api:
title: 'API'
warning: 'Keep it <strong>secret!</strong>'
form:
generate: 'Regenerate'
gist:
untitled: 'Untitled'

View File

@ -20,6 +20,11 @@ app:
my:
title: 'Mis Gists'
nothing: 'Nada por ahora.'
api:
title: 'API'
warning: 'Keep it <strong>secret!</strong>'
form:
generate: 'Regenerate'
gist:
untitled: 'Sin título'

View File

@ -20,6 +20,11 @@ app:
my:
title: 'Mes Gists'
nothing: 'Rien pour le moment !'
api:
title: 'API'
warning: 'Gardez-la <strong>secrète !</strong>'
form:
generate: 'Regénérer'
gist:
untitled: 'Sans titre'

View File

@ -25,7 +25,7 @@ class ListCommand extends Command
protected function configure()
{
$this
->setName('list')
->setName('gists')
->setDescription('List gists using the API');
}

View File

@ -63,7 +63,7 @@ class MyController extends Controller
if (empty($apiKey)) {
$regenerateApiKey = true;
}
// FIXME: CSRF issue!.
// FIXME: CSRF issue!
elseif ($request->request->get('apiKey') === $apiKey && $request->request->has('generateApiKey')) {
$regenerateApiKey = true;
} else {

View File

@ -205,49 +205,62 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
{{ 'login.login.form.password.placeholder'|trans }}
</div>
<div class="panel-body">
<div class="tab-content">
<form action="{{ path('my', params) }}" method="post">
<p>
{{ form_errors(passwordForm.currentPassword) }}
{{ form_widget(passwordForm.currentPassword) }}
</p>
{% set apiEnabled = app.settings.api.enabled %}
<p>
{{ form_errors(passwordForm.newPassword) }}
{{ form_widget(passwordForm.newPassword) }}
</p>
<div class="row">
<div class="col-md-{{ apiEnabled ? 6 : 12 }}">
<div class="panel panel-default">
<div class="panel-heading">
{{ 'login.login.form.password.placeholder'|trans }}
</div>
<div class="panel-body">
<div class="tab-content">
<form action="{{ path('my', params) }}" method="post">
<p>
{{ form_errors(passwordForm.currentPassword) }}
{{ form_widget(passwordForm.currentPassword) }}
</p>
<p>
{{ form_rest(passwordForm) }}
<input type="submit" class="btn btn-primary" value="{{ 'form.submit'|trans }}">
</p>
</form>
</div>
</div>
</div>
<p>
{{ form_errors(passwordForm.newPassword) }}
{{ form_widget(passwordForm.newPassword) }}
</p>
{% if app.settings.api.enabled %}
<div class="panel panel-default">
<div class="panel-heading">
{{ 'api.title'|trans }}
</div>
<div class="panel-body">
<div class="tab-content">
<form action="{{ path('my', params) }}" method="post">
<p>
<input type="text" name="apiKey" id="form-api-key" size="32" value="{{ apiKey }}" data-key="{{ apiKey }}">
<input type="submit" name="generateApiKey" value="{{ 'api.form.generate' }}">
</p>
</form>
<p>
{{ form_rest(passwordForm) }}
<input type="submit" class="btn btn-primary" value="{{ 'form.submit'|trans }}">
</p>
</form>
</div>
</div>
</div>
</div>
{% endif %}
{% if apiEnabled %}
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
{{ 'my.api.title'|trans }}
</div>
<div class="panel-body">
<div class="tab-content">
<p>{{ 'my.api.warning'|trans|raw }}</p>
<form action="{{ path('my', params) }}" method="post">
<div class="row">
<p class="col-md-12">
<input type="text" name="apiKey" id="form-api-key" class="form-control" value="{{ apiKey }}" data-key="{{ apiKey }}">
</p>
<p class="col-md-12">
<input type="submit" name="generateApiKey" value="{{ 'my.api.form.generate'|trans }}" class="btn btn-primary">
</p>
</div>
</form>
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}