diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 5096cb7fe..21bfdeee8 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -13,6 +13,8 @@ class PostPresenter :post => self.post.as_api_response(:backbone).update( { :user_like => self.user_like, + :user_participation => self.user_participation, + :user_reshare => self.user_reshare, :next_post => self.next_post_url, :previous_post => self.previous_post_url }), @@ -27,6 +29,19 @@ class PostPresenter end end + def user_participation + return unless self.current_user.present? + + if participation = Participation.where(:target_id => self.post.id, :target_type => "Post", :author_id => current_user.person.id).first + participation.as_api_response(:backbone) + end + end + + def user_reshare + return unless self.current_user.present? + Reshare.where(:root_guid => self.post.guid, :author_id => current_user.person.id).exists? + end + def next_post_url if n = next_post Rails.application.routes.url_helpers.post_path(n) diff --git a/public/images/glyphicons-halflings-blue.png b/public/images/glyphicons-halflings-blue.png new file mode 100644 index 000000000..a8dca0fcc Binary files /dev/null and b/public/images/glyphicons-halflings-blue.png differ diff --git a/public/images/glyphicons-halflings-green.png b/public/images/glyphicons-halflings-green.png new file mode 100644 index 000000000..1907d9bf3 Binary files /dev/null and b/public/images/glyphicons-halflings-green.png differ diff --git a/public/images/glyphicons-halflings-red.png b/public/images/glyphicons-halflings-red.png new file mode 100644 index 000000000..30c315fe0 Binary files /dev/null and b/public/images/glyphicons-halflings-red.png differ diff --git a/public/javascripts/app/templates/post-viewer/feedback.handlebars b/public/javascripts/app/templates/post-viewer/feedback.handlebars index d8bf47265..5c7548e13 100644 --- a/public/javascripts/app/templates/post-viewer/feedback.handlebars +++ b/public/javascripts/app/templates/post-viewer/feedback.handlebars @@ -5,16 +5,28 @@ --> - + {{#if user_like}} + + {{else}} + + {{/if}} - - + + {{#if user_participation}} + + {{else}} + + {{/if}} {{#if userCanReshare}} - - + + {{#if user_reshare}} + + {{else}} + + {{/if}} {{/if}} diff --git a/public/stylesheets/sass/new-templates.scss b/public/stylesheets/sass/new-templates.scss index 829cc940b..64732ab62 100644 --- a/public/stylesheets/sass/new-templates.scss +++ b/public/stylesheets/sass/new-templates.scss @@ -95,6 +95,19 @@ $light-grey: #999; 100% { left: 0; } } +/* bootstrap extentions */ +.icon-red { + background-image: url(../img/glyphicons-halflings-red.png); +} + +.icon-green { + background-image: url(../img/glyphicons-halflings-green.png); +} + +.icon-blue { + background-image: url(../img/glyphicons-halflings-blue.png); +} + /* styles */ .bump-left { @include animation(bump-left) }