diff --git a/app/assets/stylesheets/Admin.scss b/app/assets/stylesheets/Admin.scss index 7a016508b5..0b2d47c247 100644 --- a/app/assets/stylesheets/Admin.scss +++ b/app/assets/stylesheets/Admin.scss @@ -1,6 +1,6 @@ @import "defaults"; -$BODY_BG_COLOR: #DE01DD; // DD00DD +$BODY_BG_COLOR: #DD00DD; $LOGO_BORDER_COLOR: black; $LOGO_BORDER_WIDTH: 2px; // vs 1px in default @@ -9,7 +9,7 @@ $LOGO_BG_COLOR: yellow; $LOGO_HOVER_FG_COLOR: purple; $LOGO_HOVER_BG_COLOR: yellow; -$LEFT_BAR_BORDER_COLOR: gray; +$LEFT_BAR_BORDER_COLOR: #555555; // gray $LEFT_BAR_BORDER_RADIUS: 0px; $LEFT_BAR_HEADER_FG_COLOR: black; $LEFT_BAR_HEADER_BG_COLOR: yellow; diff --git a/app/assets/stylesheets/Agaricus.scss b/app/assets/stylesheets/Agaricus.scss index 0a7c4d7d62..276bed2641 100644 --- a/app/assets/stylesheets/Agaricus.scss +++ b/app/assets/stylesheets/Agaricus.scss @@ -1,6 +1,6 @@ @import "defaults"; -$augustus_cap: #EbCe94; // #ECCF95 +$augustus_cap: #EbCe93; // #ECCF95 $brasiliensis_gills_1: #A06463; $brasiliensis_gills_2: #743931; $campestris_cap: #F6F0F2; diff --git a/app/assets/stylesheets/Amanita.scss b/app/assets/stylesheets/Amanita.scss index f59620f285..e36b9ea90d 100644 --- a/app/assets/stylesheets/Amanita.scss +++ b/app/assets/stylesheets/Amanita.scss @@ -13,7 +13,7 @@ $calyptroderma_middle_cap: #c18346; $muscaria_background: #cc2616; $muscaria_foreground: #fff8c6; $velosa_background: #dd9d5f; -$velosa_light_veil: #fbebd4; // faebd4 +$velosa_light_veil: #fbebd3; // faebd4 $velosa_dark_veil: #f4d5a6; $novinupta_background: #d1afa5; $pachycolea_background: #383138; diff --git a/app/assets/stylesheets/BlackOnWhite.scss b/app/assets/stylesheets/BlackOnWhite.scss index f3c5669956..852c88ef95 100644 --- a/app/assets/stylesheets/BlackOnWhite.scss +++ b/app/assets/stylesheets/BlackOnWhite.scss @@ -3,7 +3,7 @@ @import "defaults"; $LOGO_BORDER_COLOR: #DDDDDD; -$LEFT_BAR_BORDER_COLOR: #DeDfDf; +$LEFT_BAR_BORDER_COLOR: #DfDfDf; $TOP_BAR_BORDER_COLOR: #DDDDDD; $LIST_BORDER_COLOR: #DDDDDD; $BUTTON_HOVER_BORDER_COLOR: #CCCCCC; diff --git a/app/assets/stylesheets/Cantharellaceae.scss b/app/assets/stylesheets/Cantharellaceae.scss index 5077d13187..81250bfe55 100644 --- a/app/assets/stylesheets/Cantharellaceae.scss +++ b/app/assets/stylesheets/Cantharellaceae.scss @@ -1,6 +1,6 @@ @import "defaults"; -$californicus_cap: #f5ad49; // image 557 #f6ae4a +$californicus_cap: #f6ae4a; // image 557 $californicus_stipe: #fae8b8; $cinnabarinus_dark_cap: #c12900; // image 551 $cinnabarinus_light_cap: #ff6524; @@ -11,7 +11,7 @@ $tubaeformis_hymenium: #c2914c; $tubaeformis_bright_stipe: #ffb230; $tubaeformis_dark_stipe: #4b2e0c; $tubaeformis_light_stipe: #e5bb67; -$cornucopioides_dark_hymenium: #10110b; // image 465 +$cornucopioides_dark_hymenium: #11110b; // image 465 #10110b $cornucopioides_light_hymenium: #9b9690; $cornucopioides_dark_cap: #4f4337; $cornucopioides_light_cap: #826c57; diff --git a/app/assets/stylesheets/Hygrocybe.scss b/app/assets/stylesheets/Hygrocybe.scss index 89b5a533df..c76d5c60ca 100644 --- a/app/assets/stylesheets/Hygrocybe.scss +++ b/app/assets/stylesheets/Hygrocybe.scss @@ -1,6 +1,6 @@ @import "defaults"; -$conica_stain: #36362e; // #37372f +$conica_stain: #36362d; // #37372f $conica_cap_red: #a31404; $conica_cap_orange: #dd6226; $conica_cap_yellow: #ffbf01; diff --git a/app/assets/stylesheets/Sudo.scss b/app/assets/stylesheets/Sudo.scss index 33904b3c79..4900ee18d5 100644 --- a/app/assets/stylesheets/Sudo.scss +++ b/app/assets/stylesheets/Sudo.scss @@ -1,6 +1,6 @@ @import "defaults"; -$BODY_BG_COLOR: #DE7700; // #DD7700 +$BODY_BG_COLOR: #DE7600; // #DD7700 $LOGO_BORDER_COLOR: black; $LOGO_BORDER_WIDTH: 2px; // vs 1px in default diff --git a/app/assets/stylesheets/mo/_form_elements.scss b/app/assets/stylesheets/mo/_form_elements.scss index aa4030834f..20ff6d9a2f 100644 --- a/app/assets/stylesheets/mo/_form_elements.scss +++ b/app/assets/stylesheets/mo/_form_elements.scss @@ -175,3 +175,8 @@ form { display: inline-block; } } + +.overflow-scroll-checklist { + max-height: 30rem; + overflow-y: auto; +} diff --git a/app/views/controllers/field_slips/_form.html.erb b/app/views/controllers/field_slips/_form.html.erb index bab0e45f5e..8f9afb0aea 100644 --- a/app/views/controllers/field_slips/_form.html.erb +++ b/app/views/controllers/field_slips/_form.html.erb @@ -33,7 +33,7 @@ <%= autocompleter_field(form: form, field: :location, label: :LOCATION.t + ":", type: :location) %> - <%= render(partial: "shared/notes_form", + <%= render(partial: "shared/notes_fields", locals: { form:, fields: field_slip.notes_fields }) %> <%= autocompleter_field(form: form, field: :field_slip_id, diff --git a/app/views/controllers/observations/_form.html.erb b/app/views/controllers/observations/_form.html.erb index 908059e1c9..b8ddad893b 100644 --- a/app/views/controllers/observations/_form.html.erb +++ b/app/views/controllers/observations/_form.html.erb @@ -35,13 +35,13 @@ end <%= form_with( model: @observation, - url: add_query_param(action: action, id: @observation, - approved_name: @given_name, - approved_where: @place_name), - method: method, + url: add_query_param(action:, id: @observation, + approved_name: @given_name, + approved_where: @place_name), + method:, multipart: true, id: "observation_form", - data: data + data: ) do |f| %> <%= if @field_code @@ -53,43 +53,23 @@ end <% if include_images %> <%= render(partial: "observations/form/images", locals: { f: f }) %> - <% end # if include_images %> - - <%= render(partial: "observations/form/details", - locals: { f: f, button_name: button_name, location: @location }) %> + <% end %> - <% if include_naming - # note this is not a separate form! just fields - naming_locals = { - f: f, - action: action, - button_name: button_name, - show_reasons: false, - unfocused: true, - name_help: :form_naming_name_help_leave_blank.t - } %> - <%= render(partial: "observations/namings/fields", locals: naming_locals) %> + <% ############################# Details ################################ %> - <% end # if include_naming %> + <%= render(partial: "observations/form/details", + locals: { f:, button_name:, location: @location }) %> - <%= render(partial: "observations/form/specimen_section", - locals: { f: f, button_name: button_name }) %> + <% ########################## Identification ############################ %> - <%= render(partial: "observations/form/notes", locals: { f: f }) %> + <%= render(partial: "observations/form/identification", + locals: { f:, action:, button_name:, include_naming: }) %> <% ####################################################################### %> <% if @projects.any? || @lists.any? %> - <%= submit_button(form: f, button: button_name, center: true) %> - <% end %> - - <% if @projects.any? %> - <%= render(partial: "observations/form/projects", - locals: { f: f, button_name: button_name }) %> - <% end %> - - <% if @lists.any? %> - <%= render(partial: "observations/form/species_lists", locals: { f: f }) %> + <%= render(partial: "observations/form/projects_and_lists", + locals: { f:, button_name: }) %> <% end %> <%= submit_button(form: f, button: button_name, center: true) %> diff --git a/app/views/controllers/observations/form/_collection_number.html.erb b/app/views/controllers/observations/form/_collection_number.html.erb index cd39687655..0c3045b15d 100644 --- a/app/views/controllers/observations/form/_collection_number.html.erb +++ b/app/views/controllers/observations/form/_collection_number.html.erb @@ -1,23 +1,17 @@ <%# specimen/collection_number section of create_observation form %> -
- -
- <%= fields_for(:collection_number) do |fcn| %> - <%= text_field_with_label(form: fcn, field: :name, - value: @collectors_name, - label: :collection_number_name.t + ":") %> - <%= text_field_with_label( - form: fcn, field: :number, value: @collectors_number, - label: :collection_number_number.t + ":", - data: { action: "specimen#checkCheckbox" }) %> - <% end # fields_for %> -
- -
- <%= help_block_with_arrow("left", id: "collection_number_help") do %> - <%= :form_observations_collection_number_help.t %> - <% end # help_block_with_arrow do %> -
- -
+<%= tag.div(class: "mt-3") do %> + <% fields_for(:collection_number) do |fcn| %> + <%= text_field_with_label( + form: fcn, field: :name, + value: @collectors_name, + label: :collection_number_name.t + ":", + help: :form_observations_collection_number_help.t + ) %> + <%= text_field_with_label( + form: fcn, field: :number, value: @collectors_number, + label: :collection_number_number.t + ":", + data: { action: "specimen#checkCheckbox" } + ) %> + <% end %> +<% end %> diff --git a/app/views/controllers/observations/form/_herbarium_record.html.erb b/app/views/controllers/observations/form/_herbarium_record.html.erb index 3f40446e29..26bfc0adec 100644 --- a/app/views/controllers/observations/form/_herbarium_record.html.erb +++ b/app/views/controllers/observations/form/_herbarium_record.html.erb @@ -1,32 +1,21 @@ <%# specimen/herbarium_record section of create_observation form %> -
- -
- <%= fields_for(:herbarium_record) do |fhr| %> - - <%= autocompleter_field( - form: fhr, field: :herbarium_name, type: :herbarium, - value: @herbarium_name, hidden: @herbarium_id, - label: "#{:herbarium_record_herbarium_name.t}:", - ) %> - - <%= text_field_with_label( - form: fhr, field: :accession_number, value: @accession_number, - label: "#{:herbarium_record_accession_number.t}:", - data: { action: "specimen#checkCheckbox" } - ) %> - - <%= text_field_with_label(form: fhr, field: :notes, value: "", - label: "#{:herbarium_record_notes.t}:") %> - - <% end # fields_for(:herbarium_record) %> -
- -
- <%= help_block_with_arrow("left", id: "herbarium_record_help") do %> - <%= :form_observations_herbarium_record_help.t %> - <% end # help_block_with_arrow do %> -
- -
+<%= tag.div(class: "mt-3") do %> + <% fields_for(:herbarium_record) do |fhr| %> + <%= autocompleter_field( + form: fhr, field: :herbarium_name, type: :herbarium, + value: @herbarium_name, hidden: @herbarium_id, + label: "#{:herbarium_record_herbarium_name.t}:", + help: :form_observations_herbarium_record_help.t + ) %> + <%= text_field_with_label( + form: fhr, field: :accession_number, value: @accession_number, + label: "#{:herbarium_record_accession_number.t}:", + data: { action: "specimen#checkCheckbox" } + ) %> + <%= text_field_with_label( + form: fhr, field: :notes, value: "", + label: "#{:herbarium_record_notes.t}:" + ) %> + <% end %> +<% end %> diff --git a/app/views/controllers/observations/form/_identification.html.erb b/app/views/controllers/observations/form/_identification.html.erb new file mode 100644 index 0000000000..dcb90ba16b --- /dev/null +++ b/app/views/controllers/observations/form/_identification.html.erb @@ -0,0 +1,27 @@ +<%= panel_block(id: "observation_identification", + heading: :IDENTIFICATION.l) do %> + <%= tag.div(class: "row mt-3") do %> + <%= tag.div(class: "col-xs-12 col-sm-6") do %> + <% if include_naming + naming_locals = { + f: f, + action: action, + button_name: button_name, + show_reasons: false, + unfocused: true, + name_help: :form_naming_name_help_leave_blank.t + } %> + <%= render(partial: "observations/namings/fields", + locals: naming_locals) %> + <% end %> + <%= render(partial: "observations/form/specimen_section", + locals: { f:, button_name: }) %> + <% end %> + <%= tag.div(class: "col-xs-12 col-sm-6") do %> + <%= render(partial: "shared/notes_fields", + locals: { form: f, + fields: @observation.form_notes_parts(@user) }) %> + <% end %> + <% end %> + <%= submit_button(form: f, button: button_name, center: true) %> +<% end %> diff --git a/app/views/controllers/observations/form/_notes.html.erb b/app/views/controllers/observations/form/_notes.html.erb deleted file mode 100644 index f3c74ac78f..0000000000 --- a/app/views/controllers/observations/form/_notes.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -<%# Notes section of create_observation form %> - -<% -# Users may have custom notes "parts". This prints a single large textarea and -# textile help block if there's only one notes part. Otherwise, it prints -# smaller textareas and a general textile help link. - -help = general_help = other = nil -if @observation.form_notes_parts(@user) == [Observation.other_notes_part] - help = [tag.p(:form_observations_notes_help.t), - tag.p(:shared_textile_help.l)].safe_join - other = true - rows = 10 -else - general_help = tag.p do - [ - tag.strong("#{:NOTES.t}:", class: "mr-3"), - collapse_info_trigger("notes_help"), - collapse_help_block(nil, :shared_textile_help.l, id: "notes_help") - ].safe_join - end - rows = 1 -end -%> - -<%= tag.div(class: "mt-3", id: "observation_notes") do - tag.div(class: "row") do - tag.div(class: "col-xs-12 col-sm-6") do %> - <%= general_help %> - <%= f.fields_for(:notes) do |f_n| %> - <% @observation.form_notes_parts(@user).each do |part| %> - <%= text_area_with_label( - form: f_n, rows:, help:, - label: other ? "#{:NOTES.t}:" : "#{strip_tags(part.tl)}:", - field: @observation.notes_normalized_key(part), - value: @observation.notes_part_value(part) - ) %> - <% end # each do part %> - <% end # f.fields_for(:notes) %> - <% end - end -end %> - diff --git a/app/views/controllers/observations/form/_projects.html.erb b/app/views/controllers/observations/form/_projects.html.erb index 54ad88c557..2c2d9775e9 100644 --- a/app/views/controllers/observations/form/_projects.html.erb +++ b/app/views/controllers/observations/form/_projects.html.erb @@ -1,71 +1,74 @@ <%# Projects section of create_observation form %> -<%= fields_for(:project) do |f_p| %> -
+<% +error_messages = suspect_messages = nil +if @error_checked_projects.any? + error_messages = { + level: "danger", + list: @error_checked_projects, + help: :form_observations_projects_out_of_range_help.t + } +end +if @suspect_checked_projects.any? + suspect_messages = { + level: "warning", + list: @suspect_checked_projects, + help: :form_observations_projects_out_of_range_help.t + + :form_observations_projects_out_of_range_admin_help.t(button_name:) + } +end +%> - <% if @error_checked_projects.any? %> -
-
- <%= tag.p( - "#{:form_observations_projects_out_of_range.t( - date: @observation.when, - place_name: @observation.place_name - )}:" - ) %> -
    - <% @error_checked_projects.each do |proj| %> - <%= tag.li("#{proj.title} (#{proj.constraints})") %> - <% end %> -
- <%= tag.p( - :form_observations_projects_out_of_range_help.t - )%> -
-
- <% end %> +<%= tag.div(id: "observation_projects") do %> + <%= fields_for(:project) do |f_p| %> - <% if @suspect_checked_projects.any? %> -
-
- <%= tag.p( - "#{:form_observations_projects_out_of_range.t( - date: @observation.when, - place_name: @observation.place_name - )}:" - ) %> -
    - <% @suspect_checked_projects.each do |proj| %> - <%= tag.li("#{proj.title} (#{proj.constraints})") %> - <% end %> -
- <%= tag.p( - :form_observations_projects_out_of_range_help.t + - :form_observations_projects_out_of_range_admin_help.t(button_name: button_name) - )%> - <%= check_box_with_label( - form: f_p, field: :ignore_proj_conflicts, - label: :form_observations_projects_ignore_project_constraints.t - ) %> -
-
- <% end %> -
- <%= help_block_with_arrow("left", id: "project_help") do %> - <%= :form_observations_project_help.t %> + <% if error_messages.present? || suspect_messages.present? %> + <%= tag.div(id: "project_messages") do %> + <% [error_messages, suspect_messages].compact.each do |messages| %> + <%= tag.div(class: "alert alert-#{messages[:level]}") do + [ + tag.p( + "#{:form_observations_projects_out_of_range.t( + date: @observation.when, + place_name: @observation.place_name + )}:" + ), + tag.ul do + messages[:list].each do |proj| + concat(tag.li("#{proj.title} (#{proj.constraints})")) + end + end, + tag.p(messages[:help]) + ].safe_join + end %> + <% end %> <% end %> -
+ <%= check_box_with_label( + form: f_p, field: :ignore_proj_conflicts, + label: :form_observations_projects_ignore_project_constraints.t + ) %> + <% end %> -
- <%= :PROJECTS.t %>: + <%= tag.p do + [ + tag.strong("#{:PROJECTS.l}:", class: "mr-3"), + collapse_info_trigger("project_help"), + collapse_help_block(nil, id: "project_help") do + :form_observations_project_help.t + end + ].safe_join + end %> + + <%= tag.div(class: "overflow-scroll-checklist") do %> <% @projects.each do |project| %> - <%= check_box_with_label(form: f_p, field: :"id_#{project.id}", - checked: @project_checks[project.id], - disabled: !project.user_can_add_observation?(@observation, @user), - label: project.title) %> + <%= check_box_with_label( + form: f_p, field: :"id_#{project.id}", label: project.title, + checked: @project_checks[project.id], + disabled: !project.user_can_add_observation?(@observation, @user) + ) %> <% end %> -
-
+ <% end %> + + <% end %> <% end %> diff --git a/app/views/controllers/observations/form/_projects_and_lists.html.erb b/app/views/controllers/observations/form/_projects_and_lists.html.erb new file mode 100644 index 0000000000..54ae6c0ac5 --- /dev/null +++ b/app/views/controllers/observations/form/_projects_and_lists.html.erb @@ -0,0 +1,23 @@ +<%# Project and List section of create_observation form %> + +<%= panel_block(id: "observation_projects_and_lists", + heading: "#{:PROJECTS.l}/#{:SPECIES_LISTS.l}") do %> + + <%= tag.div(class: "row mt-3") do %> + <% if @projects.any? %> + <%= tag.div(class: "col-xs-12 col-sm-6") do %> + <%= render(partial: "observations/form/projects", + locals: { f:, button_name: }) %> + <% end %> + <% end %> + <% if @lists.any? %> + <%= tag.div(class: "col-xs-12 col-sm-6") do %> + <%= render(partial: "observations/form/species_lists", + locals: { f: f }) %> + <% end %> + <% end %> + <% end %> + +<% end %> + + diff --git a/app/views/controllers/observations/form/_species_lists.html.erb b/app/views/controllers/observations/form/_species_lists.html.erb index 21d716a315..4d6014bc29 100644 --- a/app/views/controllers/observations/form/_species_lists.html.erb +++ b/app/views/controllers/observations/form/_species_lists.html.erb @@ -1,22 +1,26 @@ <%# species_list section of create_observation form %> -
-
- <%= help_block_with_arrow("left", id: "species_lists_help") do %> - <%= :form_observations_list_help.t %> - <% end %> -
-
- <%= :SPECIES_LISTS.t %>: +<%= tag.div(id: "observation_projects") do %> + <%= fields_for(:list) do |f_l| %> + + <%= tag.p do + [ + tag.strong("#{:SPECIES_LISTS.l}:", class: "mr-3"), + collapse_info_trigger("species_lists_help"), + collapse_help_block(nil, id: "species_lists_help") do + :form_observations_list_help.t + end + ].safe_join + end %> - <%= fields_for(:list) do |f_l| %> + <%= tag.div(class: "overflow-scroll-checklist") do %> <% @lists.each do |list| %> - <%= check_box_with_label(form: f_l, field: :"id_#{list.id}", - checked: @list_checks[list.id], - disabled: !check_permission(list), - label: list.title) %> + <%= check_box_with_label( + form: f_l, field: :"id_#{list.id}", label: list.title, + checked: @list_checks[list.id], disabled: !check_permission(list) + ) %> <% end %> <% end %> -
-
+ <% end %> +<% end %> diff --git a/app/views/controllers/observations/form/_specimen_section.html.erb b/app/views/controllers/observations/form/_specimen_section.html.erb index 4a9ea69d1e..7fc50ecf41 100644 --- a/app/views/controllers/observations/form/_specimen_section.html.erb +++ b/app/views/controllers/observations/form/_specimen_section.html.erb @@ -8,28 +8,22 @@ data: { controller: "specimen", user_pref: (!@user.try(&:hide_specimen_stuff?)) }) do %> -
-
- <%= check_box_with_label( - form: f, field: :specimen, - label: :form_observations_specimen_available.t, - data: { specimen_target: "checkbox", - action: "change->specimen#hideShowFields" } - ) %> - <%= help_block_with_arrow("up") do %> - <%= :form_observations_specimen_available_help.t %> - <% end # help_block_with_arrow do %> - - - <% if button_name == :SAVE_EDITS.l %> - <%= help_block_with_arrow(nil) do - :form_observations_edit_specimens_help.t - end %> - <% end # if button_name %> - - -
-
+ <%= tag.div(class: "mt-3") do %> + <%= check_box_with_label( + form: f, field: :specimen, + label: :form_observations_specimen_available.t, + help: :form_observations_specimen_available_help.t, + data: { specimen_target: "checkbox", + action: "change->specimen#hideShowFields" } + ) %> + + <% if button_name == :SAVE_EDITS.l %> + <%= help_block_with_arrow(nil) do + :form_observations_edit_specimens_help.t + end %> + <% end # if button_name %> + + <% end %> <% if button_name == :CREATE.l %> diff --git a/app/views/controllers/observations/namings/_fields.erb b/app/views/controllers/observations/namings/_fields.erb index 05f7290fcf..3c1ac6ee3c 100644 --- a/app/views/controllers/observations/namings/_fields.erb +++ b/app/views/controllers/observations/namings/_fields.erb @@ -33,35 +33,18 @@ name_help ||= :form_naming_name_help.t end, fields_for(:naming) do |f_n| [ - tag.div(class: "row mt-3") do - [ - tag.div(class: "col-xs-12 col-sm-6") do - autocompleter_field( - form: f_n, field: :name, type: :name, label: "#{:WHAT.t}:", - value: @given_name, autofocus: focus_on_name - ) - end, - tag.div(class: "col-xs-12 col-sm-6") do - help_block_with_arrow("left", id: "naming_name_help") do - tag.p(name_help) - end - end - ].safe_join + autocompleter_field( + form: f_n, field: :name, type: :name, label: "#{:WHAT.t}:", + value: @given_name, autofocus: focus_on_name, help: name_help + ), + f_n.fields_for(:vote) do |f_v| + select_with_label(form: f_v, field: :value, + options: confidences, select_opts: select_opts, + label: :form_naming_confidence.t + ":", + autofocus: focus_on_vote) end, - tag.div(class: "row mt-3") do - tag.div(class: "col-xs-12 col-sm-6") do - [ - f_n.fields_for(:vote) do |f_v| - select_with_label(form: f_v, field: :value, - options: confidences, select_opts: select_opts, - label: :form_naming_confidence.t + ":", - autofocus: focus_on_vote) - end, - f_n.fields_for(:reasons) do |f_r| - naming_form_reasons_fields(f_r, @reasons) - end - ].safe_join - end + f_n.fields_for(:reasons) do |f_r| + naming_form_reasons_fields(f_r, @reasons) end ].safe_join end, diff --git a/app/views/controllers/shared/_notes_fields.html.erb b/app/views/controllers/shared/_notes_fields.html.erb new file mode 100644 index 0000000000..baeeb2d1df --- /dev/null +++ b/app/views/controllers/shared/_notes_fields.html.erb @@ -0,0 +1,48 @@ +<%# Notes section of any form %> + +<% +# Users may have custom notes "parts". This prints a single large textarea and +# textile help block if there's only one notes part. Otherwise, it prints +# smaller textareas and a general textile help link. + +help = general_help = other = nil +if fields == [Observation.other_notes_part] + help = [tag.p(:form_observations_notes_help.t), + tag.p(:shared_textile_help.l)].safe_join + other = true + rows = 10 +else + general_help = tag.p do + [ + tag.strong("#{:NOTES.t}:", class: "mr-3"), + collapse_info_trigger("notes_help"), + collapse_help_block(nil, :shared_textile_help.l, id: "notes_help") + ].safe_join + end + rows = 1 +end +indent = form.object_name == "observation" ? "" : "ml-5" +%> + +<%= tag.div(id: "#{form.object_name}_notes") do %> + <%= general_help %> + <%= tag.div(class: indent) do %> + <%= form.fields_for(:notes) do |f_n| %> + <% fields.each do |part| %> + <% if form.object_name == "observation" + field = @observation.notes_normalized_key(part) + value = @observation.notes_part_value(part) + label = other ? "#{:NOTES.t}:" : "#{part.to_s.humanize}:" + else + field = part.name + value = part.value + label = part.label + ":" + end %> + <%= text_area_with_label( + form: f_n, rows:, help:, field:, value:, label: + ) %> + <% end %> + <% end %> + <% end %> +<% end %> + diff --git a/app/views/controllers/shared/_notes_form.html.erb b/app/views/controllers/shared/_notes_form.html.erb deleted file mode 100644 index 1247302353..0000000000 --- a/app/views/controllers/shared/_notes_form.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%# Notes section of a form %> - - -
- -

- <%= :NOTES.t %>: -

-
- <% fields.each do |field| %> - <%= form.fields_for(:notes) do |f_n| %> - <%= text_area_with_label( - form: f_n, rows: 1, label: field.label + ": ", - field: field.name, - value: field.value) %> - <% end # form.fields_for(:notes) %> - <% end # each do field %> -
- -
- diff --git a/config/locales/en.txt b/config/locales/en.txt index 0691a78483..3efe9e9518 100644 --- a/config/locales/en.txt +++ b/config/locales/en.txt @@ -270,6 +270,8 @@ field_slip: field slip FIELD_SLIPS: Field Slips field_slips: field slips + IDENTIFICATION: Identification + identification: identification IMAGE: Image image: image IMAGES: Images