Skip to content

Commit

Permalink
EZP-29475: Changes for UDW title (#1346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Grabowski authored Apr 17, 2020
1 parent f439aaf commit 0ab4926
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ eZ.addConfig('ezAlloyEditor.ezBtnEmbed', EzBtnEmbed);
EzBtnEmbed.defaultProps = {
command: 'ezembed',
modifiesSelection: true,
udwTitle: Translator.trans(/*@Desc("Select a content to embed")*/ 'embed_btn.udw.title', {}, 'alloy_editor'),
udwTitle: Translator.trans(/*@Desc("Select a Content item to embed")*/ 'embed_btn.udw.title', {}, 'alloy_editor'),
udwContentDiscoveredMethod: 'addEmbed',
udwConfigName: 'richtext_embed',
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ eZ.addConfig('ezAlloyEditor.ezBtnEmbedInline', EzBtnEmbedInline);
EzBtnEmbedInline.defaultProps = {
command: 'ezembedinline',
modifiesSelection: true,
udwTitle: Translator.trans(/*@Desc("Select a content to embed")*/ 'embed_btn.udw.title', {}, 'alloy_editor'),
udwTitle: Translator.trans(/*@Desc("Select a Content item to embed")*/ 'embed_btn.udw.title', {}, 'alloy_editor'),
udwContentDiscoveredMethod: 'addEmbed',
udwConfigName: 'richtext_embed',
};
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ AlloyEditor.Buttons[EzBtnEmbedUpdate.key] = AlloyEditor.EzBtnEmbedUpdate = EzBtn
eZ.addConfig('ezAlloyEditor.ezBtnEmbedUpdate', EzBtnEmbedUpdate);

EzBtnEmbedUpdate.defaultProps = {
udwTitle: Translator.trans(/*@Desc("Select a content to embed")*/ 'embed_update_btn.udw.title', {}, 'alloy_editor'),
udwTitle: Translator.trans(/*@Desc("Select a Content item to embed")*/ 'embed_update_btn.udw.title', {}, 'alloy_editor'),
udwContentDiscoveredMethod: 'updateEmbed',
udwConfigName: 'richtext_embed',
label: Translator.trans(/*@Desc("Select another content item")*/ 'embed_update_btn.label', {}, 'alloy_editor'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ eZ.addConfig('ezAlloyEditor.ezBtnImage', EzBtnImage);
EzBtnImage.defaultProps = {
command: 'ezembed',
modifiesSelection: true,
udwTitle: Translator.trans(/*@Desc("Select an image to embed")*/ 'image_btn.udw.label', {}, 'alloy_editor'),
udwTitle: Translator.trans(/*@Desc("Select an image")*/ 'image_btn.udw.label', {}, 'alloy_editor'),
udwContentDiscoveredMethod: 'addImage',
udwConfigName: 'richtext_embed_image',
udwLoadContent: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ AlloyEditor.Buttons[EzBtnImageUpdate.key] = AlloyEditor.EzBtnImageUpdate = EzBtn
eZ.addConfig('ezAlloyEditor.ezBtnImageUpdate', EzBtnImageUpdate);

EzBtnImageUpdate.defaultProps = {
udwTitle: Translator.trans(/*@Desc("Select an image to embed")*/ 'image_update_btn.udw.title', {}, 'alloy_editor'),
udwTitle: Translator.trans(/*@Desc("Select an image")*/ 'image_update_btn.udw.title', {}, 'alloy_editor'),
udwContentDiscoveredMethod: 'updateImage',
udwConfigName: 'richtext_embed_image',
label: Translator.trans(/*@Desc("Select another image item")*/ 'image_update_btn.label', {}, 'alloy_editor'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function(global, doc, eZ, React, ReactDOM, Translator) {
(function (global, doc, eZ, React, ReactDOM, Translator) {
const CLASS_FIELD_SINGLE = 'ez-field-edit--ezobjectrelation';
const SELECTOR_FIELD_MULTIPLE = '.ez-field-edit--ezobjectrelationlist';
const SELECTOR_FIELD_SINGLE = '.ez-field-edit--ezobjectrelation';
Expand Down Expand Up @@ -121,7 +121,19 @@
event.preventDefault();

const config = JSON.parse(event.currentTarget.dataset.udwConfig);
const title = Translator.trans(/*@Desc("Select content")*/ 'ezobjectrelationlist.title', {}, 'universal_discovery_widget');
const limit = parseInt(event.currentTarget.dataset.limit, 10);
const title =
limit === 1
? Translator.trans(
/*@Desc("Select a Content item")*/ 'ezobjectrelationlist.title.single',
{},
'universal_discovery_widget'
)
: Translator.trans(
/*@Desc("Select Content item(s)")*/ 'ezobjectrelationlist.title.multi',
{},
'universal_discovery_widget'
);

ReactDOM.render(
React.createElement(
Expand Down Expand Up @@ -163,9 +175,9 @@
<td class="ez-relations__item-name">${contentName}</td>
<td>${contentTypeName}</td>
<td>${new Date(item.ContentInfo.Content.publishedDate).toLocaleString()}</td>
<td colspan="2"><input class="ez-relations__order-input" type="number" value="${selectedItems.length +
index +
1}" /></td>
<td colspan="2"><input class="ez-relations__order-input" type="number" value="${
selectedItems.length + index + 1
}" /></td>
</tr>
`;
};
Expand Down Expand Up @@ -216,7 +228,7 @@
};
const attachRowsEventHandlers = () => {
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;

findOrderInputs().forEach((item) => {
item.addEventListener('blur', updateSelectedItemsOrder, false);

Expand Down
16 changes: 8 additions & 8 deletions src/bundle/Resources/translations/alloy_editor.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
<note>key: embed_btn.label</note>
</trans-unit>
<trans-unit id="8527fe7f41af8879f558034d2b2cf316d20eb5e3" resname="embed_btn.udw.title">
<source>Select a content to embed</source>
<target state="new">Select a content to embed</target>
<source>Select a Content item to embed</source>
<target state="new">Select a Content item to embed</target>
<note>key: embed_btn.udw.title</note>
</trans-unit>
<trans-unit id="f646efa9564da382019a8267461d76231bb688e2" resname="embed_update_btn.label">
Expand All @@ -97,8 +97,8 @@
<note>key: embed_update_btn.label</note>
</trans-unit>
<trans-unit id="e7a9e3844a638a4ee009a878206b96c9d0af681e" resname="embed_update_btn.udw.title">
<source>Select a content to embed</source>
<target state="new">Select a content to embed</target>
<source>Select a Content item to embed</source>
<target state="new">Select a Content item to embed</target>
<note>key: embed_update_btn.udw.title</note>
</trans-unit>
<trans-unit id="841a18570b88796e700e0d0cd2f8d4e99f9e13bd" resname="heading_btn.label">
Expand All @@ -112,8 +112,8 @@
<note>key: image_btn.label</note>
</trans-unit>
<trans-unit id="392f9d82a172655fbfe702c584ca3e5880fac25e" resname="image_btn.udw.label">
<source>Select an image to embed</source>
<target state="new">Select an image to embed</target>
<source>Select an image</source>
<target state="new">Select an image</target>
<note>key: image_btn.udw.label</note>
</trans-unit>
<trans-unit id="85da4c4b98bb2f13b880845e1f5850134ace276d" resname="image_update_btn.label">
Expand All @@ -122,8 +122,8 @@
<note>key: image_update_btn.label</note>
</trans-unit>
<trans-unit id="d8edff94c5ba9f6148382057d71339ba75bc3903" resname="image_update_btn.udw.title">
<source>Select an image to embed</source>
<target state="new">Select an image to embed</target>
<source>Select an image</source>
<target state="new">Select an image</target>
<note>key: image_update_btn.udw.title</note>
</trans-unit>
<trans-unit id="15e27e2548df7ace117c1dd3b119db5798d34e9a" resname="link_edit_btn.action_row.remove">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@
<target state="new">Select Image Asset</target>
<note>key: ezimageasset.title</note>
</trans-unit>
<trans-unit id="005c6256355de38d3f5cb90b08945053ac28cf9e" resname="ezobjectrelationlist.title">
<source>Select content</source>
<target state="new">Select content</target>
<note>key: ezobjectrelationlist.title</note>
<trans-unit id="a46e5fdf25ad5fc5725b6db78274102983e65ef2" resname="ezobjectrelationlist.title.multi">
<source>Select Content item(s)</source>
<target state="new">Select Content item(s)</target>
<note>key: ezobjectrelationlist.title.multi</note>
</trans-unit>
<trans-unit id="af2bf80ec528976a55efeb36753db6ca6ca652e5" resname="ezobjectrelationlist.title.single">
<source>Select a Content item</source>
<target state="new">Select a Content item</target>
<note>key: ezobjectrelationlist.title.single</note>
</trans-unit>
<trans-unit id="2d4febe56a341671c069ff47b6e6adfd2bba005c" resname="limitation.pick.error">
<source>Failed to fetch content names</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
'allowed_content_types': allowed_content_types
}) }}"
{% endif %}
data-limit="{{limit}}"
class="ez-relations__cta-btn btn btn-primary"
type="button">
<svg class="ez-icon ez-icon--medium ez-icon--light">
Expand Down

0 comments on commit 0ab4926

Please # to comment.