Update legislation drafts translatable fields

Updating it required reorganizing the form so translatable fields are
together.

We also needed to add a `hint` option to the form label and input
methods so the hint wouldn't show up for every language.

Finally, the markdown editor needed to use the same globalize attributes
as inputs, labels and hints, which adds a bit of duplication.
This commit is contained in:
Javi Martín
2018-10-09 18:06:50 +02:00
committed by decabeza
parent d5bd481f7f
commit 968a5b11d3
9 changed files with 165 additions and 128 deletions

View File

@@ -3,12 +3,12 @@ App.MarkdownEditor =
refresh_preview: (element, md) ->
textarea_content = App.MarkdownEditor.find_textarea(element).val()
result = md.render(textarea_content)
element.find('#markdown-preview').html(result)
element.find('.markdown-preview').html(result)
# Multi-locale (translatable) form fields work by hiding inputs of locales
# which are not "active".
find_textarea: (editor) ->
editor.find('textarea:visible')
editor.find('textarea')
initialize: ->
$('.markdown-editor').each ->
@@ -26,7 +26,7 @@ App.MarkdownEditor =
return
editor.find('textarea').on 'scroll', ->
$('#markdown-preview').scrollTop($(this).scrollTop())
editor.find('.markdown-preview').scrollTop($(this).scrollTop())
editor.find('.fullscreen-toggle').on 'click', ->
editor.toggleClass('fullscreen')