This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code for processing icheck checkboxes | |
# with slight modification it can be used with normal checkboxes as well | |
# Check or uncheck all checkboxes | |
# | |
$('#checkAll').on 'ifChecked ifUnchecked', (event) -> | |
$checkboxes = $(this).closest('form').find(':checkbox') | |
if event.type == 'ifChecked' | |
$checkboxes.prop 'checked', true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given there is a section object and I would like to use trix editor for adding text to the content attribute | |
# id: is required to tie trix-editor(below to to the hidden input | |
# name: is required so that you can find it via params in the controller in this case params["trix-editor_section_#{section.id}"] | |
# content: is for inserting any content that already existed in the content attribute | |
%input{id: "#{dom_id(section, 'trix-editor')}", name: "#{dom_id(section, 'trix-editor')}", content: "#{section.content}", type: :hidden} | |
%trix-editor{input: "#{dom_id(section, 'trix-editor')}"} |
NewerOlder