app/views/projects/_form.html.haml
:javascript
jQuery(document).ready(function(){
jQuery("#project_creator").chosen();
});
- unless @errors.nil?
.enable-lists{style: "color:red; padding-left:10px;"}
%strong Errors On Form
%ul
- @errors = @errors[:error ] if @errors[:error]
%ul
- @errors.each do |key, message|
<style>#project_#{key} { border: thin solid red; }</style>
%li
= message.values.join(',')
/ Override the bioportal.css for .required to avoid red text in the input fields.
:css
.required {
color: black;
}
table.form {
width: auto;
}
table.form td {
width: 450px;
}
%div{:style => "padding:10px"}
%table.form
%tr
%th Name: *
%td.top
= text_field(:project, :name, value: @project.name, class: 'required', tabindex: 1, required: 'true')
%tr
- disabled = @project.id ? "disabled" : nil
%th Acronym: *
%td.top
= text_field(:project, :acronym, value: @project.acronym, class: 'required', tabindex: 1,
disabled: disabled, required: 'true')
%tr
%th Institution:
%td= text_field :project, :institution, value: @project.institution, :tabindex => 2
%tr
%th Contacts:
%td= text_field :project, :contacts, value: @project.contacts, :tabindex => 3
%tr
%th Administrators: *
%td= f.select :creator, @user_select_list, { selected: @project.creator || session[:user].id }, { multiple: true, :"data-placeholder" => "Select administrators", tabindex: 4 }
%tr
%th
Homepage: *
%br/
%span.default_owl
Example:
%a{href: 'https://en.wikipedia.org/wiki/SNOMED_CT', target: '_blank'} https://en.wikipedia.org/wiki/SNOMED_CT
%td
= text_field(:project, :homePage, value: @project.homePage, class: 'required url',
tabindex: 5, required: 'true')
%tr
%th Description: *
%td
= text_area(:project, :description, value: @project.description, rows: 6, class: 'required',
tabindex: 6, required: 'true')
%div#ontology_picker_project{style: "padding-top: 2em;"}
- selected_ontologies = @project.ontologyUsed && @project.ontologyUsed.map {|id| id.split('/').last } || []
- locals = { sel_text: "Select Ontologies Used", selected_ontologies: selected_ontologies, form_object: :project, form_attribute: "ontologyUsed" }
= render :partial => "shared/ontology_picker", locals: locals
%div.py-4
= f.submit button_text, class: 'btn btn-primary'
= link_to 'Cancel', :back, class: 'btn btn-primary'