2015-04-26 12:48:37 +05:30
|
|
|
class @IssuableForm
|
|
|
|
constructor: (@form) ->
|
2015-09-11 14:41:01 +05:30
|
|
|
GitLab.GfmAutoComplete.setup()
|
|
|
|
new UsersSelect()
|
|
|
|
new ZenMode()
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
@titleField = @form.find("input[name*='[title]']")
|
|
|
|
@descriptionField = @form.find("textarea[name*='[description]']")
|
|
|
|
|
|
|
|
return unless @titleField.length && @descriptionField.length
|
|
|
|
|
|
|
|
@initAutosave()
|
|
|
|
|
|
|
|
@form.on "submit", @resetAutosave
|
|
|
|
@form.on "click", ".btn-cancel", @resetAutosave
|
|
|
|
|
|
|
|
initAutosave: ->
|
|
|
|
new Autosave @titleField, [
|
|
|
|
document.location.pathname,
|
|
|
|
document.location.search,
|
|
|
|
"title"
|
|
|
|
]
|
|
|
|
|
|
|
|
new Autosave @descriptionField, [
|
|
|
|
document.location.pathname,
|
|
|
|
document.location.search,
|
|
|
|
"description"
|
|
|
|
]
|
|
|
|
|
|
|
|
resetAutosave: =>
|
|
|
|
@titleField.data("autosave").reset()
|
|
|
|
@descriptionField.data("autosave").reset()
|