Skip to content

Commit

Permalink
Fix layout bug. Add layout toggle example. Closing issue#1
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Desmaisons committed Aug 11, 2016
1 parent b3001fd commit 7a790dc
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 6 deletions.
8 changes: 8 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@
"vue": "^1.0.25",
"isotope": "^3.0.1",
"lodash": "^4.13.1"
},
"devDependencies": {
"isotope-cells-by-column": "^1.1.3",
"isotope-packery": "^2.0.0",
"isotope-cells-by-row": "^1.1.3",
"isotope-masonry-horizontal": "^2.0.0",
"isotope-horizontal": "^2.0.0",
"isotope-fit-columns": "^1.1.3"
}
}
2 changes: 1 addition & 1 deletion dist/vue_isotope.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions examples/metal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ <h2>Sort</h2>
<button class="button" :class="[sortOption==='original-order'? 'is-checked' : '']" @click="sort('original-order')">original order</button>
<button v-for="(key, val) in option.getSortData" class="button" :class="[key===sortOption? 'is-checked' : '']" @click="sort(key)">{{key}}</button>
</div>


<h2>Layout</h2>
<div>
<button v-for="layout in layouts" :class="[layout===currentLayout? 'is-checked' : '']" class="button" @click="changeLayout(layout)">
{{layout}}
</button>
</div>

<div id="root_isotope1">
<div v-isotope-for="element in list" :options='option' v-bind:class='[element.category]'>
Expand All @@ -41,6 +49,12 @@ <h3 class="name">{{element.name}}</h3>
<script type="text/javascript" src="..\libs\vue\dist\vue.js"></script>
<script type="text/javascript" src="..\libs\lodash\lodash.js"></script>
<script type="text/javascript" src="..\libs\isotope\isotope.pkgd.js"></script>
<script type="text/javascript" src="..\libs\isotope-cells-by-column\cells-by-column.js"></script>
<script type="text/javascript" src="..\libs\isotope-cells-by-row\cells-by-row.js"></script>
<script type="text/javascript" src="..\libs\isotope-horizontal\horizontal.js"></script>
<script type="text/javascript" src="..\libs\isotope-masonry-horizontal\masonry-horizontal.js"></script>
<script type="text/javascript" src="..\libs\isotope-fit-columns\fit-columns.js"></script>
<script type="text/javascript" src="..\libs\isotope-packery\packery-mode.pkgd.js"></script>
<script type="text/javascript" src="src\vue_isotope.js"></script>
<script type="text/javascript" src="script\metal.js"></script>

Expand Down
32 changes: 31 additions & 1 deletion examples/script/metal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ var count=0;
var vm = new Vue({
el: "#main",
data: {
layouts:[
"masonry",
"fitRows",
"cellsByRow",
"vertical",
"packery",
"masonryHorizontal",
"fitColumns",
"cellsByColumn",
"horiz"
],
currentLayout:"masonry",
list:[{
name: "Mercury",
symbol: "Hg",
Expand Down Expand Up @@ -127,6 +139,20 @@ var vm = new Vue({
number: "number",
weight: "weight",
category: "category"
},
cellsByRow: {
columnWidth: 220,
rowHeight: 220
},
masonryHorizontal: {
rowHeight: 110
},
cellsByColumn: {
columnWidth: 220,
rowHeight: 220
},
packery: {
gutter: 10
}
}
},
Expand All @@ -138,6 +164,10 @@ var vm = new Vue({
filter : function(key){
this.isotopeFilter(key);
this.filterOption=key;
}
},
changeLayout: function(key) {
this.currentLayout = key;
this.isotopeArrange({ layoutMode:key});
}
}
});
10 changes: 8 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ var mainBowerFiles = require('gulp-main-bower-files');

gulp.task('main-bower-files', function() {
return gulp.src('./bower.json')
.pipe(mainBowerFiles())
.pipe(mainBowerFiles({
includeDev:true,
overrides: {
"isotope-packery": {
main: "packery-mode.pkgd.js"
}
}
}))
.pipe(gulp.dest('./examples/libs'));
});

Expand Down Expand Up @@ -119,5 +126,4 @@ gulp.task('watch', ['connect', 'serve'], function () {
changedSpec = event.path
gulp.start('test')
});

});
4 changes: 2 additions & 2 deletions src/vue_isotope.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
isotopeShuttle: function(id){
getIso(id).shuffle();
},
isotopeArrange: function(id){
getIso(id).arrange(arguments);
isotopeArrange: function(layout, id){
getIso(id).arrange(layout);
}
});
});
Expand Down

0 comments on commit 7a790dc

Please sign in to comment.