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

wth - (SPARCDashboard)Change Background Color of Finished Statuses #165

Merged
merged 1 commit into from
Mar 28, 2017
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
5 changes: 4 additions & 1 deletion app/assets/stylesheets/dashboard/sub_service_requests.sass
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@

.user-view-ssr-modal
width: 75% !important


a.finished-status
background-color: #e198a4

17 changes: 17 additions & 0 deletions app/helpers/dashboard/sub_service_requests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,21 @@ def ssr_admin_button(ssr, user, permission_to_edit, admin_access)
''
end
end

def ssr_select_options(ssr)
ssr.nil? ? [] : statuses_with_classes(ssr)
end

private

def statuses_with_classes(ssr)
ssr.organization.get_available_statuses.invert.map do |status|
if status.include?('Complete') || status.include?('Withdrawn')
status.push(:class=> 'finished-status')
else
status
end
end
end
end

2 changes: 1 addition & 1 deletion app/views/dashboard/sub_service_requests/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
%tbody
%tr
%td.text-center#service_request_status_dropdown
= select_tag "sub_service_request_status", options_for_select(sub_service_request ? sub_service_request.organization.get_available_statuses.invert : [], sub_service_request.try(:status)), :'data-sub_service_request_id' => sub_service_request.id, class: 'selectpicker', disabled: sub_service_request.is_complete?
= select_tag "sub_service_request_status", options_for_select(ssr_select_options(sub_service_request), sub_service_request.try(:status)), :'data-sub_service_request_id' => sub_service_request.id, class: 'selectpicker', disabled: sub_service_request.is_complete?
- if sub_service_request.is_complete?
.btn.btn-danger{ data: {toggle: "tooltip"}, title: t(:dashboard)[:sub_service_requests][:header][:lock_message] }
%span.glyphicon.glyphicon-lock
Expand Down