Repository: airavata-php-gateway Updated Branches: refs/heads/master bdbcd9bc5 -> 014bbe926
Theming addition. Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/46104a41 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/46104a41 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/46104a41 Branch: refs/heads/master Commit: 46104a4129cbbaca097e6c4afced1695412836df Parents: dfc41b6 Author: Nipurn Doshi <[email protected]> Authored: Thu Sep 10 15:31:42 2015 -0400 Committer: Nipurn Doshi <[email protected]> Committed: Thu Sep 10 15:31:42 2015 -0400 ---------------------------------------------------------------------- app/config/app.php | 2 + app/config/packages/teepluss/theme/config.php | 143 +++++++++++++++++++++ app/config/packages/teepluss/theme/twig.php | 56 ++++++++ composer.json | 3 +- 4 files changed, 203 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/46104a41/app/config/app.php ---------------------------------------------------------------------- diff --git a/app/config/app.php b/app/config/app.php index efbfed8..bc79a65 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -123,6 +123,7 @@ return array( 'Illuminate\Workbench\WorkbenchServiceProvider', 'Wsis\WsisServiceProvider', 'Airavata\AiravataServiceProvider', + 'Teepluss\Theme\ThemeServiceProvider', ), /* @@ -191,6 +192,7 @@ return array( 'View' => 'Illuminate\Support\Facades\View', 'WSIS' => 'Wsis\Facades\Wsis', 'Airavata' => 'Airavata\Facades\Airavata', + 'Theme' => 'Teepluss\Theme\Facades\Theme', ), ); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/46104a41/app/config/packages/teepluss/theme/config.php ---------------------------------------------------------------------- diff --git a/app/config/packages/teepluss/theme/config.php b/app/config/packages/teepluss/theme/config.php new file mode 100644 index 0000000..a0631cd --- /dev/null +++ b/app/config/packages/teepluss/theme/config.php @@ -0,0 +1,143 @@ +<?php + +return array( + + /* + |-------------------------------------------------------------------------- + | Asset url path + |-------------------------------------------------------------------------- + | + | The path to asset, this config can be cdn host. + | eg. http://cdn.domain.com + | + */ + + 'assetUrl' => URL::to('/'), + + /* + |-------------------------------------------------------------------------- + | Asset compression path + |-------------------------------------------------------------------------- + | + | The path to compress assets after at public directory. + | + */ + + 'compressDir' => 'cache', + + /* + |-------------------------------------------------------------------------- + | Force compress assets + |-------------------------------------------------------------------------- + | + | This forces Theme to (re)compile compression assets on every invocation. + | By default this is FALSE. This is handy for development and debugging, + | It should never be used in a production environment. + | + */ + + 'forceCompress' => false, + + /* + |-------------------------------------------------------------------------- + | Capture asset compression + |-------------------------------------------------------------------------- + | + | When you queue asset to be compression, normally It read your file(s) + | everytime, but on production you can stop the process by set capture + | true, this will be increase performance. + | + | eg. (App::environment() == 'production') ? true : false + | + */ + + 'assetCapture' => false, + + /* + |-------------------------------------------------------------------------- + | Theme Default + |-------------------------------------------------------------------------- + | + | If you don't set a theme when using a "Theme" class the default theme + | will replace automatically. + | + */ + + 'themeDefault' => 'default', + + /* + |-------------------------------------------------------------------------- + | Layout Default + |-------------------------------------------------------------------------- + | + | If you don't set a layout when using a "Theme" class the default layout + | will replace automatically. + | + */ + + 'layoutDefault' => 'default', + + /* + |-------------------------------------------------------------------------- + | Path to lookup theme + |-------------------------------------------------------------------------- + | + | The root path contains themes collections. + | + */ + + 'themeDir' => 'themes', + + /* + |-------------------------------------------------------------------------- + | A pieces of theme collections + |-------------------------------------------------------------------------- + | + | Inside a theme path we need to set up directories to + | keep "layouts", "assets" and "partials". + | + */ + + 'containerDir' => array( + 'layout' => 'layouts', + 'asset' => 'assets', + 'partial' => 'partials', + 'widget' => 'widgets', + 'view' => 'views' + ), + + /* + |-------------------------------------------------------------------------- + | Listener from events + |-------------------------------------------------------------------------- + | + | You can hook a theme when event fired on activities + | this is cool feature to set up a title, meta, default styles and scripts. + | + */ + + 'events' => array( + + // Before all event, this event will effect for global. + 'before' => function($theme) + { + //$theme->setTitle('Something in global.'); + }, + + // This event will fire as a global you can add any assets you want here. + 'asset' => function($asset) + { + // Preparing asset you need to serve after. + $asset->cook('backbone', function($asset) + { + $asset->add('backbone', '//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js'); + $asset->add('underscorejs', '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js'); + }); + + // To use cook 'backbone' you can fire with 'serve' method. + // Theme::asset()->serve('backbone'); + } + + ) + +); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/46104a41/app/config/packages/teepluss/theme/twig.php ---------------------------------------------------------------------- diff --git a/app/config/packages/teepluss/theme/twig.php b/app/config/packages/teepluss/theme/twig.php new file mode 100644 index 0000000..76a6034 --- /dev/null +++ b/app/config/packages/teepluss/theme/twig.php @@ -0,0 +1,56 @@ +<?php + +return array( + + /* + |-------------------------------------------------------------------------- + | PHP alow in twig + |-------------------------------------------------------------------------- + | + | This is laravel alias to allow in twig compiler + | The list all of methods is at /app/config/app.php + | + */ + + 'allows' => array( + 'Auth', + 'Cache', + 'Config', + 'Cookie', + 'Form', + 'HTML', + 'Input', + 'Lang', + 'Paginator', + 'Str', + 'Theme', + 'URL', + 'Validator' + ), + + /* + |-------------------------------------------------------------------------- + | PHP alow in twig + |-------------------------------------------------------------------------- + | + | This is laravel alias to allow in twig compiler + | The list all of methods is at /app/config/app.php + | + */ + + 'hooks' => function($twig) + { + // Example add funciton name "demo". + /*$function = new Twig_SimpleFunction('example', function() + { + $args = func_get_args(); + + return "Example" . print_r($args, true); + }); + + $twig->addFunction($function);*/ + + return $twig; + } + +); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/46104a41/composer.json ---------------------------------------------------------------------- diff --git a/composer.json b/composer.json index 8fdfe81..d8978db 100755 --- a/composer.json +++ b/composer.json @@ -4,7 +4,8 @@ "keywords": ["framework", "laravel"], "license": "MIT", "require": { - "laravel/framework": "4.2.*" + "laravel/framework": "4.2.*", + "teepluss/theme": "1.*@dev" }, "autoload": { "classmap": [
