Skip to content

Commit

Permalink
add contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Teepluss committed Mar 21, 2015
1 parent 03eec66 commit cc5e2aa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
27 changes: 5 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ echo Theme::widget('demo', array('label' => 'Demo Widget'))->render();

### Using theme global
~~~php

use Teepluss\Theme\Contracts\Theme;

class BaseController extends Controller {

/**
Expand All @@ -608,10 +611,10 @@ class BaseController extends Controller {
*
* @return void
*/
public function __construct()
public function __construct(Theme $theme)
{
// Using theme as a global.
$this->theme = Theme::uses('default')->layout('ipad');
$this->theme = $theme->uses('default')->layout('ipad');
}

}
Expand All @@ -630,26 +633,6 @@ public function getIndex()
}
~~~

## Changes

#### v1.1.2
- Bug fixed.
- Added method watchPartial to look up in main view folder.
- Fixed compress JS and CSS.
- Fixed asset URL doesn't read from config.

#### v1.0.1
- Added method "ofWithLayout" and "scopeWithLayout" to add theme prefix before look up view.
- Asset queue can use callable to group assets in one queue.
- Stop asset compression using capture.

#### v1.0.0
- Added method "asset()->cook" and "asset()->server" to prepare group of assets.
- Added method "bind" to prepare variable.
- Added method "watch" to widget.
- Added methed Theme::symlink to look up view from another theme.
- Added method Theme::share to override View::share.

## Support or Contact

If you have any problems, Contact [email protected]
Expand Down
5 changes: 5 additions & 0 deletions src/Contracts/Theme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php namespace Teepluss\Theme\Contracts;

interface Theme {

}
3 changes: 2 additions & 1 deletion src/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
use Teepluss\Theme\Compilers\TwigCompiler;
use Illuminate\View\Compilers\BladeCompiler;
use Symfony\Component\HttpFoundation\Cookie;
use Teepluss\Theme\Contracts\Theme as ThemeContract;

class Theme {
class Theme implements ThemeContract {

/**
* Theme namespace.
Expand Down
2 changes: 2 additions & 0 deletions src/ThemeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public function registerTheme()
{
return new Theme($app['config'], $app['events'], $app['view'], $app['asset'], $app['files'], $app['breadcrumb']);
});

$this->app->alias('theme', 'Teepluss\Theme\Contracts\Theme');
}

/**
Expand Down

0 comments on commit cc5e2aa

Please sign in to comment.