Skip to content

Commit

Permalink
Show warning that the copy needs to be saved before it is created
Browse files Browse the repository at this point in the history
  • Loading branch information
carakas committed May 20, 2019
1 parent b01dbbd commit 4455b1a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Backend/Core/Layout/Sass/components/_pages.scss
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -299,3 +299,7 @@ label .templateVisual {
margin-top: 1rem; margin-top: 1rem;
margin-left: -20px; margin-left: -20px;
} }

#copyPageWarning {
margin: 0 0 15px 0;
}
2 changes: 2 additions & 0 deletions src/Backend/Modules/Pages/Actions/Add.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ private function getOriginalPage(): ?array
return null; return null;
} }


$this->template->assign('showCopyWarning', true);

$originalPage = BackendPagesModel::get($id); $originalPage = BackendPagesModel::get($id);
$this->blocksContent = BackendPagesModel::getBlocks($id, $originalPage['revision_id']); $this->blocksContent = BackendPagesModel::getBlocks($id, $originalPage['revision_id']);


Expand Down
10 changes: 10 additions & 0 deletions src/Backend/Modules/Pages/Installer/Data/locale.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -768,6 +768,16 @@
<translation language="ru"><![CDATA[%1$s копия]]></translation> <translation language="ru"><![CDATA[%1$s копия]]></translation>
<translation language="it"><![CDATA[%1$s copia]]></translation> <translation language="it"><![CDATA[%1$s copia]]></translation>
</item> </item>
<item type="message" name="CopySaveWarning">
<translation language="nl"><![CDATA[<p><strong>Belangrijk:</strong> De kopie is nog niet opgeslagen.</p>]]></translation>
<translation language="en"><![CDATA[<p><strong>Important:</strong> The copy hasn't been saved yet.</p>]]></translation>
<translation language="fr"><![CDATA[<p><strong>Important:</strong> La copie n'a pas encore été sauvegardée.</p>]]></translation>
<translation language="de"><![CDATA[<p><strong> Wichtig:</strong> Die Kopie wurde noch nicht gespeichert.</p>]]></translation>
<translation language="pl"><![CDATA[<p><strong>Uwaga:</strong> Kopia nie została jeszcze zapisana.</p>]]></translation>
<translation language="es"><![CDATA[<p><strong>Importante:</strong> La copia aún no se ha guardado.</p>]]></translation>
<translation language="ru"><![CDATA[<p><strong>Важно:</strong> Копия еще не сохранена.</p>]]></translation>
<translation language="it"><![CDATA[<p><strong>Importante:</strong> La copia non è stata ancora salvata.</p>]]></translation>
</item>
</Pages> </Pages>
<Core> <Core>
<item type="error" name="CantBeMoved"> <item type="error" name="CantBeMoved">
Expand Down
5 changes: 5 additions & 0 deletions src/Backend/Modules/Pages/Layout/Templates/Add.html.twig
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
{% endblock %} {% endblock %}


{% block content %} {% block content %}
{% if showCopyWarning %}
<div id="copyPageWarning" class="alert alert-warning alert-xs">
{{ macro.icon('exclamation-triangle') }}{{ 'msg.CopySaveWarning'|trans|raw }}
</div>
{% endif %}
{% form add %} {% form add %}
{{ hidTemplateId|raw }} {{ hidTemplateId|raw }}
<div class="row fork-module-content"> <div class="row fork-module-content">
Expand Down
3 changes: 2 additions & 1 deletion tests/data/test_db.sql
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2231,7 +2231,8 @@ VALUES
(1530, 1, 'en', 'Backend', 'Pages', 'lbl', 'InsidePage', 'add as subpage of the reference page', '2017-08-31 14:28:26'), (1530, 1, 'en', 'Backend', 'Pages', 'lbl', 'InsidePage', 'add as subpage of the reference page', '2017-08-31 14:28:26'),
(1531, 1, 'en', 'Backend', 'Pages', 'lbl', 'CopyThisPage', 'copy this page', '2017-08-31 14:28:26'), (1531, 1, 'en', 'Backend', 'Pages', 'lbl', 'CopyThisPage', 'copy this page', '2017-08-31 14:28:26'),
(1532, 1, 'en', 'Backend', 'Pages', 'lbl', 'CopiedTitle', '%1$s copy', '2017-08-31 14:28:26'), (1532, 1, 'en', 'Backend', 'Pages', 'lbl', 'CopiedTitle', '%1$s copy', '2017-08-31 14:28:26'),
(1533, 1, 'en', 'Backend', 'Pages', 'lbl', 'AfterPage', 'add after reference page', '2017-08-31 14:28:26'); (1533, 1, 'en', 'Backend', 'Pages', 'msg', 'CopySaveWarning', '<p><strong>Important:</strong> The copy hasn''t been saved yet.</p>', '2017-08-31 14:28:26'),
(1534, 1, 'en', 'Backend', 'Pages', 'lbl', 'AfterPage', 'add after reference page', '2017-08-31 14:28:26');


/*!40000 ALTER TABLE `locale` ENABLE KEYS */; /*!40000 ALTER TABLE `locale` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
Expand Down

0 comments on commit 4455b1a

Please sign in to comment.