Minor main.js refactor and docs
This commit is contained in:
parent
ad1aa517c7
commit
3551df8eb1
1 changed files with 8 additions and 6 deletions
|
@ -21,8 +21,8 @@ window.disableButtonIfEmptyField = (field_selector, button_selector) ->
|
||||||
closest_submit.enable()
|
closest_submit.enable()
|
||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
$(".one_click_select").live 'click', ->
|
# Click a .one_click_select field, select the contents
|
||||||
$(this).select()
|
$(".one_click_select").live 'click', -> $(this).select()
|
||||||
|
|
||||||
# Disable form buttons while a form is submitting
|
# Disable form buttons while a form is submitting
|
||||||
$('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
|
$('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
|
||||||
|
@ -66,10 +66,12 @@ $ ->
|
||||||
$(this).text(previewLinkText)
|
$(this).text(previewLinkText)
|
||||||
|
|
||||||
note = $('#note_note').val()
|
note = $('#note_note').val()
|
||||||
note = 'Nothing to preview' if note.trim().length is 0
|
|
||||||
$.post($(this).attr('href'), {note: note}, (data) ->
|
if note.trim().length == 0
|
||||||
$('#preview-note').html(data)
|
$('#preview-note').text("Nothing to preview.")
|
||||||
)
|
else
|
||||||
|
$.post $(this).attr('href'), {note: note}, (data) ->
|
||||||
|
$('#preview-note').html(data)
|
||||||
|
|
||||||
$('#preview-note, #note_note').toggle()
|
$('#preview-note, #note_note').toggle()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue