diff --git a/src/Controller/SystemConfigurationController.php b/src/Controller/SystemConfigurationController.php index b62686d8..177ed106 100644 --- a/src/Controller/SystemConfigurationController.php +++ b/src/Controller/SystemConfigurationController.php @@ -191,10 +191,6 @@ class SystemConfigurationController extends AbstractController ->setName('timesheet.mode') ->setType(TimesheetModeType::class) ->setTranslationDomain('system-configuration'), - (new Configuration()) - ->setName('timesheet.markdown_content') - ->setType(CheckboxType::class) - ->setTranslationDomain('system-configuration'), (new Configuration()) ->setName('timesheet.rules.allow_future_times') ->setType(CheckboxType::class) @@ -237,6 +233,11 @@ class SystemConfigurationController extends AbstractController ->setName('theme.select_type') ->setTranslationDomain('system-configuration') ->setType(EnhancedSelectboxType::class), + (new Configuration()) + ->setName('timesheet.markdown_content') + ->setLabel('theme.markdown_content') + ->setType(CheckboxType::class) + ->setTranslationDomain('system-configuration'), ]), (new SystemConfigurationModel()) ->setSection(SystemConfigurationModel::SECTION_CALENDAR) diff --git a/src/Twig/MarkdownExtension.php b/src/Twig/MarkdownExtension.php index 09efca9c..47e72fc1 100644 --- a/src/Twig/MarkdownExtension.php +++ b/src/Twig/MarkdownExtension.php @@ -46,6 +46,7 @@ class MarkdownExtension extends AbstractExtension return [ new TwigFilter('md2html', [$this, 'markdownToHtml'], ['is_safe' => ['html']]), new TwigFilter('desc2html', [$this, 'timesheetContent'], ['is_safe' => ['html']]), + new TwigFilter('comment2html', [$this, 'timesheetContent'], ['is_safe' => ['html']]), ]; } diff --git a/templates/activity/index.html.twig b/templates/activity/index.html.twig index 8c05393b..4f7ef761 100644 --- a/templates/activity/index.html.twig +++ b/templates/activity/index.html.twig @@ -47,7 +47,7 @@ {{ widgets.label_project(entry.project, path('admin_project_edit', {'id' : entry.project.id})) }} {% endif %} - {{ entry.comment }} + {{ entry.comment|comment2html }} {{ widgets.label_visible(entry.visible) }} {{ actions.activity(entry, 'index') }} diff --git a/templates/customer/index.html.twig b/templates/customer/index.html.twig index 49e00e67..b17f13a4 100644 --- a/templates/customer/index.html.twig +++ b/templates/customer/index.html.twig @@ -35,7 +35,7 @@ {% for entry in entries %} {{ widgets.label_color_dot('customer', true, entry.name, null, entry.color) }} {% if entry.company is not empty %}({{ entry.company }}){% endif %} - {{ entry.comment }} + {{ entry.comment|comment2html }} {{ entry.country|country }} {{ entry.number }} {{ entry.currency }} {{ entry.currency|currency }} diff --git a/templates/project/index.html.twig b/templates/project/index.html.twig index 234d6861..5c5417aa 100644 --- a/templates/project/index.html.twig +++ b/templates/project/index.html.twig @@ -37,7 +37,7 @@ {{ widgets.label_customer(entry.customer, path('admin_customer_edit', {'id' : entry.customer.id})) }} - {{ entry.comment }} + {{ entry.comment|comment2html }} {{ entry.budget|money(entry.customer.currency) }} {{ widgets.label_visible(entry.visible) }} diff --git a/tests/Controller/SystemConfigurationControllerTest.php b/tests/Controller/SystemConfigurationControllerTest.php index 716f7344..b1e922cd 100644 --- a/tests/Controller/SystemConfigurationControllerTest.php +++ b/tests/Controller/SystemConfigurationControllerTest.php @@ -61,7 +61,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $client->getContainer()->get(SystemConfiguration::class); - $this->assertEquals(false, $configService->find('timesheet.markdown_content')); $this->assertEquals('default', $configService->find('timesheet.mode')); $this->assertEquals(true, $configService->find('timesheet.rules.allow_future_times')); $this->assertEquals(1, $configService->find('timesheet.active_entries.hard_limit')); @@ -72,7 +71,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest 'system_configuration_form_timesheet' => [ 'configuration' => [ ['name' => 'timesheet.mode', 'value' => 'duration_only'], - ['name' => 'timesheet.markdown_content', 'value' => 1], ['name' => 'timesheet.rules.allow_future_times', 'value' => false], ['name' => 'timesheet.active_entries.hard_limit', 'value' => 99], ['name' => 'timesheet.active_entries.soft_limit', 'value' => 77], @@ -86,7 +84,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertHasFlashSaveSuccess($client); $configService = $client->getContainer()->get(SystemConfiguration::class); - $this->assertEquals(true, $configService->find('timesheet.markdown_content')); $this->assertEquals('duration_only', $configService->find('timesheet.mode')); $this->assertEquals(false, $configService->find('timesheet.rules.allow_future_times')); $this->assertEquals(99, $configService->find('timesheet.active_entries.hard_limit')); @@ -103,7 +100,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest 'system_configuration_form_timesheet' => [ 'configuration' => [ ['name' => 'timesheet.mode', 'value' => 'foo'], - ['name' => 'timesheet.markdown_content', 'value' => 1], ['name' => 'timesheet.rules.allow_future_times', 'value' => 1], ['name' => 'timesheet.active_entries.hard_limit', 'value' => -1], ['name' => 'timesheet.active_entries.soft_limit', 'value' => -1], @@ -112,8 +108,8 @@ class SystemConfigurationControllerTest extends ControllerBaseTest ], [ '#system_configuration_form_timesheet_configuration_0_value', // mode - '#system_configuration_form_timesheet_configuration_3_value', // hard_limit - '#system_configuration_form_timesheet_configuration_4_value', // soft_limit + '#system_configuration_form_timesheet_configuration_2_value', // hard_limit + '#system_configuration_form_timesheet_configuration_3_value', // soft_limit ], true ); @@ -181,6 +177,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $this->assertAccessIsGranted($client, '/admin/system-config/'); $configService = $client->getContainer()->get(SystemConfiguration::class); + $this->assertEquals(false, $configService->find('timesheet.markdown_content')); $this->assertNull($configService->find('theme.select_type')); $form = $client->getCrawler()->filter('form[name=system_configuration_form_theme]')->form(); @@ -188,6 +185,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest 'system_configuration_form_theme' => [ 'configuration' => [ ['name' => 'theme.select_type', 'value' => '1'], + ['name' => 'timesheet.markdown_content', 'value' => 1], ] ] ]); @@ -199,6 +197,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest $configService = $client->getContainer()->get(SystemConfiguration::class); $this->assertEquals('selectpicker', $configService->find('theme.select_type')); + $this->assertEquals(true, $configService->find('timesheet.markdown_content')); } public function testUpdateThemeConfigValidation() @@ -211,6 +210,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest 'system_configuration_form_theme' => [ 'configuration' => [ ['name' => 'theme.select_type', 'value' => 'foo'], + ['name' => 'timesheet.markdown_content', 'value' => 1], ] ] ], diff --git a/tests/Twig/MarkdownExtensionTest.php b/tests/Twig/MarkdownExtensionTest.php index 49102d5b..292d47c2 100644 --- a/tests/Twig/MarkdownExtensionTest.php +++ b/tests/Twig/MarkdownExtensionTest.php @@ -26,9 +26,10 @@ class MarkdownExtensionTest extends TestCase $config = new TimesheetConfiguration($loader, ['markdown_content' => true]); $sut = new MarkdownExtension(new Markdown(), $config); $filters = $sut->getFilters(); - $this->assertCount(2, $filters); + $this->assertCount(3, $filters); $this->assertEquals('md2html', $filters[0]->getName()); $this->assertEquals('desc2html', $filters[1]->getName()); + $this->assertEquals('comment2html', $filters[2]->getName()); } public function testMarkdownToHtml() diff --git a/translations/system-configuration.de.xliff b/translations/system-configuration.de.xliff index e964b96c..3939edde 100644 --- a/translations/system-configuration.de.xliff +++ b/translations/system-configuration.de.xliff @@ -26,9 +26,9 @@ calendar Kalender - - label.timesheet.markdown_content - Erlaube Markdown in den Beschreibungen der erfassten Zeiten + + label.theme.markdown_content + Erlaube Markdown-Formatierungen in Beschreibungen und Kommentaren label.timesheet.mode diff --git a/translations/system-configuration.en.xliff b/translations/system-configuration.en.xliff index 4abb953d..a9756033 100644 --- a/translations/system-configuration.en.xliff +++ b/translations/system-configuration.en.xliff @@ -26,9 +26,9 @@ calendar Calendar - - label.timesheet.markdown_content - Allow Markdown in the timesheet descriptions + + label.theme.markdown_content + Allow markdown-formattings in descriptions and comments label.timesheet.mode diff --git a/translations/system-configuration.hu.xliff b/translations/system-configuration.hu.xliff index 35d31657..e957abe9 100644 --- a/translations/system-configuration.hu.xliff +++ b/translations/system-configuration.hu.xliff @@ -18,10 +18,6 @@ form_customer Új ügyfél alapértelmezett értékei - - label.timesheet.markdown_content - Markdown használatának engedélyezése a rögzítések leírásában - label.timesheet.mode_duration_only "Csak időtartam" mód - a befejezés mezőt kicseréli időtartamra diff --git a/translations/system-configuration.ja.xliff b/translations/system-configuration.ja.xliff index 3048d0c5..809d4597 100644 --- a/translations/system-configuration.ja.xliff +++ b/translations/system-configuration.ja.xliff @@ -22,10 +22,6 @@ theme テーマ - - label.timesheet.markdown_content - タイムシートの説明文を Markdown 書式で書けるようにする - label.timesheet.mode タイムトラッキング モード diff --git a/translations/system-configuration.sv.xliff b/translations/system-configuration.sv.xliff index 8ea9ec50..deab4009 100644 --- a/translations/system-configuration.sv.xliff +++ b/translations/system-configuration.sv.xliff @@ -18,10 +18,6 @@ form_customer Skapa kund - standardvärden - - label.timesheet.markdown_content - Tillåt Markdown i tidskriftsbeskrivningarna - label.timesheet.mode Tidsredovisningsläge