Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

L5 fix #252

Open
wants to merge 6 commits into
base: version3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
],
"require": {
"php": ">=5.3.0",
"illuminate/support": "4.*",
"illuminate/view": "4.*",
"illuminate/config": "4.*"
"illuminate/support": "~5.0",
"illuminate/view": "~5.0",
"illuminate/config": "~5.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
Expand Down
13 changes: 11 additions & 2 deletions src/Chumper/Datatable/DatatableServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ class DatatableServiceProvider extends ServiceProvider {
*/
protected $defer = false;

/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->package('chumper/datatable');
$this->publishes([
__DIR__.'/../../config/config.php' => config_path('packages/chumper_datatable.php'),
]);

$this->loadViewsFrom(__DIR__.'/../../', 'Chumper');
}

/**
Expand All @@ -40,4 +49,4 @@ public function provides()
return array('datatable');
}

}
}
2 changes: 1 addition & 1 deletion src/Chumper/Datatable/Engines/BaseEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ abstract class BaseEngine {
function __construct()
{
$this->columns = new Collection();
$this->config = Config::get('datatable::engine');
$this->config = Config::get('chumper_datatable.engine');
$this->setExactWordSearch( $this->config['exactWordSearch'] );
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Chumper/Datatable/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Table {

function __construct()
{
$this->config = Config::get('datatable::table');
$this->config = Config::get('packages.chumper_datatable.table');

$this->setId( $this->config['id'] );
$this->setClass( $this->config['class'] );
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
|
*/

'table_view' => 'datatable::template',
'table_view' => 'Chumper::views.template',


/*
Expand All @@ -106,7 +106,7 @@
|
*/

'script_view' => 'datatable::javascript',
'script_view' => 'Chumper::views.javascript',


),
Expand Down
8 changes: 4 additions & 4 deletions src/views/javascript.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<script type="text/javascript">
jQuery(document).ready(function(){
// dynamic table
oTable = jQuery('#{{ $id }}').dataTable({
oTable = jQuery('#{!! $id !!}').dataTable({

@foreach ($options as $k => $o)
{{ json_encode($k) }}: @if(!is_array($o)) @if(preg_match("/function/", $o)) {{ $o }} @else {{ json_encode($o) }}, @endif
{!! json_encode($k) !!}: @if(!is_array($o)) @if(preg_match("/function/", $o)) {!! $o !!} @else {!! json_encode($o) !!}, @endif
@else
[{
@foreach ($o as $x => $r)
{{ json_encode($x) }}: @if(is_array($r)) {{ json_encode($r) }}, @elseif(preg_match("/function/", $r)) {{ $r }}, @else {{ json_encode($r) }} @endif
{!! json_encode($x) !!}: @if(is_array($r)) {!! json_encode($r) !!}, @elseif(preg_match("/function/", $r)) {!! $r !!}, @else {!! json_encode($r) !!} @endif
@endforeach
}],
@endif

@endforeach

@foreach ($callbacks as $k => $o)
{{ json_encode($k) }}: {{ $o }},
{!! json_encode($k) !!}: {!! $o !!},
@endforeach

});
Expand Down
2 changes: 1 addition & 1 deletion src/views/template.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
</table>

@if (!$noScript)
@include(Config::get('datatable::table.script_view'), array('id' => $id, 'options' => $options, 'callbacks' => $callbacks))
@include(Config::get('packages.chumper_datatable.table.script_view'), array('id' => $id, 'options' => $options, 'callbacks' => $callbacks))
@endif
4 changes: 2 additions & 2 deletions tests/DatatableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class DatatableTest extends PHPUnit_Framework_TestCase {
protected function setUp()
{
// set up config
Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
);
Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::table")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.table")->andReturn(
array(
'class' => 'table table-bordered',
'id' => '',
Expand Down
2 changes: 1 addition & 1 deletion tests/Engines/BaseEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BaseEngineTest extends TestCase {
public function setUp()
{
// set up config
Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/Engines/CollectionEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class CollectionEngineTest extends TestCase {

public function setUp()
{
Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
);

parent::setUp();

Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/Engines/QueryEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QueryEngineTest extends PHPUnit_Framework_TestCase {
public function setUp()
{

Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.engine")->andReturn(
array(
'exactWordSearch' => false,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected function setUp()
{
parent::setUp();

Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::table")->andReturn(
Config::shouldReceive('get')->zeroOrMoreTimes()->with("chumper_datatable.table")->andReturn(
array(
'class' => 'table table-bordered',
'id' => '',
Expand Down