Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2056 #2087

Merged
merged 4 commits into from Sep 15, 2015
Merged

Fix #2056 #2087

merged 4 commits into from Sep 15, 2015

Conversation

ralsina
Copy link
Member

@ralsina ralsina commented Sep 15, 2015

A few minor changes:

  1. Add padding between rows because without it it looked awful
  2. Spread the width slack among image containers to get even rows

@Kwpolska
Copy link
Member

Your editor ruined the indentation. Here’s a better diff, courtesy of ?w=1:

                 // Create a new row div, add class, append the htmls and insert the flowy items
                 var $row = $('<div>').addClass(settings.rowClassName);
+                var slack = $this[0].clientWidth - rowData.width - 2 * settings.padding
                 for (i = 0; i < rowData.data.length; i++) {
                     var displayData = rowData.data[i];
                     // Get the HTML object from custom render function passed as argument
                     var displayObject = settings.render.call($this, displayData);
                     displayObject = $(displayObject);
+                    extraw = Math.floor(slack/rowData.data.length)
+                    if (i == 0) {
+                        extraw += slack % rowData.data.length
+                    }
                     // Set some basic stuff
                     displayObject
-                       .css( 'width', displayData.width )
+                        .css('width', displayData.width + extraw)
                         .css('height', displayData.height)
+                        .css('margin-bottom', settings.padding + "px")
                         .css('margin-left', i == 0 ? '0' : settings.padding + "px"); //TODO:Refactor
                     $row.append(displayObject);

And with this, I guess it looks okay.

@ralsina
Copy link
Member Author

ralsina commented Sep 15, 2015

Actually, I reindented the file because it was horrible to edit :-P

ralsina added a commit that referenced this pull request Sep 15, 2015
@ralsina ralsina merged commit acd7b15 into master Sep 15, 2015
@ralsina ralsina deleted the fix-2056 branch September 15, 2015 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants