diff --git a/Changelog.md b/Changelog.md index 005785678..73d490d6e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -41,7 +41,7 @@ * Added comment count to statistic to enable calculations of posts/comments ratios [#4799](https://github.com/diaspora/diaspora/pull/4799) * Add filters to notifications controller [#4814](https://github.com/diaspora/diaspora/pull/4814) * Activate hovercards in SPV and conversations [#4870](https://github.com/diaspora/diaspora/pull/4870) -* Added possibility to conduct polls [#4861](https://github.com/diaspora/diaspora/pull/4861) [#4894](https://github.com/diaspora/diaspora/pull/4894) +* Added possibility to conduct polls [#4861](https://github.com/diaspora/diaspora/pull/4861) [#4894](https://github.com/diaspora/diaspora/pull/4894) [#4897](https://github.com/diaspora/diaspora/pull/4897) # 0.3.0.3 diff --git a/app/assets/javascripts/app/views/poll_blueprint_view.js b/app/assets/javascripts/app/views/poll_blueprint_view.js deleted file mode 100644 index ffb996961..000000000 --- a/app/assets/javascripts/app/views/poll_blueprint_view.js +++ /dev/null @@ -1,17 +0,0 @@ -//= require ./poll_view -app.views.PollBlueprint = app.views.Poll.extend({ - templateName: 'poll_blueprint', - - initialize: function(options) { - this.constructor.__super__.initialize.apply(this, options); - this.progressBarFactor = 3; - }, - setProgressBarData: function(progressBar, percent) { - progressBar.css('width', percent * this.progressBarFactor + 'px'); - progressBar.parent().next().html(" - " + percent + "%"); - }, - toggleElements: function() { - this.$('.poll_progress_bar_wrapper').toggle(); - this.$('.percentage').toggle(); - } -}); diff --git a/app/assets/javascripts/app/views/stream_post_views.js b/app/assets/javascripts/app/views/stream_post_views.js index 5088784bc..fb1d846d4 100644 --- a/app/assets/javascripts/app/views/stream_post_views.js +++ b/app/assets/javascripts/app/views/stream_post_views.js @@ -32,7 +32,7 @@ app.views.StreamPost = app.views.Post.extend({ this.commentStreamView = new app.views.CommentStream({model : this.model}); this.oEmbedView = new app.views.OEmbed({model : this.model}); this.openGraphView = new app.views.OpenGraph({model : this.model}); - this.pollView = new app.views.PollBlueprint({model : this.model}); + this.pollView = new app.views.Poll({model : this.model}); }, diff --git a/app/assets/stylesheets/poll.css.scss b/app/assets/stylesheets/poll.css.scss index dd5c89f4f..590dd8502 100644 --- a/app/assets/stylesheets/poll.css.scss +++ b/app/assets/stylesheets/poll.css.scss @@ -1,45 +1,32 @@ +@import 'new_styles/poll'; + .poll_form { - display: block; - margin: 10px 0px 10px 0px; - border-top: solid 1px $border-grey; - border-bottom: solid 1px $border-grey; - padding: 10px 0px 5px 0px; - overflow: hidden; - width: 100%; -} + .pull-right { + float: right; + } + label { + display: block; + font-size: 13px; + font-weight: normal; + line-height: 20px; + padding-left: 20px; -.poll_form input[type="radio"] { - display:inline !important; -} + input[type=radio] { + float: left; + margin-left: -20px; + } + &:HOVER { + cursor: pointer; + } + } + .progress { + overflow: hidden; + background-color: #f6f6f6; + @include border-radius(4px); -.poll_result { - width:100%px; -} - -.poll_progress_bar { - position:absolute; - width:0px; - height:15px; - top:-12px; - z-index:-1; - background-color:$background-grey; -} - -.poll_statistic{ - float:right; -} - -.poll_progress_bar_wrapper { - position: relative; - width: 0; - height: 0; - display:inline-block; -} - -.poll_answer_entry{ - width:100%; -} - -.percentage { - display:inline; + .bar { + height: 100%; + float: left; + } + } } diff --git a/app/assets/templates/poll_blueprint_tpl.jst.hbs b/app/assets/templates/poll_blueprint_tpl.jst.hbs deleted file mode 100644 index ed9e18e7c..000000000 --- a/app/assets/templates/poll_blueprint_tpl.jst.hbs +++ /dev/null @@ -1,32 +0,0 @@ -{{#if poll}} -
-

{{t "poll.count" count=poll.participation_count}}

- {{poll.question}}
- {{#unless already_participated_in_poll}} -
- {{#poll.poll_answers}} - - - {{answer}} - -
- {{/poll.poll_answers}} - -
-

-
{{t "poll.show_result"}}
-

- {{else}} - {{#poll.poll_answers}} -
-
-
- {{answer}} -

-
- {{/poll.poll_answers}} - {{/unless}} -
-{{/if}} \ No newline at end of file diff --git a/spec/javascripts/app/views/poll_blueprint_view_spec.js b/spec/javascripts/app/views/poll_view_spec.js similarity index 81% rename from spec/javascripts/app/views/poll_blueprint_view_spec.js rename to spec/javascripts/app/views/poll_view_spec.js index acac4e1b6..d6fe1cfc7 100644 --- a/spec/javascripts/app/views/poll_blueprint_view_spec.js +++ b/spec/javascripts/app/views/poll_view_spec.js @@ -1,15 +1,15 @@ -describe("app.views.PollBlueprint", function(){ +describe("app.views.Poll", function(){ beforeEach(function() { loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}}); - this.view = new app.views.PollBlueprint({ model: factory.postWithPoll()}); + this.view = new app.views.Poll({ model: factory.postWithPoll()}); this.view.render(); }); describe("setProgressBar", function(){ it("sets the progress bar according to the voting result", function(){ var percentage = (this.view.poll.poll_answers[0].vote_count / this.view.poll.participation_count)*100; - expect(this.view.$('.poll_progress_bar:first').css('width')).toBe(this.view.progressBarFactor * percentage+"px"); - expect(this.view.$(".percentage:first").text()).toBe(" - " + percentage + "%"); + expect(this.view.$('.poll_progress_bar:first').css('width')).toBe(percentage+"%"); + expect(this.view.$(".percentage:first").text()).toBe(percentage + "%"); }) });