Skip to content

Commit

Permalink
Merge pull request #13 from bluzphp/develop
Browse files Browse the repository at this point in the history
Migrated to new skeleton
  • Loading branch information
Anton authored Nov 6, 2017
2 parents 648698d + d5e5cca commit 02dc769
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion application/modules/media/views/crud.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<?php endif; ?>
</div>
<?php if (0 === strpos($row->type, 'image')) : ?>
<a href="<?=$this->baseUrl($row->file)?>" class="thumbnail bluz-preview">
<a href="<?=$this->baseUrl($row->file)?>" class="thumbnail" data-ajax-preview>
<img src="<?=$this->baseUrl($row->thumb?:$row->file)?>" class="d-flex ml-3" alt="<?=$row->title?>" />
</a>
<?php endif; ?>
Expand Down
10 changes: 5 additions & 5 deletions application/modules/media/views/grid.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ if (!$grid) {
<div class="card-deck">
<?php foreach ($grid->getData() as $row) : ?>
<div class="card mb-3" style="min-width: 240px; max-width: 240px">
<a href="<?= $this->baseUrl($row['file']) ?>" class="bluz-preview">
<a href="<?= $this->baseUrl($row['file']) ?>" data-ajax-preview>
<img class="card-img-top" src="<?= $this->baseUrl($row['thumb']) ?>" alt="<?= esc($row['title']) ?>">
</a>
<div class="card-body">
<div class="d-flex justify-content-end">
<h4 class="card-title mr-auto p-2"><?= esc($row['title']) ?></h4>
<a href="<?= $this->url('media', 'crud', ['id' => $row['id']]) ?>"
class="btn btn-xs btn-primary dialog align-self-start mr-2"
data-ajax-method="get" data-modal-style="modal-lg">
class="btn btn-primary align-self-start mr-2"
data-ajax-dialog data-ajax-method="get" data-modal-style="modal-lg">
<i class="fa fa-pencil"></i>
</a>
<a href="<?= $this->url('media', 'crud', ['id' => $row['id']]) ?>"
class="confirm btn btn-xs btn-danger ajax align-self-start" data-ajax-method="delete">
class="btn btn-danger align-self-start" data-confirm data-ajax data-ajax-method="delete">
<i class="fa fa-trash-o"></i>
</a>
</div>
Expand All @@ -67,7 +67,7 @@ if (!$grid) {
</div>
<?php endforeach; ?>
</div>
<hr style="display: block; clear: both"/>
<hr/>
<?= $this->partial('grid/total.phtml', ['grid' => $grid]) ?>
<?= $this->partial('grid/pagination.phtml', ['grid' => $grid]) ?>
</div>
12 changes: 6 additions & 6 deletions application/modules/media/views/manager.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ echo $this->style('css/media.css');
<div class="d-flex justify-content-end">
<h4 class="card-title mr-auto p-2"><?= esc($row['title']) ?></h4>
<a href="<?= $this->url('media', 'crud', ['id' => $row['id']]) ?>"
class="btn btn-xs btn-primary dialog align-self-start mr-2"
data-ajax-method="get" data-modal-style="modal-lg">
class="btn btn-primary align-self-start mr-2"
data-ajax-dialog data-ajax-method="get" data-modal-style="modal-lg">
<i class="fa fa-pencil"></i>
</a>
<a href="<?= $this->url('media', 'crud', ['id' => $row['id']]) ?>"
class="confirm btn btn-xs btn-danger ajax align-self-start" data-ajax-method="delete">
class="btn btn-danger align-self-start" data-confirm data-ajax data-ajax-method="delete">
<i class="fa fa-trash-o"></i>
</a>
</div>
Expand All @@ -64,12 +64,12 @@ echo $this->style('css/media.css');
<div class="d-flex justify-content-end">
<h4 class="card-title mr-auto p-2" data-dz-name></h4>
<a href="<?= $this->url('media', 'crud') ?>"
class="btn btn-xs btn-primary dialog align-self-start mr-2"
data-ajax-method="get" data-modal-style="modal-lg">
class="btn btn-primary align-self-start mr-2"
data-ajax-dialog data-ajax-method="get" data-modal-style="modal-lg">
<i class="fa fa-pencil"></i>
</a>
<a href="<?= $this->url('media', 'crud') ?>"
class="confirm btn btn-xs btn-danger ajax align-self-start" data-ajax-method="delete">
class="btn btn-danger align-self-start" data-confirm data-ajax data-ajax-method="delete">
<i class="fa fa-trash-o"></i>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion public/js/bluz.media.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ define(['jquery', 'bluz', 'bluz.notify', 'dropzone'], function ($, bluz, notify,
});

// hookup for delete click
media.$previews.on('success.bluz.ajax', 'a.confirm.ajax[data-ajax-method=delete]', function () {
media.$previews.on('success.bluz.ajax', 'a[data-ajax-method=delete]', function () {
$(this).parents('div.image-preview').remove();
});
};
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/modules/media/controllers/CrudTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@
*/
class CrudTest extends ControllerTestCase
{
/**
* Drop photo after the test
*/
public static function tearDownAfterClass()
{
Db::delete('media')->where('userId', [1])->execute();
$path = Config::getModuleData('media', 'upload_path').'/1';
Tools\Cleaner::delete($path);
}

/**
* setUp
*
Expand All @@ -54,6 +44,16 @@ public function setUp()
Auth::setIdentity(new UserHasPermission(UserFixtureContainer::$fixture));
}

/**
* Drop photo after the test
*/
public static function tearDownAfterClass()
{
Db::delete('media')->where('userId = ?', 1)->execute();
$path = Config::getModuleData('media', 'upload_path').'/1';
Tools\Cleaner::delete($path);
}

/**
* Test upload file
*/
Expand Down

0 comments on commit 02dc769

Please sign in to comment.