Skip to content

Commit

Permalink
Higlight dans recherche
Browse files Browse the repository at this point in the history
  • Loading branch information
totor committed May 31, 2020
1 parent f7b8e49 commit 1728a85
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
3 changes: 3 additions & 0 deletions assets/css/scss/components/post/post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@
line-height: 150% !important;
font-size: $MmediumS;
font-style: $light;
.highlight{
color: $green;
}
}

.actions {
Expand Down
2 changes: 1 addition & 1 deletion templates/comment/only-comment.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
data-action="{{ path('comment.delete',{'comment': comment.id} ) }}"
class="deleteForm">

<i class="icon-blocked"></i><span
<i class="icon-trash"></i><span
class="number ">Suprimer</span>
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion templates/notification/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@
<a href="{{ path('post.show',{"id":notif.byComment.post.id}) }}#comment-{{ notif.byComment.id }}">

{% endif %}
<img src="{{ vich_uploader_asset(notif.byUser, 'imageFile') }}"/>
{% if notif.byUser.image == "false" %}
<img src="https://api.adorable.io/avatars/60/{{ notif.byUser.username }}"/>
{% else %}
<img src="{{ vich_uploader_asset(notif.byUser, 'imageFile') }}"/>


{% endif %}

</a>
{% else %}
{% if notif.byPost is not null %}
Expand Down
2 changes: 1 addition & 1 deletion templates/posts/only-post.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
data-action="{{ path('post.delete',{'post': post.id} ) }}"
class="deleteForm">

<i class="icon-blocked"></i><span
<i class="icon-trash"></i><span
class="number ">Suprimer</span>
</div>
</div>
Expand Down
24 changes: 11 additions & 13 deletions templates/search/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -93,38 +93,36 @@
//we need to check if the value is the same
if (value == $(that).val()) {
var result = JSON.parse(msg);
// console.log(result.list.posts);
// console.log(result.list.posts);
$.each(result, function (key, arr) {
if (arr.users.length >0 ) {
if (arr.users.length > 0) {
usersSelector.find($('.single-compte').remove());
usersSelector.html(arr.users);
}else{
} else {
usersSelector.text('Aucun résultat');
}
if (arr.posts.length > 0) {
postsSelector.find($('.post-container').remove());
arr.posts.map((x,i)=>{
console.log( )
var textBrut = $($(x)[0]).find('.text')[0];
textBrut.replace(value, '<span class="highlight fc-white">'+value+'</span>');
var postEntier = $((x)[0]);
postsSelector.append(x.replace(new RegExp('('+value+')','ig'), '<span class="highlight fc-white">$1</span>'))
postsSelector.html('');
arr.posts.map((x, i) => {
changed = $(x).find('.text')[0].innerText.replace(value, '<span class="highlight ">' + value + '</span>')
console.log(changed)
return postsSelector.append(x.replace($(x).find('.text')[0].innerText, changed))
})
// postsSelector.html(arr.posts);
//
console.log(value)
}else{
} else {
postsSelector.text('Aucun résultat');
}
});
}
},
error:function(msg){
error: function (msg) {
}
Expand Down

0 comments on commit 1728a85

Please sign in to comment.