mirror of
https://github.com/neocities/neocities.git
synced 2025-04-28 11:12:30 +02:00
Almost where I want the follow button to be, but not quite
This commit is contained in:
parent
8665e70be1
commit
5011d83436
4 changed files with 42 additions and 19 deletions
|
@ -1,14 +1,11 @@
|
||||||
var Site = {
|
var Site = {
|
||||||
toggleFollow: function(siteId, csrfToken) {
|
toggleFollow: function(siteId, csrfToken) {
|
||||||
var link = $('a#followLink')
|
var link = $('a#followLink')
|
||||||
var span = $('a#followLink span')
|
|
||||||
$.post('/site/'+siteId+'/toggle_follow', {csrf_token: csrfToken}, function(res) {
|
$.post('/site/'+siteId+'/toggle_follow', {csrf_token: csrfToken}, function(res) {
|
||||||
if(res.result == "followed") {
|
if(res.result == "followed") {
|
||||||
span.text('Unfollow')
|
link.addClass('is-following')
|
||||||
link.removeClass('follow')
|
|
||||||
} else if(res.result == 'unfollowed') {
|
} else if(res.result == 'unfollowed') {
|
||||||
span.text('Follow')
|
link.removeClass('is-following')
|
||||||
link.addClass('follow')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,7 +484,7 @@ a.tag:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background: #FFEE8A;
|
background: #FFEE8A;
|
||||||
}
|
}
|
||||||
.following {
|
.follower-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
float: left;
|
float: left;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
|
@ -669,18 +669,40 @@ a.tag:hover {
|
||||||
.interior .header-Outro .stats .stat.tips {
|
.interior .header-Outro .stats .stat.tips {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
}
|
}
|
||||||
.btn-Action.follow span {
|
#followLink {
|
||||||
background-image: url(/img/follow.png);
|
.follow {
|
||||||
padding-left: 22px;
|
display: inline;
|
||||||
|
}
|
||||||
|
.following {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.unfollow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.btn-Action.tip span {
|
#followLink.is-following {
|
||||||
background-image: url(/img/tip.png);
|
width: 8.7em;
|
||||||
padding-left: 26px;
|
|
||||||
background-position-y: -1px;
|
.follow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.following {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.unfollow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.btn-Action.share span {
|
#followLink.is-following:hover {
|
||||||
background-image: url(/img/share.png);
|
.follow {
|
||||||
padding-left: 26px;
|
display: none;
|
||||||
|
}
|
||||||
|
.following {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.unfollow {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.col-33 .stats .stat {
|
.col-33 .stats .stat {
|
||||||
margin-bottom: .4em;
|
margin-bottom: .4em;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<% site_follows = site.follows %>
|
<% site_follows = site.follows %>
|
||||||
<% if (!is_current_site && !site_follows.empty?) || is_current_site %>
|
<% if (!is_current_site && !site_follows.empty?) || is_current_site %>
|
||||||
<h3>Followers</h3>
|
<h3>Followers</h3>
|
||||||
<div class="following">
|
<div class="follower-list">
|
||||||
<% if site_follows.empty? %>
|
<% if site_follows.empty? %>
|
||||||
No followers yet.
|
No followers yet.
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -34,9 +34,13 @@
|
||||||
|
|
||||||
<% if current_site && current_site != site %>
|
<% if current_site && current_site != site %>
|
||||||
<% is_following = current_site.is_following?(site) %>
|
<% is_following = current_site.is_following?(site) %>
|
||||||
<a id="followLink" href="#" onclick="Site.toggleFollow(<%= site.id %>, '<%= csrf_token %>'); return false" class="btn-Action <%= is_following ? '' : 'follow' %>">
|
|
||||||
<span><%= is_following ? 'Unfollow' : 'Follow' %></span>
|
<a id="followLink" href="#" onclick="Site.toggleFollow(<%= site.id %>, '<%= csrf_token %>'); return false" class="btn-Action <%= is_following ? 'is-following' : '' %>">
|
||||||
|
<span class="unfollow"><i class="fa fa-times"></i>Unfollow</span>
|
||||||
|
<span class="following"><i class="fa fa-check"></i>Following</span>
|
||||||
|
<span class="follow"><i class="fa fa-plus"></i>Follow</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- <a href="#" class="btn-Action tip"><span>Tip</span></a> -->
|
<!-- <a href="#" class="btn-Action tip"><span>Tip</span></a> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue