add coffescript to expand options

This commit is contained in:
Andreas N 2015-01-27 18:25:20 +01:00
parent ddbff78926
commit 9c2b0951bf
2 changed files with 17 additions and 2 deletions

View File

@ -121,3 +121,18 @@ $(document).on "click", "button[name=ib-destroy]", ->
complete: (jqxhr, status) -> complete: (jqxhr, status) ->
btn.button "reset" btn.button "reset"
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly" $("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
# Toggle button
$(document).on "click", "button[name=ib-options]", ->
btn = $(this)
ibid = btn[0].dataset.ib_id
state = btn[0].dataset.state
optionBox = $("#ib-options-#{ibid}")
switch state
when 'hidden'
optionBox.slideDown()
btn[0].dataset.state = 'shown'
when 'shown'
optionBox.slideUp()
btn[0].dataset.state = 'hidden'

View File

@ -23,9 +23,9 @@
Answer Answer
%button.btn.btn-danger{name: 'ib-destroy', data: { ib_id: i.id }} %button.btn.btn-danger{name: 'ib-destroy', data: { ib_id: i.id }}
Delete Delete
%button.btn.btn-default %button.btn.btn-default{name: 'ib-options', data: { ib_id: i.id, state: :hidden }}
Options Options
.panel-footer .panel-footer{id: "ib-options-#{i.id}", style: 'display: none'}
%h4 Sharing %h4 Sharing
- if @services.count > 0 - if @services.count > 0
.row .row