Sha256: 52990aa41f8a461e8227be092d0a7a7faef388a263036d8d081e538b5a1a11fe

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

/** @jsx React.DOM */

/**
 Renders a link to the resource with id given by this.props.data.
 
 Includes a slick little icon for the following kinds:
  TODO which kinds? 
**/
var ResourceLink = React.createClass({
  render: function(){
    var resourceId = this.props.data;
    if ( resourceId.id )
      resourceId = resourceId.id;
    
    var tokens = resourceId.split(':');
    var kind = tokens[1];
    var id = tokens[tokens.length - 1];
    var text = this.props.text || id;
    var href = "/ui/" + pluralize(kind) + "/" + encodeURIComponent(id);
    var classes = ['resource-link'];
    if(!this.props.noIcon){
      classes.push(kind);
    }
    return <a className={classes.join(' ')} href={href}>{text}</a>
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-api-1.2.0 public/js/views/resource.js