Commit 78df1c1e by Őry Máté

dashboard: add favorite icon to VM details

fixes #349
parent fa1d82c3
...@@ -132,7 +132,7 @@ $(function () { ...@@ -132,7 +132,7 @@ $(function () {
$('.js-hidden').hide(); $('.js-hidden').hide();
/* favourite star */ /* favourite star */
$("#dashboard-vm-list").on('click', '.dashboard-vm-favourite', function(e) { $("#dashboard-vm-list, .page-header").on('click', '.dashboard-vm-favourite', function(e) {
var star = $(this).children("i"); var star = $(this).children("i");
var pk = $(this).data("vm"); var pk = $(this).data("vm");
if(star.hasClass("fa-star-o")) { if(star.hasClass("fa-star-o")) {
......
...@@ -70,6 +70,13 @@ ...@@ -70,6 +70,13 @@
{{ instance.name }} {{ instance.name }}
</div> </div>
<small>{{ instance.primary_host.get_fqdn }}</small> <small>{{ instance.primary_host.get_fqdn }}</small>
<small class="dashboard-vm-favourite" style="line-height: 39.6px;" data-vm="{{ instance.pk }}">
{% if fav %}
<i class="fa fa-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i>
{% else %}
<i class="fa fa-star-o text-primary title-favourite" title="{% trans "Mark as favorite" %}"></i>
{% endif %}
</small>
</h1> </h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
......
...@@ -115,6 +115,7 @@ class VmDetailView(GraphMixin, CheckedDetailView): ...@@ -115,6 +115,7 @@ class VmDetailView(GraphMixin, CheckedDetailView):
'op': {i.op: i for i in ops}, 'op': {i.op: i for i in ops},
'connect_commands': user.profile.get_connect_commands(instance), 'connect_commands': user.profile.get_connect_commands(instance),
'hide_tutorial': hide_tutorial, 'hide_tutorial': hide_tutorial,
'fav': instance.favourite_set.filter(user=user).exists(),
}) })
# activity data # activity data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment