From c02414c36decded0016d54ed427caa1f1d03c332 Mon Sep 17 00:00:00 2001 From: Jannik Streek <theshowcanbegin@gmail.com> Date: Fri, 21 Mar 2014 19:09:24 +0100 Subject: [PATCH] fixed wrong indenting and broken messages tab for polls --- app/assets/stylesheets/publisher.css.scss | 2 -- app/models/poll.rb | 2 +- app/models/poll_answer.rb | 4 ++-- app/models/poll_participation.rb | 2 +- spec/models/poll_participation_spec.rb | 20 ++++++++++---------- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/publisher.css.scss b/app/assets/stylesheets/publisher.css.scss index 08ff3cec0d..76bce5669d 100644 --- a/app/assets/stylesheets/publisher.css.scss +++ b/app/assets/stylesheets/publisher.css.scss @@ -59,7 +59,6 @@ resize: none; height: 50px; } - } &.active textarea { min-height: 70px; @@ -79,7 +78,6 @@ line-height: 20px !important; width: 100% !important; } - } &.with_attachments .row-fluid#photodropzone_container { border-top: 1px dashed $border-grey; diff --git a/app/models/poll.rb b/app/models/poll.rb index 778f654ca8..df01f127ab 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -15,7 +15,7 @@ class Poll < ActiveRecord::Base validate :enough_poll_answers def enough_poll_answers - errors.add(:poll_answers, I18n.t("activerecord.errors.models.poll.attributes.poll_answers.not_enough_poll_answers")) if poll_answers.size < 2 + errors.add(:poll_answers, I18n.t("activerecord.errors.models.poll.attributes.poll_answers.not_enough_poll_answers")) if poll_answers.size < 2 end end diff --git a/app/models/poll_answer.rb b/app/models/poll_answer.rb index 14ee658cf7..46421266d9 100644 --- a/app/models/poll_answer.rb +++ b/app/models/poll_answer.rb @@ -9,8 +9,8 @@ class PollAnswer < ActiveRecord::Base xml_attr :answer def update_vote_counter - self.vote_count = self.vote_count + 1 - self.save! + self.vote_count = self.vote_count + 1 + self.save! end end diff --git a/app/models/poll_participation.rb b/app/models/poll_participation.rb index c6c2ee85c7..c666e50307 100644 --- a/app/models/poll_participation.rb +++ b/app/models/poll_participation.rb @@ -52,7 +52,7 @@ class PollParticipation < ActiveRecord::Base existing = PollParticipation.where(author_id: self.author.id, poll_id: self.poll.id) if existing.first != self and existing.count != 0 - self.errors.add(:poll, I18n.t("errors.models.poll_participations.attributes.poll.already_participated")) + self.errors.add(:poll, I18n.t("activerecord.errors.models.poll_participations.attributes.poll.already_participated")) end end diff --git a/spec/models/poll_participation_spec.rb b/spec/models/poll_participation_spec.rb index 26fbd10fc4..c09ae06aa1 100644 --- a/spec/models/poll_participation_spec.rb +++ b/spec/models/poll_participation_spec.rb @@ -29,7 +29,7 @@ describe PollParticipation do end - describe 'xml' do + describe 'xml' do before do @poll_participant = FactoryGirl.create(:user) @poll_participant_aspect = @poll_participant.aspects.create(:name => "bruisers") @@ -75,22 +75,22 @@ describe PollParticipation do end describe 'it is relayable' do - before do - @local_luke, @local_leia, @remote_raphael = set_up_friends - @remote_parent = FactoryGirl.build(:status_message_with_poll, :author => @remote_raphael) + before do + @local_luke, @local_leia, @remote_raphael = set_up_friends + @remote_parent = FactoryGirl.build(:status_message_with_poll, :author => @remote_raphael) - @local_parent = @local_luke.post :status_message, :text => "hi", :to => @local_luke.aspects.first + @local_parent = @local_luke.post :status_message, :text => "hi", :to => @local_luke.aspects.first @poll2 = Poll.new(:question => 'Who is now in charge?') @poll2.poll_answers.build(:answer => "a") @poll2.poll_answers.build(:answer => "b") @local_parent.poll = @poll2 - @object_by_parent_author = @local_luke.participate_in_poll!(@local_parent, @poll2.poll_answers.first) - @object_by_recipient = @local_leia.participate_in_poll!(@local_parent, @poll2.poll_answers.first) - @dup_object_by_parent_author = @object_by_parent_author.dup + @object_by_parent_author = @local_luke.participate_in_poll!(@local_parent, @poll2.poll_answers.first) + @object_by_recipient = @local_leia.participate_in_poll!(@local_parent, @poll2.poll_answers.first) + @dup_object_by_parent_author = @object_by_parent_author.dup - @object_on_remote_parent = @local_luke.participate_in_poll!(@remote_parent, @remote_parent.poll.poll_answers.first) - end + @object_on_remote_parent = @local_luke.participate_in_poll!(@remote_parent, @remote_parent.poll.poll_answers.first) + end let(:build_object) { PollParticipation::Generator.new(alice, @status, @poll.poll_answers.first).build } it_should_behave_like 'it is relayable' -- GitLab