For a desktop/ mobile layout i created a 25/50/25 homebox layout. On mobile layouts all columns have 100% width and the middle column should be on top of all other columns. On desktop layout the three columns are displayed as usual - floating left to each other..

To achieve my desired mobile layout - i buildt the markup manually and ordered the elements in following manner: (just duplicated the markup created by standard for-each loop and added correct ids/ classes)

  • homebox-column-wrapper-2
  • homebox-column-wrapper-1
  • homebox-column-wrapper-3

With the help of some CSS and negative margins the layout works as expected.

But after dragging a box to another region / auto-saving and reloading the page, the blocks are not on the position they should be.

Move block from right to center
move to center

Position of block after saving
box not in center

i already checked all my DOM-id and the rest of the markup - if i put the "manual markup" in the correct order everything is working fine here.

Thx for your help.
SteffenR

Comments

steffenr’s picture

Issue summary: View changes

changed image pathes

steffenr’s picture

StatusFileSize
new147.65 KB
new160.32 KB

Add screenshot images

steffenr’s picture

Issue summary: View changes

Image pathes

steffenr’s picture

Issue summary: View changes

uploaded image to drupal.org

stborchert’s picture

Simple fix in line 46 of homebox.js:
Before:
colIndex = colIndex + 1;
After:
colIndex = $(this).attr('id').replace(/homebox-column-/, '');

After making this change the blocks are saved in the correct region again.

drumm’s picture

Status: Active » Needs work

Looks like a good change. I think we can go ahead and remove colIndex as a parameter, and declare it as a var, maybe with a better name.

drumm’s picture

Category: support » bug
steffenr’s picture

StatusFileSize
new721 bytes

Hi stborchert,

thx for sharing your simple fix. Attached you'll find a patch i did against the latest DEV of the module.

SteffenR

steffenr’s picture

Status: Needs work » Needs review
stborchert’s picture

Status: Needs review » Needs work
+++ b/homebox.jsundefined
@@ -40,10 +40,10 @@
+          var blocks = {}, colIndex;
           Drupal.homebox.$columns.each(function (colIndex) {

colIndex is now defined twice (as var and as parameter).
I guess changing the name to "regionIndex" or something similar would be good since this is exactly whats its meant to be ;)

steffenr’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB

Hi stborchert - attached you find an updated patch solving the issue you mentioned.

SteffenR

stborchert’s picture

Status: Needs review » Fixed

Thanks for the patch. Committed to 7.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

changed wording for better understanding