Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
15739763
authored
Oct 30, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add transfer template ownership views
parent
2ba3690e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
2 deletions
+105
-2
circle/dashboard/static/dashboard/dashboard.js
+15
-0
circle/dashboard/templates/dashboard/confirm/transfer-template-ownership.html
+28
-0
circle/dashboard/templates/dashboard/template-edit.html
+19
-0
circle/dashboard/templates/dashboard/template-tx-owner.html
+16
-0
circle/dashboard/urls.py
+5
-0
circle/dashboard/views/template.py
+22
-2
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
15739763
...
@@ -50,6 +50,21 @@ $(function () {
...
@@ -50,6 +50,21 @@ $(function () {
return
false
;
return
false
;
});
});
$
(
'.tx-tpl-ownership'
).
click
(
function
(
e
)
{
$
.
ajax
({
type
:
'GET'
,
url
:
$
(
'.tx-tpl-ownership'
).
attr
(
'href'
),
success
:
function
(
data
)
{
$
(
'body'
).
append
(
data
);
$
(
'#confirmation-modal'
).
modal
(
'show'
);
$
(
'#confirmation-modal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#confirmation-modal'
).
remove
();
});
}
});
return
false
;
});
$
(
'.template-choose'
).
click
(
function
(
e
)
{
$
(
'.template-choose'
).
click
(
function
(
e
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'GET'
,
type
:
'GET'
,
...
...
circle/dashboard/templates/dashboard/confirm/transfer-template-ownership.html
0 → 100644
View file @
15739763
{% extends "dashboard/base.html" %}
{% load i18n %}
{% block content %}
<div
class=
"body-content"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h3
class=
"no-margin"
>
{% trans "Ownership transfer" %}
</h3>
</div>
<div
class=
"panel-body"
>
{% blocktrans with owner=instance.owner name=instance.name id=instance.id%}
<strong>
{{ owner }}
</strong>
offered to take the ownership of
template
<strong>
{{name}} ({{id}})
</strong>
.
Do you accept the responsility of being the template's owner?
{% endblocktrans %}
<div
class=
"pull-right"
>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
<a
class=
"btn btn-default"
href=
"{% url "
dashboard
.
index
"
%}"
>
{% trans "No" %}
</a>
<input
type=
"hidden"
name=
"key"
value=
"{{ key }}"
/>
<button
class=
"btn btn-danger"
type=
"submit"
>
{% trans "Yes" %}
</button>
</form>
</div>
</div>
</div>
{% endblock %}
circle/dashboard/templates/dashboard/template-edit.html
View file @
15739763
...
@@ -81,6 +81,25 @@
...
@@ -81,6 +81,25 @@
<div
class=
"panel panel-default"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<h4
class=
"no-margin"
><i
class=
"fa fa-user"
></i>
{% trans "Owner" %}
</h4>
</div>
<div
class=
"panel-body"
>
{% if user == object.owner %}
{% blocktrans %}You are the current owner of this template.{% endblocktrans %}
{% else %}
{% blocktrans with owner=object.owner name=object.owner.get_full_name%}
The current owner of this template is
<strong>
{{name}} ({{owner}})
</strong>
.
{% endblocktrans %}
{% endif %}
{% if user == object.owner or user.is_superuser %}
<a
href=
"{% url "
dashboard
.
views
.
template-transfer-ownership
"
object
.
pk
%}"
class=
"btn btn-link tx-tpl-ownership"
>
{% trans "Transfer ownership..." %}
</a>
{% endif %}
</div>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h4
class=
"no-margin"
><i
class=
"fa fa-group"
></i>
{% trans "Manage access" %}
</h4>
<h4
class=
"no-margin"
><i
class=
"fa fa-group"
></i>
{% trans "Manage access" %}
</h4>
</div>
</div>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
...
...
circle/dashboard/templates/dashboard/template-tx-owner.html
0 → 100644
View file @
15739763
{% load i18n %}
<div
class=
"pull-right"
>
<form
action=
"{% url "
dashboard
.
views
.
template-transfer-ownership
"
pk=
object.pk
%}"
method=
"POST"
style=
"max-width: 400px;"
>
{% csrf_token %}
<label>
{{ form.name.label }}
</label>
<div
class=
"input-group"
>
{{form.name}}
<div
class=
"input-group-btn"
>
<input
type=
"submit"
value=
"{% trans "
Save
"
%}"
class=
"btn btn-primary"
>
</div>
</div>
</form>
</div>
circle/dashboard/urls.py
View file @
15739763
...
@@ -80,6 +80,8 @@ urlpatterns = patterns(
...
@@ -80,6 +80,8 @@ urlpatterns = patterns(
name
=
"dashboard.views.template-list"
),
name
=
"dashboard.views.template-list"
),
url
(
r"^template/delete/(?P<pk>\d+)/$"
,
TemplateDelete
.
as_view
(),
url
(
r"^template/delete/(?P<pk>\d+)/$"
,
TemplateDelete
.
as_view
(),
name
=
"dashboard.views.template-delete"
),
name
=
"dashboard.views.template-delete"
),
url
(
r'^template/(?P<pk>\d+)/tx/$'
,
TransferTemplateOwnershipView
.
as_view
(),
name
=
'dashboard.views.template-transfer-ownership'
),
url
(
r'^vm/(?P<pk>\d+)/remove_port/(?P<rule>\d+)/$'
,
PortDelete
.
as_view
(),
url
(
r'^vm/(?P<pk>\d+)/remove_port/(?P<rule>\d+)/$'
,
PortDelete
.
as_view
(),
name
=
'dashboard.views.remove-port'
),
name
=
'dashboard.views.remove-port'
),
url
(
r'^vm/(?P<pk>\d+)/$'
,
VmDetailView
.
as_view
(),
url
(
r'^vm/(?P<pk>\d+)/$'
,
VmDetailView
.
as_view
(),
...
@@ -113,6 +115,9 @@ urlpatterns = patterns(
...
@@ -113,6 +115,9 @@ urlpatterns = patterns(
url
(
r'^vm/tx/(?P<key>.*)/?$'
,
url
(
r'^vm/tx/(?P<key>.*)/?$'
,
TransferInstanceOwnershipConfirmView
.
as_view
(),
TransferInstanceOwnershipConfirmView
.
as_view
(),
name
=
'dashboard.views.vm-transfer-ownership-confirm'
),
name
=
'dashboard.views.vm-transfer-ownership-confirm'
),
url
(
r'^template/tx/(?P<key>.*)/?$'
,
TransferTemplateOwnershipConfirmView
.
as_view
(),
name
=
'dashboard.views.template-transfer-ownership-confirm'
),
url
(
r'^node/delete/(?P<pk>\d+)/$'
,
NodeDelete
.
as_view
(),
url
(
r'^node/delete/(?P<pk>\d+)/$'
,
NodeDelete
.
as_view
(),
name
=
"dashboard.views.delete-node"
),
name
=
"dashboard.views.delete-node"
),
url
(
r'^node/status/(?P<pk>\d+)/$'
,
NodeStatus
.
as_view
(),
url
(
r'^node/status/(?P<pk>\d+)/$'
,
NodeStatus
.
as_view
(),
...
...
circle/dashboard/views/template.py
View file @
15739763
...
@@ -26,7 +26,7 @@ from django.core.urlresolvers import reverse, reverse_lazy
...
@@ -26,7 +26,7 @@ from django.core.urlresolvers import reverse, reverse_lazy
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
,
ugettext_noop
from
django.views.generic
import
(
from
django.views.generic
import
(
TemplateView
,
CreateView
,
DeleteView
,
UpdateView
,
TemplateView
,
CreateView
,
DeleteView
,
UpdateView
,
)
)
...
@@ -44,7 +44,10 @@ from ..forms import (
...
@@ -44,7 +44,10 @@ from ..forms import (
)
)
from
..tables
import
TemplateListTable
,
LeaseListTable
from
..tables
import
TemplateListTable
,
LeaseListTable
from
.util
import
AclUpdateView
,
FilterMixin
from
.util
import
(
AclUpdateView
,
FilterMixin
,
TransferOwnershipConfirmView
,
TransferOwnershipView
,
)
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -488,3 +491,20 @@ class LeaseDelete(LoginRequiredMixin, DeleteView):
...
@@ -488,3 +491,20 @@ class LeaseDelete(LoginRequiredMixin, DeleteView):
else
:
else
:
messages
.
success
(
request
,
success_message
)
messages
.
success
(
request
,
success_message
)
return
HttpResponseRedirect
(
success_url
)
return
HttpResponseRedirect
(
success_url
)
class
TransferTemplateOwnershipConfirmView
(
TransferOwnershipConfirmView
):
template
=
"dashboard/confirm/transfer-template-ownership.html"
model
=
InstanceTemplate
class
TransferTemplateOwnershipView
(
TransferOwnershipView
):
confirm_view
=
TransferTemplateOwnershipConfirmView
model
=
InstanceTemplate
notification_msg
=
ugettext_noop
(
'
%(user)
s offered you to take the ownership of '
'his/her template called
%(instance)
s. '
'<a href="
%(token)
s" '
'class="btn btn-success btn-small">Accept</a>'
)
token_url
=
'dashboard.views.template-transfer-ownership-confirm'
template
=
"dashboard/template-tx-owner.html"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment