From 5a4de4750c3db661389dc6dfa5890879c38b9f78 Mon Sep 17 00:00:00 2001 From: mike-esokia Date: Wed, 16 May 2018 16:34:42 +0400 Subject: [PATCH 1/3] PORT PHRAS-1681 to 4.1 --- .../Phrasea/Twig/PhraseanetExtension.php | 25 ------------------- templates/web/common/macros.html.twig | 6 ++--- templates/web/prod/results/record.html.twig | 2 +- 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php index 0fef3ee23e..b9c92f5015 100644 --- a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php +++ b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php @@ -47,37 +47,12 @@ class PhraseanetExtension extends \Twig_Extension new \Twig_SimpleFunction('record_flags', array($this, 'getRecordFlags')), new \Twig_SimpleFunction('border_checker_from_fqcn', array($this, 'getCheckerFromFQCN')), new \Twig_SimpleFunction('caption_field', array($this, 'getCaptionField')), - new \Twig_SimpleFunction('caption_field_label', array($this, 'getCaptionFieldLabel')), new \Twig_SimpleFunction('caption_field_order', array($this, 'getCaptionFieldOrder')), new \Twig_SimpleFunction('flag_slugify', array(Flag::class, 'normalizeName')), ); } - /** - * get localized field's label - * @param RecordInterface $record - * @param $fieldName - * @return string - the name label - */ - public function getCaptionFieldLabel(RecordInterface $record, $fieldName) - { - if ($record) { - /** @var \appbox $appbox */ - $appbox = $this->app['phraseanet.appbox']; - $databox = $appbox->get_databox($record->getDataboxId()); - - foreach ($databox->get_meta_structure() as $meta) { - /** @var \databox_field $meta */ - if ($meta->get_name() === $fieldName) { - return $meta->get_label($this->app['locale']); - } - } - } - - return ''; - } - public function getCaptionField(RecordInterface $record, $field, $value) { if ($record instanceof ElasticsearchRecord) { diff --git a/templates/web/common/macros.html.twig b/templates/web/common/macros.html.twig index a8abb904d6..50091a8af3 100644 --- a/templates/web/common/macros.html.twig +++ b/templates/web/common/macros.html.twig @@ -126,9 +126,9 @@ {% macro caption(record, can_see_business, display_exif, limitedWidth = false) %}
- {% for name, value in record.getCaption(caption_field_order(record, can_see_business)) %} -
{{ caption_field_label(record, name) }}
-
{{ caption_field(record, name, value)|e|highlight }}
+ {% for field in record.get_caption().get_highlight_fields(null, can_see_business) %} +
{{ field.label_name }}
+
{{ _self.caption_value(field, bounceable|default(true))|highlight|linkify }}
{% endfor %}
{% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %} diff --git a/templates/web/prod/results/record.html.twig b/templates/web/prod/results/record.html.twig index bccf31775e..8f8dccbe1e 100644 --- a/templates/web/prod/results/record.html.twig +++ b/templates/web/prod/results/record.html.twig @@ -24,7 +24,7 @@ {% set can_see_business = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %}
From a724ac9d8b363a246bee32dcbe9fd793a3394d53 Mon Sep 17 00:00:00 2001 From: mike-esokia Date: Thu, 17 May 2018 10:45:36 +0400 Subject: [PATCH 2/3] translate remember me text --- templates/web/login/common/macros.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/web/login/common/macros.html.twig b/templates/web/login/common/macros.html.twig index 9cbf464f86..b659ef4b02 100644 --- a/templates/web/login/common/macros.html.twig +++ b/templates/web/login/common/macros.html.twig @@ -39,7 +39,7 @@ {% macro checkboxInput(field, label = '') %}
{{ form_errors(field) }} From ecced3d58324c3be8bdcc62bc0754921993fe1df Mon Sep 17 00:00:00 2001 From: mike-esokia Date: Fri, 18 May 2018 10:40:10 +0400 Subject: [PATCH 3/3] fix delete icon function on status --- .../Phrasea/Status/XmlStatusStructureProvider.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Alchemy/Phrasea/Status/XmlStatusStructureProvider.php b/lib/Alchemy/Phrasea/Status/XmlStatusStructureProvider.php index 0b860872e6..4103753942 100644 --- a/lib/Alchemy/Phrasea/Status/XmlStatusStructureProvider.php +++ b/lib/Alchemy/Phrasea/Status/XmlStatusStructureProvider.php @@ -220,13 +220,13 @@ class XmlStatusStructureProvider implements StatusStructureProviderInterface $status['searchable'] = (Boolean) $properties['searchable']; $status['printable'] = (Boolean) $properties['printable']; - if (!isset($properties['img_on'])) { - $status['img_on'] = null; - } - - if (!isset($properties['img_off'])) { - $status['img_off'] = null; - } +// if (!isset($properties['img_on'])) { +// $status['img_on'] = null; +// } +// +// if (!isset($properties['img_off'])) { +// $status['img_off'] = null; +// } $statusStructure->setStatus($bit, $status);