Skip to content
Snippets Groups Projects
Commit 6965d6da authored by danielgrippi's avatar danielgrippi
Browse files

fix feedback views. use gross callbacks for now

parent 5ac6188f
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require Rails.root.join("app", "presenters", "post_presenter")
class LikesController < ApplicationController
include ApplicationHelper
before_filter :authenticate_user!
......@@ -17,7 +19,7 @@ class LikesController < ApplicationController
respond_to do |format|
format.html { render :nothing => true, :status => 201 }
format.mobile { redirect_to post_path(@like.post_id) }
format.json { render :json => @like.parent.as_api_response(:backbone), :status => 201 }
format.json { render :json => PostPresenter.new(@like.parent, current_user).to_json, :status => 201 }
end
else
render :nothing => true, :status => 422
......
......@@ -2,6 +2,8 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require Rails.root.join("app", "presenters", "post_presenter")
class ParticipationsController < ApplicationController
include ApplicationHelper
before_filter :authenticate_user!
......@@ -15,7 +17,7 @@ class ParticipationsController < ApplicationController
if @participation
respond_to do |format|
format.mobile { redirect_to post_path(@participation.post_id) }
format.json { render :json => @participation.parent.as_api_response(:backbone), :status => 201 }
format.json { render :json => PostPresenter.new(@participation.parent, current_user).to_json, :status => 201 }
end
else
render :nothing => true, :status => 422
......
......@@ -38,7 +38,10 @@ app.models.Post = Backbone.Model.extend({
},
follow : function() {
this.set({ user_participation : this.participations.create() });
var self = this;
this.participations.create({}, {success : function(resp){
self.set(resp.attributes.post)
}});
},
unfollow : function() {
......@@ -59,7 +62,10 @@ app.models.Post = Backbone.Model.extend({
},
like : function() {
this.set({ user_like : this.likes.create() });
var self = this;
this.likes.create({}, {success : function(resp){
self.set(resp.attributes.post)
}});
},
unlike : function() {
......
......@@ -11,7 +11,7 @@ app.pages.PostViewer = app.views.Base.extend({
postView : function(){
return new app.views.Post({
model : this.model,
className : "loaded",
className : "dd",
templateName : "post-viewer/content/" + this.options.postTemplateName
})
},
......
app.views.Base = Backbone.View.extend({
app.views.Base = Backbone.View.extend({
initialize : function(options) {
this.setupRenderEvents();
},
presenter : function(){
return this.defaultPresenter()
......@@ -18,6 +22,7 @@ app.views.Base = Backbone.View.extend({
this.renderTemplate()
this.renderSubviews()
this.renderPluginWidgets()
this.removeTooltips()
return this
},
......@@ -45,5 +50,9 @@ app.views.Base = Backbone.View.extend({
renderPluginWidgets : function() {
this.$(this.tooltipSelector).twipsy();
this.$("time").timeago();
},
removeTooltips : function() {
$(".twipsy").remove();
}
})
......@@ -42,7 +42,7 @@ app.views.Post = app.views.StreamObject.extend({
feedbackView : function(){
if(!window.app.user()) { return null }
return new app.views.Feedback({model : this.model});
return new app.views.Feedback({model : this.model});
},
postContentView: function(){
......
app.views.StreamObject = app.views.Base.extend({
initialize: function(options) {
this.setupRenderEvents();
},
postRenderTemplate : function() {
// collapse long posts
......
......@@ -137,6 +137,7 @@ $light-grey: #999;
.note {
width: 550px;
padding-bottom: 50px;
p {
font-size: 20px;
......@@ -306,6 +307,7 @@ $light-grey: #999;
#post-interactions {
@include center(horizontal);
z-index: 20;
#post-interactions-container {
@include box-shadow(0, 6px, 15px, #000);
......@@ -316,6 +318,7 @@ $light-grey: #999;
border-left: 1px solid #444;
width: 420px;
background-color: #444;
background-image: url("../images/hatched-bg-dark.png");
color: #ccc;
......@@ -329,7 +332,7 @@ $light-grey: #999;
}
#new-post-comment {
border: 2px solid #333;
border-top: 2px solid #333;
text-align: left;
background-image: url("../images/hatched-bg-dark.png");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment