settings.PermissionsView Class
/var/www/azaleahealth.com/branches/docs/source_repo/awa/resources/apps/js/system/PermissionsView.js:96
Item Index
Methods
- bindToModel
- destroy
- didRender
- disableChildCheckboxes
- doChildrenLayouts
- doLayout
- getCheckedPermissions
- getWidget
- hideEmptyPermissionGroups
- hideInvsiblePermissionGroups
- initialize
- onAdmin
- onGroupCheck
- onPermissionCheck
- onRendered
- onSearch
- onSelectAll
- postRenderDetails
- postRenderEdit
- refresh
- render
- renderPermissions
- requestChange
- requestClose
- setElement
- triggerRendered
- viewOptions
Methods
bindToModel
-
[model]
Binds the view to a Model. will explain more later.
Parameters:
-
[model]awa.mvc.Model | Backbone.Model optionalModel to bind to
Returns:
destroy
()
awa.mvc.View
clears out all widgets, grids, and events. Also removes and destroys children
Returns:
this
didRender
()
Undefined
Post rendering tasks.
Returns:
disableChildCheckboxes
()
Undefined
Disables all child checkboxes that are not checked.
Returns:
doChildrenLayouts
()
Undefined
Needed for height fixing and other positioning changes
Returns:
doLayout
()
Undefined
Needed for height fixing and other positioning changes
Returns:
getCheckedPermissions
()
Object
Returns all of the permisssions that are checked or the admin permission.
If the user cannot view / edit permissions this returns FALSE.
Returns:
Obejct map of permission keys to checked value
getWidget
()
Array
get the view controlling a widget by it's selector
Returns:
widgets
hideEmptyPermissionGroups
()
Undefined
Hides empty permissions groups from the user.
Returns:
hideInvsiblePermissionGroups
()
Undefined
Hides invisible permissions groups from the user.
Returns:
initialize
-
options
Parameters:
-
optionsObjectArgument bag
Returns:
onAdmin
-
evt
Called when the user clicks the admin check box.
Parameters:
-
evtjQuery.EventEvent object
Returns:
onGroupCheck
-
evt
Called when the user clicks on a checkbox in a group label
Parameters:
-
evtjQuery.EventEvent object
Returns:
onPermissionCheck
-
evt
Called when the user clicks on a permission checkbox
Parameters:
-
evtjQuery.EventEvent object
Returns:
onRendered
-
callback -
context
This is called only once in the lifetime of a view, if you bind to it before the view is rendered, the function will be called after triggerRendered is called.
Parameters:
-
callbackFunctionCallback
-
contextObjectDefines scope of callback
Returns:
onSearch
-
evt
Called when the user types in the search box.
Parameters:
-
evtjQuery.EventEvent object
Returns:
onSelectAll
-
evt
Called when the user clicks on the Select All Permissions checkbox
Parameters:
-
evtjQuery.EventEvent object
Returns:
postRenderDetails
()
Undefined
Post rendering tasks for details view.
Returns:
postRenderEdit
()
Undefined
Post rendering tasks for edit view.
Returns:
refresh
()
awa.mvc.View
There is a habit of re-rendering entire views when it may not be necessary. Parent views can check the rendered flag and call refresh instead if the child view has already been rendered.
Returns:
this
render
()
Undefined
Returns:
renderPermissions
()
Undefined
Renders the permissions portion of the view.
Returns:
requestChange
-
callback
Parent views should check this before changing/swapping a view. Useful for views that are in edit mode that you want to do confirmation before leaving.
Parameters:
-
callbackFunctionfunction to call when you have determined if the view can close or not. If it can close, return an object with property 'success' set to 1.
Returns:
requestClose
-
callback
Parent views should check this before closing a view. Useful for views that are in edit mode that you want to do confirmation before closing.
Parameters:
-
callbackFunctionfunction to call when you have determined if the view can close or not. If it can close, return an object with property 'success' set to 1.
Returns:
setElement
-
element -
[delegate]
Overidden setElement method applies the className to the new element the view is applied to. Also, if multiple views are passed in (what is returned from a jquery selector) it will be the top of the list.
Parameters:
-
elementJquery.SelectorJquery selector
-
[delegate]? optional?
Returns:
triggerRendered
-
args
The view should only call this once its completely rendered. This does not include refreshing views (i.e. grids changing pages). This also sets the view's rendered property to true.
Parameters:
-
argsObjectparameter to emit
Returns:
viewOptions
()
Array
the constructor uses this function to determine which properties to pull out of the passed in options to directly attach to the view. All other options can be referenced from the view's options property
Returns:
Acceptable view options
Properties
__parent__
View
Parent view object
Default: undefined
className
Boolean | Function
when this view is rendered, it will create a new element with this class added. If the setElement method is used, this will append itself to the class attribute
Default: "awa-mvc-View"
closeOnReplace
Boolean
Mostly for views that contain multiple views. This allows a parent view to know that the view should be closed and destroyed when another view is swapped in.
Default: false
globalKeys
Object
used for the keymaster plugin. These will be scoped to the entire app.
Default: undefined
keys
Object
used for the keymaster plugin. These will be scoped to this view in the future.
Default: undefined
refreshOnReplace
Boolean
Mostly for views that contain multiple views. This allows a parent view to know that the view should be refreshed when this view is swapped back in.
Default: true
rendered
Boolean
Lets you know if this view object has been rendered or not. If you override the render method without doing a supercall, be sure to set it to true when you are done rendering.
Default: false
title
Strin
Can be used by parent views to put on tabs, control bars, popup headers, etc. Use accessor methods.
Default: "View"
tpl
Function
default template to use with this view, the render method will use this and inject the resulting html into it's $el.
Default: undefined
tplArgs
Object
arguments that are passed to the template
Default: undefined