Skip to content

Commit

Permalink
fixing a few issues with querise / styling
Browse files Browse the repository at this point in the history
  • Loading branch information
kayla-glick committed Jun 25, 2020
1 parent 12f5a71 commit 1063f91
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/sparc_requests.coffee
Expand Up @@ -261,9 +261,9 @@ $ ->
$('#sparc_request_protocol_attributes_primary_pi_role_attributes_identity_id').val(suggestion.id)

(exports ? this).loadI2B2Queries = () ->
$("select[name*=query_id]").parents('.dropdown').attr('data-toggle', 'tooltip').prop('title', I18n.t('requests.form.tooltips.loading_i2b2_queries'))
$("select[name*=query_id]").parents('.dropdown').data('toggle', 'tooltip').prop('title', I18n.t('requests.form.tooltips.loading_i2b2_queries')).tooltip()
$.ajax
meethod: 'GET'
method: 'GET'
dataType: 'script'
url: '/i2b2_queries'
data:
Expand Down
14 changes: 6 additions & 8 deletions app/views/i2b2_queries/index.js.coffee
@@ -1,25 +1,23 @@
updateQueries = () ->
<% if @queries.any? %>
$("select[name*=query_id]").parents('.dropdown').prop('title', '').tooltip('show')
$("select[name*=query_id]").parents('.dropdown').tooltip('dispose')
options = []
$("select[name*=query_id]").each ->
$(this).children('option:not(:first-child):not(:selected)').remove()
val = $(this).val()
# $(this).children('option:not(:first-child)').remove()
<% @queries.each do |query| %>
if val != "<%= query.id %>"
$(this).append($("<option value=\"<%= query.id %>\"><%= query.name %></option>"))
<% end %>

$(this).selectpicker('refresh')
<% else %>
$("select[name*=query_id]").parents('.dropdown').attr('data-toggle', 'tooltip').prop('title', "<%= t("requests.form.tooltips.no_i2b2_queries.#{params[:protocol_id].present? ? 'protocol' : 'user'}").html_safe %>")
$("select[name*=query_id] option:not(:first-child)").remove()
$("select[name*=query_id]").selectpicker('refresh')
$("select[name*=query_id]").parents('.dropdown').data('toggle', 'tooltip').prop('title', "<%= t("requests.form.tooltips.no_i2b2_queries.#{params[:protocol_id].present? ? 'protocol' : 'user'}").html_safe %>").tooltip('dispose').tooltip()
<% end %>

updateQueries()
$("select[name*=query_id]").selectpicker('refresh')

$(document).off('fields_added.nested_form_fields').on('fields_added.nested_form_fields', ->
updateQueries()
$("select[name*=query_id]").one 'rendered.bs.select', ->
updateQueries()
$(document).trigger('ajax:complete') # rails-ujs element replacement bug fix
)
2 changes: 1 addition & 1 deletion app/views/layouts/_footer.html.haml
@@ -1,4 +1,4 @@
.d-flex.flex-column.justify-content-end
.d-flex.flex-column.justify-content-end.flex-fill
%p.text-muted.text-center.mb-1.mt-3
= t('site_information.version', site_name: t('site_information.footer_name'), version: ENV.fetch('APP_VERSION')).html_safe
%p.text-muted.text-center.mb-0
Expand Down
3 changes: 2 additions & 1 deletion app/views/sparc_requests/edit.js.coffee
@@ -1,4 +1,5 @@
$('#modalContainer').html("<%= j render 'sparc_requests/form', sparc_request: @sparc_request, is_draft: @is_draft %>")
initializePrimaryPITypeahead()
loadI2B2Queries()
$("select[name*=query_id]").one 'rendered.bs.select', ->
loadI2B2Queries()
$('#modalContainer').modal('show')
3 changes: 2 additions & 1 deletion app/views/sparc_requests/new.js.coffee
Expand Up @@ -2,5 +2,6 @@ $('#modalContainer').html("<%= j render 'sparc_requests/form', sparc_request: @s
setRequiredFields()
initializeProtocolTypeahead()
initializePrimaryPITypeahead()
loadI2B2Queries()
$("select[name*=query_id]").one 'rendered.bs.select', ->
loadI2B2Queries()
$('#modalContainer').modal('show')

0 comments on commit 1063f91

Please sign in to comment.