Skip to content

Instantly share code, notes, and snippets.

@shirashin
Created January 25, 2013 18:30
Show Gist options
  • Select an option

  • Save shirashin/4636726 to your computer and use it in GitHub Desktop.

Select an option

Save shirashin/4636726 to your computer and use it in GitHub Desktop.
JQueryUIのダイアログ拡張
class @Dialog
yesNoDialog:(target, dialog)->
jquery_dialog = $(dialog)
# ボタンの表示文字列を取得
buttons_ary = {}
buttons_ary[jquery_dialog.attr("dialog_ok")] = ->
$(@).dialog( "close" )
$(target).unbind("click")
target.click()
buttons_ary[jquery_dialog.attr("dialog_no")] = ->
$(@).dialog( "close" )
# ダイアログの描画
jquery_dialog.dialog({
resizable: false,
height:140,
modal: true,
buttons: buttons_ary
})
$(($)->
$('.destroyConfirm').bind("click", ->
dialog = new Dialog()
dialog.yesNoDialog(@,"#destroy-confirm-dialog")
false
)
)
body{
text-align : center;
font-family: 'MS ゴシック', Osaka, Arial, sans-serif;
font-size: 12px;
}
<a href="#" class="destroyConfirm">dialog test!!!</a>
<div id="destroy-confirm-dialog" title="Sample" dialog_ok="YES!!" dialog_no="NO" style="display: none;">
<p style="text-align: left;"><span class="ui-icon ui-icon-alert" style="float:left;"></span>ponpocopocopoco!!!!!!!!!!!!!!!</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment