Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonne Haß <me@jhass.eu>2014-10-14 15:02:37 +0400
committerJonne Haß <me@jhass.eu>2014-10-14 15:03:19 +0400
commit0419174570abe3943596aed76641ce7dbe45ec19 (patch)
tree60a57bc2e7614a7a7ab559345dcd8732dc245747
parentdcc629bc4c1ec1cc47d430f06f2143d5473efa18 (diff)
parent42a3e702e68595af66540aad3ad7b0720fce884e (diff)
Merge pull request #5334 from svbergerem/fix-bootstrap-poll
Fix poll for Bootstrap publisher
-rw-r--r--Changelog.md1
-rw-r--r--app/assets/javascripts/app/views/publisher/poll_creator_view.js5
-rw-r--r--app/assets/javascripts/app/views/publisher_view.js2
-rw-r--r--app/assets/stylesheets/publisher.css.scss15
-rw-r--r--app/assets/stylesheets/publisher_blueprint.css.scss11
-rw-r--r--app/assets/templates/poll_creator_tpl.jst.hbs25
-rw-r--r--app/views/publisher/_publisher_blueprint.html.haml2
-rw-r--r--app/views/publisher/_publisher_bootstrap.html.haml12
-rw-r--r--features/desktop/post_with_a_poll.feature14
-rw-r--r--features/step_definitions/post_with_poll_steps.rb6
10 files changed, 47 insertions, 46 deletions
diff --git a/Changelog.md b/Changelog.md
index 4f7fe91d1..9d1c1bae5 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -65,6 +65,7 @@ The keys will still be available in the root level within the 0.5 release. The o
* Fix services settings reported by statistics.json [#5256](https://github.com/diaspora/diaspora/pull/5256)
* Only collapse empty comment box [#5328](https://github.com/diaspora/diaspora/pull/5328)
* Fix pagination for people/guid/contacts [#5304](https://github.com/diaspora/diaspora/pull/5304)
+* Fix poll creation on Bootstrap pages [#5334](https://github.com/diaspora/diaspora/pull/5334)
## Features
* Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105)
diff --git a/app/assets/javascripts/app/views/publisher/poll_creator_view.js b/app/assets/javascripts/app/views/publisher/poll_creator_view.js
index ebc6755aa..f443801c5 100644
--- a/app/assets/javascripts/app/views/publisher/poll_creator_view.js
+++ b/app/assets/javascripts/app/views/publisher/poll_creator_view.js
@@ -71,15 +71,14 @@ app.views.PublisherPollCreator = app.views.Base.extend({
},
validateInput: function(input){
- var wrapper = input.parents('.control-group');
var isValid = this.isValidInput(input);
if(isValid){
- wrapper.removeClass('error');
+ input.removeClass('error');
return true;
}
else {
- wrapper.addClass('error');
+ input.addClass('error');
return false;
}
},
diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js
index 2f20a3b44..a14b55df7 100644
--- a/app/assets/javascripts/app/views/publisher_view.js
+++ b/app/assets/javascripts/app/views/publisher_view.js
@@ -123,7 +123,7 @@ app.views.Publisher = Backbone.View.extend({
this.view_uploader.on('change', this.checkSubmitAvailability, this);
this.view_poll_creator = new app.views.PublisherPollCreator({
- el: this.$('#publisher-poll-creator')
+ el: this.$('#poll_creator_container')
});
this.view_poll_creator.on('change', this.checkSubmitAvailability, this);
this.view_poll_creator.render();
diff --git a/app/assets/stylesheets/publisher.css.scss b/app/assets/stylesheets/publisher.css.scss
index 696f573d6..6326d8ea1 100644
--- a/app/assets/stylesheets/publisher.css.scss
+++ b/app/assets/stylesheets/publisher.css.scss
@@ -50,7 +50,7 @@
border-radius: 3px;
border: 1px solid $border-dark-grey;
- input[type='text'] {
+ input[type='text']#status_message_text {
border: none;
box-shadow: none;
margin: none;
@@ -87,13 +87,22 @@
border-top: 1px dashed $border-grey;
}
- #poll_creator_wrapper {
- display:none;
+ .row-fluid#poll_creator_container {
+ display: none;
border-top: 1px dashed $border-grey;
padding:4px 6px 4px 6px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
+ .remove-answer.entypo.cross {
+ display: none;
+ color: lighten($black,75%);
+ &.active { display: block; }
+ &:hover { color: $black; }
+ line-height: 30px;
+ font-size: 18px;
+ cursor: pointer;
+ }
}
&.with_location .row-fluid#location_container {
diff --git a/app/assets/stylesheets/publisher_blueprint.css.scss b/app/assets/stylesheets/publisher_blueprint.css.scss
index 97dd3b56d..95ea2ac45 100644
--- a/app/assets/stylesheets/publisher_blueprint.css.scss
+++ b/app/assets/stylesheets/publisher_blueprint.css.scss
@@ -344,7 +344,7 @@
}
}
-#publisher-poll-creator {
+#poll_creator_container {
border: 1px solid $border-dark-grey;
padding: 5px;
margin-top: 5px;
@@ -379,19 +379,18 @@
}
}
.poll-answer {
+ .span1, .span11 { display: inline-block; }
+ .span11 { width: 96%; }
input {
- width: 96%;
+ width: 100%;
display: inline-block;
vertical-align: bottom;
}
.remove-answer {
- width: 14px;
- height: 14px;
@include opacity(0.4);
cursor: pointer;
- vertical-align: top;
- margin-top: 7px;
display: none;
+ line-height: 27px;
&:hover {
@include opacity(1);
diff --git a/app/assets/templates/poll_creator_tpl.jst.hbs b/app/assets/templates/poll_creator_tpl.jst.hbs
index f71d46f01..ea5ce6207 100644
--- a/app/assets/templates/poll_creator_tpl.jst.hbs
+++ b/app/assets/templates/poll_creator_tpl.jst.hbs
@@ -1,20 +1,21 @@
<div class="poll-question control-group">
- <div class="controls">
- <input class="span12" placeholder="{{t 'publisher.question' }}" type="text" name="poll_question">
- </div>
+ <input class="input-block-level" placeholder="{{t 'publisher.question' }}" type="text" name="poll_question">
</div>
<div class="poll-answers">
- <div class="poll-answer control-group">
- <div class="controls">
- <input type="text" name="poll_answers[]" placeholder="{{t 'publisher.option' }}">
- <div class="remove-answer icons-deletelabel"></div>
+ <div class="poll-answer row-fluid">
+ <div class="span11">
+ <input type="text" class="input-block-level" name="poll_answers[]" placeholder="{{t 'publisher.option' }}">
+ </div>
+ <div class="span1">
+ <i class="remove-answer entypo cross"></i>
</div>
</div>
- <div class="poll-answer control-group">
- <div class="controls">
- <input type="text" name="poll_answers[]" placeholder="{{t 'publisher.option' }}">
- <div class="remove-answer icons-deletelabel"></div>
+ <div class="poll-answer row-fluid">
+ <div class="span11">
+ <input type="text" class="input-block-level" name="poll_answers[]" placeholder="{{t 'publisher.option' }}">
+ </div>
+ <div class="span1">
+ <i class="remove-answer entypo cross"></i>
</div>
</div>
</div>
-
diff --git a/app/views/publisher/_publisher_blueprint.html.haml b/app/views/publisher/_publisher_blueprint.html.haml
index b54a3e716..b43ea5512 100644
--- a/app/views/publisher/_publisher_blueprint.html.haml
+++ b/app/views/publisher/_publisher_blueprint.html.haml
@@ -37,7 +37,7 @@
= image_tag 'icons/camera.png', :alt => t('shared.publisher.upload_photos').titleize, :class => 'publisher_image'
= hidden_field :location, :coords
#location_container
- #publisher-poll-creator
+ #poll_creator_container
- if publisher_public
= hidden_field_tag 'aspect_ids[]', "public"
diff --git a/app/views/publisher/_publisher_bootstrap.html.haml b/app/views/publisher/_publisher_bootstrap.html.haml
index 627f7258e..77c506702 100644
--- a/app/views/publisher/_publisher_bootstrap.html.haml
+++ b/app/views/publisher/_publisher_bootstrap.html.haml
@@ -22,16 +22,8 @@
%ul#photodropzone
.row-fluid#location_container
= hidden_field :location, :coords
- .row-fluid#poll_creator_wrapper
- #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#poll_creator_container
+ -# handlebars template
.row-fluid#button_container
#publisher-images.pull-right
#poll_creator.btn.btn-link{:title => t('shared.publisher.poll.add_a_poll')}
diff --git a/features/desktop/post_with_a_poll.feature b/features/desktop/post_with_a_poll.feature
index 807ec908f..89fa8d506 100644
--- a/features/desktop/post_with_a_poll.feature
+++ b/features/desktop/post_with_a_poll.feature
@@ -9,18 +9,18 @@ Feature: posting with a poll
And I am on the home page
Scenario: expanding the publisher
- Given "#publisher-poll-creator" is hidden
+ Given "#poll_creator_container" is hidden
When I expand the publisher
Then I should see an element "#poll_creator"
Scenario: expanding the poll creator
- Given "#publisher-poll-creator" is hidden
+ Given "#poll_creator_container" is hidden
When I expand the publisher
And I press the element "#poll_creator"
- Then I should see an element "#publisher-poll-creator"
+ Then I should see an element "#poll_creator_container"
Scenario: adding option to poll
- Given "#publisher-poll-creator" is hidden
+ Given "#poll_creator_container" is hidden
When I expand the publisher
And I press the element "#poll_creator"
And I fill in values for the first two options
@@ -28,7 +28,7 @@ Feature: posting with a poll
Then I should see 3 options
Scenario: delete an option
- Given "#publisher-poll-creator" is hidden
+ Given "#poll_creator_container" is hidden
When I expand the publisher
And I press the element "#poll_creator"
And I fill in values for the first two options
@@ -89,6 +89,6 @@ Feature: posting with a poll
And I fill in the following for the options:
| normal |
| |
- And I press the element "#publisher-poll-creator"
+ And I press the element "#poll_creator_container"
And I press the element "input[type=submit]"
- Then I should see an element ".poll-answer.error"
+ Then I should see an element ".poll-answer input.error"
diff --git a/features/step_definitions/post_with_poll_steps.rb b/features/step_definitions/post_with_poll_steps.rb
index 2b3725c3c..cee8f77d3 100644
--- a/features/step_definitions/post_with_poll_steps.rb
+++ b/features/step_definitions/post_with_poll_steps.rb
@@ -1,9 +1,9 @@
Then /^I should see ([1-9]+) options?$/ do |number|
- find("#publisher-poll-creator").all(".poll-answer").count.should eql(number.to_i)
+ find("#poll_creator_container").all(".poll-answer").count.should eql(number.to_i)
end
And /^I delete the last option$/ do
- find("#publisher-poll-creator").all(".poll-answer .remove-answer").first.click
+ find("#poll_creator_container").all(".poll-answer .remove-answer").first.click
end
And /^I should not see a remove icon$/ do
@@ -36,7 +36,7 @@ When(/^I fill in values for the first two options$/) do
end
When(/^I lose focus$/) do
- find("#publisher-poll-creator").click
+ find("#poll_creator_container").click
end
Then /^I should see an element "([^"]*)"$/ do |selector|