Commit 612f2eba authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Link to edit response from virus/host detailed view

parent 8eee3e3e
...@@ -106,7 +106,7 @@ th.hover { ...@@ -106,7 +106,7 @@ th.hover {
left: 0; left: 0;
top: auto; top: auto;
} }
.popover a[href] { .popover a[href]:not(.allow-deco) {
color: inherit; color: inherit;
} }
.out-of-scope{ .out-of-scope{
......
...@@ -157,13 +157,16 @@ function hover_behavior(selector){ ...@@ -157,13 +157,16 @@ function hover_behavior(selector){
popover.find("a.close_cmd").on('click', function(e){ popover.find("a.close_cmd").on('click', function(e){
elt.popover('hide').popover('dispose').attr("aria-describedby",null); elt.popover('hide').popover('dispose').attr("aria-describedby",null);
}); });
var url=update_response.replace("000000",$(elt).attr("data-col")).replace("111111",$(elt).attr("data-row"));
content = $('<dl class="mb-0">'+ content = $('<dl class="mb-0">'+
'<dt>'+gettext('Data source name')+'</dt>'+ '<dt>'+gettext('Data source name')+'</dt>'+
'<dd data-data-source='+$(elt).attr("data-col")+'></dd>'+ '<dd data-data-source='+$(elt).attr("data-col")+'></dd>'+
'<dt>'+in_row_kind+'</dt>'+ '<dt>'+in_row_kind+'</dt>'+
'<dd data-row='+$(elt).attr("data-row")+'></dd>'+ '<dd data-row='+$(elt).attr("data-row")+'></dd>'+
'<dt>'+detailed_kind+'</dt>'+ '<dt>'+detailed_kind+'</dt>'+
'<dd>'+$("#detailed_name").html()+'</dd>' '<dd>'+$("#detailed_name").html()+'</dd>'+
'</dl>'+
'<a class="allow-deco pull-right mb-2" href="'+url+'">'+gettext('Edit response')+' <i class="fa fa-pencil"></i></a>'
).appendTo($(popover).find(".popover-body").empty()); ).appendTo($(popover).find(".popover-body").empty());
$($('#grid_host thead>tr>th[data-col='+$(elt).attr("data-col")+']').html()).appendTo( $($('#grid_host thead>tr>th[data-col='+$(elt).attr("data-col")+']').html()).appendTo(
content.find('[data-data-source='+$(elt).attr("data-col")+']') content.find('[data-data-source='+$(elt).attr("data-col")+']')
......
...@@ -66,7 +66,13 @@ var get_responses = "{% url 'viralhostrangedb-api:responses' %}?{{object|class_v ...@@ -66,7 +66,13 @@ var get_responses = "{% url 'viralhostrangedb-api:responses' %}?{{object|class_v
var get_infection_ratios = "{% url 'viralhostrangedb-api:infection-ratio-detail' slug=object|class_verbose_name|lower slug_pk=object.id %}"; var get_infection_ratios = "{% url 'viralhostrangedb-api:infection-ratio-detail' slug=object|class_verbose_name|lower slug_pk=object.id %}";
var row_pks=[{% for d in data_sources%}{%if not forloop.first%},{%endif%}{{d.pk}}{%endfor%}]; var row_pks=[{% for d in data_sources%}{%if not forloop.first%},{%endif%}{{d.pk}}{%endfor%}];
var get_virus_url = "{% url 'viralhostrangedb:virus-detail' pk='000000' %}"; var get_virus_url = "{% url 'viralhostrangedb:virus-detail' pk='000000' %}";
var focus_is_on_first_level_of_data={{focus_is_on_first_level_of_data|yesno:"true,false"}}; {%if focus_is_on_first_level_of_data %}
var update_response = "{% url 'viralhostrangedb:response-update' ds_pk='000000' virus_pk=object.id host_pk='111111' %}";
var focus_is_on_first_level_of_data=true;
{%else%}
var update_response = "{% url 'viralhostrangedb:response-update' ds_pk='000000' virus_pk='111111' host_pk=object.id %}";
var focus_is_on_first_level_of_data=false;
{%endif%}
var in_row_kind="{{in_row_kind}}"; var in_row_kind="{{in_row_kind}}";
var detailed_kind="{{detailed_kind}}"; var detailed_kind="{{detailed_kind}}";
</script> </script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment