Skip to content

Instantly share code, notes, and snippets.

@yamaaki
Last active November 26, 2015 16:45
Show Gist options
  • Save yamaaki/cf03e4dfbb574b91b356 to your computer and use it in GitHub Desktop.
Save yamaaki/cf03e4dfbb574b91b356 to your computer and use it in GitHub Desktop.
$(document).ready ->
$('.button-collapse').sideNav()
rightNav = $('.u-right-nav')
if rightNav.length
rightNav.pushpin
top: rightNav.offset().top
$('.scrollspy').scrollSpy()
$('select').material_select()
$('.datepicker').pickadate
monthsFull : [ '1月' , '2月' , '3月' , '4月' , '5月' , '6月' , '7月' , '8月' , '9月' , '10月' , '11月' , '12月' ] ,
monthsShort : [ '1月' , '2月' , '3月' , '4月' , '5月' , '6月' , '7月' , '8月' , '9月' , '10月' , '11月' , '12月' ] ,
weekdaysFull : [ '日曜' , '月曜' , '火曜' , '水曜' , '木曜' , '金曜' , '土曜' ],
weekdaysShort : [ '日曜' , '月曜' , '火曜' , '水曜' , '木曜' , '金曜' , '土曜' ],
weekdaysLetter : [ '日' , '月' , '火' , '水' , '木' , '金' , '土' ] ,
today: '今日'
clear: 'リセット'
close: '閉じる'
selectMonths: true
selectYears: 15
format: 'yyyy.mm.dd'
onClose: ->
input = $(@['$node'][0])
idVal = input.attr 'id'
input.parent().find("label[for=#{idVal}]").removeClass 'active' unless input.val()
$(document.activeElement).blur()
Waves.displayEffect()
$('.u-toast').each ->
toast = $(@)
Materialize.toast toast.text(), 2000
$('.tooltipped').tooltip
delay: 50
$.rails.allowAction = (element) ->
message = element.data 'confirm'
return yes unless message
answer = no
modal = $('#u-confirm-modal')
modal.find('h4').text message
modal.find('.u-confirm-modal-ok').on 'click', (e) ->
element.data 'confirm', null
element.trigger 'click.rails'
modal.openModal()
return no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment