Skip to content

Commit e64dd12

Browse files
committed
fix variables names
1 parent 9383cce commit e64dd12

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

views/sort.php

100644100755
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
<?php
2+
3+
# @Copyright 2017 Rafal Marguzewicz pceuropa.net
4+
25
pceuropa\sort\SortAsset::register($this);
36
use yii\helpers\Html;
47
use yii\helpers\Url;
58

69
$return = '';
710
$el = '';
811

9-
foreach ($list as $item){
1012

11-
if ($item['image'] != null){
12-
$el = Html::img( $config['image_url'] .$item['image'], ['class' => 'img-responsive', 'alt' => $item['name']]);
13+
#print_r($items);die();
14+
#
15+
foreach ($items as $item){
16+
if (isset($item['image_name']) ){
17+
18+
$el = Html::img( $config['image_url'] .$item['image_name'], ['class' => 'img-responsive', 'alt' => isset($item['image_name']) ? $item['image_name'] : '']);
1319
} else {
14-
$el = Html::a ( $item['name'], $item['url'] );
20+
$el = Html::a ( $item['title'], $item['url'] );
1521
}
1622

1723
$row = '<div class="row">
@@ -44,20 +50,24 @@
4450

4551
$this->registerJs('var config = {
4652
group: "pclista",
47-
animation: 0,
4853
ghostClass: "ghost",
4954
onUpdate: function () {
50-
var a = [];
51-
52-
$("#lista li").each(function (){ a.push($(this)[0].id) })
55+
var a = [], data = {};
5356
57+
$("#lista li").each(function (){ a.push($(this)[0].id) });
58+
data = { serialize: true, array: a };
59+
5460
$.ajax({
55-
url: document.URL,
61+
url: '.$config["controller"].',
5662
type: "post",
5763
dataType:"JSON",
58-
data: { serialize: true, array: a },
59-
success: function (r) {
60-
if (r.success === false) {console.log(r.message);}
64+
data: data,
65+
success: function (response) {
66+
if (response.success === false) {console.log(response);}
67+
if (response.success === true) {
68+
$("#message_request").text(JSON.stringify(data, null, 4));
69+
$("#message_response").text(JSON.stringify(response, null, 4));
70+
console.log(response);}
6171
},
6272
error: function (XMLHttpRequest, textStatus, errorThrown) {
6373
alert(textStatus);

0 commit comments

Comments
 (0)