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

JM - (SPARCReport) Protocols Report: Include Epic Option and Report Columns #1261

Merged
merged 1 commit into from
Feb 28, 2018
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
8 changes: 7 additions & 1 deletion app/reports/protocols.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def default_options
Institution => {:field_type => :select_tag, :has_dependencies => "true"},
Provider => {:field_type => :select_tag, :dependency => '#institution_id', :dependency_id => 'parent_id'},
Program => {:field_type => :select_tag, :dependency => '#provider_id', :dependency_id => 'parent_id'},
Core => {:field_type => :select_tag, :dependency => '#program_id', :dependency_id => 'parent_id'}
Core => {:field_type => :select_tag, :dependency => '#program_id', :dependency_id => 'parent_id'},
"Include Epic Interface Columns" => {:field_type => :check_box_tag, :for => 'show_epic_cols', :field_label => 'Include Epic Interface Columns'}
}
end

Expand Down Expand Up @@ -73,6 +74,11 @@ def column_attrs
attrs["Business Manager(s)"] = "service_request.try(:protocol).try(:billing_managers).try(:map){|x| x.full_name}.try(:join, ', ')"
attrs["Business Manager Email(s)"] = "service_request.try(:protocol).try(:billing_business_manager_email)"

if params[:show_epic_cols]
attrs["Selected For Epic"] = "service_request.try(:protocol).try(:selected_for_epic) ? 'Yes' : service_request.try(:protocol).try(:selected_for_epic).nil? ? '' : 'No'"
attrs["Last Epic Push Date"] = "service_request.try(:protocol).try(:last_epic_push_time)"
attrs["Last Epic Push Status"] = "service_request.try(:protocol).try(:last_epic_push_status)"
end

attrs
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/reports/_setup.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#report-fields
- report.options.each do |field, options|
.form-group
- next if (field == "Include Epic Interface Columns" && !Setting.find_by_key("use_epic").value) # Only show Epic field if use_epic is set to true
- field_type = options[:field_type] || 'text_field_tag'
- field_label = "#{options[:field_label] || field.to_s.titleize}:"

= render "reports/form_partials/#{options[:field_type]}_form_partial", options: options, field_label: field_label, field: field
.report-actions.text-center
= submit_tag t(:reporting)[:actions][:create], class: "btn btn-success", data: { disable_with: false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- default_classes = options[:required] ? "required" : ""
- name = options[:for] ? "report[#{options[:for]}]" : "report[#{field.name.underscore}_id]"
- name += "[]" if multiple
- show_epic = options[:field_label] == "Include Epic Interface Columns"

= label_tag nil, field_label, class: ['col-sm-3 control-label', default_classes]
- if grouping && multiple # we have a defined grouping
Expand All @@ -44,9 +45,8 @@
= label_tag k, '', class: ['checkbox-inline', default_classes] do
= check_box_tag name, k, selected.include?(v), class: default_classes, type: "checkbox"
= v

- else # for individual checkboxes that have true/false
.col-sm-9
= check_box_tag name, true, selected.any?, class: default_classes, type: "checkbox"
= check_box_tag name, true, selected.any?, class: default_classes, type: "checkbox" unless (show_epic && !(Setting.find_by_key("use_epic").value)) # Only show Epic checkbox if use_epic is set to true

-# TODO define behavior if multiple is a method or string representation of method chain