Skip to content

Commit

Permalink
Bugfix - we now display the correct order button for non-ikmc mouse l…
Browse files Browse the repository at this point in the history
…ines from EMMA. closes #4627
  • Loading branch information
Daz Oakley committed Apr 1, 2011
1 parent b6e5cbb commit af95b22
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
6 changes: 3 additions & 3 deletions config/server/datasets/emma-strains/custom_sort.rb
Expand Up @@ -15,7 +15,6 @@ def emma_strains_sort_results( results )

# Add singular info first...
singles = [
:gene_symbol,
:emma_id,
:international_strain_name,
:common_name,
Expand All @@ -32,8 +31,9 @@ def emma_strains_sort_results( results )
emma_record[attribute] = result[attribute]
end

# Allele name...
emma_record[:allele_name] = fix_superscript_text_in_attribute(result[:alls_form])
emma_record[:emma] = true
emma_record[:marker_symbol] = result[:gene_symbol]
emma_record[:allele_name] = fix_superscript_text_in_attribute(result[:alls_form])

# References...
pubmed_id = result[:pubmed_id]
Expand Down
6 changes: 5 additions & 1 deletion config/server/dataviews/mice/views/_template.erubis
Expand Up @@ -21,7 +21,11 @@
dist_flag = false
dist_flag = true if mouse[:emma] == "1"
%>
<%= mouse_order_button( mouse[:mgi_accession_id], mouse[:marker_symbol], mouse[:sponsor], mouse[:ikmc_project_id], dist_flag, mouse[:mi_centre], mouse[:distribution_centre] ) %>
<% if mouse[:sponsor].blank? and !mouse[:emma_id].blank? %>
<%= emma_mouse_order_button( mouse[:emma_id] ) %>
<% else %>
<%= mouse_order_button( mouse[:mgi_accession_id], mouse[:marker_symbol], mouse[:sponsor], mouse[:ikmc_project_id], dist_flag, mouse[:mi_centre], mouse[:distribution_centre] ) %>
<% end %>
</td>
<td><%= mouse[:allele_name] %></td>
<td>
Expand Down
9 changes: 9 additions & 0 deletions lib/martsearch/server_view_helpers/order_buttons.rb
Expand Up @@ -44,6 +44,15 @@ def mouse_order_button( mgi_accession_id, marker_symbol, project, project_id, fl
return button_text
end

# Helper function to build an order button Non-IKMC EMMA lines.
#
# @param [String] emma_id The EMMA id for this line
# @return [String] The html markup for a button
def emma_mouse_order_button( emma_id )
url = emma_link_url( emma_id )
button_text = generic_order_button( 'Non-IKMC', url )
end

# Helper function to centralise the logic for producing a button for
# ordering an ES cell.
#
Expand Down
7 changes: 7 additions & 0 deletions test/test_server_view_helpers.rb
Expand Up @@ -108,6 +108,13 @@ def test_mouse_order_button
end
end

def test_emma_mouse_order_button
order_button = emma_mouse_order_button( 'EM:05020' )
assert_match( /EM\:\d+/, order_button )
assert_match( /emmanet/, order_button )
assert_match( /order/, order_button )
end

##
## DataView Helper Tests...
##
Expand Down

0 comments on commit af95b22

Please sign in to comment.