diff --git a/circle/dashboard/static/dashboard/dashboard.js b/circle/dashboard/static/dashboard/dashboard.js index 964c692..cd7ccfa 100644 --- a/circle/dashboard/static/dashboard/dashboard.js +++ b/circle/dashboard/static/dashboard/dashboard.js @@ -132,7 +132,7 @@ $(function () { $('.js-hidden').hide(); /* 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 pk = $(this).data("vm"); if(star.hasClass("fa-star-o")) { diff --git a/circle/dashboard/templates/dashboard/vm-detail.html b/circle/dashboard/templates/dashboard/vm-detail.html index 84e95e9..ef7752a 100644 --- a/circle/dashboard/templates/dashboard/vm-detail.html +++ b/circle/dashboard/templates/dashboard/vm-detail.html @@ -70,6 +70,13 @@ {{ instance.name }} </div> <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> <div style="clear: both;"></div> </div> diff --git a/circle/dashboard/views/vm.py b/circle/dashboard/views/vm.py index 606b768..b02153f 100644 --- a/circle/dashboard/views/vm.py +++ b/circle/dashboard/views/vm.py @@ -115,6 +115,7 @@ class VmDetailView(GraphMixin, CheckedDetailView): 'op': {i.op: i for i in ops}, 'connect_commands': user.profile.get_connect_commands(instance), 'hide_tutorial': hide_tutorial, + 'fav': instance.favourite_set.filter(user=user).exists(), }) # activity data