Skip to content

Commit

Permalink
Merge pull request #69 from legalthings/fix-material-checkbox
Browse files Browse the repository at this point in the history
Fix material checkbox
  • Loading branch information
svenstm authored Jul 27, 2017
2 parents ebd5a6e + 5e352d6 commit b203adb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions js/ractive-legalform.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
onChangeLegalForm: function (newValue, oldValue, keypath) {
if (this.isCondition(keypath)) {
this.onChangeCondition(newValue, oldValue, keypath);

if ($(this.el).hasClass('material')) {
$(this.el).toMaterial();
}
}

this.updateExpressions(newValue, oldValue, keypath);
Expand Down
18 changes: 11 additions & 7 deletions js/to-material.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
var $wizardSteps = $docWizard.find('.wizard-step');

$wizardSteps.each(function(index, value) {
var $wizardForm = $('<div>').appendTo(this);
$wizardForm.addClass('wizzard-form');
$wizardForm.append($(this).find('form'));
$wizardForm.append($(this).find('.wizards-actions'));
if (!$(this).children('.wizzard-form').length) {
var $wizardForm = $('<div>').appendTo(this);
$wizardForm.addClass('wizzard-form');
$wizardForm.append($(this).find('form'));
$wizardForm.append($(this).find('.wizards-actions'));
}
});

// Change checkboxes to the bootstrap material
Expand All @@ -30,9 +32,11 @@

// Change likert-view on bootstrap material
$docWizard.find('.likert-answer').each(function(){
var $div = $('<div>').appendTo(this).addClass('radio');
var $label = $('<label>').appendTo($div);
$(this).find('input').appendTo($label);
if (!$(this).children('.radio').length) {
var $div = $('<div>').appendTo(this).addClass('radio');
var $label = $('<label>').appendTo($div);
$(this).find('input').appendTo($label);
}
});

// Do all labels floating for nice view
Expand Down

0 comments on commit b203adb

Please sign in to comment.