Skip to content

Commit 18cfd9f

Browse files
committed
Fix second view with blocked form
1 parent 6af2673 commit 18cfd9f

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/Resources/public/js/mass-edit/translate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ define([
6363
locales: locales,
6464
channels: channels,
6565
attributes: attributes,
66+
translatedAttributes: model.actions[0].translatedAttributes,
6667
sourceChannel: model.actions[0].sourceChannel,
6768
sourceLocale: model.actions[0].sourceLocale,
6869
targetChannel: model.actions[0].targetChannel,

src/Resources/public/templates/mass-edit/translate.html

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
</div>
88
<div class="AknFieldContainer-inputContainer">
99
<select name="translatedAttributes[]" id="translated-attributes" class="select2 label-field AknSettingField"
10-
multiple="multiple">
11-
<% _.each(attributes, function (attribute){ %>
12-
<option value="<%= attribute.code %>"><%- i18n.getLabel(attribute.labels, uiLocale, attribute.code) %>
13-
</option>
14-
<% }); %>
10+
multiple="multiple" <% if(translatedAttributes.length > 0){ %> readonly="true"<% } %>>
11+
<% _.each(attributes, function (attribute){ %>
12+
<option value="<%= attribute.code %>" <% if(translatedAttributes.includes(attribute.code)){ %>selected="selected"<% } %>><%- i18n.getLabel(attribute.labels, uiLocale, attribute.code) %>
13+
</option>
14+
<% }); %>
1515
</select>
1616
</div>
1717
</div>
@@ -22,10 +22,10 @@
2222
</label>
2323
</div>
2424
<div class="AknFieldContainer-inputContainer">
25-
<select name="sourceChannel" id="source-channel" class="select2 form-field label-field AknSettingField">
26-
<% _.each(channels, function (channel, key){ %>
27-
<option value="<%= channel.code %>"><%- i18n.getLabel(channel.labels, uiLocale, channel.code) %></option>
28-
<% }); %>
25+
<select name="sourceChannel" id="source-channel" class="select2 form-field label-field AknSettingField" <% if(translatedAttributes.length > 0){ %> readonly="true"<% } %>>
26+
<% _.each(channels, function (channel, key){ %>
27+
<option value="<%= channel.code %>" <% if(channel.code == sourceChannel){ %>selected="selected"<% } %>><%- i18n.getLabel(channel.labels, uiLocale, channel.code) %></option>
28+
<% }); %>
2929
</select>
3030
</div>
3131
</div>
@@ -36,10 +36,10 @@
3636
</label>
3737
</div>
3838
<div class="AknFieldContainer-inputContainer">
39-
<select name="sourceLocale" id="source-locale" class="select2 form-field label-field AknSettingField">
40-
<% _.each(locales, function (locale, key){ %>
41-
<option value="<%= locale.code %>"><%= locale.label %></option>
42-
<% }); %>
39+
<select name="sourceLocale" id="source-locale" class="select2 form-field label-field AknSettingField" <% if(translatedAttributes.length > 0){ %> readonly="true"<% } %>>
40+
<% _.each(locales, function (locale, key){ %>
41+
<option value="<%= locale.code %>" <% if(locale.code == sourceLocale){ %>selected="selected"<% } %>><%= locale.label %></option>
42+
<% }); %>
4343
</select>
4444
</div>
4545
</div>
@@ -50,10 +50,10 @@
5050
</label>
5151
</div>
5252
<div class="AknFieldContainer-inputContainer">
53-
<select name="targetChannel" id="target-channel" class="select2 form-field label-field AknSettingField">
54-
<% _.each(channels, function (channel, key){ %>
55-
<option value="<%= channel.code %>"><%- i18n.getLabel(channel.labels, uiLocale, channel.code) %></option>
56-
<% }); %>
53+
<select name="targetChannel" id="target-channel" class="select2 form-field label-field AknSettingField" <% if(translatedAttributes.length > 0){ %> readonly="true"<% } %>>
54+
<% _.each(channels, function (channel, key){ %>
55+
<option value="<%= channel.code %>" <% if(channel.code == targetChannel){ %>selected="selected"<% } %>><%- i18n.getLabel(channel.labels, uiLocale, channel.code) %></option>
56+
<% }); %>
5757
</select>
5858
</div>
5959
</div>
@@ -64,10 +64,10 @@
6464
</label>
6565
</div>
6666
<div class="AknFieldContainer-inputContainer">
67-
<select name="targetLocale" id="target-locale" class="select2 form-field label-field AknSettingField">
68-
<% _.each(locales, function (locale, key){ %>
69-
<option value="<%= locale.code %>"><%= locale.label %></option>
70-
<% }); %>
67+
<select name="targetLocale" id="target-locale" class="select2 form-field label-field AknSettingField" <% if(translatedAttributes.length > 0){ %> readonly="true"<% } %>>
68+
<% _.each(locales, function (locale, key){ %>
69+
<option value="<%= locale.code %>" <% if(locale.code == targetLocale){ %>selected="selected"<% } %>><%= locale.label %></option>
70+
<% }); %>
7171
</select>
7272
</div>
7373
</div>

0 commit comments

Comments
 (0)