allow markdown for customer, project and activity comments (#807)
This commit is contained in:
@@ -191,10 +191,6 @@ class SystemConfigurationController extends AbstractController
|
|||||||
->setName('timesheet.mode')
|
->setName('timesheet.mode')
|
||||||
->setType(TimesheetModeType::class)
|
->setType(TimesheetModeType::class)
|
||||||
->setTranslationDomain('system-configuration'),
|
->setTranslationDomain('system-configuration'),
|
||||||
(new Configuration())
|
|
||||||
->setName('timesheet.markdown_content')
|
|
||||||
->setType(CheckboxType::class)
|
|
||||||
->setTranslationDomain('system-configuration'),
|
|
||||||
(new Configuration())
|
(new Configuration())
|
||||||
->setName('timesheet.rules.allow_future_times')
|
->setName('timesheet.rules.allow_future_times')
|
||||||
->setType(CheckboxType::class)
|
->setType(CheckboxType::class)
|
||||||
@@ -237,6 +233,11 @@ class SystemConfigurationController extends AbstractController
|
|||||||
->setName('theme.select_type')
|
->setName('theme.select_type')
|
||||||
->setTranslationDomain('system-configuration')
|
->setTranslationDomain('system-configuration')
|
||||||
->setType(EnhancedSelectboxType::class),
|
->setType(EnhancedSelectboxType::class),
|
||||||
|
(new Configuration())
|
||||||
|
->setName('timesheet.markdown_content')
|
||||||
|
->setLabel('theme.markdown_content')
|
||||||
|
->setType(CheckboxType::class)
|
||||||
|
->setTranslationDomain('system-configuration'),
|
||||||
]),
|
]),
|
||||||
(new SystemConfigurationModel())
|
(new SystemConfigurationModel())
|
||||||
->setSection(SystemConfigurationModel::SECTION_CALENDAR)
|
->setSection(SystemConfigurationModel::SECTION_CALENDAR)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class MarkdownExtension extends AbstractExtension
|
|||||||
return [
|
return [
|
||||||
new TwigFilter('md2html', [$this, 'markdownToHtml'], ['is_safe' => ['html']]),
|
new TwigFilter('md2html', [$this, 'markdownToHtml'], ['is_safe' => ['html']]),
|
||||||
new TwigFilter('desc2html', [$this, 'timesheetContent'], ['is_safe' => ['html']]),
|
new TwigFilter('desc2html', [$this, 'timesheetContent'], ['is_safe' => ['html']]),
|
||||||
|
new TwigFilter('comment2html', [$this, 'timesheetContent'], ['is_safe' => ['html']]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
{{ widgets.label_project(entry.project, path('admin_project_edit', {'id' : entry.project.id})) }}
|
{{ widgets.label_project(entry.project, path('admin_project_edit', {'id' : entry.project.id})) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment2html }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{ actions.activity(entry, 'index') }}
|
{{ actions.activity(entry, 'index') }}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_customer_edit', {'id': entry.id}) }}"{% endif %}>
|
<tr{% if is_granted('edit', entry) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_customer_edit', {'id': entry.id}) }}"{% endif %}>
|
||||||
<td>{{ widgets.label_color_dot('customer', true, entry.name, null, entry.color) }} {% if entry.company is not empty %}({{ entry.company }}){% endif %}</td>
|
<td>{{ widgets.label_color_dot('customer', true, entry.name, null, entry.color) }} {% if entry.company is not empty %}({{ entry.company }}){% endif %}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment2html }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'country') }}">{{ entry.country|country }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'country') }}">{{ entry.country|country }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'number') }}">{{ entry.number }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'number') }}">{{ entry.number }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'currency') }}">{{ entry.currency }} {{ entry.currency|currency }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'currency') }}">{{ entry.currency }} {{ entry.currency|currency }}</td>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
|
||||||
{{ widgets.label_customer(entry.customer, path('admin_customer_edit', {'id' : entry.customer.id})) }}
|
{{ widgets.label_customer(entry.customer, path('admin_customer_edit', {'id' : entry.customer.id})) }}
|
||||||
</td>
|
</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment2html }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money(entry.customer.currency) }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money(entry.customer.currency) }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
$this->assertAccessIsGranted($client, '/admin/system-config/');
|
$this->assertAccessIsGranted($client, '/admin/system-config/');
|
||||||
|
|
||||||
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
||||||
$this->assertEquals(false, $configService->find('timesheet.markdown_content'));
|
|
||||||
$this->assertEquals('default', $configService->find('timesheet.mode'));
|
$this->assertEquals('default', $configService->find('timesheet.mode'));
|
||||||
$this->assertEquals(true, $configService->find('timesheet.rules.allow_future_times'));
|
$this->assertEquals(true, $configService->find('timesheet.rules.allow_future_times'));
|
||||||
$this->assertEquals(1, $configService->find('timesheet.active_entries.hard_limit'));
|
$this->assertEquals(1, $configService->find('timesheet.active_entries.hard_limit'));
|
||||||
@@ -72,7 +71,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
'system_configuration_form_timesheet' => [
|
'system_configuration_form_timesheet' => [
|
||||||
'configuration' => [
|
'configuration' => [
|
||||||
['name' => 'timesheet.mode', 'value' => 'duration_only'],
|
['name' => 'timesheet.mode', 'value' => 'duration_only'],
|
||||||
['name' => 'timesheet.markdown_content', 'value' => 1],
|
|
||||||
['name' => 'timesheet.rules.allow_future_times', 'value' => false],
|
['name' => 'timesheet.rules.allow_future_times', 'value' => false],
|
||||||
['name' => 'timesheet.active_entries.hard_limit', 'value' => 99],
|
['name' => 'timesheet.active_entries.hard_limit', 'value' => 99],
|
||||||
['name' => 'timesheet.active_entries.soft_limit', 'value' => 77],
|
['name' => 'timesheet.active_entries.soft_limit', 'value' => 77],
|
||||||
@@ -86,7 +84,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
$this->assertHasFlashSaveSuccess($client);
|
$this->assertHasFlashSaveSuccess($client);
|
||||||
|
|
||||||
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
||||||
$this->assertEquals(true, $configService->find('timesheet.markdown_content'));
|
|
||||||
$this->assertEquals('duration_only', $configService->find('timesheet.mode'));
|
$this->assertEquals('duration_only', $configService->find('timesheet.mode'));
|
||||||
$this->assertEquals(false, $configService->find('timesheet.rules.allow_future_times'));
|
$this->assertEquals(false, $configService->find('timesheet.rules.allow_future_times'));
|
||||||
$this->assertEquals(99, $configService->find('timesheet.active_entries.hard_limit'));
|
$this->assertEquals(99, $configService->find('timesheet.active_entries.hard_limit'));
|
||||||
@@ -103,7 +100,6 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
'system_configuration_form_timesheet' => [
|
'system_configuration_form_timesheet' => [
|
||||||
'configuration' => [
|
'configuration' => [
|
||||||
['name' => 'timesheet.mode', 'value' => 'foo'],
|
['name' => 'timesheet.mode', 'value' => 'foo'],
|
||||||
['name' => 'timesheet.markdown_content', 'value' => 1],
|
|
||||||
['name' => 'timesheet.rules.allow_future_times', 'value' => 1],
|
['name' => 'timesheet.rules.allow_future_times', 'value' => 1],
|
||||||
['name' => 'timesheet.active_entries.hard_limit', 'value' => -1],
|
['name' => 'timesheet.active_entries.hard_limit', 'value' => -1],
|
||||||
['name' => 'timesheet.active_entries.soft_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_0_value', // mode
|
||||||
'#system_configuration_form_timesheet_configuration_3_value', // hard_limit
|
'#system_configuration_form_timesheet_configuration_2_value', // hard_limit
|
||||||
'#system_configuration_form_timesheet_configuration_4_value', // soft_limit
|
'#system_configuration_form_timesheet_configuration_3_value', // soft_limit
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -181,6 +177,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
$this->assertAccessIsGranted($client, '/admin/system-config/');
|
$this->assertAccessIsGranted($client, '/admin/system-config/');
|
||||||
|
|
||||||
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
||||||
|
$this->assertEquals(false, $configService->find('timesheet.markdown_content'));
|
||||||
$this->assertNull($configService->find('theme.select_type'));
|
$this->assertNull($configService->find('theme.select_type'));
|
||||||
|
|
||||||
$form = $client->getCrawler()->filter('form[name=system_configuration_form_theme]')->form();
|
$form = $client->getCrawler()->filter('form[name=system_configuration_form_theme]')->form();
|
||||||
@@ -188,6 +185,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
'system_configuration_form_theme' => [
|
'system_configuration_form_theme' => [
|
||||||
'configuration' => [
|
'configuration' => [
|
||||||
['name' => 'theme.select_type', 'value' => '1'],
|
['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);
|
$configService = $client->getContainer()->get(SystemConfiguration::class);
|
||||||
$this->assertEquals('selectpicker', $configService->find('theme.select_type'));
|
$this->assertEquals('selectpicker', $configService->find('theme.select_type'));
|
||||||
|
$this->assertEquals(true, $configService->find('timesheet.markdown_content'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpdateThemeConfigValidation()
|
public function testUpdateThemeConfigValidation()
|
||||||
@@ -211,6 +210,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
'system_configuration_form_theme' => [
|
'system_configuration_form_theme' => [
|
||||||
'configuration' => [
|
'configuration' => [
|
||||||
['name' => 'theme.select_type', 'value' => 'foo'],
|
['name' => 'theme.select_type', 'value' => 'foo'],
|
||||||
|
['name' => 'timesheet.markdown_content', 'value' => 1],
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -26,9 +26,10 @@ class MarkdownExtensionTest extends TestCase
|
|||||||
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
|
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
|
||||||
$sut = new MarkdownExtension(new Markdown(), $config);
|
$sut = new MarkdownExtension(new Markdown(), $config);
|
||||||
$filters = $sut->getFilters();
|
$filters = $sut->getFilters();
|
||||||
$this->assertCount(2, $filters);
|
$this->assertCount(3, $filters);
|
||||||
$this->assertEquals('md2html', $filters[0]->getName());
|
$this->assertEquals('md2html', $filters[0]->getName());
|
||||||
$this->assertEquals('desc2html', $filters[1]->getName());
|
$this->assertEquals('desc2html', $filters[1]->getName());
|
||||||
|
$this->assertEquals('comment2html', $filters[2]->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMarkdownToHtml()
|
public function testMarkdownToHtml()
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
<source>calendar</source>
|
<source>calendar</source>
|
||||||
<target>Kalender</target>
|
<target>Kalender</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.markdown_content">
|
<trans-unit id="label.theme.markdown_content">
|
||||||
<source>label.timesheet.markdown_content</source>
|
<source>label.theme.markdown_content</source>
|
||||||
<target>Erlaube Markdown in den Beschreibungen der erfassten Zeiten</target>
|
<target>Erlaube Markdown-Formatierungen in Beschreibungen und Kommentaren</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.mode">
|
<trans-unit id="label.timesheet.mode">
|
||||||
<source>label.timesheet.mode</source>
|
<source>label.timesheet.mode</source>
|
||||||
|
|||||||
@@ -26,9 +26,9 @@
|
|||||||
<source>calendar</source>
|
<source>calendar</source>
|
||||||
<target>Calendar</target>
|
<target>Calendar</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.markdown_content">
|
<trans-unit id="label.theme.markdown_content">
|
||||||
<source>label.timesheet.markdown_content</source>
|
<source>label.theme.markdown_content</source>
|
||||||
<target>Allow Markdown in the timesheet descriptions</target>
|
<target>Allow markdown-formattings in descriptions and comments</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.mode">
|
<trans-unit id="label.timesheet.mode">
|
||||||
<source>label.timesheet.mode</source>
|
<source>label.timesheet.mode</source>
|
||||||
|
|||||||
@@ -18,10 +18,6 @@
|
|||||||
<source>form_customer</source>
|
<source>form_customer</source>
|
||||||
<target>Új ügyfél alapértelmezett értékei</target>
|
<target>Új ügyfél alapértelmezett értékei</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.markdown_content">
|
|
||||||
<source>label.timesheet.markdown_content</source>
|
|
||||||
<target>Markdown használatának engedélyezése a rögzítések leírásában</target>
|
|
||||||
</trans-unit>
|
|
||||||
<trans-unit id="label.timesheet.mode_duration_only">
|
<trans-unit id="label.timesheet.mode_duration_only">
|
||||||
<source>label.timesheet.mode_duration_only</source>
|
<source>label.timesheet.mode_duration_only</source>
|
||||||
<target>"Csak időtartam" mód - a befejezés mezőt kicseréli időtartamra</target>
|
<target>"Csak időtartam" mód - a befejezés mezőt kicseréli időtartamra</target>
|
||||||
|
|||||||
@@ -22,10 +22,6 @@
|
|||||||
<source>theme</source>
|
<source>theme</source>
|
||||||
<target>テーマ</target>
|
<target>テーマ</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.markdown_content">
|
|
||||||
<source>label.timesheet.markdown_content</source>
|
|
||||||
<target>タイムシートの説明文を Markdown 書式で書けるようにする</target>
|
|
||||||
</trans-unit>
|
|
||||||
<trans-unit id="label.timesheet.mode">
|
<trans-unit id="label.timesheet.mode">
|
||||||
<source>label.timesheet.mode</source>
|
<source>label.timesheet.mode</source>
|
||||||
<target>タイムトラッキング モード</target>
|
<target>タイムトラッキング モード</target>
|
||||||
|
|||||||
@@ -18,10 +18,6 @@
|
|||||||
<source>form_customer</source>
|
<source>form_customer</source>
|
||||||
<target state="translated">Skapa kund - standardvärden</target>
|
<target state="translated">Skapa kund - standardvärden</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="label.timesheet.markdown_content">
|
|
||||||
<source>label.timesheet.markdown_content</source>
|
|
||||||
<target state="translated">Tillåt Markdown i tidskriftsbeskrivningarna</target>
|
|
||||||
</trans-unit>
|
|
||||||
<trans-unit id="label.timesheet.mode">
|
<trans-unit id="label.timesheet.mode">
|
||||||
<source>label.timesheet.mode</source>
|
<source>label.timesheet.mode</source>
|
||||||
<target state="translated">Tidsredovisningsläge</target>
|
<target state="translated">Tidsredovisningsläge</target>
|
||||||
|
|||||||
Reference in New Issue
Block a user