Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletions
+36
-1
circle/dashboard/static/dashboard/dashboard.js
+11
-0
circle/dashboard/templates/dashboard/index-templates.html
+13
-1
circle/dashboard/views/template.py
+12
-0
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,7 +33,18 @@
...
@@ -33,7 +33,18 @@
{% 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"
>
<div
class=
"col-xs-6"
>
<form
action=
"{% url "
dashboard
.
views
.
template-list
"
%}"
method=
"GET"
id=
"dashboard-template-search-form"
>
<div
class=
"input-group input-group-sm"
>
<input
id=
"dashboard-group-search-input"
name=
"s"
type=
"text"
class=
"form-control"
placeholder=
"{% trans "
Search
..."
%}"
/>
<div
class=
"input-group-btn"
>
<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"
>
<a
href=
"{% url "
dashboard
.
views
.
template-list
"
%}"
class=
"btn btn-primary btn-xs"
>
<i
class=
"fa fa-chevron-circle-right"
></i>
{% trans "show all" %}
<i
class=
"fa fa-chevron-circle-right"
></i>
{% trans "show all" %}
</a>
</a>
...
@@ -43,4 +54,5 @@
...
@@ -43,4 +54,5 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
circle/dashboard/views/template.py
View file @
0df9f5df
...
@@ -207,6 +207,18 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView):
...
@@ -207,6 +207,18 @@ 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
()
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
)
return
super
(
TemplateList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
create_acl_queryset
(
self
,
model
):
def
create_acl_queryset
(
self
,
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