Sha256: 55954cb21643e214d35edd612a354750811f98a99c5bfc3262fc6105d5d39119

Contents?: true

Size: 1.08 KB

Versions: 26

Compression:

Stored size: 1.08 KB

Contents

class App.Controllers.Admin.Articles extends App.Controllers.Base
  published: ->
    @view = new App.Views.Admin.Articles.List
    this.connectWith [App.Models.Article, App.Models.Article.Comment]
    App.Models.Article.get('published').then (resp) =>
      @view.render articles: resp.resources

  edit: ->
    editView = new App.Views.Admin.Articles.Edit
    App.Models.Article.find(@params.id).then (article) ->
      editView.render article
      formView = new App.Views.Admin.Articles.Form
      formView.render article
    App.Models.Article.Comment.all(articleId: @params.id).then (resp) ->
      editView.renderComments resp.resources

  receivedSignal: (signal, data) ->
    switch signal
      when 'Article published'
        App.Models.Article.find(id: data.id).then (article) =>
          @view.renderNewArticle article
      when 'Article updated'
        @view.updateArticle data.id
      when 'Article.Comment created'
        @view.commentsQuantityChangedForArticle data.article_id, 1
      when 'Article.Comment destroyed'
        @view.commentsQuantityChangedForArticle data.article_id, -1

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
loco-rails-3.0.3 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.5.3 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.5.2 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-3.0.2 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-3.0.1 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.5.1 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.5.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.4.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.3.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-3.0.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.2.2 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.2.1 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.2.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.1.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-2.0.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-1.5.2 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-1.5.1 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-1.5.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-1.4.0 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee
loco-rails-1.3.3 test/dummy/app/assets/javascripts/controllers/admin/articles.coffee