2019-06-13 01:12:15 +00:00
@ extends ( 'settings.template' )
@ section ( 'section' )
2019-06-16 23:38:23 +00:00
< div class = " title " >
2019-07-11 03:26:05 +00:00
< h3 class = " font-weight-bold " > Relationships </ h3 >
2019-06-16 23:38:23 +00:00
</ div >
< hr >
2024-04-06 04:38:13 +00:00
< div class = " form-group pb-1 " >
< p >
< a class = " btn py-0 btn-link { { !request()->has('mode') || $mode == 'followers' ? 'font-weight-bold' : 'text-muted'}} " href = " ?mode=followers&page=1 " > Followers </ a >
< a class = " btn btn-link py-0 { { $mode == 'following' ? 'font-weight-bold' : 'text-muted' } } " href = " ?mode=following&page=1 " > Following </ a >
< a class = " btn btn-link py-0 { { $mode == 'hashtags' ? 'font-weight-bold' : 'text-muted' } } " href = " ?mode=hashtags&page=1 " > Hashtags </ a >
</ p >
</ div >
2019-07-11 03:26:05 +00:00
@ if ( empty ( $data ))
< p class = " text-center lead pt-5 mt-5 " > You are not {{ $mode == 'hashtags' ? 'following any hashtags.' : ( $mode == 'following' ? 'following anyone.' : 'followed by anyone.' )}} </ p >
@ else
2019-06-18 04:46:14 +00:00
< div class = " table-responsive " >
< table class = " table table-bordered table-hover " >
2019-07-11 03:26:05 +00:00
@ if ( $mode == 'hashtags' )
< thead >
< tr >
{{ -- < th scope = " col " class = " pt-0 pb-1 mt-0 " >
< input type = " checkbox " name = " check " class = " form-control check-all " >
</ th > -- }}
< th scope = " col " > Hashtag </ th >
< th scope = " col " > Action </ th >
</ tr >
</ thead >
< tbody >
@ foreach ( $data as $hashtag )
< tr >
< td class = " font-weight-bold " >
< a href = " { { $hashtag -> hashtag -> url ( '?src=relset' ) } } " class = " text-decoration-none text-dark " >
< p class = " mb-0 pb-0 " > #{{$hashtag->hashtag->name}}</p>
</ a >
</ td >
< td class = " text-center " >
< a class = " btn btn-outline-danger btn-sm py-0 action-btn " href = " # " data - id = " { { $hashtag -> hashtag -> name } } " data - action = " unfollowhashtag " > Unfollow </ a >
</ td >
</ tr >
@ endforeach
@ else
2019-06-16 23:38:23 +00:00
< thead >
< tr >
2019-06-18 04:46:14 +00:00
{{ -- < th scope = " col " class = " pt-0 pb-1 mt-0 " >
2019-06-16 23:38:23 +00:00
< input type = " checkbox " name = " check " class = " form-control check-all " >
2019-06-18 04:46:14 +00:00
</ th > -- }}
2019-06-16 23:38:23 +00:00
< th scope = " col " > Username </ th >
< th scope = " col " > Action </ th >
</ tr >
</ thead >
< tbody >
@ foreach ( $data as $follower )
< tr >
2019-06-18 04:46:14 +00:00
{{ -- < th scope = " row " class = " pb-0 pt-1 my-0 " >
< input type = " checkbox " class = " form-control mr-1 check-row " >
</ th > -- }}
2019-06-16 23:38:23 +00:00
< td class = " font-weight-bold " >
2019-06-18 04:46:14 +00:00
< a href = " { { $follower -> url () } } " class = " text-decoration-none text-dark " >
< p class = " mb-0 pb-0 text-truncate " title = " { { $follower -> username } } " > {{ $follower -> username }} </ p >
</ a >
2019-06-16 23:38:23 +00:00
</ td >
@ if ( $mode == 'following' )
< td class = " text-center " >
< a class = " btn btn-outline-danger btn-sm py-0 action-btn " href = " # " data - id = " { { $follower -> id } } " data - action = " unfollow " > Unfollow </ a >
</ td >
@ else
< td class = " text-center " >
< a class = " btn btn-outline-primary btn-sm py-0 action-btn " href = " # " data - id = " { { $follower -> id } } " data - action = " mute " > Mute </ a >
< a class = " btn btn-outline-danger btn-sm py-0 action-btn " href = " # " data - id = " { { $follower -> id } } " data - action = " block " > Block </ a >
</ td >
@ endif
</ tr >
@ endforeach
2019-07-11 03:26:05 +00:00
@ endif
2019-06-16 23:38:23 +00:00
</ tbody >
</ table >
2019-06-18 04:46:14 +00:00
</ div >
2019-06-16 23:38:23 +00:00
< div class = " d-flex justify-content-center " > {{ $data -> appends ([ 'mode' => $mode ]) -> links ()}} </ div >
@ endif
2019-06-13 01:12:15 +00:00
@ endsection
2019-06-18 04:46:14 +00:00
@ push ( 'styles' )
< style type = " text/css " >
. table - hover tbody tr : hover {
color : #718096;
background - color : #F7FAFC;
}
</ style >
@ endpush
2019-06-13 01:12:15 +00:00
@ push ( 'scripts' )
< script type = " text/javascript " >
2019-06-16 23:38:23 +00:00
$ ( document ) . ready (() => {
$ ( '.action-btn' ) . on ( 'click' , e => {
e . preventDefault ();
let action = e . target . getAttribute ( 'data-action' );
let id = e . target . getAttribute ( 'data-id' );
2019-06-13 01:12:15 +00:00
2019-06-16 23:38:23 +00:00
switch ( action ) {
case 'mute' :
axios . post ( '/i/mute' , {
type : 'user' ,
item : id
}) . then ( res => {
swal (
'Mute Successful' ,
'You have successfully muted that user' ,
'success'
);
});
break ;
2019-06-13 01:12:15 +00:00
2019-06-16 23:38:23 +00:00
case 'block' :
axios . post ( '/i/block' , {
type : 'user' ,
item : id
}) . then ( res => {
swal (
'Block Successful' ,
'You have successfully blocked that user' ,
'success'
);
});
break ;
2019-06-13 01:12:15 +00:00
2019-06-16 23:38:23 +00:00
case 'unfollow' :
2023-03-05 10:13:12 +00:00
axios . post ( '/api/v1/accounts/' + id + '/unfollow' )
. then ( res => {
2019-06-16 23:38:23 +00:00
swal (
'Unfollow Successful' ,
'You have successfully unfollowed that user' ,
'success'
);
2023-03-05 10:13:12 +00:00
})
. catch ( err => {
swal (
'Error' ,
'An error occured when attempting to unfollow this user' ,
'error'
);
2019-06-16 23:38:23 +00:00
});
break ;
2019-07-11 03:26:05 +00:00
case 'unfollowhashtag' :
2024-04-06 04:38:13 +00:00
axios . post ( '/api/v1/tags/' + id + '/unfollow' ) . then ( res => {
2019-07-11 03:26:05 +00:00
swal (
'Unfollow Successful' ,
'You have successfully unfollowed that hashtag' ,
'success'
);
});
2019-06-16 23:38:23 +00:00
}
setTimeout ( function () {
window . location . href = window . location . href ;
}, 3000 );
});
2019-06-13 01:12:15 +00:00
2019-06-16 23:38:23 +00:00
$ ( '.check-all' ) . on ( 'click' , e => {
})
});
2019-06-13 01:12:15 +00:00
</ script >
2023-03-05 10:13:12 +00:00
@ endpush