diff options
author | Jochen Topf <jochen@topf.org> | 2014-05-18 07:18:09 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-05-18 07:23:48 +0200 |
commit | f766377bc9ff5548536515dfad73045db8378a4a (patch) | |
tree | 95fccc0727aed99cef5b4ada2d9c2b5bf92ef987 | |
parent | 149c5f60b7b0e7ff7109ce513e020e4067dd8e68 (diff) | |
download | taginfo-f766377bc9ff5548536515dfad73045db8378a4a.tar taginfo-f766377bc9ff5548536515dfad73045db8378a4a.tar.gz |
Add close button to boxes on compare page.
-rw-r--r-- | web/public/css/taginfo.css | 11 | ||||
-rw-r--r-- | web/public/img/close.png | bin | 0 -> 320 bytes | |||
-rw-r--r-- | web/views/compare.erb | 18 |
3 files changed, 22 insertions, 7 deletions
diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css index 84a1f14..48cf1ec 100644 --- a/web/public/css/taginfo.css +++ b/web/public/css/taginfo.css @@ -443,9 +443,16 @@ table.comparison { margin-right: -10px; } +table.comparison a.close { + float: right; +} + table.comparison td.data h2 { - margin-top: 4px; - margin-bottom: 8px; + position: relative; + clear: both; + top: -12px; + margin-left: 20px; + margin-right: 20px; } table.comparison th.data, table.comparison td.data { diff --git a/web/public/img/close.png b/web/public/img/close.png Binary files differnew file mode 100644 index 0000000..efbb39d --- /dev/null +++ b/web/public/img/close.png diff --git a/web/views/compare.erb b/web/views/compare.erb index af69256..aa81986 100644 --- a/web/views/compare.erb +++ b/web/views/compare.erb @@ -5,6 +5,7 @@ <tr> <% @data.each_with_index do |data, num| %> <td class="data first item<%= num %>" style="width: <%= 100/@data.size %>%"> + <a class="close" href="#"><img src="/img/close.png" width="16" height="16"/></a> <h2></h2> <p><%= data[:desc] %></p> </td> @@ -81,13 +82,20 @@ JS.raw(<<"JAVASCRIPT") function page_init2() { var data = #{ @data.to_json }; - jQuery.each(data, function(index, data) { - if (data.value) { - jQuery('.item' + index + ' h2').html(link_to_tag(data.key, data.value)); + jQuery.each(data, function(index, item) { + var datac = []; + jQuery.each(data, function(i, item) { + if (i != index) { + datac.push([item['key'], item['value']]); + } + }); + jQuery('.item' + index + ' a.close').attr('href', comparison_list_url(datac)); + if (item.value) { + jQuery('.item' + index + ' h2').html(link_to_tag(item.key, item.value)); } else { - jQuery('.item' + index + ' h2').html(link_to_key(data.key)); + jQuery('.item' + index + ' h2').html(link_to_key(item.key)); jQuery('.item' + index + '.prevalent_values p b').html('#{ h(t.misc.prevalent_values)}:'); - jQuery('.item' + index + '.prevalent_values div').html(fmt_prevalent_value_list(data.key, data.prevalent_values)); + jQuery('.item' + index + '.prevalent_values div').html(fmt_prevalent_value_list(item.key, item.prevalent_values)); } }); jQuery('div.prevalent_values a').tipsy({ opacity: 1, delayIn: 500, gravity: 'w' }); |