{:uriI"file://app/assets/javascripts/views/main/pages/article_list.coffee?type=application/javascript&pipeline=self&id=e7b2e5d1904cb19ac50a13152f2a2af3fe8ceb5f04c6a833b23c9d81893f309c:ET:load_pathI"app/assets/javascripts;T: filenameI"@app/assets/javascripts/views/main/pages/article_list.coffee;T: nameI""views/main/pages/article_list;T:logical_pathI"*views/main/pages/article_list.self.js;T:content_typeI"application/javascript;T: sourceI"K (function() { var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; App.Views.Main.Pages.ArticleList = (function(superClass) { extend(ArticleList, superClass); function ArticleList(opts) { if (opts == null) { opts = {}; } ArticleList.__super__.constructor.call(this, opts); this.page = 1; } ArticleList.prototype.render = function() { return this._handleLoadMore(); }; ArticleList.prototype.renderArticles = function(articles) { var article, i, len, results; results = []; for (i = 0, len = articles.length; i < len; i++) { article = articles[i]; results.push($('#articles').append(JST["templates/main/articles/article_for_list"]({ article: article }))); } return results; }; ArticleList.prototype.renderNewArticle = function(article) { return $('#articles').prepend(JST["templates/main/articles/article_for_list"]({ article: article })); }; ArticleList.prototype.updateArticle = function(articleId) { if ($("#article_" + articleId).length === 0) { return; } return App.Models.Article.find({ id: articleId, abbr: true }).then(function(article) { var template; template = JST["templates/main/articles/article_for_list"]({ article: article }); return $("#article_" + article.id).replaceWith(template); }); }; ArticleList.prototype.commentsQuantityChangedForArticle = function(articleId, quantity) { var match, sel; if ($("#article_" + articleId).length === 0) { return; } sel = $("#article_" + articleId + " a.comments_quantity"); match = /\d+/.exec(sel.text()); quantity = parseInt(match[0]) + quantity; return sel.text(quantity + " comment" + (quantity === 1 ? '' : 's')); }; ArticleList.prototype._handleLoadMore = function() { return $('#load_more').click((function(_this) { return function(e) { e.preventDefault(); _this.page += 1; return App.Models.Article.get('all', { page: _this.page }).then(function(resp) { if (resp.resources.length > 0) { return _this.renderArticles(resp.resources); } else { return $('#load_more').replaceWith('

No more posts.

'); } })["catch"](function(err) { return alert("Invalid URL"); }); }; })(this)); }; return ArticleList; })(App.Views.Base); }).call(this); ;T: metadata{ :dependencieso:Set: @hash} I"environment-version;TTI"environment-paths;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"Nfile-digest://app/assets/javascripts/views/main/pages/article_list.coffee;TTF: requiredo;;}F: stubbedo;;}F: linkso;;}F: charsetI" utf-8;F: digest"%}$t;gCdd9iT 6 IĒ: lengthiK :dependencies_digest"%O wye^NԐd:P:idI"Ee7b2e5d1904cb19ac50a13152f2a2af3fe8ceb5f04c6a833b23c9d81893f309c;F: mtimel+IW