Add VotationType fields to admin poll question form
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
d1c1aa6691
commit
815a526d78
21
app/assets/javascripts/admin/votation_types/fields.js
Normal file
21
app/assets/javascripts/admin/votation_types/fields.js
Normal file
@@ -0,0 +1,21 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
App.AdminVotationTypesFields = {
|
||||
adjustForm: function() {
|
||||
if ($(this).val() === "unique") {
|
||||
$(".max-votes").hide();
|
||||
$(".description-unique").show();
|
||||
$(".description-multiple").hide();
|
||||
$(".votation-type-max-votes").prop("disabled", true);
|
||||
} else {
|
||||
$(".max-votes").show();
|
||||
$(".description-unique").hide();
|
||||
$(".description-multiple").show();
|
||||
$(".votation-type-max-votes").prop("disabled", false);
|
||||
}
|
||||
},
|
||||
initialize: function() {
|
||||
$(".votation-type-vote-type").on("change", App.AdminVotationTypesFields.adjustForm).trigger("change");
|
||||
}
|
||||
};
|
||||
}).call(this);
|
||||
Reference in New Issue
Block a user