Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KG - Marking Required Fields #100

Merged
merged 6 commits into from
Nov 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.sass
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
.slide-toggle-hidden
display: none

.required-message
text-align: center
padding-bottom: 15px

/************Main Layout Styling************/
.header
background-color: #113967
Expand Down
2 changes: 1 addition & 1 deletion app/models/participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Participant < ActiveRecord::Base
after_save :update_faye
after_destroy :update_faye

validates :protocol_id, :first_name, :last_name, :mrn, :date_of_birth, :ethnicity, :race, :gender, :address, :city, :state, :zipcode, presence: true
validates :protocol_id, :last_name, :first_name, :mrn, :date_of_birth, :gender, :ethnicity, :race, :address, :city, :state, :zipcode, presence: true
validate :phone_number_format, :middle_initial_format, :zip_code_format

def self.title id
Expand Down
4 changes: 4 additions & 0 deletions app/views/application/_required_fields.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.row
.col-lg-12.required-message
= t(:actions)[:required_message]

3 changes: 2 additions & 1 deletion app/views/appointments/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
= t(:appointment)[:edit_header]
.modal-body
#appointment_modal_errors
= render partial: 'required_fields'
.form-group
= form.label "name", t(:appointment)[:name], class: "col-sm-3 control-label"
= form.label "name", t(:appointment)[:name]+t(:actions)[:required], class: "col-sm-3 control-label"
.col-sm-8
= form.text_field :name, {class: 'form-control'}
.form-group
Expand Down
23 changes: 12 additions & 11 deletions app/views/participants/_participant_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@
%h4#CreateNewParticipant.modal-title.text-center= header_text
.modal-body
#modal_errors
= render partial: 'required_fields'
.row
.col-md-12
= p.hidden_field :protocol_id
.form-group
= p.label "last_name", t(:participant)[:last_name], class: "col-sm-4 control-label"
= p.label "last_name", t(:participant)[:last_name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "last_name", {class: 'form-control'}
.form-group
= p.label "first_name", t(:participant)[:first_name], class: "col-sm-4 control-label"
= p.label "first_name", t(:participant)[:first_name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "first_name", {class: 'form-control'}
.form-group
= p.label "middle_initial", t(:participant)[:middle_initial], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "middle_initial", {class: 'form-control'}
%hr
.form-group
= p.label "mrn", t(:participant)[:mrn], class: "col-sm-4 control-label"
= p.label "mrn", t(:participant)[:mrn]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "mrn", {class: 'form-control'}
.form-group
= p.label "external_id", t(:participant)[:id], class: "col-sm-4 control-label"
Expand All @@ -31,33 +32,33 @@
= p.label "status", t(:participant)[:status], class: "col-sm-4 control-label"
.col-sm-7= p.select "status", Participant::STATUS_OPTIONS, {include_blank: true}, :class => "form-control selectpicker"
.form-group
= p.label "date_of_birth", t(:participant)[:dob], class: "col-sm-4 control-label "
= p.label "date_of_birth", t(:participant)[:dob]+t(:actions)[:required], class: "col-sm-4 control-label "
.col-sm-7
.input-group#dob_time_picker
= p.text_field "date_of_birth", {class: 'form-control datetimepicker', value: format_date(participant.date_of_birth)}
%span.input-group-addon
%span.glyphicon.glyphicon-calendar
.form-group
= p.label "gender", t(:participant)[:gender], class: "col-sm-4 control-label"
= p.label "gender", t(:participant)[:gender]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.select "gender", Participant::GENDER_OPTIONS, {include_blank: true}, :class => "form-control selectpicker"
.form-group
= p.label "ethnicity", t(:participant)[:ethnicity], class: "col-sm-4 control-label"
= p.label "ethnicity", t(:participant)[:ethnicity]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.select "ethnicity", Participant::ETHNICITY_OPTIONS, {include_blank: true}, :class => "form-control selectpicker"
.form-group
= p.label "race", t(:participant)[:race], class: "col-sm-4 control-label"
= p.label "race", t(:participant)[:race]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.select "race", Participant::RACE_OPTIONS, {include_blank: true}, :class => "form-control selectpicker"
%hr
.form-group
= p.label "address", t(:participant)[:address], class: "col-sm-4 control-label"
= p.label "address", t(:participant)[:address]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "address", {class: 'form-control'}
.form-group
= p.label "city", t(:participant)[:city], class: "col-sm-4 control-label"
= p.label "city", t(:participant)[:city]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "city", {class: 'form-control'}
.form-group
= p.label "state", t(:participant)[:state], class: "col-sm-4 control-label"
= p.label "state", t(:participant)[:state]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.select "state", options_for_select(us_states, participant.state), {include_blank: true}, :class => "form-control selectpicker"
.form-group
= p.label "zipcode", t(:participant)[:zip], class: "col-sm-4 control-label"
= p.label "zipcode", t(:participant)[:zip]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= p.text_field "zipcode", {class: 'form-control'}
%hr
.form-group
Expand Down
5 changes: 3 additions & 2 deletions app/views/study_level_activities/_fulfillment_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
%h4.modal-title.text-center= header_text
.modal-body
#modal_errors
= render partial: 'required_fields'
.row
.col-md-12
= form.hidden_field :line_item_id
.form-group
= form.label "fulfilled_at", t(:fulfillment)[:fulfillment_date], class: "col-sm-4 control-label"
= form.label "fulfilled_at", t(:fulfillment)[:fulfillment_date]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7
= form.text_field "fulfilled_at", {class: 'form-control datetimepicker', id: 'date_fulfilled_field', value: format_date(fulfillment.fulfilled_at)}
.form-group
= form.label "quantity", t(:fulfillment)[:quantity], class: "col-sm-4 control-label"
= form.label "quantity", t(:fulfillment)[:quantity]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7
= form.text_field "quantity", {class: 'form-control'}
.form-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
%h4.modal-title.text-center= header_text
.modal-body
#modal_errors
= render partial: 'required_fields'
.row
.col-md-12
= form.hidden_field :protocol_id
.form-group
= form.label "service", t(:line_item)[:service], class: "col-sm-4 control-label"
= form.label "service", t(:line_item)[:service]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7
= form.select "service_id", options_from_collection_for_select(protocol.organization.inclusive_child_services(:one_time_fee), 'id', 'name', line_item.service_id), {include_blank: true}, :class => 'form-control selectpicker'
.form-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
%h4#add_arm.modal-title.text-center Add Arm
.modal-body
#modal_errors
= render partial: 'required_fields'
.row
.col-md-12
= a.hidden_field :protocol_id
= hidden_field_tag :schedule_tab, schedule_tab
.form-group
= a.label "name", t(:arm)[:name], class: "col-sm-4 control-label"
= a.label "name", t(:arm)[:name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "name", {class: 'form-control'}
.form-group
= a.label "subject_count", t(:arm)[:subject_count], class: "col-sm-4 control-label"
= a.label "subject_count", t(:arm)[:subject_count]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "subject_count", {class: 'form-control'}
.form-group
= a.label "visit_count", t(:arm)[:visit_count], class: "col-sm-4 control-label"
= a.label "visit_count", t(:arm)[:visit_count]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "visit_count", {class: 'form-control'}
.form-group
= label_tag "service_ids", t(:services)[:objects], class: "col-sm-4 control-label"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
= form_for arm, {remote: true, html: {class: "form-horizontal edit_arm", role: "form"}} do |a|
.form-group
= a.label "name", t(:arm)[:name], class: "col-sm-4 control-label"
= a.label "name", t(:arm)[:name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "name", {class: 'form-control'}
.form-group
= a.label "subject_count", t(:arm)[:subject_count], class: "col-sm-4 control-label"
= a.label "subject_count", t(:arm)[:subject_count]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "subject_count", {class: 'form-control'}
.modal-footer
.center-block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
%h4.modal-title.text-center= intended_action == "edit" ? t(:arm)[:edit_arm] : t(:arm)[:remove_arm]
.modal-body
#modal_errors
- if intended_action == "edit"
= render partial: 'required_fields'
.row
.col-md-12.form-horizontal#navigate_arm_form{data: { intended_action: intended_action }}
.form-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
%h4#CreateNewParticipant.modal-title.text-center= "Add Visit"
.modal-body
#modal_errors
= render partial: 'required_fields'
.row
= hidden_field_tag :schedule_tab, schedule_tab
= hidden_field_tag :current_page, current_page
Expand All @@ -16,10 +17,10 @@
= a.label "arm_id", t(:visit_groups)[:arm], class: "col-sm-4 control-label"
.col-sm-7= a.select "arm_id", options_from_collection_for_select(protocol.arms,'id','name', arm.id), {include_blank: false}, class: "form-control selectpicker"
.form-group
= a.label "name", t(:visit_groups)[:name], class: "col-sm-4 control-label"
= a.label "name", t(:visit_groups)[:name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "name", {class: 'form-control'}
.form-group
= a.label "day", t(:visit_groups)[:day], class: "col-sm-4 control-label"
= a.label "day", t(:visit_groups)[:day]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "day", {class: 'form-control', maxlength: 4}
.form-group
= a.label "position", t(:visit_groups)[:position], class: "col-sm-4 control-label"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
= form_for visit_group, {remote: true, html: {class: "form-horizontal new_visit", role: "form"}} do |a|
.form-group
= a.label "name", t(:visit_groups)[:name], class: "col-sm-4 control-label"
= a.label "name", t(:visit_groups)[:name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "name", {class: 'form-control'}
.form-group
= a.label "day", t(:visit_groups)[:day], class: "col-sm-4 control-label"
= a.label "day", t(:visit_groups)[:day]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7= a.text_field "day", {class: 'form-control', maxlength: 4}
.form-group
= a.label "window_before", t(:visit_groups)[:window_before], class: "col-sm-4 control-label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
%h4.modal-title.text-center= intended_action == "edit" ? t(:visit)[:edit_visit] : t(:visit)[:remove_visit]
.modal-body
#modal_errors
- if intended_action == "edit"
= render partial: 'required_fields'
.row
.col-md-12.form-horizontal#navigate_visit_form{data: { intended_action: intended_action }}
.form-group
Expand Down
5 changes: 3 additions & 2 deletions app/views/tasks/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
%h4.modal-title.text-center= t(:task)[:create_task]
.modal-body
#modal_errors
= render partial: 'required_fields'
.row
.col-md-12
.form-group
= f.label "assignee_id", t(:task)[:assignee_name], class: "col-sm-4 control-label"
= f.label "assignee_id", t(:task)[:assignee_name]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7
= f.select :assignee_id, options_from_collection_for_select(clinical_providers.map(&:identity), 'id', 'full_name'), { include_blank: true }, :class => "form-control selectpicker"
.form-group
= f.label "follow_up_date", t(:task)[:due_at], class: "col-sm-4 control-label"
= f.label "follow_up_date", t(:task)[:due_at]+t(:actions)[:required], class: "col-sm-4 control-label"
.col-sm-7
.input-group.date#follow_up_datepicker
= f.text_field :due_at, {class: 'form-control'}
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ en:
n_a: "N/A"
options: "Options"
remove: "Remove"
add: "Add"
actions: "Actions"
required: " * "
required_message: "Fields marked with an asterisk ( * ) are required to continue."
save: "Save"

appointment:
Expand Down