|
1 | 1 | <?php |
2 | | - |
3 | | -# @Copyright 2017 Rafal Marguzewicz pceuropa.net |
4 | | - |
5 | 2 | pceuropa\sort\SortAsset::register($this); |
6 | 3 | use yii\helpers\Html; |
7 | 4 | use yii\helpers\Url; |
8 | 5 |
|
9 | 6 | $return = ''; |
10 | 7 | $el = ''; |
11 | 8 |
|
| 9 | +foreach ($list as $item){ |
12 | 10 |
|
13 | | -#print_r($items);die(); |
14 | | -foreach ($items as $item){ |
15 | | - if (isset($item['image']) ){ |
16 | | - |
17 | | - $el = Html::img( $config['image_url'] .$item['image'], ['class' => 'img-responsive', 'alt' => isset($item['name']) ? $item['name'] : '']); |
| 11 | + if ($item['image'] != null){ |
| 12 | + $el = Html::img( $config['image_url'] .$item['image'], ['class' => 'img-responsive', 'alt' => $item['name']]); |
18 | 13 | } else { |
19 | 14 | $el = Html::a ( $item['name'], $item['url'] ); |
20 | 15 | } |
|
49 | 44 |
|
50 | 45 | $this->registerJs('var config = { |
51 | 46 | group: "pclista", |
| 47 | + animation: 0, |
52 | 48 | ghostClass: "ghost", |
53 | 49 | onUpdate: function () { |
54 | | - var a = [], data = {}; |
| 50 | + var a = []; |
| 51 | + |
| 52 | + $("#lista li").each(function (){ a.push($(this)[0].id) }) |
55 | 53 | |
56 | | - $("#lista li").each(function (){ a.push($(this)[0].id) }); |
57 | | - data = { serialize: true, array: a }; |
58 | | - |
59 | 54 | $.ajax({ |
60 | | - url: '.$config["controller"].', |
| 55 | + url: document.URL, |
61 | 56 | type: "post", |
62 | 57 | dataType:"JSON", |
63 | | - data: data, |
64 | | - success: function (response) { |
65 | | - if (response.success === false) {console.log(response);} |
66 | | - if (response.success === true) { |
67 | | - $("#message_request").text(JSON.stringify(data, null, 4)); |
68 | | - $("#message_response").text(JSON.stringify(response, null, 4)); |
69 | | - console.log(response);} |
| 58 | + data: { serialize: true, array: a }, |
| 59 | + success: function (r) { |
| 60 | + if (r.success === false) {console.log(r.message);} |
70 | 61 | }, |
71 | 62 | error: function (XMLHttpRequest, textStatus, errorThrown) { |
72 | 63 | alert(textStatus); |
|
0 commit comments