This file contains 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
$(function() { | |
$("INPUT.datepicker").datepicker(); | |
} |
This file contains 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
# datepicker is accessible trough data("datepicker") | |
# but its focusDate is cleared out on keydown for tab (9) | |
# my solution is thus to store the focusDate as data('datepicker_focusdate') on keydown when the key is a navigation key (up, down, left, right) | |
# and then set the datepicker date to that date when tabbing out | |
$("body").on("keydown", '[data-provide~=datepicker]', function(e){ | |
if ([37,38,39,40].indexOf(e.keyCode) >= 0 ) { | |
$(this).data('datepicker_focusdate', $(this).data("datepicker").focusDate) | |
} else if (e.keyCode == 9 && $(this).data('datepicker_focusdate')) { | |
$(this).datepicker('update', $(this).data('datepicker_focusdate')); |
This file contains 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
# config/application.rb | |
[...] | |
config.autoload_paths += %W["#{config.root}/app/validators/"] | |
[...] |
This file contains 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
import { Controller } from "stimulus" | |
export default class extends Controller { | |
connect() { | |
const templates = this.element.import.querySelectorAll("template"); | |
templates.forEach(function(template) { | |
document.querySelector('body').appendChild(template); | |
}); | |
} | |
} |
This file contains 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
def self.multi_scope(scopes) | |
my_scopes = Array.new | |
scopes.each do |scope| | |
m_scopes << self.send(scope) if self.respond_to? scope | |
end | |
if my_scopes.length == 0 | |
return slef.none | |
else | |
f = my_scopes.delete_at(0) | |
my_scopes.each do |s| |
This file contains 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
.select2-container, .select2-container--material { | |
ul { | |
margin: 0; | |
padding: 0; | |
} | |
.select2-selection, .select2-selection--single, .select2-selection--multiple { | |
@extend .form-control; | |
/*@extend .d-flex;*/ |
This file contains 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
.alert { | |
background-color: #fff; | |
border-top-left-radius: 0; | |
border-top-right-radius: 0; | |
border-top: 0; | |
border-left: 0; | |
.container:before { | |
@extend .navbar-toggler-icon; | |
content: "info"; | |
vertical-align: middle; |