[DE mobile] Custom Color (paragraph)

This commit is contained in:
Julia Svinareva 2019-10-08 14:16:46 +03:00
parent 098f8995b7
commit d3a039f6b0
2 changed files with 54 additions and 1 deletions

View file

@ -184,4 +184,20 @@
</div>
</div>
</div>
</div>
<!-- Custom color view -->
<div id="edit-paragraph-custom-color-view">
<div class="navbar">
<div class="navbar-inner" data-page="edit-paragraph-custom-color">
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
<div class="center sliding"><%= scope.textCustomColor %></div>
<div class="right"><% if (phone) { %><a href="#" class="link icon-only close-picker"><i class="icon icon-expand-down"></i></a><% } %></div>
</div>
</div>
<div class="page" data-page="edit-paragraph-custom-color">
<div class="page-content">
<!--Color HSB palette-->
</div>
</div>
</div>

View file

@ -150,6 +150,24 @@ define([
el: $('.page[data-page=edit-paragraph-color] .page-content'),
transparent: true
});
this.paletteBackgroundColor.on('customcolor', function () {
me.showCustomColor();
});
var template = _.template(['<div class="list-block">',
'<ul>',
'<li>',
'<a id="edit-paragraph-add-custom-color" class="item-link">',
'<div class="item-content">',
'<div class="item-inner">',
'<div class="item-title"><%= scope.textAddCustomColor %></div>',
'</div>',
'</div>',
'</a>',
'</li>',
'</ul>',
'</div>'].join(''));
$('.page[data-page=edit-paragraph-color] .page-content').append(template({scope: this}));
$('#edit-paragraph-add-custom-color').single('click', _.bind(this.showCustomColor, this));
Common.Utils.addScrollIfNeed('.page[data-page=edit-paragraph-color]', '.page[data-page=edit-paragraph-color] .page-content');
this.fireEvent('page:show', [this, '#edit-paragraph-color']);
@ -160,6 +178,23 @@ define([
Common.Utils.addScrollIfNeed('.page[data-page=edit-paragraph-advanced]', '.page[data-page=edit-paragraph-advanced] .page-content');
},
showCustomColor: function () {
var me = this,
selector = '#edit-paragraph-custom-color-view';
me.showPage(selector, true);
me.customColorPicker = new Common.UI.HsbColorPicker({
el: $('.page[data-page=edit-paragraph-custom-color] .page-content'),
color: me.paletteBackgroundColor.currentColor
});
me.customColorPicker.on('addcustomcolor', function (colorPicker, color) {
me.paletteBackgroundColor.addNewDynamicColor(colorPicker, color);
DE.getController('EditContainer').rootView.router.back();
});
me.fireEvent('page:show', [me, selector]);
},
textBackground: 'Background',
textAdvSettings: 'Advanced settings',
textPrgStyles: 'Paragraph styles',
@ -174,7 +209,9 @@ define([
textPageBreak: 'Page Break Before',
textOrphan: 'Orphan Control',
textKeepLines: 'Keep Lines Together',
textKeepNext: 'Keep with Next'
textKeepNext: 'Keep with Next',
textAddCustomColor: 'Add Custom Color',
textCustomColor: 'Custom Color'
}
})(), DE.Views.EditParagraph || {}))
});