Sha256: cdfab4649646af22d7deacc3b638e25ec880959f8258c1fda16fc8ed0160c555
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
import React from "react"; import { render as renderElement } from "react-dom"; import { Views } from "loco-js"; import CommentList from "components/admin/CommentList"; class Edit extends Views.Base { constructor(opts = {}) { super(opts); this.article = null; } receivedSignal(signal) { switch (signal) { case "updated": this.article.reload().then(() => { this.article.applyChanges(); this._renderArticle(); }); } } render(article) { this.article = article; this.connectWith(article); this._renderArticle(); } renderComments(comments) { renderElement( <CommentList comments={comments} />, document.getElementById("comments") ); } _renderArticle() { document.getElementById("article_author").textContent = this.article.author; document.getElementById("article_title").textContent = this.article.title; document.getElementById("article_text").textContent = this.article.content; } } export default Edit;
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loco-rails-3.0.4 | test/dummy/frontend/js/views/admin/articles/Edit.js |