Skip to content

Commit

Permalink
audio: disable delete button in readonly mode
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Nov 20, 2014
1 parent e003d2f commit 9700923
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions static/coffee/audioplayer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,17 @@ class AudioAnnotation
error: (msg) ->
flash_message "Error: #{msg}"

$closeBtn = jQuery('<a>').text '[X]'
@$div.append $closeBtn

$closeBtn.click =>
@rest.delete this, =>
@player.removeAnnotation @id
@$div.remove()

$textDiv = $('<div>').text(@text)
@$div.append $textDiv

if !readOnly
$closeBtn = jQuery('<a>').text '[X]'
@$div.prepend $closeBtn
$closeBtn.click =>
@rest.delete this, =>
@player.removeAnnotation @id
@$div.remove()

$textDiv.editable (value, settings) =>
@text = value
@submitChanges()
Expand Down

0 comments on commit 9700923

Please sign in to comment.