2017 © Pedro Peláez
 

yii2-extension yii2masonry

Yii2 Masonry Integration for Yii2

image

philippfrenzel/yii2masonry

Yii2 Masonry Integration for Yii2

  • Monday, January 4, 2016
  • by philippfrenzel
  • Repository
  • 2 Watchers
  • 12 Stars
  • 6,755 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 2 Open issues
  • 6 Versions
  • 13 % Grown

The README.md

yii2masonry, (*1)

===============, (*2)

Widget for masonry.js pinterest like layout container for Yii Framework 2 Original sources for the jquery plugin: http://masonry.desandro.com/, (*3)

Latest Stable Version Build Status Code Climate Version Eye License, (*4)

How to install?

Get it via composer by adding the package to your composer.json:, (*5)

{
  "require": {
    "philippfrenzel/yii2masonry": "*"
  }
}

And ensure, that you have the follwing plugin installed global:, (*6)

php composer.phar global require "fxp/composer-asset-plugin:~1.0", (*7)

Due to limitations of fxp/composer-asset-plugin you also need to add the following section to the "extra" section of your composer.json, (*8)

"asset-repositories": [
  {
    "name": "bower-asset/eventemitter",
    "type": "bower-vcs",
    "url": "git://github.com/Wolfy87/EventEmitter.git"
  }
]

You may also check the package information on packagist., (*9)

Usage

On a page with a ListView, just add:, (*10)


[ 'columnWidth' => 50, 'itemSelector' => '.item' ] ]); ?> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div> <div class="item"><h3>Test</h3><p>Und mehr Text</p></div>

CSS, (*11)

Size of columns can be defined within css, (*12)

  .item { width: 25%; } 
  .item.w2 { width: 50%; }

If you have a sidebar resizeble by a button you need to reload the masonry container adding these following code:, (*13)

<?php
$script = <<< JS
    $('a#menu_toggle').on('click', function() {
        $('.js-masonry').masonry();
    });
JS;
$this->registerJs($script, View::POS_READY);
?>

My button have an ID name #menu_toggle, (*14)

INFINITE SCROLL Sample:, (*15)

use yii\helpers\Html;
use yii\widgets\ListView;
use yii\web\JsExpression;
use yii\widgets\Pjax;

/* @var $this yii\web\View */
/* @var $searchModel app\models\PolizzenserviceSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$script = <<<SKRIPT
$('#boxes').on('infinitescroll:afterRetrieve', function(){
    msnryWgArbeiten.masonry('reloadItems');
    mscontainerWgArbeiten.imagesLoaded(function(){ msnryWgArbeiten.masonry() });
});

$(document).on('submit', '#WgArbeitenSearchform', function(event) {
  $.pjax.submit(event, '#WgArbeitenPjaxContainer')
});
SKRIPT;
$this->registerJs($script);

?>

 'WgArbeiten',
    'clientOptions' => [
        'columnWidth' => 20,
        'itemSelector' => '.flowers'
    ]
]); ?>



'WgArbeitenPjaxContainer']); ?> render('@app/views/arbeiten/_search', ['model' => $searchModel]); ?> = \yii\widgets\ListView::widget([ 'dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'flowers'], 'itemView' => '@app/views/arbeiten/iviews/_view', 'summary' => false, 'layout' => '{items}
{pager}
' ]); ?> '.flowers', 'paginationSelector' => '.pagination', 'containerSelector' => '#WgArbeitenPjaxContainer', 'pjaxContainer' => $pjax->id, 'pagination' => $dataProvider->pagination, ]); ?>

The Versions

04/01 2016

dev-master

9999999-dev http://www.frenzel.net/

Yii2 Masonry Integration for Yii2

  Sources   Download

MIT

The Requires

  • yiisoft/yii2 *
  • bower-asset/imagesloaded *
  • php >=5.4.0
  • bower-asset/masonry 3.*
  • bower-asset/eventemitter 4.*
  • bower-asset/outlayer 1.*

 

The Development Requires

yii2 masonry

27/05 2015

1.1.4

1.1.4.0 http://www.frenzel.net/

Yii2 Masonry Integration for Yii2

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • yiisoft/yii2 *
  • bower-asset/masonry 3.*
  • bower-asset/imagesloaded *
  • bower-asset/eventemitter 4.*
  • bower-asset/outlayer 1.*

 

The Development Requires

yii2 masonry

19/02 2015

1.1.3

1.1.3.0 http://www.frenzel.net/

Yii2 Masonry Integration for Yii2

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • yiisoft/yii2 *
  • bower-asset/masonry ^3.2
  • bower-asset/imagesloaded *
  • bower-asset/eventemitter ^4.2
  • bower-asset/outlayer ^1.3

 

The Development Requires

yii2 masonry

21/01 2015

1.1.1

1.1.1.0 http://www.frenzel.net/

Yii2 Masonry Integration for Yii2

  Sources   Download

MIT License

The Requires

 

yii2 masonry

21/01 2015

1.1

1.1.0.0 http://www.frenzel.net/

Yii2 Masonry Integration for Yii2

  Sources   Download

MIT License

The Requires

 

yii2 masonry

21/01 2015

1.0

1.0.0.0 http://www.frenzel.net/

Yii2 Masonry Integration for Yii2

  Sources   Download

MIT License

The Requires

 

yii2 masonry