function getActiveAnnotations(state) { if (!state) return []; // Subjects-specific // -------------------- // // When a subject has been clicked in the subjects panel if (state.contextId === "editSubjectReference" && state.subjectReferenceId) { return [ doc.get(state.subjectReferenceId) ]; } if (state.contextId === "subjects" && state.subjectId) { return _.map(doc.subjects.getReferencesForSubject(state.subjectId), function(id) { return doc.get(id); }); } // Entities-specific // -------------------- // // When a subject has been clicked in the subjects panel // Let the extension handle which nodes should be highlighted if (state.contextId === "entities" && state.entityId) { // Use reference handler return _.map(doc.entityReferencesIndex.get(state.entityId)); } else if (state.entityReferenceId) { return [ doc.get(state.entityReferenceId) ]; } return []; }
EntitiesModel.prototype.getEntities = function(entityType) { if (entityType) { this.findByType(entityType); } else { return _.map(this.entities); } };
render: function() { return $$("div", {className: "dashboard-component"}, $$("div", {className: "header"}, FAKE_DATA.length + " articles" ), $$("div", {className: "documents"}, _.map(FAKE_DATA, function(doc) { return $$(DocumentRecord, doc); }) ) ); }
render: function() { return $$("div", {className: "admin-menu-component"}, $$('div', {className: "admin-contexts"}, _.map(menuItems, function(menuItem) { return $$('a', { className: "admin-context"+(this.props.context === menuItem.name ? " active" : ""), "data-id": menuItem.name, key: menuItem.name, href: "#", onClick: this.handleMenuSelection, dangerouslySetInnerHTML: {__html: '<i class="fa fa-'+menuItem.icon+'"></i> ' + menuItem.label}, }); }, this) ) ); }
render: function() { var classNames = ['text-tool-component', 'tool']; if (this.state.active) classNames.push('active'); var currentTextType = "None"; if (this.state.currentTextType) { currentTextType = TEXT_TYPES[this.state.currentTextType].label; } var currentTextTypeEl = $$('a', { href: "#", className: "current-text-type", dangerouslySetInnerHTML: {__html: currentTextType + ' <i class="fa fa-sort-down"></i>'}, onMouseDown: this.toggleAvailableTextTypes, onClick: this.handleClick }); var availableTextTypes = $$('div'); if (this.state.expanded) { availableTextTypes = _.map(TEXT_TYPES, function(textType, textTypeId) { return $$('a', { href: "#", className: 'text-type', "data-type": textTypeId, onMouseDown: this.handleMouseDown, onClick: this.handleClick }, textType.label); }.bind(this)); } return $$("div", { className: classNames.join(' ')}, currentTextTypeEl, $$('div', {className: "available-text-types"}, availableTextTypes ) ); }