난 레일 애플 리케이션에서 fullcalender를 사용하고 있습니다.ruby on rails coffeescript 입력 양식
select: (start, end, allDay) ->
title = prompt("Event Title:", "")
hours = prompt("Hours", "")
if title
...
대신 2 개 프롬프트 코드 라인을 사용하여, 나는이 두 데이터 필드 작은 팝업 창을 가지고 싶습니다 나는 다음과 같은 커피 스크립트 코드가 있습니다. 어떻게해야합니까? 부트 스트랩 모달을 사용해야합니까?
감사
OK --- 나는이 모달을 생성하고 잘 표시
<div id="calModal" class="modal hide fade" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Create Labor</h3>
</div>
<div class="modal-body">
<form class="form-inline" method="get">
<input type="text" id="title" class="input" placeholder="Title" name="title">
<input type="floating" id="hours" class="input" placeholder="Hours" name="hours">
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>`
그러나, 제목 값과 시간 내 커피 스크립트 코드의 나머지 부분에서 사용할 수 없습니다 :
select: (start, end, allDay) ->
$('#calModal').modal('show')
title = $(".modal-body #title").val
hours = $(".modal-body #hours").val
if title
$.create "/events/",
event:
title: title,
starts_at: "" + start,
ends_at: "" + end,
all_day: allDay,
workorder_id: 1,
# need a modal for inputing these fields
hours: hours,
employee_id: 1
# pickup the current employee
$('#calendar').fullCalendar('refetchEvents')`
이 문은 작동하지 않습니다 :
,966,
모달 대화 상자가 작동합니다. 그렇습니다. –