BigW Consortium Gitlab

Commit 87da9185 by Douwe Maan

Autosave title and description of new issues/MRs.

parent a30a5663
......@@ -33,12 +33,16 @@ class Dispatcher
shortcut_handler = new ShortcutsNavigation()
new ZenMode()
new DropzoneInput($('.issue-form'))
if page == 'projects:issues:new'
new IssuableForm($('.issue-form'))
when 'projects:merge_requests:new', 'projects:merge_requests:edit'
GitLab.GfmAutoComplete.setup()
new Diff()
shortcut_handler = new ShortcutsNavigation()
new ZenMode()
new DropzoneInput($('.merge-request-form'))
if page == 'projects:merge_requests:new'
new IssuableForm($('.merge-request-form'))
when 'projects:merge_requests:show'
new Diff()
shortcut_handler = new ShortcutsIssueable()
......
class @IssuableForm
constructor: (@form) ->
@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()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment