API Docs for: 0.25.0
Show:

NodeActionsMixin Class

Extends Ember.Mixin
Module: mixins
Parent Module: ember-osf

Controller mixin that implements common actions performed on nodes.

Methods

_affiliateNode

(
  • node
  • institution
)
Promise private

Helper method that affiliates an institution with a node.

Parameters:

Returns:

Promise:

Returns a promise that resolves to the updated node with the newly created institution relationship

addChild

(
  • title
  • description
  • category
)
Promise

Add a child (component) to a node.

Parameters:

  • title String

    Title for the child

  • description String

    Description for the child

  • category String

    Category for the child

Returns:

Promise:

Returns a promise that resolves to the newly created child node.

addContributor

(
  • userId
  • permission
  • isBibliographic
  • sendEmail
)
Promise

Add a contributor to a node

Parameters:

  • userId String

    ID of user that will be a contributor on the node

  • permission String

    User permission level. One of "read", "write", or "admin". Default: "write".

  • isBibliographic Boolean

    Whether user will be included in citations for the node. "default: true"

  • sendEmail Boolean

    Whether user will receive an email when added. "default: true"

Returns:

Promise:

Returns a promise that resolves to the newly created contributor object.

addContributors

(
  • contributors
  • sendEmail
)
Promise

Bulk add contributors to a node

Parameters:

  • contributors Array

    Array of objects containing contributor permission, bibliographic, and userId keys

  • sendEmail Boolean

    Whether user will receive an email when added. "default: true"

Returns:

Promise:

Returns a promise that resolves to an array of added contributors

affiliateNode

(
  • institutionId
)
Promise

Affiliate a node with an institution

Parameters:

  • institutionId String

    ID of the institutution to be affiliated

Returns:

Promise:

Returns a promise that resolves to the updated node with the newly affiliated institution relationship

apply

(
  • obj
)
private

Parameters:

Returns:

applied object

deleteNode

() Promise

Delete a node

Returns:

Promise:

Returns a promise that resolves after the deletion of the node.

detect

(
  • obj
)
Boolean private

Parameters:

Returns:

removeContributor

(
  • contributor
)
Promise

Remove a contributor from a node

Parameters:

  • contributor Object

    Contributor relationship that will be removed from node

Returns:

Promise:

Returns a promise that will resolve upon contributor deletion. User itself will not be removed.

reopen

(
  • arguments
)
private

Parameters:

reorderContributors

(
  • contributor
  • newIndex
  • contributors
)
Promise

Reorder contributors on a node, and manually updates store.

Parameters:

  • contributor Object

    Contributor record to be modified

  • newIndex Integer

    Contributor's new position in the list

  • contributors Array

    New contributor list in correct order

Returns:

Promise:

Returns a promise that resolves to the updated contributor.

unaffiliateNode

(
  • institution
)
Promise

Unaffiliate a node with an institution

Parameters:

  • institution Object

    Institution relationship to be removed from node

Returns:

Promise:

Returns a promise that resolves to the updated node with the affiliated institution relationship removed.

updateContributor

(
  • contributor
  • permissions
  • bibliographic
)
Promise

Update contributors of a node. Makes a bulk request to the APIv2.

Parameters:

  • contributor Contributor

    relationship on the node.

  • permissions String

    desired permissions.

  • bibliographic Boolean

    desired bibliographic statuses

Returns:

Promise:

Returns a promise that resolves to the updated node with edited contributor relationships.

updateContributors

(
  • contributors
  • permissionsChanges
  • bibliographicChanges
)
Promise

Update contributors of a node. Makes a bulk request to the APIv2.

Parameters:

  • contributors Contributor[]

    Contributor relationships on the node.

  • permissionsChanges Object

    Dictionary mapping contributor ids to desired permissions.

  • bibliographicChanges Object

    Dictionary mapping contributor ids to desired bibliographic statuses

Returns:

Promise:

Returns a promise that resolves to the updated node with edited contributor relationships.

updateNode

(
  • title
  • description
  • category
  • isPublic
)
Promise

Update a node

Parameters:

  • title String

    New title of the node

  • description String

    New Description of the node

  • category String

    New node category

  • isPublic Boolean

    Should this node be publicly-visible?

Returns:

Promise:

Returns a promise that resolves to the updated node

Properties

node

DS.Model

The node to perform these actions on. If not specified, defaults to the model hook.