summaryrefslogtreecommitdiff
path: root/data/js
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-11-11 15:51:40 +0100
committerYorhel <git@yorhel.nl>2015-11-11 16:00:34 +0100
commit1e97c0405a0cacb05d9d70429d7e7969e231b786 (patch)
tree1d31d74761726bf29868d1d0aebc66e188180dd9 /data/js
parentfd9f224ad7e1d6ebe4f7abba75526b5190c963ba (diff)
Misc poll improvements
- Merged polls table into threads table. Not much of a storage/performance difference, and it's a bit simpler this way. - Merged DB::Polls into DB::Discussions. Mainly because of the above change in DB structure. - Add option to remove an existing poll. - Allow preview and recast to be changed without deleting the votes - Set preview option by default. Because personal preferences. :) - Minor form validation differences
Diffstat (limited to 'data/js')
-rw-r--r--data/js/polls.js27
1 files changed, 11 insertions, 16 deletions
diff --git a/data/js/polls.js b/data/js/polls.js
index b34f0f7b..94a0bba2 100644
--- a/data/js/polls.js
+++ b/data/js/polls.js
@@ -1,26 +1,21 @@
-function addPoll() {
- var a = byId('poll_add');
- setClass(a, 'hidden', false);
+// Discussion board polls
+if(byId('jt_box_postedit') && byId('poll')) {
+ var c = byId('poll');
var parentNode = function(n, tag) {
while(n && n.nodeName.toLowerCase() != tag)
n = n.parentNode;
return n;
};
var show = function(v) {
- setClass(parentNode(byId('poll_q'), 'tr'), 'hidden', !v);
- setClass(parentNode(byId('poll_opt'), 'tr'), 'hidden', !v);
- setClass(parentNode(byId('poll_max'), 'tr'), 'hidden', !v);
- setClass(parentNode(byId('poll_preview'),'tr'), 'hidden', !v);
- setClass(parentNode(byId('poll_recast'), 'tr'), 'hidden', !v);
- setClass(parentNode(a, 'tr'), 'hidden', v);
+ setClass(parentNode(byId('poll_question'), 'tr'), 'hidden', !v);
+ setClass(parentNode(byId('poll_options'), 'tr'), 'hidden', !v);
+ setClass(parentNode(byId('poll_max_options'), 'tr'), 'hidden', !v);
+ setClass(parentNode(byId('poll_preview'), 'tr'), 'hidden', !v);
+ setClass(parentNode(byId('poll_recast'), 'tr'), 'hidden', !v);
};
- a.onclick = function() {
- show(true);
+ c.onclick = function() {
+ show(this.checked);
return true;
};
- show(false);
+ show(c.checked);
}
-
-// Discussion board polls
-if(byId('poll_add'))
- addPoll();