Address github annotations

This commit is contained in:
Romain Neutron
2013-05-27 23:49:39 +02:00
parent 9535ee23ea
commit 7ba46abaff
7 changed files with 95 additions and 172 deletions

View File

@@ -16,7 +16,6 @@
"gedmo/doctrine-extensions" : "~2.3.0",
"imagine/imagine" : "dev-ColorSpaces@dev",
"jms/serializer" : "~0.10",
"jms/twig-js" : "dev-master",
"mediavorus/mediavorus" : "~0.3",
"media-alchemyst/media-alchemyst" : "~0.2, >=0.2.3",
"monolog/monolog" : "~1.3.0",

50
composer.lock generated
View File

@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "b996280dc670585a8647ca983149a73e",
"hash": "5aeb56bf583572c3c4d4da8f930f55ed",
"packages": [
{
"name": "BadFaith/BadFaith",
@@ -939,53 +939,6 @@
],
"time": "2013-03-28 16:41:24"
},
{
"name": "jms/twig-js",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/twig.js.git",
"reference": "159542ed93a61801c1502497a65efbfd97628090"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/twig.js/zipball/159542ed93a61801c1502497a65efbfd97628090",
"reference": "159542ed93a61801c1502497a65efbfd97628090",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"twig/twig": ">=1.8,<2.0-dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"TwigJs": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache2"
],
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"role": "Developer of wrapped JMSSerializerBundle"
}
],
"description": "twig.js, flexible, secure, and high-performance templating engine for Javascript",
"keywords": [
"templating"
],
"time": "2013-03-26 10:59:54"
},
{
"name": "media-alchemyst/media-alchemyst",
"version": "0.2.5",
@@ -2471,7 +2424,6 @@
"dailymotion/sdk": 20,
"data-uri/data-uri": 20,
"imagine/imagine": 20,
"jms/twig-js": 20,
"mrclay/minify": 20,
"neutron/silex-imagine-provider": 20,
"neutron/silex-badfaith-provider": 20,

View File

@@ -114,8 +114,6 @@ use Silex\Provider\WebProfilerServiceProvider;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
use Unoconv\UnoconvServiceProvider;
use TwigJs\Twig\TwigJsExtension;
use TwigJs\JsCompiler;
use XPDF\PdfToText;
use XPDF\XPDFServiceProvider;
@@ -500,22 +498,6 @@ class Application extends SilexApplication
return $twig;
})
);
$this['twig.js.compiler'] = $this->share(function(Application $app) {
$compiler = new JsCompiler($app['twig']);
$compiler->setFilterFunction('trans', 'i18n.t');
return $compiler;
});
$this['twig.js'] = $this->share(function(Application $app) {
$twig = clone $app['twig'];
$twig->addExtension(new TwigJsExtension());
$twig->getExtension('escaper')->setDefaultStrategy(false);
$twig->setCompiler($app['twig.js.compiler']);
return $twig;
});
}
/**

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Metadata\TagProvider;
use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController;
use Silex\Application;
@@ -114,7 +113,7 @@ class Fields implements ControllerProviderInterface
$fields[] = $field->toArray();
} catch (\Exception $e) {
$connection->rollback();
$app->abort(500, _(sprintf('Field %s could not be saved, please try again or contact an admin', $jsonField['name'])));
$app->abort(500, _(sprintf('Field %s could not be saved, please try again or contact an admin.', $jsonField['name'])));
break;
}
}
@@ -127,30 +126,22 @@ class Fields implements ControllerProviderInterface
public function getLanguage(Application $app, Request $request)
{
return $app->json(array(
'something_wrong' => _('Something wrong happened, please try again or contact an admin'),
'created_success' => _('%s field has been created with success'),
'deleted_success' => _('%s field has been deleted with success'),
'something_wrong' => _('Something wrong happened, please try again or contact an admin.'),
'created_success' => _('%s field has been created with success.'),
'deleted_success' => _('%s field has been deleted with success.'),
'are_you_sure_delete' => _('Do you really want to delete the field %s ?'),
'validation_blank' => _('Field can not be blank'),
'validation_name_exists' => _('Field name already exists'),
'validation_tag_invalid' => _('Field source is not valid'),
'field_error' => _('Field %s contains errors'),
'fields_save' => _('Your configuration has been successfuly saved'),
'validation_blank' => _('Field can not be blank.'),
'validation_name_exists' => _('Field name already exists.'),
'validation_tag_invalid' => _('Field source is not valid.'),
'field_error' => _('Field %s contains errors.'),
'fields_save' => _('Your configuration has been successfuly saved.'),
));
}
public function displayApp(Application $app, Request $request, $sbas_id)
{
$languages = array();
foreach (PhraseaApplication::getAvailableLanguages() as $code => $language) {
$data = explode('_', $code);
$languages[$data[0]] = $language;
}
return $app['twig']->render('/admin/fields/index.html.twig', array(
'sbas_id' => $sbas_id,
'languages' => $languages,
'sbas_id' => $sbas_id
));
}
@@ -232,15 +223,14 @@ class Fields implements ControllerProviderInterface
$this->updateFieldWithData($app, $field, $data);
$field->save();
} catch (\Exception $e) {
$app->abort(500, _(sprintf('Field %s could not be created, please try again or contact an admin', $data['name'])));
$app->abort(500, _(sprintf('Field %s could not be created, please try again or contact an admin.', $data['name'])));
}
return $app->json($field->toArray(), 201, array(
'location' => $app->path('admin_fields_show_field', array(
'sbas_id' => $sbas_id,
'id' => $field->get_id()
))
));
))));
}
public function listFields(Application $app, $sbas_id) {
@@ -347,7 +337,7 @@ class Fields implements ControllerProviderInterface
$class = sprintf('\databox_Field_DCES_%s', $dcesElement);
if (!class_exists($class)) {
throw new BadRequestHttpException(sprintf('DCES element %s does not exist', $dcesElement));
throw new BadRequestHttpException(sprintf('DCES element %s does not exist.', $dcesElement));
}
$field->set_dces_element(new $class());
@@ -366,7 +356,7 @@ class Fields implements ControllerProviderInterface
private function validateNameField(\databox_descriptionStructure $metaStructure, array $field)
{
if (null !== $metaStructure->get_element_by_name($field['name'])) {
throw new BadRequestHttpException(_(sprintf('Field %s already exists', $field['name'])));
throw new BadRequestHttpException(_(sprintf('Field %s already exists.', $field['name'])));
}
}
@@ -375,7 +365,7 @@ class Fields implements ControllerProviderInterface
try {
\databox_field::loadClassFromTagName($field['tag']);
} catch(\Exception_Databox_metadataDescriptionNotFound $e) {
throw new BadRequestHttpException(_(sprintf('Provided tag %s is unknown', $field['tag'])));
throw new BadRequestHttpException(_(sprintf('Provided tag %s is unknown.', $field['tag'])));
}
}
@@ -385,7 +375,7 @@ class Fields implements ControllerProviderInterface
$data = @json_decode($body, true);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new BadRequestHttpException('Body must contain a valid JSON payload');
throw new BadRequestHttpException('Body must contain a valid JSON payload.');
}
return $data;

View File

@@ -39,7 +39,7 @@
<div class="row-fluid">
<div class="span12">
<div class="sidebar-add-block">
<button type="button" class="btn btn-success btn-add-field"><i class="icon-plus icon-white"></i>{% trans %}Add new field{% endtrans %}</button>
<button type="button" class="btn btn-success btn-add-field"><i class="icon-plus icon-white"></i>{% trans %}Add a new field{% endtrans %}</button>
</div>
<div class="well well-small add-field-block" style="display:none">
<h3>{% trans %}Add a new field{% endtrans %}</h3>
@@ -194,7 +194,7 @@
<td>
<label for="readonly" class="checkbox">
<input id="readonly" type="checkbox" <%= field.readonly ? "checked='checked'" : "" %> />
{% trans %}Read only{% endtrans %}
{% trans %}Read-only{% endtrans %}
</label>
</td>
</tr>

View File

@@ -194,7 +194,7 @@
<td>
<label for="readonly" class="checkbox">
<input id="readonly" type="checkbox" <%= field.readonly ? "checked='checked'" : "" %> />
{% trans %}Read only{% endtrans %}
{% trans %}Read-only{% endtrans %}
</label>
</td>
</tr>