Sha256: d981f61e78d0ad9cc64361180ee2f760ab94ae40d71048aae676aa4d61c889be

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

import React from "react";
import { render } from "react-dom";
import { Controllers } from "loco-js";

import store from "stores/admin";
import Article from "models/Article";
import Comment from "models/article/Comment";
import Edit from "views/admin/articles/Edit";
import Form from "views/admin/articles/Form";

import ArticleList from "containers/admin/StatefulArticleList";

class Articles extends Controllers.Base {
  published() {
    Article.get("published").then(resp => {
      store.dispatch({
        type: "SET_ARTICLES",
        payload: { articles: resp.resources }
      });
      render(
        <ArticleList articles={resp.resources} />,
        document.getElementById("articles")
      );
    });
  }

  edit() {
    const editView = new Edit();
    Article.find(this.params.id).then(article => {
      editView.render(article);
      new Form().render(article);
    });
    Comment.all({ articleId: this.params.id }).then(resp => {
      editView.renderComments(resp.resources);
    });
  }
}

export default Articles;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loco-rails-3.0.4 test/dummy/frontend/js/controllers/admin/Articles.js