From 948ebb242490092c5a7e187c3b7813134b047d5e Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 23 Jun 2015 20:47:46 -0400 Subject: Improve assets loading: remove http call to load task colors and async load of app.js --- app/Controller/App.php | 10 ---------- app/Helper/Asset.php | 15 +++++++++++++-- app/Model/Acl.php | 1 - app/Template/analytic/layout.php | 8 ++++---- app/Template/budget/index.php | 6 +++--- app/Template/layout.php | 4 ++-- tests/units/AclTest.php | 1 - 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/app/Controller/App.php b/app/Controller/App.php index 8a97e8c7..5c9c45b5 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -93,16 +93,6 @@ class App extends Base $this->response->html($this->helper->text->markdown($payload['text'])); } - /** - * Colors stylesheet - * - * @access public - */ - public function colors() - { - $this->response->css($this->color->getCss()); - } - /** * Task autocompletion (Ajax) * diff --git a/app/Helper/Asset.php b/app/Helper/Asset.php index fe285081..1b1e47c5 100644 --- a/app/Helper/Asset.php +++ b/app/Helper/Asset.php @@ -16,9 +16,9 @@ class Asset extends \Core\Base * @param string $filename Filename * @return string */ - public function js($filename) + public function js($filename, $async = false) { - return ''; + return ''; } /** @@ -48,4 +48,15 @@ class Asset extends \Core\Base return ''; } + + /** + * Get CSS for task colors + * + * @access public + * @return string + */ + public function colorCss() + { + return ''; + } } diff --git a/app/Model/Acl.php b/app/Model/Acl.php index 90944128..c9e155ed 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -21,7 +21,6 @@ class Acl extends Base 'user' => array('google', 'github'), 'task' => array('readonly'), 'board' => array('readonly'), - 'app' => array('colors'), 'webhook' => '*', 'ical' => '*', 'feed' => '*', diff --git a/app/Template/analytic/layout.php b/app/Template/analytic/layout.php index 72aab4d8..41c6a2ab 100644 --- a/app/Template/analytic/layout.php +++ b/app/Template/analytic/layout.php @@ -1,6 +1,3 @@ -asset->js('assets/js/vendor/d3.v3.min.js') ?> -asset->js('assets/js/vendor/c3.min.js') ?> -
- \ No newline at end of file + + +asset->js('assets/js/vendor/d3.v3.min.js') ?> +asset->js('assets/js/vendor/c3.min.js') ?> \ No newline at end of file diff --git a/app/Template/budget/index.php b/app/Template/budget/index.php index 3b594017..80153bbd 100644 --- a/app/Template/budget/index.php +++ b/app/Template/budget/index.php @@ -1,6 +1,3 @@ -asset->js('assets/js/vendor/d3.v3.min.js') ?> -asset->js('assets/js/vendor/c3.min.js') ?> - @@ -32,3 +29,6 @@

+ +asset->js('assets/js/vendor/d3.v3.min.js') ?> +asset->js('assets/js/vendor/c3.min.js') ?> \ No newline at end of file diff --git a/app/Template/layout.php b/app/Template/layout.php index 0d9326f4..c630132d 100644 --- a/app/Template/layout.php +++ b/app/Template/layout.php @@ -12,12 +12,12 @@ - asset->js('assets/js/app.js') ?> + asset->js('assets/js/app.js', true) ?> - asset->css($this->url->href('app', 'colors'), false, 'all') ?> asset->css('assets/css/app.css') ?> asset->css('assets/css/print.css', true, 'print') ?> + asset->colorCss() ?> asset->customCss() ?> diff --git a/tests/units/AclTest.php b/tests/units/AclTest.php index c74a90ca..72c897c0 100644 --- a/tests/units/AclTest.php +++ b/tests/units/AclTest.php @@ -37,7 +37,6 @@ class AclTest extends Base $acl = new Acl($this->container); $this->assertTrue($acl->isPublicAction('board', 'readonly')); $this->assertFalse($acl->isPublicAction('board', 'show')); - $this->assertTrue($acl->isPublicAction('app', 'colors')); $this->assertTrue($acl->isPublicAction('feed', 'project')); $this->assertTrue($acl->isPublicAction('feed', 'user')); } -- cgit v1.2.3