Make save dropdown menu opening up in the bottom
This introduces setDropdownDirectionDown() and setDropdownDirectionUp() methods on the save component to switch between dropdown/dropup functionality. Default is dropdown, in the bottom of the page dropup is used. [MAILPOET-1448]
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
right: 0
|
right: 0
|
||||||
z-index: 1000
|
z-index: 1000
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
margin: 5px 0 0 0
|
margin: 5px 0
|
||||||
clear: both
|
clear: both
|
||||||
vertical-align: top
|
vertical-align: top
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
@@ -40,16 +40,9 @@
|
|||||||
.mailpoet_save_show_options
|
.mailpoet_save_show_options
|
||||||
padding: 6px 3px 4px
|
padding: 6px 3px 4px
|
||||||
|
|
||||||
&.mailpoet_save_show_options_active
|
|
||||||
.mailpoet_save_show_options_icon::before
|
|
||||||
content: '\f142'
|
|
||||||
|
|
||||||
.mailpoet_save_show_options_icon
|
.mailpoet_save_show_options_icon
|
||||||
vertical-align: middle
|
vertical-align: middle
|
||||||
|
|
||||||
&::before
|
|
||||||
content: '\f140'
|
|
||||||
|
|
||||||
.mailpoet_save_as_template_container,
|
.mailpoet_save_as_template_container,
|
||||||
.mailpoet_export_template_container
|
.mailpoet_export_template_container
|
||||||
border-radius(3px)
|
border-radius(3px)
|
||||||
@@ -59,7 +52,7 @@
|
|||||||
z-index: 1000
|
z-index: 1000
|
||||||
clear: both
|
clear: both
|
||||||
|
|
||||||
margin-top: 5px
|
margin: 5px 0
|
||||||
padding: 0 10px
|
padding: 0 10px
|
||||||
background-color: $white-color
|
background-color: $white-color
|
||||||
border: 1px solid $structure-border-color
|
border: 1px solid $structure-border-color
|
||||||
@@ -77,3 +70,35 @@
|
|||||||
|
|
||||||
.mailpoet_save_error
|
.mailpoet_save_error
|
||||||
color: $error-text-color
|
color: $error-text-color
|
||||||
|
|
||||||
|
.mailpoet_save_dropdown_down
|
||||||
|
.mailpoet_save_options,
|
||||||
|
.mailpoet_save_as_template_container,
|
||||||
|
.mailpoet_export_template_container
|
||||||
|
top: 100%
|
||||||
|
bottom: auto
|
||||||
|
|
||||||
|
.mailpoet_save_show_options
|
||||||
|
&.mailpoet_save_show_options_active
|
||||||
|
.mailpoet_save_show_options_icon::before
|
||||||
|
content: '\f142'
|
||||||
|
|
||||||
|
.mailpoet_save_show_options_icon
|
||||||
|
&::before
|
||||||
|
content: '\f140'
|
||||||
|
|
||||||
|
.mailpoet_save_dropdown_up
|
||||||
|
.mailpoet_save_options,
|
||||||
|
.mailpoet_save_as_template_container,
|
||||||
|
.mailpoet_export_template_container
|
||||||
|
top: auto
|
||||||
|
bottom: 100%
|
||||||
|
|
||||||
|
.mailpoet_save_show_options
|
||||||
|
&.mailpoet_save_show_options_active
|
||||||
|
.mailpoet_save_show_options_icon::before
|
||||||
|
content: '\f140'
|
||||||
|
|
||||||
|
.mailpoet_save_show_options_icon
|
||||||
|
&::before
|
||||||
|
content: '\f142'
|
||||||
|
@@ -114,6 +114,11 @@ define([
|
|||||||
|
|
||||||
Module.SaveView = Marionette.View.extend({
|
Module.SaveView = Marionette.View.extend({
|
||||||
getTemplate: function () { return window.templates.save; },
|
getTemplate: function () { return window.templates.save; },
|
||||||
|
templateContext: function () {
|
||||||
|
return {
|
||||||
|
wrapperClass: this.wrapperClass
|
||||||
|
};
|
||||||
|
},
|
||||||
events: {
|
events: {
|
||||||
'click .mailpoet_save_button': 'save',
|
'click .mailpoet_save_button': 'save',
|
||||||
'click .mailpoet_save_show_options': 'toggleSaveOptions',
|
'click .mailpoet_save_show_options': 'toggleSaveOptions',
|
||||||
@@ -125,10 +130,18 @@ define([
|
|||||||
'click .mailpoet_save_export': 'toggleExportTemplate',
|
'click .mailpoet_save_export': 'toggleExportTemplate',
|
||||||
'click .mailpoet_export_template': 'exportTemplate'
|
'click .mailpoet_export_template': 'exportTemplate'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
this.setDropdownDirectionDown();
|
||||||
App.getChannel().on('beforeEditorSave', this.beforeSave, this);
|
App.getChannel().on('beforeEditorSave', this.beforeSave, this);
|
||||||
App.getChannel().on('afterEditorSave', this.afterSave, this);
|
App.getChannel().on('afterEditorSave', this.afterSave, this);
|
||||||
},
|
},
|
||||||
|
setDropdownDirectionDown: function () {
|
||||||
|
this.wrapperClass = 'mailpoet_save_dropdown_down';
|
||||||
|
},
|
||||||
|
setDropdownDirectionUp: function () {
|
||||||
|
this.wrapperClass = 'mailpoet_save_dropdown_up';
|
||||||
|
},
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
this.validateNewsletter(App.toJSON());
|
this.validateNewsletter(App.toJSON());
|
||||||
},
|
},
|
||||||
@@ -325,9 +338,10 @@ define([
|
|||||||
|
|
||||||
App.on('start', function (BeforeStartApp) {
|
App.on('start', function (BeforeStartApp) {
|
||||||
var topSaveView = new Module.SaveView();
|
var topSaveView = new Module.SaveView();
|
||||||
BeforeStartApp._appView.showChildView('topRegion', topSaveView);
|
|
||||||
|
|
||||||
var bottomSaveView = new Module.SaveView();
|
var bottomSaveView = new Module.SaveView();
|
||||||
|
bottomSaveView.setDropdownDirectionUp();
|
||||||
|
|
||||||
|
BeforeStartApp._appView.showChildView('topRegion', topSaveView);
|
||||||
BeforeStartApp._appView.showChildView('bottomRegion', bottomSaveView);
|
BeforeStartApp._appView.showChildView('bottomRegion', bottomSaveView);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div class="mailpoet_save_wrapper">
|
<div class="mailpoet_save_wrapper {{ wrapperClass }}">
|
||||||
<div class="mailpoet_button_group">
|
<div class="mailpoet_button_group">
|
||||||
<input type="button" name="save" value="<%= __('Save') %>" class="button button-primary mailpoet_save_button" /><button class="button button-primary mailpoet_save_show_options" data-automation-id="newsletter_save_options_toggle" ><span class="dashicons mailpoet_save_show_options_icon"></span></button>
|
<input type="button" name="save" value="<%= __('Save') %>" class="button button-primary mailpoet_save_button" /><button class="button button-primary mailpoet_save_show_options" data-automation-id="newsletter_save_options_toggle" ><span class="dashicons mailpoet_save_show_options_icon"></span></button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user