/ Variables: field placeholder ctrl_as angularjs controllerAs hash params hash name - modal_id = "#{field}Modal" - field_name = field.to_s.underscore - var_name = field_name.singularize - func_name = field.to_s.singularize - title = t "activerecord.attributes.build_list.#{field_name}" - ctrl_as = "#{ctrl_as}." h4 = title a<[ class='fa fa-question-circle' href='#' data-toggle='modal' data-target="##{modal_id}" ] .modal.fade[ id=modal_id tabindex='-1' role='dialog' aria-labelledby="#{modal_id}Label" aria-hidden='true' ] .modal-dialog .modal-content .modal-header button[ class='close' type='button' data-dismiss='modal' ] span[ aria-hidden='true' ] × span.sr-only Close h4.modal-title[ id=modal_id ]= title .modal-body== render "shared/autocomplete_docs/#{field_name}" .row .col-md-8 input[ class = 'form-control' type = 'text' ng-model = "#{ctrl_as}selected_#{var_name}" placeholder = placeholder typeahead = "extra.label for extra in #{ctrl_as}get#{field}($viewValue)" typeahead-on-select = "#{ctrl_as}select#{func_name}($item, $model, $label)" ] .col-md-4 button[ class='btn btn-primary' type='button' ng-click="#{ctrl_as}add#{func_name}()" ] = t('layout.add') table.table.offset5 tr[ ng-repeat="el in #{ctrl_as}#{field_name}" ] td a[ ng-href='{{ el.path }}' ] {{ el.label }} td a[ class='fa fa-times-circle text-danger' href='' ng-click="#{ctrl_as}remove#{func_name}(el.id)" ] input[ name="#{hash}[#{field_name}][]" type='hidden' ng-model='el.id' ng-value='el.id' ]