Merge pull request #4993 from consul/refactor_public_polls
Refactor and simplify public polls views
This commit is contained in:
@@ -1,28 +1,7 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Polls = {
|
||||
generateToken: function() {
|
||||
var strings;
|
||||
strings = Array.apply(null, {
|
||||
length: 6
|
||||
}).map(function() {
|
||||
return Math.random().toString(36).substr(2); // remove `0.`
|
||||
});
|
||||
return strings.join("").substring(0, 64);
|
||||
},
|
||||
replaceToken: function(token) {
|
||||
$(".js-question-answer").each(function() {
|
||||
var token_param;
|
||||
token_param = this.search.slice(-6);
|
||||
if (token_param === "token=") {
|
||||
this.href = this.href + token;
|
||||
}
|
||||
});
|
||||
},
|
||||
initialize: function() {
|
||||
var token;
|
||||
token = App.Polls.generateToken();
|
||||
App.Polls.replaceToken(token);
|
||||
$(".zoom-link").on("click", function(event) {
|
||||
var answer;
|
||||
answer = $(event.target).closest("div.answer");
|
||||
|
||||
@@ -1633,9 +1633,10 @@
|
||||
}
|
||||
|
||||
.poll-question-answers {
|
||||
@include flex-with-gap($line-height / 4);
|
||||
flex-wrap: wrap;
|
||||
|
||||
.button {
|
||||
margin-right: $line-height / 4;
|
||||
min-width: rem-calc(168);
|
||||
|
||||
@include breakpoint(medium down) {
|
||||
|
||||
Reference in New Issue
Block a user