Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
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
0df9f5df
authored
Jan 21, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add template search func
parent
47ecf19c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
8 deletions
+43
-8
circle/dashboard/static/dashboard/dashboard.js
+11
-0
circle/dashboard/templates/dashboard/index-templates.html
+19
-7
circle/dashboard/views/template.py
+13
-1
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
0df9f5df
...
@@ -215,6 +215,7 @@ $(function () {
...
@@ -215,6 +215,7 @@ $(function () {
register_search
(
$
(
"#dashboard-node-search-form"
),
$
(
"#dashboard-node-list"
),
generateNodeHTML
);
register_search
(
$
(
"#dashboard-node-search-form"
),
$
(
"#dashboard-node-list"
),
generateNodeHTML
);
register_search
(
$
(
"#dashboard-group-search-form"
),
$
(
"#dashboard-group-list"
),
generateGroupHTML
);
register_search
(
$
(
"#dashboard-group-search-form"
),
$
(
"#dashboard-group-list"
),
generateGroupHTML
);
register_search
(
$
(
"#dashboard-user-search-form"
),
$
(
"#dashboard-user-list"
),
generateUserHTML
);
register_search
(
$
(
"#dashboard-user-search-form"
),
$
(
"#dashboard-user-list"
),
generateUserHTML
);
register_search
(
$
(
"#dashboard-template-search-form"
),
$
(
"#dashboard-template-list"
),
generateTemplateHTML
);
/* notification message toggle */
/* notification message toggle */
$
(
document
).
on
(
'click'
,
".notification-message-subject"
,
function
()
{
$
(
document
).
on
(
'click'
,
".notification-message-subject"
,
function
()
{
...
@@ -302,6 +303,16 @@ function generateUserHTML(data, is_last) {
...
@@ -302,6 +303,16 @@ function generateUserHTML(data, is_last) {
'</a>'
;
'</a>'
;
}
}
function
generateTemplateHTML
(
data
,
is_last
)
{
return
'<a href="'
+
data
.
url
+
'" class="list-group-item real-link'
+
(
is_last
?
" list-group-item-last"
:
""
)
+
'">'
+
' <span class="index-template-list-name">'
+
' <i class="fa fa-'
+
data
.
icon
+
'"></i> '
+
safe_tags_replace
(
data
.
name
)
+
' </span>'
+
' <small class="text-muted index-template-list-system">'
+
safe_tags_replace
(
data
.
system
)
+
'</small>'
+
' <div class="clearfix"></div>'
+
'</a>'
;
}
function
generateNodeHTML
(
data
,
is_last
)
{
function
generateNodeHTML
(
data
,
is_last
)
{
return
'<a href="'
+
data
.
url
+
'" class="list-group-item real-link'
+
(
is_last
?
' list-group-item-last'
:
''
)
+
'">'
+
return
'<a href="'
+
data
.
url
+
'" class="list-group-item real-link'
+
(
is_last
?
' list-group-item-last'
:
''
)
+
'">'
+
'<span class="index-node-list-name">'
+
'<span class="index-node-list-name">'
+
...
...
circle/dashboard/templates/dashboard/index-templates.html
View file @
0df9f5df
...
@@ -33,13 +33,25 @@
...
@@ -33,13 +33,25 @@
{% endfor %}
{% endfor %}
</div>
</div>
<div
class=
"list-group-item list-group-footer"
>
<div
class=
"list-group-item list-group-footer"
>
<div
class=
"text-right"
>
<div
class=
"row"
>
<a
href=
"{% url "
dashboard
.
views
.
template-list
"
%}"
class=
"btn btn-primary btn-xs"
>
<div
class=
"col-xs-6"
>
<i
class=
"fa fa-chevron-circle-right"
></i>
{% trans "show all" %}
<form
action=
"{% url "
dashboard
.
views
.
template-list
"
%}"
method=
"GET"
id=
"dashboard-template-search-form"
>
</a>
<div
class=
"input-group input-group-sm"
>
<a
href=
"{% url "
dashboard
.
views
.
template-choose
"
%}"
class=
"btn btn-success btn-xs template-choose"
>
<input
id=
"dashboard-group-search-input"
name=
"s"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<i
class=
"fa fa-plus-circle"
></i>
{% trans "new" %}
<div
class=
"input-group-btn"
>
</a>
<button
type=
"submit"
class=
"btn btn-primary"
><i
class=
"fa fa-search"
></i></button>
</div>
</div>
</form>
</div>
<div
class=
"col-xs-6 text-right"
>
<a
href=
"{% url "
dashboard
.
views
.
template-list
"
%}"
class=
"btn btn-primary btn-xs"
>
<i
class=
"fa fa-chevron-circle-right"
></i>
{% trans "show all" %}
</a>
<a
href=
"{% url "
dashboard
.
views
.
template-choose
"
%}"
class=
"btn btn-success btn-xs template-choose"
>
<i
class=
"fa fa-plus-circle"
></i>
{% trans "new" %}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
circle/dashboard/views/template.py
View file @
0df9f5df
...
@@ -207,7 +207,19 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView):
...
@@ -207,7 +207,19 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView):
def
get
(
self
,
*
args
,
**
kwargs
):
def
get
(
self
,
*
args
,
**
kwargs
):
self
.
search_form
=
TemplateListSearchForm
(
self
.
request
.
GET
)
self
.
search_form
=
TemplateListSearchForm
(
self
.
request
.
GET
)
self
.
search_form
.
full_clean
()
self
.
search_form
.
full_clean
()
return
super
(
TemplateList
,
self
)
.
get
(
*
args
,
**
kwargs
)
if
self
.
request
.
is_ajax
():
templates
=
[{
'icon'
:
i
.
os_type
,
'system'
:
i
.
system
,
'url'
:
reverse
(
"dashboard.views.template-detail"
,
kwargs
=
{
'pk'
:
i
.
pk
}),
'name'
:
i
.
name
}
for
i
in
self
.
get_queryset
()]
return
HttpResponse
(
json
.
dumps
(
templates
),
content_type
=
"application/json"
,
)
else
:
return
super
(
TemplateList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
create_acl_queryset
(
self
,
model
):
def
create_acl_queryset
(
self
,
model
):
queryset
=
super
(
TemplateList
,
self
)
.
create_acl_queryset
(
model
)
queryset
=
super
(
TemplateList
,
self
)
.
create_acl_queryset
(
model
)
...
...
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