Translate color picker actions in newsletter editor

This commit is contained in:
Tautvidas Sipavičius
2017-02-27 19:32:08 +02:00
parent 626d6c0fa9
commit 47f5e1e7b4
3 changed files with 9 additions and 10 deletions

View File

@ -6,8 +6,9 @@
define([ define([
'backbone.marionette', 'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup', 'newsletter_editor/behaviors/BehaviorsLookup',
'mailpoet',
'spectrum' 'spectrum'
], function(Marionette, BehaviorsLookup, Spectrum) { ], function(Marionette, BehaviorsLookup, MailPoet, Spectrum) {
BehaviorsLookup.ColorPickerBehavior = Marionette.Behavior.extend({ BehaviorsLookup.ColorPickerBehavior = Marionette.Behavior.extend({
onRender: function() { onRender: function() {
@ -17,6 +18,8 @@ define([
showInitial: true, showInitial: true,
preferredFormat: "hex6", preferredFormat: "hex6",
allowEmpty: true, allowEmpty: true,
chooseText: MailPoet.I18n.t('selectColor'),
cancelText: MailPoet.I18n.t('cancelColorSelection')
}); });
}, },
}); });

View File

@ -158,6 +158,9 @@ define([
*/ */
Module.SidebarStylesView = Marionette.LayoutView.extend({ Module.SidebarStylesView = Marionette.LayoutView.extend({
getTemplate: function() { return templates.sidebarStyles; }, getTemplate: function() { return templates.sidebarStyles; },
behaviors: {
ColorPickerBehavior: {},
},
events: function() { events: function() {
return { return {
"change #mailpoet_text_font_color": _.partial(this.changeColorField, 'text.fontColor'), "change #mailpoet_text_font_color": _.partial(this.changeColorField, 'text.fontColor'),
@ -205,15 +208,6 @@ define([
initialize: function(options) { initialize: function(options) {
this.availableStyles = options.availableStyles; this.availableStyles = options.availableStyles;
}, },
onRender: function() {
this.$('.mailpoet_color').spectrum({
clickoutFiresChange: true,
showInput: true,
showInitial: true,
preferredFormat: "hex6",
allowEmpty: true,
});
},
changeField: function(field, event) { changeField: function(field, event) {
this.model.set(field, jQuery(event.target).val()); this.model.set(field, jQuery(event.target).val());
}, },

View File

@ -336,6 +336,8 @@
'newsletterBodyIsCorrupted': __('Contents of this newsletter are corrupted and may be lost, you may need to add new content to this newsletter, or create a new one. If possible, please contact us and report this issue.'), 'newsletterBodyIsCorrupted': __('Contents of this newsletter are corrupted and may be lost, you may need to add new content to this newsletter, or create a new one. If possible, please contact us and report this issue.'),
'saving': __('Saving...'), 'saving': __('Saving...'),
'unsavedChangesWillBeLost': __('There are unsaved changes which will be lost if you leave this page.'), 'unsavedChangesWillBeLost': __('There are unsaved changes which will be lost if you leave this page.'),
'selectColor': _x('Select', 'select color'),
'cancelColorSelection': _x('Cancel', 'cancel color selection'),
}) %> }) %>
<% endblock %> <% endblock %>