Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
piphone-front
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
piphone-front
Commits
791ff06b
Commit
791ff06b
authored
Feb 13, 2017
by
okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better management of json data
parent
22933c52
Pipeline
#879
passed with stage
in 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
static/css/piphone.css
static/css/piphone.css
+4
-0
templates/contactslist.html
templates/contactslist.html
+7
-5
No files found.
static/css/piphone.css
View file @
791ff06b
...
...
@@ -31,3 +31,7 @@ main {
height
:
48px
;
width
:
48px
;
}
.json-data
{
display
:
none
;
}
templates/contactslist.html
View file @
791ff06b
...
...
@@ -19,7 +19,10 @@
</repeat>
</div>
</nav>
<div
class=
"wrapper"
data-json=
'{{ json_encode(@contacts) }}'
>
<div
class=
"json-data"
>
{{ json_encode(@contacts) }}
</div>
<div
class=
"wrapper"
>
</div>
</ul>
</div>
...
...
@@ -37,7 +40,6 @@ $(document).ready(function() {
$
(
'
select.filter
'
).
change
(
function
()
{
var
filter_group
=
$
(
this
).
val
();
var
contacts
=
JSON
.
parse
(
wrapper
.
attr
(
'
data-json
'
));
contacts
=
contacts
.
filter
(
function
(
contact
)
{
var
keep
=
false
contact
[
'
groups
'
].
forEach
(
function
(
group
)
{
...
...
@@ -47,11 +49,10 @@ $(document).ready(function() {
});
return
keep
;
});
list_meps
(
contacts
,
$
(
'
.contact .wrapper
'
)
);
list_meps
(
contacts
,
wrapper
);
});
$
(
'
#search
'
).
change
(
function
()
{
var
contacts
=
JSON
.
parse
(
wrapper
.
attr
(
'
data-json
'
));
contacts
=
contacts
.
filter
(
function
(
contact
)
{
return
contact
[
'
full_name
'
].
startsWith
(
$
(
'
#search
'
).
val
());
});
...
...
@@ -59,7 +60,8 @@ $(document).ready(function() {
});
var
wrapper
=
$
(
'
.contact .wrapper
'
);
var
contacts
=
JSON
.
parse
(
wrapper
.
attr
(
'
data-json
'
));
var
contacts_json
=
$
(
'
.contact .json-data
'
).
text
()
var
contacts
=
JSON
.
parse
(
contacts_json
);
list_meps
(
contacts
,
wrapper
);
var
random
=
Math
.
floor
((
Math
.
random
()
*
$
(
'
.collection-item
'
).
length
));
...
...
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