updated dev docs with new changes to the appframework

This commit is contained in:
Bernhard Posselt
2013-03-29 14:38:45 +01:00
parent 811a76e6f1
commit 84bc571395
6 changed files with 55 additions and 25 deletions

View File

@@ -68,7 +68,7 @@ Simple object that can be used for displaying loading notifcations. It has an in
Example:
.. code-block:: python
.. code-block:: js
loading = new Loading()
loading.isLoading() # false
@@ -264,7 +264,7 @@ Because AngularJS getters have to be fast (Angular checks for changed objects af
To query an object with a **_BiggerThanQuery** use its **get** method:
.. code-block:: python
.. code-block:: js
valuesBiggerThan4 = myModel.get(new _BiggerThanQuery('id', 4))
@@ -284,7 +284,7 @@ You can override this method if you need to. The **exec** method is used to run
A query that would select only ids between a range of numbers would look like this:
.. code-block:: python
.. code-block:: ruby
angular.module('YourApp').factory '_LessThanQuery', ['_Query', (_Query) ->
@@ -309,7 +309,7 @@ A query that would select only ids between a range of numbers would look like th
If **hashCode** is not overwritten it would produce the following output:
.. code-block:: python
.. code-block:: ruby
query = new _RangeQuery('id', 3, 6)
query.hashCode() # prints range_id_3_6
@@ -330,10 +330,12 @@ Can be enhanced by passing an expression:
{
selector: '#jquery .selector'
hideOnFocusLost: true
cssClass: 'opened'
}
* **selector**: if defined, a different area is slid up on click
* **hideOnFocusLost**: if defined, the slid up area will hide when the focus is lost
* **cssClass**: if defined, the class which should be toggled on the element where the directive is bound to
Example:
@@ -342,6 +344,28 @@ Example:
<button oc-click-slide-toggle="{selector: '#settings', hideOnFocusLost: true}" />
<div id="settings"></div>
ocClickFocus
~~~~~~~~~~~~
Can be used to focus a different element when the element is being clicked that has this directive
Must pass an expression:
.. code-block:: js
{
selector: '#jquery .selector'
}
* **selector**: the area that should be focused
Example:
.. code-block:: html
<button oc-click-focus="{selector: '#settings'}" />
<input id="settings" type="text" />
ocDraggable
~~~~~~~~~~~
Shortcut for using jquery-ui draggable. The expression is passed to $.draggable.

View File

@@ -17,11 +17,6 @@ Entity
.. php:method:: __construct()
.. php:method:: resetUpdatedFields()
@@ -72,6 +67,17 @@ Entity
.. php:method:: addType($fieldName, $type)
:param string $fieldName: the name of the attribute
:param string $type: the type which will be used to call settype()
* **Protected**
Adds type information for a field so that its automatically casted tothat value once its being returned from the database
.. php:method:: fromRow($row)
:param array $row: the row to map onto the entity

View File

@@ -47,6 +47,7 @@ may be subject to change in the future
.. php:method:: update($entity)
:param \\OCA\\AppFramework\\Db\\Entity $entity:
:throws \\InvalidArgumentException: if entity has no id
Updates an entry in the db from an entity

View File

@@ -11,10 +11,9 @@ Encapsulates $_GET, $_FILES and $_POST arrays for better testability
.. php:method:: __construct($get=array(), $post=array(), $files=array(), $server=array(), $env=array(), $session=array(), $cookie=array(), $urlParams=array())
.. php:method:: __construct($params=array(), $files=array(), $server=array(), $env=array(), $session=array(), $cookie=array(), $urlParams=array())
:param array $get: the $_GET array
:param array $post: the $_POST array
:param array $params: the parsed json array
:param array $files: the $_FILES array
:param array $server: the $_SERVER array
:param array $env: the $_ENV array
@@ -32,24 +31,14 @@ Encapsulates $_GET, $_FILES and $_POST arrays for better testability
Returns the merged urlParams, GET and POST array
.. php:method:: getGET($key, $default=null)
.. php:method:: getParams($key, $default=null)
:param string $key: the array key that should be looked up
:param string $default: if the key is not found, return this value
:returns mixed: the value of the stored array or the default
Returns the get value or the default if not found
.. php:method:: getPOST($key, $default=null)
:param string $key: the array key that should be looked up
:param string $default: if the key is not found, return this value
:returns mixed: the value of the stored array or the default
Returns the get value or the default if not found
Returns the request params value or the default if not found
.. php:method:: getFILES($key)

View File

@@ -40,3 +40,4 @@ Simple utility class for testing mappers
Create mocks and set expected results for database queries

View File

@@ -27,10 +27,19 @@ Getters and setters will automatically be created for all public attributes. Sho
class Item extends Entity {
public $id;
// Note: a field id is set automatically by the parent class
public $name;
public $path;
public $user;
public $timestamp;
public function __construct(){
// cast timestamp to an int when fromRow is being called
// the second parameter is the argument that is passed to
// the php function settype()
$this->addType('timestamp', 'int')
}
// transform username to lower case
public function function setName($name){