fixed poll icon issue, improved code, poll in bookmarklets now available
This commit is contained in:
parent
12fabe2fb9
commit
c484b2cd0c
8 changed files with 53 additions and 22 deletions
|
|
@ -9,7 +9,6 @@ app.views.Poll = app.views.Base.extend({
|
|||
initialize : function(options) {
|
||||
this.poll = this.model.attributes.poll;
|
||||
this.progressBarFactor = 3;
|
||||
//this.model.bind('remove', this.remove, this);
|
||||
},
|
||||
|
||||
postRenderTemplate : function() {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ app.views.Publisher = Backbone.View.extend({
|
|||
},
|
||||
|
||||
removePollAnswer: function(evt){
|
||||
$(evt.target).parents().eq(1).remove();
|
||||
$(evt.currentTarget).parent().remove();
|
||||
if($(".poll_answer").size() == 1) {
|
||||
$(".remove_poll_answer").css("visibility","hidden");;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,13 @@
|
|||
&.with_attachments .row-fluid#photodropzone_container {
|
||||
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 {
|
||||
height: 30px;
|
||||
#hide_location { display: none !important; }
|
||||
|
|
@ -216,4 +223,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,9 +310,22 @@
|
|||
}
|
||||
}
|
||||
#poll_creator {
|
||||
@extend #locator;
|
||||
right: 60px;
|
||||
margin-bottom:-5px;
|
||||
bottom: 1px !important;
|
||||
display: inline-block;
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -3,20 +3,18 @@ class PollParticipationsController < ApplicationController
|
|||
before_filter :authenticate_user!
|
||||
|
||||
def create
|
||||
begin
|
||||
answer = PollAnswer.find(params[:poll_answer_id])
|
||||
poll_participation = current_user.participate_in_poll!(target, answer) if target
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render json: poll_participation, :status => 201 }
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render :nothing => true, :status => 403 }
|
||||
end
|
||||
answer = PollAnswer.find(params[:poll_answer_id])
|
||||
poll_participation = current_user.participate_in_poll!(target, answer) if target
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render json: poll_participation, :status => 201 }
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.mobile { redirect_to stream_path }
|
||||
format.json { render :nothing => true, :status => 403 }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@
|
|||
%span#publisher-images
|
||||
%span.markdownIndications
|
||||
!= 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')}
|
||||
= image_tag 'icons/marker.png', :alt => t('shared.publisher.get_location').titleize, :class => 'publisher_image'
|
||||
#file-upload.btn{:title => t('shared.publisher.upload_photos')}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,21 @@
|
|||
%ul#photodropzone
|
||||
.row-fluid#location_container
|
||||
= 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
|
||||
#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')}
|
||||
%i.entypo.camera.publisher_image
|
||||
#locator.btn.btn-link{:title => t('shared.publisher.get_location')}
|
||||
|
|
|
|||
Loading…
Reference in a new issue