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 on (eventName, selector, callback) { | |
document.addEventListener(eventName, function (event) { | |
var elem = event.srcElement | |
var matches = elem.matches || elem.matchesSelector | |
if (matches.call(elem, selector)) { | |
callback.call(elem) | |
} | |
}) | |
} |
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
$(document).on('click', '@stepper-up, @stepper-down', function() { | |
var sender = $(this); | |
var parent = sender.parents('@stepper'); | |
var target = parent.find('@stepper-input'); | |
var val = parseInt(target.val()); | |
if (sender.is('@stepper-up')) { | |
val++; | |
} | |
else { |
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 image_2x_tag(img, opts={}) | |
x2_img = img.gsub(/(.+)(\.\w+)/, '\1@2x\2') | |
x2_path = image_path(x2_img) | |
opts[:srcset] = "#{x2_path} 2x" | |
image_tag(img, opts) | |
end |
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
.fa-state-warning { | |
color: #f0ad4e; | |
} | |
.fa-state-danger { | |
color: #d9534f; | |
} | |
.fa-state-primary { | |
color: #286090; |
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
--- | |
da: | |
clearance_mailer: | |
change_password: | |
closing: Ignorer denne email hvis du ikke har bedt om dette. Dit password er ikke blevet ændret. | |
link_text: Skift mit password | |
opening: "Du har bedt om et link til at skifte dit password:" | |
flashes: | |
failure_after_create: Ugyldig email eller password. | |
failure_after_update: Password skal udfyldes |
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
$.rails.allowAction = function(element) { | |
var message = element.data('confirm'); | |
if (!message) { | |
return true; | |
} | |
bootbox.confirm(message, function(result) { | |
if (result) { | |
$.rails.handleMethod(element); | |
} |
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 generatePassword(length) { | |
var charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", | |
retVal = ""; | |
for (var i = 0, n = charset.length; i < length; ++i) { | |
retVal += charset.charAt(Math.floor(Math.random() * n)); | |
} | |
return retVal; | |
} | |
document.activeElement.value = prompt('Password:', generatePassword(16)); |
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
.inner { | |
position: relative; | |
top: 50%; | |
transform: translateY(-50%); | |
} |
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
window.ParsleyConfig = { | |
errorClass: 'has-error', | |
successClass: 'has-success', | |
classHandler: function (ParsleyField) { | |
return ParsleyField.$element.parents('.form-group'); | |
}, | |
errorsContainer: function (ParsleyField) { | |
return ParsleyField.$element.parents('.form-group'); | |
}, | |
errorsWrapper: '<span class="help-block">', |
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
before_action :set_order | |
def set_order | |
if session[:order_id] | |
@order = Order.find(session[:order_id]) | |
else | |
@order = Order.new | |
end | |
end |
NewerOlder