fix feedback views. use gross callbacks for now
This commit is contained in:
parent
5ac6188f23
commit
6965d6da24
8 changed files with 30 additions and 12 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
require Rails.root.join("app", "presenters", "post_presenter")
|
||||||
|
|
||||||
class LikesController < ApplicationController
|
class LikesController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
@ -17,7 +19,7 @@ class LikesController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :nothing => true, :status => 201 }
|
format.html { render :nothing => true, :status => 201 }
|
||||||
format.mobile { redirect_to post_path(@like.post_id) }
|
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
|
end
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => 422
|
render :nothing => true, :status => 422
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
require Rails.root.join("app", "presenters", "post_presenter")
|
||||||
|
|
||||||
class ParticipationsController < ApplicationController
|
class ParticipationsController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
@ -15,7 +17,7 @@ class ParticipationsController < ApplicationController
|
||||||
if @participation
|
if @participation
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.mobile { redirect_to post_path(@participation.post_id) }
|
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
|
end
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => 422
|
render :nothing => true, :status => 422
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ app.models.Post = Backbone.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
follow : function() {
|
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() {
|
unfollow : function() {
|
||||||
|
|
@ -59,7 +62,10 @@ app.models.Post = Backbone.Model.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
like : function() {
|
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() {
|
unlike : function() {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ app.pages.PostViewer = app.views.Base.extend({
|
||||||
postView : function(){
|
postView : function(){
|
||||||
return new app.views.Post({
|
return new app.views.Post({
|
||||||
model : this.model,
|
model : this.model,
|
||||||
className : "loaded",
|
className : "dd",
|
||||||
templateName : "post-viewer/content/" + this.options.postTemplateName
|
templateName : "post-viewer/content/" + this.options.postTemplateName
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
app.views.Base = Backbone.View.extend({
|
app.views.Base = Backbone.View.extend({
|
||||||
|
|
||||||
|
initialize : function(options) {
|
||||||
|
this.setupRenderEvents();
|
||||||
|
},
|
||||||
|
|
||||||
presenter : function(){
|
presenter : function(){
|
||||||
return this.defaultPresenter()
|
return this.defaultPresenter()
|
||||||
},
|
},
|
||||||
|
|
@ -18,6 +22,7 @@ app.views.Base = Backbone.View.extend({
|
||||||
this.renderTemplate()
|
this.renderTemplate()
|
||||||
this.renderSubviews()
|
this.renderSubviews()
|
||||||
this.renderPluginWidgets()
|
this.renderPluginWidgets()
|
||||||
|
this.removeTooltips()
|
||||||
|
|
||||||
return this
|
return this
|
||||||
},
|
},
|
||||||
|
|
@ -45,5 +50,9 @@ app.views.Base = Backbone.View.extend({
|
||||||
renderPluginWidgets : function() {
|
renderPluginWidgets : function() {
|
||||||
this.$(this.tooltipSelector).twipsy();
|
this.$(this.tooltipSelector).twipsy();
|
||||||
this.$("time").timeago();
|
this.$("time").timeago();
|
||||||
|
},
|
||||||
|
|
||||||
|
removeTooltips : function() {
|
||||||
|
$(".twipsy").remove();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
app.views.StreamObject = app.views.Base.extend({
|
app.views.StreamObject = app.views.Base.extend({
|
||||||
|
|
||||||
initialize: function(options) {
|
|
||||||
this.setupRenderEvents();
|
|
||||||
},
|
|
||||||
|
|
||||||
postRenderTemplate : function() {
|
postRenderTemplate : function() {
|
||||||
// collapse long posts
|
// collapse long posts
|
||||||
this.$(".collapsible").expander({
|
this.$(".collapsible").expander({
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ $light-grey: #999;
|
||||||
|
|
||||||
.note {
|
.note {
|
||||||
width: 550px;
|
width: 550px;
|
||||||
|
padding-bottom: 50px;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
|
|
@ -306,6 +307,7 @@ $light-grey: #999;
|
||||||
|
|
||||||
#post-interactions {
|
#post-interactions {
|
||||||
@include center(horizontal);
|
@include center(horizontal);
|
||||||
|
z-index: 20;
|
||||||
|
|
||||||
#post-interactions-container {
|
#post-interactions-container {
|
||||||
@include box-shadow(0, 6px, 15px, #000);
|
@include box-shadow(0, 6px, 15px, #000);
|
||||||
|
|
@ -316,6 +318,7 @@ $light-grey: #999;
|
||||||
border-left: 1px solid #444;
|
border-left: 1px solid #444;
|
||||||
|
|
||||||
width: 420px;
|
width: 420px;
|
||||||
|
background-color: #444;
|
||||||
background-image: url("../images/hatched-bg-dark.png");
|
background-image: url("../images/hatched-bg-dark.png");
|
||||||
|
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
|
|
@ -329,7 +332,7 @@ $light-grey: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
#new-post-comment {
|
#new-post-comment {
|
||||||
border: 2px solid #333;
|
border-top: 2px solid #333;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
background-image: url("../images/hatched-bg-dark.png");
|
background-image: url("../images/hatched-bg-dark.png");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue