Improve assets loading: remove http call to load task colors and async load of app.js
This commit is contained in:
@@ -93,16 +93,6 @@ class App extends Base
|
|||||||
$this->response->html($this->helper->text->markdown($payload['text']));
|
$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)
|
* Task autocompletion (Ajax)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ class Asset extends \Core\Base
|
|||||||
* @param string $filename Filename
|
* @param string $filename Filename
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function js($filename)
|
public function js($filename, $async = false)
|
||||||
{
|
{
|
||||||
return '<script type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>';
|
return '<script '.($async ? 'async' : '').' type="text/javascript" src="'.$filename.'?'.filemtime($filename).'"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,4 +48,15 @@ class Asset extends \Core\Base
|
|||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get CSS for task colors
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function colorCss()
|
||||||
|
{
|
||||||
|
return '<style>'.$this->color->getCss().'</style>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class Acl extends Base
|
|||||||
'user' => array('google', 'github'),
|
'user' => array('google', 'github'),
|
||||||
'task' => array('readonly'),
|
'task' => array('readonly'),
|
||||||
'board' => array('readonly'),
|
'board' => array('readonly'),
|
||||||
'app' => array('colors'),
|
|
||||||
'webhook' => '*',
|
'webhook' => '*',
|
||||||
'ical' => '*',
|
'ical' => '*',
|
||||||
'feed' => '*',
|
'feed' => '*',
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
<?= $this->asset->js('assets/js/vendor/d3.v3.min.js') ?>
|
|
||||||
<?= $this->asset->js('assets/js/vendor/c3.min.js') ?>
|
|
||||||
|
|
||||||
<section id="main">
|
<section id="main">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -32,4 +29,7 @@
|
|||||||
<?= $content_for_sublayout ?>
|
<?= $content_for_sublayout ?>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<?= $this->asset->js('assets/js/vendor/d3.v3.min.js') ?>
|
||||||
|
<?= $this->asset->js('assets/js/vendor/c3.min.js') ?>
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
<?= $this->asset->js('assets/js/vendor/d3.v3.min.js') ?>
|
|
||||||
<?= $this->asset->js('assets/js/vendor/c3.min.js') ?>
|
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2><?= t('Budget overview') ?></h2>
|
<h2><?= t('Budget overview') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,3 +29,6 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p class="alert"><?= t('There is not enough data to show something.') ?></p>
|
<p class="alert"><?= t('There is not enough data to show something.') ?></p>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?= $this->asset->js('assets/js/vendor/d3.v3.min.js') ?>
|
||||||
|
<?= $this->asset->js('assets/js/vendor/c3.min.js') ?>
|
||||||
@@ -12,12 +12,12 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (! isset($not_editable)): ?>
|
<?php if (! isset($not_editable)): ?>
|
||||||
<?= $this->asset->js('assets/js/app.js') ?>
|
<?= $this->asset->js('assets/js/app.js', true) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $this->asset->css($this->url->href('app', 'colors'), false, 'all') ?>
|
|
||||||
<?= $this->asset->css('assets/css/app.css') ?>
|
<?= $this->asset->css('assets/css/app.css') ?>
|
||||||
<?= $this->asset->css('assets/css/print.css', true, 'print') ?>
|
<?= $this->asset->css('assets/css/print.css', true, 'print') ?>
|
||||||
|
<?= $this->asset->colorCss() ?>
|
||||||
<?= $this->asset->customCss() ?>
|
<?= $this->asset->customCss() ?>
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="assets/img/favicon.png">
|
<link rel="icon" type="image/png" href="assets/img/favicon.png">
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class AclTest extends Base
|
|||||||
$acl = new Acl($this->container);
|
$acl = new Acl($this->container);
|
||||||
$this->assertTrue($acl->isPublicAction('board', 'readonly'));
|
$this->assertTrue($acl->isPublicAction('board', 'readonly'));
|
||||||
$this->assertFalse($acl->isPublicAction('board', 'show'));
|
$this->assertFalse($acl->isPublicAction('board', 'show'));
|
||||||
$this->assertTrue($acl->isPublicAction('app', 'colors'));
|
|
||||||
$this->assertTrue($acl->isPublicAction('feed', 'project'));
|
$this->assertTrue($acl->isPublicAction('feed', 'project'));
|
||||||
$this->assertTrue($acl->isPublicAction('feed', 'user'));
|
$this->assertTrue($acl->isPublicAction('feed', 'user'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user