Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/danitoro97/druidkuma
Browse files Browse the repository at this point in the history
  • Loading branch information
danitoro97 committed May 19, 2018
2 parents 3707f07 + 5dea83b commit b3c337a
Show file tree
Hide file tree
Showing 27 changed files with 3,211 additions and 71 deletions.
3 changes: 3 additions & 0 deletions assets/AppAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ class AppAsset extends AssetBundle
public $baseUrl = '@web';
public $css = [
'css/site.css',
'plugin/easy-autocomplete.css',
'plugin/easy-autocomplete.themes.css',
];
public $js = [
'plugin/jquery.easy-autocomplete.js',
];
public $depends = [
'yii\web\YiiAsset',
Expand Down
20 changes: 20 additions & 0 deletions controllers/EquiposController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ public function actionIndex()
]);
}

public function actionEquipos($busqueda)
{
if (Yii::$app->request->isAjax) {
$equipos = Equipos::find()->where(['ilike', 'nombre', $busqueda])
->orWhere(['ilike', 'alias', $busqueda]);
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

$array = [];
foreach ($equipos->all() as $equipo) {
$array[] = [
'label' => $equipo->nombre,
//'value' => $equipo->nombre,
'value' => Url::to(['/equipos/view', 'id' => $equipo->id]),
];
}

return $array;
}
}

/**
* Muestra el equipo y sus jugadores. Si la peticion es ajax te devolvera
* los jugadores que toquen.
Expand Down
836 changes: 836 additions & 0 deletions docs/api/app-controllers-plantillausuariocontroller.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion models/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function attributeLabels()
'id' => 'ID',
'creador_id' => 'Creador ID',
'equipo_usuario_id' => 'Equipo Usuario ID',
'texto' => 'Texto',
'texto' => 'Descripcion',
'img' => 'Img',
];
}
Expand Down
2 changes: 1 addition & 1 deletion views/comentarios/_comentarios.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<p>
<?php
if (isset($model->padre_id)){
echo '#' . $nombre;
echo '#' . $model->padre->usuario->usuarios->nombre;
}
?>
<?=Html::encode($model->comentario)?>
Expand Down
4 changes: 2 additions & 2 deletions views/equipos-usuarios/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<?= $form->field($model, 'nombre')->textInput(['maxlength' => true]) ?>

<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
<?= Html::submitButton('Guardar', ['class' => 'btn btn-success']) ?>
</div>

<?php ActiveForm::end(); ?>



</div>
2 changes: 1 addition & 1 deletion views/equipos-usuarios/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* @var $this yii\web\View */
/* @var $model app\models\EquiposUsuarios */

$this->title = 'Crer Equipo';
$this->title = 'Crear Equipo';
$this->params['breadcrumbs'][] = ['label' => 'Mis Equipos', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
Expand Down
14 changes: 10 additions & 4 deletions views/equipos-usuarios/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,29 @@
<div class="container col-md-8 col-md-offset-2">
<div class="col-md-12 text-center">
<h3>Mis equipos</h3>

</div>

<div class="row">
<div class="col-md-12">


<?php
if ($model == null) {
echo $this->render('_guia');
} else {
echo Html::a('Crear equipo', ['/equipos-usuarios/create'], ['class' => 'col-xs-offset-9 btn btn-success']);
echo Html::a('Crear equipo', ['/equipos-usuarios/create'], ['class' => 'col-md-offset-10 btn btn-xs btn-success']);
}
?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?php foreach ($model as $m) : ?>
<?php foreach ($model as $equipo) : ?>
<?php
$ruta = ($m->aceptar) ? '_equiposDisponibles' : '_equiposInvitaciones';
$ruta = ($equipo->aceptar) ? '_equiposDisponibles' : '_equiposInvitaciones';
?>
<?= $this->render($ruta,['model' => $m]) ?>
<?= $this->render($ruta,['model' => $equipo]) ?>
<?php endforeach; ?>
</div>
</div>
Expand Down
19 changes: 11 additions & 8 deletions views/equipos/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
$this->registerJs($js);
$css = <<<EOT
a.disabled {
/* Make the disabled links grayish*/
color: gray;
/* And disable the pointer events */
pointer-events: none;
}
color: gray;
pointer-events: none;
}
#myCarousel {
margin-top:100px;
}
EOT;

$this->registerCss($css);
Expand All @@ -43,7 +45,8 @@
</div>
</div>
<div class="row">
<div class="col-md-5">
<?php echo $this->render('/ligas/_clasificacion', ['clasificacion' => $clasificacion, 'equipo' => $model->id]); ?>
<div class="col-md-4">

<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Indicators -->
Expand All @@ -70,9 +73,9 @@
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<?php echo $this->render('/ligas/_clasificacion', ['clasificacion' => $clasificacion, 'equipo' => $model->id]); ?>

</div>

</div>
Expand Down
52 changes: 50 additions & 2 deletions views/layouts/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use app\models\Ligas;
use app\widgets\Alert;
use yii\helpers\Url;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
Expand All @@ -13,7 +14,50 @@
use app\assets\AppAsset;

AppAsset::register($this);

$ruta = Url::to(['/equipos/equipos']);
$js = <<<EOT
var options = {
url: "$ruta",
getValue: "label",
template: {
type: "links",
fields: {
link: "value"
}
},
list: {
/*onClickEvent: function(event) {
enlace = $("#search").getSelectedItemData().value;
window.location.href = enlace;
},*/
match: {
enabled: true
},
sort: {
enabled: true
}
},
ajaxSettings: {
dataType: "json",
method: "GET",
data: {
busqueda: $(this).val()
}
},
theme: "round"
};
$("#search").easyAutocomplete(options);
EOT;

$this->registerJs($js);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
Expand Down Expand Up @@ -50,7 +94,11 @@


}

echo "<form class='navbar-form navbar-right'>
<div class='form-group has-feedback'>
<input id='search' type='text' placeholder='Buscar equipo' class='form-control'>
</div>
</form>";
$item = [
['label' => 'Inicio', 'url' => ['/noticias/index']],
['label' => 'Ligas', 'items' => $i],
Expand Down
2 changes: 1 addition & 1 deletion views/ligas/_clasificacion.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
?>

<div class="clasificacion">
<div class="col-md-offset-1 col-md-6">
<div class="col-md-offset-2 col-md-6">
<h2>Clasificacion</h2>
<?= GridView::widget([
'dataProvider' => $clasificacion,
Expand Down
2 changes: 1 addition & 1 deletion views/ligas/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$this->registerJs($js);

?>
<div class="ligas-view">
<div class="ligas-view text-center">

<h1><?= Html::encode($this->title) ?> (<?=Html::encode($model->siglas)?>)
de <?=Html::encode(ucwords(mb_strtolower($model->pais->nombre)))?>
Expand Down
2 changes: 1 addition & 1 deletion views/noticias/_noticias.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/* @var $form yii\widgets\ActiveForm */
?>

<div class="col-xs-12 col-xs-offset-1 col-md-5 noticias">
<div class="col-xs-12 col-xs-offset-0 col-md-5 noticias">
<h2><?=Html::a(Html::encode($noticia->titulo), ['noticias/view', 'id' => $noticia->id])?></h2>
<figure>
<img src="<?=Html::encode($noticia->img)?>" alt="" class="noticia-img img-responsive">
Expand Down
8 changes: 4 additions & 4 deletions views/participantes/_form.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

use app\models\Usuarios;

use yii\helpers\Html;
use yii\helpers\ArrayHelper;

use yii\widgets\ActiveForm;
use kartik\widgets\Select2;


/* @var $this yii\web\View */
/* @var $model app\models\Participantes */
Expand All @@ -15,7 +15,7 @@

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'usuarios[]')->textInput()?>
<?= $form->field($model, 'usuarios[]')->textInput(['placeholder'=>'Introduce nombre de usuario'])?>

<div class="form-group">
<?= Html::submitButton('Invitar', ['class' => 'btn btn-success']) ?>
Expand Down
9 changes: 9 additions & 0 deletions views/participantes/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
/* @var $model app\models\Participantes */

$this->title = 'Invitar al equipo ' . $equipo->nombre;
$this->params['breadcrumbs'][] = ['label' => 'Mis Equipos', 'url' => ['/equipos-usuarios/index']];
$this->params['breadcrumbs'][] = ['label' => $equipo->nombre, 'url' => ['/posts/index','id'=> $equipo->id]];
$this->params['breadcrumbs'][] = $this->title;

$this->registerJsFile('/js/participantes.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
$css = <<<EOT
input {
margin-top:10px;
}
EOT;

$this->registerCss($css);
?>
<div class="participantes-create">

Expand Down
15 changes: 12 additions & 3 deletions views/partidos/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
h2,h3 {
text-align: center;
}
input {
margin-top:10px;
border-radius: 5px;
border: 1px solid black;
}
.comentario {
text-align:center;
}
EOT;

$this->registerCss($css);
Expand Down Expand Up @@ -90,9 +99,9 @@
<?= Html::img($model->visitante->escudo, ['class' => 'img-responsive escudo']) ?>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1 comentario">
<textarea></textarea>
<input type="button" id="boton" value="Comentar">
<div class="col-md-10 col-md-offset-1 comentario ">
<input type='text'></input>
<input type="button" id="boton" value="Comentar" class="btn-xs btn-info responder">
<?php if ($model->comentarPartidos) {
echo ListView::widget([
'dataProvider' => new ActiveDataProvider([
Expand Down
Loading

0 comments on commit b3c337a

Please sign in to comment.