Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ui: highlight letters that change between blast method names (#72)

So if SequenceServer decides 'blastp' is to be used, 'p' is highlighted (in
bold) on the blast button.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
  • Loading branch information...
commit 9a32ce0b092d41060ee2c5cf5ca9aefb682e74d1 1 parent 71e4e09
@yeban yeban authored
View
8 public/css/custom.css
@@ -48,6 +48,10 @@ body {
padding-bottom: 10px;
}
+span.highlight {
+ font-weight: bold;
+}
+
.advanced label {
display: inline-block;
font-size: 16px;
@@ -69,6 +73,10 @@ body {
text-transform: uppercase;
}
+#methods > button {
+ height: 38px;
+}
+
#result{
border-radius: 6px;
-moz-border-radius: 6px;
View
38 public/js/sequenceserver.js
@@ -53,6 +53,18 @@
})( jQuery );
(function ($) {
+ //pass `null` to unset
+ $.fn.set_blast_method = function (name) {
+ var value = name || '';
+ var name = name || 'blast';
+ var tokens = name.split('blast');
+ this.val(value).children('span.highlight').each(function (i) {
+ $(this).text(tokens[i]);
+ });
+ };
+})(jQuery);
+
+(function ($) {
$.fn.poll = function () {
var that, val, tmp;
@@ -137,24 +149,30 @@ $(document).ready(function(){
$('form').on('blast_method_changed', function (event, methods){
if (methods) {
var method = methods.shift();
- $('#method').enable().val(method).text(method);
- if (methods.length >=1) {
- var method_list = $('#methods').addClass('btn-group').children('.dropdown-toggle').show().siblings('.dropdown-menu').children('li');
+ $('#method').enable().set_blast_method(method);
- $.each(methods, function (i, method){
- method_list.eq(i).text(method).click(function () {
- var tmp = $('#method').text();
+ if (methods.length >=1) {
+ $('#methods').addClass('btn-group').
+ children('.dropdown-toggle').show().
+ siblings('.dropdown-menu').children('li').
+ each(function (i){
+ $(this).text(methods[i]);
+ }).
+ click(function (event) {
+ var old = $('#method').text();
var method = $(this).text();
- $('#method').val(method).text(method);
- $(this).text(tmp);
+
+ //swap
+ $(this).text(old);
+ $('#method').set_blast_method(method);
+
event.preventDefault();
});
- });
}
}
else {
- $('#method').disable().val('').text('blast');
+ $('#method').disable().set_blast_method(null);
$('#methods').removeClass('btn-group').children('.dropdown-toggle').hide();
}
});
View
2  views/search.erb
@@ -167,7 +167,7 @@
<div class="span4">
<div id="methods" class="btn-group">
- <button type="submit" class="span3 btn btn-large btn-primary" id="method">blast</button>
+ <button type="submit" class="span3 btn btn-large btn-primary" id="method"><span class="highlight"></span><span>blast</span><span class="highlight"></span></button>
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
Please sign in to comment.
Something went wrong with that request. Please try again.