mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Clean up the unwanted extended versions of Backform Switch controls.
The Bootstrap Switch Control was extended only for alignment in most places. IIntroduce a configurable option to set the necessary class on the main div and also remove the extra extended controls.
This commit is contained in:
committed by
Dave Page
parent
3fae181c27
commit
4a75053514
@@ -439,10 +439,11 @@ define([
|
||||
controlsClassName: Backform.controlsClassName,
|
||||
extraClasses: [],
|
||||
helpMessage: null,
|
||||
extraToggleClasses: null,
|
||||
},
|
||||
template: _.template([
|
||||
'<label class="<%=controlLabelClassName%>"><%=label%></label>',
|
||||
'<div class="<%=controlsClassName%>">',
|
||||
'<div class="<%=controlsClassName%> <%=extraClasses.join(\' \')%>">',
|
||||
' <input tabindex="0" type="checkbox" data-style="quick" data-toggle="toggle"',
|
||||
' data-size="<%=options.size%>" data-height="<%=options.height%>" ',
|
||||
' data-on="<%=options.onText%>" data-off="<%=options.offText%>" ',
|
||||
@@ -513,6 +514,10 @@ define([
|
||||
$.fn.bootstrapToggle.defaults);
|
||||
|
||||
this.$el.html(this.template(data)).addClass(field.name);
|
||||
|
||||
// Add Extra Toggle classes to render multiple toggles in a single row
|
||||
if(!_.isNull(field.extraToggleClasses)) this.$el.addClass(field.extraToggleClasses);
|
||||
|
||||
this.$input = this.$el.find('input[type=checkbox]').first();
|
||||
this.$input.bootstrapToggle();
|
||||
this.updateInvalid();
|
||||
|
||||
Reference in New Issue
Block a user