fixed poll icon issue, improved code, poll in bookmarklets now available

This commit is contained in:
Jannik Streek 2014-03-26 18:45:49 +01:00
parent 12fabe2fb9
commit c484b2cd0c
8 changed files with 53 additions and 22 deletions

View file

@ -9,7 +9,6 @@ app.views.Poll = app.views.Base.extend({
initialize : function(options) { initialize : function(options) {
this.poll = this.model.attributes.poll; this.poll = this.model.attributes.poll;
this.progressBarFactor = 3; this.progressBarFactor = 3;
//this.model.bind('remove', this.remove, this);
}, },
postRenderTemplate : function() { postRenderTemplate : function() {

View file

@ -202,7 +202,7 @@ app.views.Publisher = Backbone.View.extend({
}, },
removePollAnswer: function(evt){ removePollAnswer: function(evt){
$(evt.target).parents().eq(1).remove(); $(evt.currentTarget).parent().remove();
if($(".poll_answer").size() == 1) { if($(".poll_answer").size() == 1) {
$(".remove_poll_answer").css("visibility","hidden");; $(".remove_poll_answer").css("visibility","hidden");;
} }

View file

@ -82,6 +82,13 @@
&.with_attachments .row-fluid#photodropzone_container { &.with_attachments .row-fluid#photodropzone_container {
border-top: 1px dashed $border-grey; border-top: 1px dashed $border-grey;
} }
#poll_creator_wrapper {
display:none;
border-top: 1px dashed $border-grey;
padding:4px 6px 4px 6px;
}
&.with_location .row-fluid#location_container { &.with_location .row-fluid#location_container {
height: 30px; height: 30px;
#hide_location { display: none !important; } #hide_location { display: none !important; }
@ -216,4 +223,3 @@
} }
} }
} }

View file

@ -310,9 +310,22 @@
} }
} }
#poll_creator { #poll_creator {
@extend #locator; bottom: 1px !important;
right: 60px; display: inline-block;
margin-bottom:-5px; margin: 0;
cursor: pointer;
position: absolute !important;
right: 55px;
i {
@include opacity(0.4);
}
&:hover {
color: $text-dark-grey;
cursor: pointer;
i {
@include opacity(1);
}
}
} }
.btn { .btn {

View file

@ -3,20 +3,18 @@ class PollParticipationsController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
def create def create
begin answer = PollAnswer.find(params[:poll_answer_id])
answer = PollAnswer.find(params[:poll_answer_id]) poll_participation = current_user.participate_in_poll!(target, answer) if target
poll_participation = current_user.participate_in_poll!(target, answer) if target respond_to do |format|
respond_to do |format| format.html { redirect_to :back }
format.html { redirect_to :back } format.mobile { redirect_to stream_path }
format.mobile { redirect_to stream_path } format.json { render json: poll_participation, :status => 201 }
format.json { render json: poll_participation, :status => 201 } end
end rescue ActiveRecord::RecordInvalid
rescue ActiveRecord::RecordInvalid respond_to do |format|
respond_to do |format| format.html { redirect_to :back }
format.html { redirect_to :back } format.mobile { redirect_to stream_path }
format.mobile { redirect_to stream_path } format.json { render :nothing => true, :status => 403 }
format.json { render :nothing => true, :status => 403 }
end
end end
end end

View file

@ -28,7 +28,9 @@
%span#publisher-images %span#publisher-images
%span.markdownIndications %span.markdownIndications
!= t('shared.publisher.formatWithMarkdown', markdown_link: link_to(t('help.markdown'), 'https://diasporafoundation.org/formatting', target: :blank)) != t('shared.publisher.formatWithMarkdown', markdown_link: link_to(t('help.markdown'), 'https://diasporafoundation.org/formatting', target: :blank))
%a{:id => "poll_creator", :href => "#", :class => "entypo bar-graph gray small publisher_image"} #poll_creator.btn{:title => t('shared.publisher.poll.add_a_poll')}
%i.entypo.bar-graph{:class => "publisher_image"}
#locator.btn{:title => t('shared.publisher.get_location')} #locator.btn{:title => t('shared.publisher.get_location')}
= image_tag 'icons/marker.png', :alt => t('shared.publisher.get_location').titleize, :class => 'publisher_image' = image_tag 'icons/marker.png', :alt => t('shared.publisher.get_location').titleize, :class => 'publisher_image'
#file-upload.btn{:title => t('shared.publisher.upload_photos')} #file-upload.btn{:title => t('shared.publisher.upload_photos')}

View file

@ -22,8 +22,21 @@
%ul#photodropzone %ul#photodropzone
.row-fluid#location_container .row-fluid#location_container
= hidden_field :location, :coords = hidden_field :location, :coords
.row-fluid#poll_creator_wrapper
= t('shared.publisher.poll.add_a_poll')
#poll_question_wrapper{:class => "input-block-level"}
%input{:id => 'poll_question', :placeholder => t('shared.publisher.poll.question'), :name => 'poll_question', :class=> "form-control"}
.poll_answer
%input{:class => 'form-control poll_answer_input', :placeholder => t('shared.publisher.poll.option'), :name => 'poll_answers[]'}
.remove_poll_answer.btn.btn-link{:title => t('shared.publisher.poll.remove_poll_answer')}
%i.entypo.trash
#add_poll_answer_wrapper
#add_poll_answer{:class => 'btn btn-default'}
= t('shared.publisher.poll.add_poll_answer')
.row-fluid#button_container .row-fluid#button_container
#publisher-images.pull-right #publisher-images.pull-right
#poll_creator.btn.btn-link{:title => t('shared.publisher.poll.add_a_poll')}
%i.entypo.bar-graph
#file-upload.btn.btn-link{:title => t('shared.publisher.upload_photos')} #file-upload.btn.btn-link{:title => t('shared.publisher.upload_photos')}
%i.entypo.camera.publisher_image %i.entypo.camera.publisher_image
#locator.btn.btn-link{:title => t('shared.publisher.get_location')} #locator.btn.btn-link{:title => t('shared.publisher.get_location')}