Merge pull request #555 from owncloud/template-functions

Template functions
This commit is contained in:
Bernhard Posselt
2014-09-09 19:43:52 +02:00
2 changed files with 25 additions and 3 deletions

View File

@@ -9,8 +9,26 @@ The CSS files reside in the **css/** folder and should be included in the templa
.. code-block:: php
<?php
\OCP\Util::addStyle('myapp', 'style'); // adds js/style.css
// include one file
style('myapp', 'style'); // adds js/style.css
// include multiple files for the same app
style('myapp', array('style', 'navigation')); // adds js/style.css, js/navigation.css
Web Components go into the **component/** folder and can be imported like this:
.. code-block:: php
<?php
// include one file
component('myapp', 'tabs'); // adds component/tabs.html
// include multiple files for the same app
component('myapp', array('tabs', 'forms')); // adds component/tabs.html, component/forms.html
.. note:: Keep in mind that Web Components are still very new and you `might need to add polyfills using Polymer <http://www.polymer-project.org/resources/compatibility.html>`_
Standard layout
===============
To use the commonly used layout consisting of sidebar navigation and content the **app-navigation** and **app-content** ids can be used:

View File

@@ -9,7 +9,11 @@ The JavaScript files reside in the **js/** folder and should be included in the
.. code-block:: php
<?php
\OCP\Util::addScript('myapp', 'script'); // adds js/script.js
// add one file
script('myapp', 'script'); // adds js/script.js
// add multiple files in the same app
script('myapp', array('script', 'navigation')); // adds js/script.js js/navigation.js
The recommended JavaScript framework to use is `AngularJS <https://angularjs.org/#>`_. A nice tutorial screencast collection can be found on `Egghead.io <https://egghead.io/technologies/angularjs>`_
@@ -38,4 +42,4 @@ Full URLs can be genrated by using:
.. code-block:: js
var authorUrl = OC.generateUrl('/apps/myapp/authors/1');
var authorUrl = OC.generateUrl('/apps/myapp/authors/1');