Skip to content

Commit

Permalink
translated warning message, added link to docu
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Nov 28, 2021
1 parent 023c316 commit 5b9de90
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
28 changes: 28 additions & 0 deletions EventSubscriber/CustomCssActionSubscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/*
* This file is part of the MetaFieldsBundle for Kimai 2.
* All rights reserved by Kevin Papst (www.kevinpapst.de).
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KimaiPlugin\CustomCSSBundle\EventSubscriber;

use App\Event\PageActionsEvent;
use App\EventSubscriber\Actions\AbstractActionsSubscriber;
use KimaiPlugin\MetaFieldsBundle\MetaFieldsRegistry;

final class CustomCssActionSubscriber extends AbstractActionsSubscriber
{
public static function getActionName(): string
{
return 'custom_css';
}

public function onActions(PageActionsEvent $event): void
{
$event->addHelp($this->documentationLink('plugin-custom-css.html'));
}
}
4 changes: 4 additions & 0 deletions Resources/translations/messages.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<source>custom_css.add_rule_help</source>
<target>Fügen Sie ihre eigenen CSS Regeln hier ein</target>
</trans-unit>
<trans-unit id="custom_css.replace">
<source>custom_css.replace</source>
<target>Die Regel "%name%" ist bereits in Ihrem eigenen CSS enthalten. Soll Sie ersetzt werden? Falls nicht, wird die Regel angehangen.</target>
</trans-unit>
</body>
</file>
</xliff>
4 changes: 4 additions & 0 deletions Resources/translations/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<source>custom_css.add_rule_help</source>
<target>Add all of your custom CSS rules here</target>
</trans-unit>
<trans-unit id="custom_css.replace">
<source>custom_css.replace</source>
<target>The rule "%name%" is already included in your custom CSS. Replace it? If not, it will be appended.</target>
</trans-unit>
</body>
</file>
</xliff>
7 changes: 5 additions & 2 deletions Resources/views/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}

{% block page_title %}{{ 'Custom CSS'|trans }}{% endblock %}
{% block page_actions %}
{% set event = actions(app.user, 'custom_css', 'index') %}
{{ widgets.page_actions(event.actions) }}
{% endblock %}

{% block main %}

Expand All @@ -26,7 +29,7 @@
var customCss = jQuery('#custom_css_customCss').val();
var newCss = header + "\n" + cssRules[ruleName].trim() + "\n" + footer;
if (ruleRegexp.test(customCss) && confirm(humanRuleName + " is already in your Custom CSS replace it? If not it will be appended.")) {
if (ruleRegexp.test(customCss) && confirm("{{ 'custom_css.replace'|trans|e('js') }}".replace(/%name%/, humanRuleName))) {
customCss = customCss.replace(ruleRegexp, newCss);
} else {
customCss = customCss + "\n" + newCss + "\n";
Expand Down

0 comments on commit 5b9de90

Please sign in to comment.