/* Usage: <%= react_component("DocumentEntityLinkModal", { form_path: link_entity_documents_path, content_list: @current_user_content, document_id: @document.id }) %> */ import React from "react" import PropTypes from "prop-types" var pluralize = require('pluralize'); class DocumentEntityLinkModal extends React.Component { constructor(props) { super(props); this.state = { selected: false }; } componentDidMount() { $('.js-link-entity').click(function () { $('#entity-link-modal').modal('open'); return false; }); $('.js-link-entity-selection').click(function () { var entity = $(this); var form = $(this).closest('form'); form.find('input[name=entity_id]').val(entity.data('id')); form.find('input[name=entity_type]').val(entity.data('type')); form.submit(); }); } classIcon(class_name) { return window.ContentTypeData[class_name].icon; } classColor(class_name) { return window.ContentTypeData[class_name].color; } toggleEntityLink(entity) { // console.log('linking'); // console.log(entity); } render () { return (
Select the page below you'd like to link to this document. You can then click it at any time to quickly view that page without leaving your document.