Skip to content

Commit

Permalink
[FEATURE] Translate input element
Browse files Browse the repository at this point in the history
refs OSC-17
  • Loading branch information
Bunhok committed Sep 20, 2022
1 parent 5e76c27 commit b67db52
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/custom_form_builder.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class CIF.CustomFormBuilder
localLabel = "Local Label"
if fields[index - 1]
localLabel = if fields[index - 1][localLabelName] then fields[index - 1][localLabelName] else localLabel
frmHolder = fldElement.find('.frm-holder')
localLabelBlock = "<div class='form-group local-label-wrap' style='display: block'><label for='#{localLabelName}'>Local Label</label><div class='input-wrap'><div name='#{localLabelName}' placeholder='Local Label' class='fld-label-#{fldId} form-control' id='local-label-#{fldId}' contenteditable='true'>#{localLabel}</div></div></div>"
localLabelBlockElement = $.parseHTML(localLabelBlock)
frmHolder.find('.label-wrap').after(localLabelBlockElement)
3 changes: 3 additions & 0 deletions app/assets/javascripts/multiple_form/form.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ CIF.Client_trackingsNew = CIF.Client_trackingsCreate = CIF.Client_custom_fieldsN
_preventCreateDatePickerClientEnrollment()
_setAnotherLanguageFieldValue()
_hideAnotherLanguageField()

$('input[type="text"]').on 'keyup', (e) ->
console.log(e)

_initICheckBox = ->
$('.i-checks').iCheck
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/program_streams/form.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C
number: builderOption.eventNumberOption()
'radio-group': builderOption.eventRadioOption()
select: builderOption.eventSelectOption(fields)
text: builderOption.eventTextFieldOption()
text: builderOption.eventTextFieldOption(fields)
textarea: builderOption.eventTextAreaOption()
separateLine: builderOption.eventSeparateLineOption()
paragraph: builderOption.eventParagraphOption()
Expand Down
6 changes: 4 additions & 2 deletions app/views/shared/fields/_text.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- label = field_label(field_props)
%div{ class: "form-group #{field_with(field_props['label'],errors)}" }
%label.control-label{ class: required?(field_props['required'] || false) }
%abbr{ title: 'required' }= '*' if field_props['required'] || false
= field_props['label'].html_safe
= f.input field_props['label'], required: (field_props['required'] || false), input_html: { class: field_props['className'], placeholder: format_placeholder(field_props['placeholder']), title: field_props['description'], name: "#{f.object_name}[#{remove_field_prop_unicode(field_props)}]", type: field_props['subtype'] , id: "#{f.object_name}[#{remove_field_prop_unicode(field_props)}]".parameterize}, label: false
= label.html_safe
= f.input field_props['label'], required: (field_props['required'] || false), input_html: { class: field_props['className'], placeholder: format_placeholder(field_props['placeholder']), title: field_props['description'], name: "#{f.object_name}[#{remove_field_prop_unicode(field_props)}]", type: field_props['subtype'] , id: "#{f.object_name}[#{remove_field_prop_unicode(field_props)}]".parameterize, 'data-local-input': "#{f.object_name}[#{remove_local_field_prop_unicode(field_props)}]".parameterize }, label: false
= f.input field_props['local_label'], :as => :hidden, input_html: { name: "#{f.object_name}[#{remove_local_field_prop_unicode(field_props)}]", id: "#{f.object_name}[#{remove_local_field_prop_unicode(field_props)}]".parameterize }
%span.help-block
= field_message(field_props['label'], errors)

0 comments on commit b67db52

Please sign in to comment.