Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement requireJS and requireCSS #120

Merged
merged 9 commits into from
Apr 6, 2017
Merged

Conversation

DarkSide666
Copy link
Member

  • implements requireJS and requireCSS methods for App
  • adds documentation of new metods
  • App now have new property $defaultTemplate = 'html.html' for better configurability

src/App.php Outdated
*/
public function requireJS($url)
{
$this->html->template->appendHTML('HEAD', '<script src="'.$this->url($url, null).'"></script>');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should't call url, should simply use the $url , for simplicity.

src/App.php Outdated
@@ -282,7 +291,7 @@ public function url($args = [])
$page = $args[0];
unset($args[0]);

$url = $page ? ($page.'.php') : '';
$url = $page ? ($page.($extension ? '.'.$extension : '')) : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want to encourage integrators (people who integrate Agile UI into a framework) to rewrite url() method with the goal to properly create links between PAGES. Passing extension to a page is not right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should rename url() into page() in the future. The full name could be getPageURL().

src/App.php Outdated
@@ -157,7 +165,7 @@ public function initLayout($layout, $options = [])
}
$layout->app = $this;

$this->html = new View(['defaultTemplate'=>'html.html']);
$this->html = new View(['defaultTemplate' => $this->defaultTemplate]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application doesn't really have a template, as it's not extending View. Having defaultTemplate would be confusing here. If possible leave it 'html.html' for now as I don't want people to tamper with this too much at this point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at best we can make it possible for someone to inject "html" property, so

if (!$this->html) {
...
}

docs/app.rst Outdated

.. php:method:: requireCSS($url)

Method to include additional CSS stylesheet in page.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example would be nice here. Advise people to use CDN.

@DarkSide666
Copy link
Member Author

all change requests addressed

src/App.php Outdated
@@ -311,7 +305,7 @@ public function url($args = [], $extension = 'php')
*/
public function requireJS($url)
{
$this->html->template->appendHTML('HEAD', '<script src="'.$this->url($url, null).'"></script>');
$this->html->template->appendHTML('HEAD', '<script src="'.$url.'"></script>');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if we can use getTag here...

@romaninsh romaninsh merged commit 34ffc96 into develop Apr 6, 2017
@romaninsh romaninsh deleted the feature/implement-requirejs branch April 6, 2017 21:53
@romaninsh
Copy link
Member

implements #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants