Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dancinllama/8126fc1c438205525d6f to your computer and use it in GitHub Desktop.

Select an option

Save dancinllama/8126fc1c438205525d6f to your computer and use it in GitHub Desktop.

Revisions

  1. James Loghry revised this gist Oct 7, 2015. No changes.
  2. James Loghry revised this gist Oct 7, 2015. No changes.
  3. James Loghry revised this gist Oct 7, 2015. 3 changed files with 0 additions and 0 deletions.
  4. James Loghry created this gist Oct 7, 2015.
    16 changes: 16 additions & 0 deletions Lightning Design System Checkbox Helper JS
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    ({
    //Method for fixing Lightning Design System Checkboxes
    fixLDSCheckboxes : function(component){
    //Add all the checkboxes here. Note, you'll need their aura Ids
    this.fixLDSCheckbox(component.find("requiredCheckbox"));
    this.fixLDSCheckbox(component.find("showLabelCheckbox"));
    this.fixLDSCheckbox(component.find("showCheckbox"));
    return false;
    },
    fixLDSCheckbox : function(chkbox){
    var el = chkbox.getElement();
    var elLabel = el.parentElement;
    elLabel.setAttribute("for",el.getAttribute("Id"));
    return false;
    }
    })
    8 changes: 8 additions & 0 deletions Lightning Design System Checkbox Lightning Component (cmp)
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    <!-- LDS markup for a checkbox (https://www.lightningdesignsystem.com/components/forms/) -->
    <div class="slds-form-element margintop10">
    <label class="slds-checkbox" for="requiredCheckbox">
    <ui:inputCheckbox aura:Id="requiredCheckbox" value="{!v.selectedFormObject.Required_On_Form__c}" />
    <span class="slds-checkbox--faux" />
    <span class="slds-form-element__label marginleft10">Required on Form?</span>
    </label>
    </div>
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    ({
    //Called from either another helper method or from the aura:initHandler call or an event, etc.
    doInit : function(component, event, helper) {
    return helper.fixLDSCheckboxes(component);
    }
    })