Skip to content

Commit

Permalink
fix issue #871 and #859 (#873)
Browse files Browse the repository at this point in the history
* fix issue #871 and #859

* Update CHANGES.rts

* Update CHANGES.rts

* Update test_layout.robot and Test_resize

* Update test_layout_resize.robot

* Update CHANGES.rst

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update CHANGES.rst

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update CHANGES.rst

* Update test_layout_resize.robot

* Update CHANGES.rst

* Update test_layout_resize.robot

* Update CHANGES.rst

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot

* Update test_layout_resize.robot
  • Loading branch information
Mubra authored and hvelarde committed Dec 24, 2019
1 parent 4ccbe9f commit a92bc36
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ There's a frood who really knows where his towel is.
2.2.1 (unreleased)
^^^^^^^^^^^^^^^^^^

- Fix issue when we try delete a row or column in layout tab, adding auxiliary variable is defined to refer to the selected object (let le_delete = this.$le; in the case of the "delete_manager" method ), in this way always it is guaranteed that the methods are applied correctly to the indicated object. This in order to avoid ambiguities with other equal elements (fixes `#871 <https://github.com/collective/collective.cover/issues/871>`_ ).
[Mubra]

- Fix issue when we try resize a column in layout tab, adding auxiliary variable is defined to refer to the selected object(let le_resize = this.$le; in the case of the "resize_columns_manager" method),in this way always it is guaranteed that the methods are applied correctly to the indicated object. This in order to avoid ambiguities with other equal elements (fixes `#859 <https://github.com/collective/collective.cover/issues/859>`_).
[Mubra]

- A "row" object is generated and its location in the DOM is added with the even "drop.target" (fixes `#868 <https://github.com/collective/collective.cover/issues/868>`_).
[Mubra]

Expand Down
1 change: 0 additions & 1 deletion src/collective/cover/tests/test_layout.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ${tile_class} = div.cover-tile
*** Test cases ***

Test Basic Layout Operations
[Tags] Mandelbug

Enable Autologin as Site Administrator
Go to Homepage
Expand Down
36 changes: 36 additions & 0 deletions src/collective/cover/tests/test_layout_resize.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
*** Settings ***

Resource cover.robot
Library Remote ${PLONE_URL}/RobotRemote

Suite Setup Open Test Browser
Suite Teardown Close all browsers

*** Variables ***

${basic_tile_name} = "collective.cover.basic"
${size_xpath} //*[@id="content"]/div[2]/div/div@data-column-size
${text_xpath} //*[@id="column-size-resize"]/span

*** Test cases ***

Test Columns-Titles and Resize

Enable Autologin as Site Administrator
Go to Homepage
Create Cover Save-Cover Test-cover
Open Layout Tab
Add Tile ${basic_tile_name}
${data-size-before}= Get Element Attribute xpath=${size_xpath}
Click Element css=i.resizer
Wait until element is visible id=ui-id-1
${data-text-before}= Get Text xpath=${text_xpath}
Drag And Drop By Offset css=a.ui-slider-handle.ui-state-default.ui-corner-all -30 0
${data-text-after}= Get Text xpath=${text_xpath}
Should Be True """${data-text-before}""" != """${data-text-after}"""
Click Element css=.ui-dialog-titlebar-close
Save Cover Layout
Click Link link=Compose
Open Layout Tab
${data-size-after}= Get Element Attribute xpath=${size_xpath}
Should Be True """${data-size-before}""" != """${data-size-after}"""
13 changes: 7 additions & 6 deletions webpack/app/js/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ export default class LayoutView {
* manage the delete process of layout elements
**/
delete_manager(elements) {
let le_delete = this.$le;
let button = $('<button class="close">&times;</button>').css({
'font-size': '15px',
'left': '0',
Expand All @@ -355,12 +356,11 @@ export default class LayoutView {
'top': '0',
'width': '15px'
});
let onClick = function() {
let element = button.parent('div');
button.click(function() {
let element = $(this).parent('div');
element.remove();
this.$le.trigger('modified.layout');
};
button.on('click', onClick.bind(this));
le_delete.trigger('modified.layout');
});
button.hover(
function() {
$(this).parent('div').addClass('to-delete');
Expand Down Expand Up @@ -458,6 +458,7 @@ export default class LayoutView {
*
**/
resize_columns_manager(columns) {
let le_resize = this.$le;
columns = columns !== undefined ? columns : this.$le.find(`.${this.column_class}`);

let resizer = $('<i/>').addClass('resizer');
Expand All @@ -478,7 +479,7 @@ export default class LayoutView {
$('#slider').off("slide");
$('#slider').on("slide", function(event, ui) {
column.attr('data-column-size', ui.value);
le.trigger('modified.layout');
le_resize.trigger('modified.layout');
});
return false;
});
Expand Down

0 comments on commit a92bc36

Please sign in to comment.