mirror of
https://github.com/neocities/neocities.git
synced 2025-04-28 11:12:30 +02:00
Merge violasong
This commit is contained in:
commit
578246668e
19 changed files with 1544 additions and 1775 deletions
|
@ -21,15 +21,33 @@ class Numeric
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_large_numbers
|
def format_large_number
|
||||||
if self > 999999999
|
if self > 9999
|
||||||
return sprintf "%.2fB", (self/1000000000.0)
|
if self > 999999999
|
||||||
elsif self > 999999
|
unit_char = 'B' #billion
|
||||||
return sprintf "%.2fM", (self/1000000.0)
|
unit_amount = 1000000000.0
|
||||||
elsif self > 999
|
elsif self > 999999
|
||||||
return sprintf "%.2fK", (self/1000.0)
|
unit_char = 'M' #million
|
||||||
|
unit_amount = 1000000.0
|
||||||
|
elsif self > 9999
|
||||||
|
unit_char = 'K' #thousand
|
||||||
|
unit_amount = 1000.0
|
||||||
|
end
|
||||||
|
|
||||||
|
self_divided = self.to_f / unit_amount
|
||||||
|
self_rounded = self_divided.round(1)
|
||||||
|
|
||||||
|
if self_rounded.denominator == 1
|
||||||
|
return sprintf ("%.0f" + unit_char), self_divided
|
||||||
|
else
|
||||||
|
return sprintf ("%.1f" + unit_char), self_divided
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return self
|
if self > 999
|
||||||
|
return self.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
|
||||||
|
else
|
||||||
|
return self
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -930,14 +930,6 @@ class Site < Sequel::Model
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def hits_english
|
|
||||||
values[:hits].to_s.reverse.gsub(/...(?=.)/,'\&,').reverse
|
|
||||||
end
|
|
||||||
|
|
||||||
def views_english
|
|
||||||
values[:views].to_s.reverse.gsub(/...(?=.)/,'\&,').reverse
|
|
||||||
end
|
|
||||||
|
|
||||||
def screenshots_delete(path)
|
def screenshots_delete(path)
|
||||||
SCREENSHOT_RESOLUTIONS.each do |res|
|
SCREENSHOT_RESOLUTIONS.each do |res|
|
||||||
begin
|
begin
|
||||||
|
|
BIN
public/img/neocitieslogo.png
Normal file
BIN
public/img/neocitieslogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 111 KiB |
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 121 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 7.5 KiB |
|
@ -258,8 +258,33 @@
|
||||||
@media (max-device-width:480px), screen and (max-width:800px){
|
@media (max-device-width:480px), screen and (max-width:800px){
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
>.fa-heart {
|
||||||
|
vertical-align: .5em;
|
||||||
|
margin-left: .3em;
|
||||||
|
font-size: 9px;
|
||||||
|
position: relative;
|
||||||
|
color: rgba(255, 255, 255, 0.4);
|
||||||
|
|
||||||
|
>.fa-heart {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:hover{background:#528995; text-decoration:underline}
|
&:hover{
|
||||||
|
background:#528995; text-decoration:underline;
|
||||||
|
>.fa-heart {
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
>.fa-heart {
|
||||||
|
color: $c-Brand-1;
|
||||||
|
position: absolute;
|
||||||
|
left: 1.6pt;
|
||||||
|
top: 1.2pt;
|
||||||
|
font-size: 5pt;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
&.selected, &:active{background:#528995; text-decoration:underline}
|
&.selected, &:active{background:#528995; text-decoration:underline}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -721,14 +721,14 @@ a.tag:hover {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.interior .header-Outro .stats {
|
.interior .header-Outro .stats {
|
||||||
margin-bottom: 1.2em;
|
margin-bottom: 1.3em;
|
||||||
float: left;
|
float: left;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 2em;
|
margin-top: 1.9em;
|
||||||
}
|
}
|
||||||
.interior .header-Outro .stats strong {
|
.interior .header-Outro .stats strong {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
font-weight: bold;
|
font-weight: normal;
|
||||||
color: #DAEEA5;
|
color: #DAEEA5;
|
||||||
}
|
}
|
||||||
.interior .header-Outro .stats span {
|
.interior .header-Outro .stats span {
|
||||||
|
@ -739,8 +739,9 @@ a.tag:hover {
|
||||||
}
|
}
|
||||||
.interior .header-Outro .stats .stat {
|
.interior .header-Outro .stats .stat {
|
||||||
float: left;
|
float: left;
|
||||||
width: 90px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
margin-right: 28px;
|
||||||
|
color: #84997E;
|
||||||
}
|
}
|
||||||
.interior .header-Outro .stats .stat.tips {
|
.interior .header-Outro .stats .stat.tips {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
|
@ -842,17 +843,17 @@ a.tag:hover {
|
||||||
.supporter-badge {
|
.supporter-badge {
|
||||||
background:url(/img/supporter.png);
|
background:url(/img/supporter.png);
|
||||||
width: 99px;
|
width: 99px;
|
||||||
height: 26px;
|
height: 24px;
|
||||||
float: left;
|
background-size: 99px;
|
||||||
margin-top: 7px;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
|
||||||
}
|
}
|
||||||
.title-with-badge {
|
.title-with-badge {
|
||||||
float: left;
|
float: left;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
.title-with-badge span {
|
.title-with-badge span {
|
||||||
float: left;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
.section {
|
.section {
|
||||||
padding: 55px 8%;
|
padding: 55px 8%;
|
||||||
|
@ -1389,7 +1390,13 @@ a.tag:hover {
|
||||||
padding: 25px 40px 40px 40px;
|
padding: 25px 40px 40px 40px;
|
||||||
}
|
}
|
||||||
.brand-asset {
|
.brand-asset {
|
||||||
margin-bottom: 2.7em;
|
margin-bottom: 2em;
|
||||||
|
float: left;
|
||||||
|
clear: both;
|
||||||
|
background: rgba(228, 228, 228, 0.42);
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
padding: 26px 0 5px;
|
||||||
p {
|
p {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,12 @@
|
||||||
.username {
|
.username {
|
||||||
float: left;
|
float: left;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 70%;
|
width: 63%;
|
||||||
}
|
}
|
||||||
.site-stats {
|
.site-stats {
|
||||||
float: right;
|
float: right;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 28%;
|
width: 35%;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.site-tags {
|
.site-tags {
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
<nav class="footer-Nav col col-40">
|
<nav class="footer-Nav col col-40">
|
||||||
<ul class="tiny h-Nav">
|
<ul class="tiny h-Nav">
|
||||||
<li><a href="/about" title="About Neocities">About</a></li>
|
<li><a href="/about">About</a></li>
|
||||||
<li><a href="/blog" title="Neocities Blog">Blog</a></li>
|
<li><a href="/blog">Blog</a></li>
|
||||||
<li><a href="/api" title="Neocities API">API</a></li>
|
<li><a href="/api">API</a></li>
|
||||||
<li><a href="/press" title="Neocities Press">Press</a></li>
|
<li><a href="/press">Press</a></li>
|
||||||
<li><a href="/terms" title="Neocities Terms of Use" rel="nofollow">Terms</a></li>
|
<li><a href="/terms" rel="nofollow">Terms</a></li>
|
||||||
<li><a href="/privacy" title="Neocities Privacy Policy" rel="nofollow">Privacy</a></li>
|
<li><a href="/privacy" rel="nofollow">Privacy</a></li>
|
||||||
<li><a href="/contact" title="Contact Us" rel="nofollow">Contact</a></li>
|
<li><a href="/contact" rel="nofollow">Contact</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div> <!-- end .row -->
|
</div> <!-- end .row -->
|
||||||
|
|
|
@ -8,29 +8,29 @@
|
||||||
|
|
||||||
<ul class="h-Nav constant-Nav">
|
<ul class="h-Nav constant-Nav">
|
||||||
<li>
|
<li>
|
||||||
<a href="/browse" title="Browse Neocities member websites">Websites</a>
|
<a href="/browse">Websites</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/about" title="About Neocities">About</a>
|
<a href="/about">About</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/tutorials" title="Learn to code with these tutorials">Tutorials</a>
|
<a href="/tutorials">Tutorials</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/api" title="Neocities Developers API">API</a>
|
<a href="/api">API</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/plan" title="Support Neocities">Support Us</a>
|
<a href="/plan">Support Us<i class="fa fa-heart"><i class="fa fa-heart"></i></i></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="status-Nav">
|
<ul class="status-Nav">
|
||||||
<% if !signed_in? %>
|
<% if !signed_in? %>
|
||||||
<li>
|
<li>
|
||||||
<a href="/#new" class="create-New" title="Sign up for free">Sign up for Free</a>
|
<a href="/#new" class="create-New">Sign up for Free</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/signin" class="sign-In" title="Sign into your account">Sign In</a>
|
<a href="/signin" class="sign-In">Sign In</a>
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
<% event.comments.each do |comment| %>
|
<% event.comments.each do |comment| %>
|
||||||
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username, :stripe_customer_id).first %>
|
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username, :stripe_customer_id).first %>
|
||||||
<div class="comment" id="comment_<%= comment.id %>">
|
<div class="comment" id="comment_<%= comment.id %>">
|
||||||
<img class="avatar" src="<%= comment_actioning_site.screenshot_url('index.html', '50x50') %>">
|
<a href="/site/<%= comment_actioning_site.username %>"><img class="avatar" src="<%= comment_actioning_site.screenshot_url('index.html', '50x50') %>"></a>
|
||||||
<a href="/site/<%= comment_actioning_site.username %>" class="user" title="<%= comment_actioning_site.title %>"><i class="fa fa-user"><% if comment_actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= comment_actioning_site.username %></a>
|
<a href="/site/<%= comment_actioning_site.username %>" class="user" title="<%= comment_actioning_site.title %>"><i class="fa fa-user"><% if comment_actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= comment_actioning_site.username %></a>
|
||||||
<span class="date">
|
<span class="date">
|
||||||
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
|
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<% site = profile_comment.site_dataset.select(:id, :username, :stripe_customer_id).first %>
|
<% site = profile_comment.site_dataset.select(:id, :username, :stripe_customer_id).first %>
|
||||||
|
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="icon" style="background-image:url(<%= actioning_site.screenshot_url('index.html', '100x100') %>);"></div>
|
<a href="/site/<%= actioning_site.username %>" class="icon" style="background-image:url(<%= actioning_site.screenshot_url('index.html', '100x100') %>);"></a>
|
||||||
|
|
||||||
<% if current_site && current_site.id == actioning_site.id %>
|
<% if current_site && current_site.id == actioning_site.id %>
|
||||||
<a href="/site/<%= current_site.username %>" class="you">You</a>
|
<a href="/site/<%= current_site.username %>" class="you">You</a>
|
||||||
|
|
|
@ -80,9 +80,9 @@
|
||||||
<div class="site-stats">
|
<div class="site-stats">
|
||||||
<a href="/site/<%= site.username %>">
|
<a href="/site/<%= site.username %>">
|
||||||
<% if params[:sort_by] == 'hits' %>
|
<% if params[:sort_by] == 'hits' %>
|
||||||
<%= site.hits %> hit<%= site.hits == 1 ? '' : 's' %>
|
<%= site.hits.format_large_number %> hit<%= site.hits == 1 ? '' : 's' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= site.views %> view<%= site.views == 1 ? '' : 's' %>
|
<%= site.views.format_large_number %> view<%= site.views == 1 ? '' : 's' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -62,12 +62,12 @@
|
||||||
<div class="site-info">
|
<div class="site-info">
|
||||||
<div class="username">
|
<div class="username">
|
||||||
<a href="/site/<%= suggested_site.username %>" title="Profile">
|
<a href="/site/<%= suggested_site.username %>" title="Profile">
|
||||||
<i class="fa fa-user"></i><%= suggested_site .username %>
|
<i class="fa fa-user"></i><%= suggested_site.username %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="site-stats">
|
<div class="site-stats">
|
||||||
<a href="/site/<%= suggested_site.username %>">
|
<a href="/site/<%= suggested_site.username %>">
|
||||||
<%= suggested_site.views %> view<%= suggested_site.views == 1 ? '' : 's' %>
|
<%= suggested_site.views.format_large_number %> view<%= suggested_site.views == 1 ? '' : 's' %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="site-tags">
|
<div class="site-tags">
|
||||||
|
@ -97,9 +97,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-50">
|
<div class="col col-50">
|
||||||
<div><strong><%= site.views_english %></strong> unique views</div>
|
<div><strong><%= site.views.format_large_number %></strong> unique views</div>
|
||||||
<div><strong><%= site.hits_english %></strong> hits</div>
|
<div><strong><%= site.hits.format_large_number %></strong> hits</div>
|
||||||
<div><strong><%= site.follows_dataset.count %></strong> followers</div>
|
<div><strong><%= site.follows_dataset.count.format_large_number %></strong> followers</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -50,22 +50,22 @@
|
||||||
</a>
|
</a>
|
||||||
<ul class="h-Nav constant-Nav">
|
<ul class="h-Nav constant-Nav">
|
||||||
<li>
|
<li>
|
||||||
<a href="/" title="back to the start">Neocities</a>
|
<a href="/">Neocities</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/browse" title="Browse Neocities member websites">Websites</a>
|
<a href="/browse">Websites</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/about" title="About Neocities">About</a>
|
<a href="/about">About</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/tutorials" title="Learn to code with these tutorials">Tutorials</a>
|
<a href="/tutorials">Tutorials</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/api" title="Neocities Developers API">API</a>
|
<a href="/api">API</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/plan" title="Support Neocities">Support Us</a>
|
<a href="/plan">Support Us<i class="fa fa-heart"><i class="fa fa-heart"></i></i></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
<% if !signed_in? %>
|
<% if !signed_in? %>
|
||||||
<li>
|
<li>
|
||||||
<a href="/signin" class="sign-In" title="Sign into your account">Sign In</a>
|
<a href="/signin" class="sign-In">Sign In</a>
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -32,17 +32,13 @@
|
||||||
<p><a href="mailto:press@neocities.org"><i class="fa fa-envelope-o"></i> press@neocities.org</a></p>
|
<p><a href="mailto:press@neocities.org"><i class="fa fa-envelope-o"></i> press@neocities.org</a></p>
|
||||||
|
|
||||||
<h2>Brand Assets</h2>
|
<h2>Brand Assets</h2>
|
||||||
<div class="brand-asset" style="margin-bottom: 2.3em;">
|
|
||||||
<a href="/img/neocitieslogo.svg" download="neocitieslogo.svg"><img src="/img/neocitieslogo.svg" style="width:100px; margin: -10px 0;"></a>
|
|
||||||
<p><a href="/img/neocitieslogo.svg" download="neocitieslogo.svg"><i class="fa fa-arrow-circle-down"></i> Download SVG</a></p>
|
|
||||||
</div>
|
|
||||||
<div class="brand-asset">
|
<div class="brand-asset">
|
||||||
<a href="/img/neocitieslogotext.svg" download="neocitieslogotext.svg"><img src="/img/neocitieslogotext.svg" style="width:180px;"></a>
|
<a href="/img/neocitieslogo.svg" download="neocitieslogo.svg"><img src="/img/neocitieslogo.svg" style="width:100px; margin: -5px 0;"></a>
|
||||||
<p><a href="/img/neocitieslogotext.svg" download="neocitieslogotext.svg"><i class="fa fa-arrow-circle-down"></i> Download SVG</a></p>
|
<p>Download: <a href="/img/neocitieslogo.svg" download="neocitieslogo.svg">SVG</a> | <a href="/img/neocitieslogo.png" download="neocitieslogo.png">PNG</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-asset">
|
<div class="brand-asset">
|
||||||
<a href="/img/neocitiesbadge.svg" download="neocitiesbadge.svg"><img src="/img/neocitiesbadge.svg"></a>
|
<a href="/img/neocitiesbadge.svg" download="neocitiesbadge.svg"><img src="/img/neocitiesbadge.svg"></a>
|
||||||
<p><a href="/img/neocitiesbadge.svg" download="neocitiesbadge.svg"><i class="fa fa-arrow-circle-down"></i> Download SVG</a></p>
|
<p>Download: <a href="/img/neocitiesbadge.svg" download="neocitiesbadge.svg">SVG</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
|
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
|
||||||
<p class="site-url"><a href="/surf/<%= site.username %>"><%= site.host %></a></p>
|
<p class="site-url"><a href="/surf/<%= site.username %>"><%= site.host %></a></p>
|
||||||
<div class="stats">
|
<div class="stats">
|
||||||
<div class="stat"><strong><%= site.views_english %></strong> <span>views</span></div>
|
<div class="stat"><strong><%= site.views.format_large_number %></strong> <span>views</span></div>
|
||||||
<div class="stat"><strong><%= site.hits_english %></strong> <span>hits</span></div>
|
<div class="stat"><strong><%= site.hits.format_large_number %></strong> <span>hits</span></div>
|
||||||
<div class="stat"><strong><%= site.follows_dataset.count %></strong> <span>followers</span></div>
|
<div class="stat"><strong><%= site.follows_dataset.count.format_large_number %></strong> <span>followers</span></div>
|
||||||
<!-- <div class="stat tips"><strong><%= site.tips_dataset.count %></strong> <span>tips</span></div> -->
|
<!-- <div class="stat tips"><strong><%= site.tips_dataset.count %></strong> <span>tips</span></div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
@ -107,8 +107,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat"><span>Number of updates</span><strong><%= site.changed_count %></strong></div>
|
<div class="stat"><span>Number of updates</span><strong><%= site.changed_count.format_large_number %></strong></div>
|
||||||
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%B %-d, %Y') %></strong></div>
|
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%b %-d, %Y') %></strong></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%== erb :'_follows', layout: false, locals: {site: site, is_current_site: site == current_site} %>
|
<%== erb :'_follows', layout: false, locals: {site: site, is_current_site: site == current_site} %>
|
||||||
|
|
|
@ -137,6 +137,37 @@
|
||||||
display:none!important;
|
display:none!important;
|
||||||
visibility:hidden
|
visibility:hidden
|
||||||
}
|
}
|
||||||
|
#followLink .follow {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
#followLink .following {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#followLink .unfollow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#followLink.is-following {
|
||||||
|
width: 6em;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#followLink.is-following .follow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#followLink.is-following .following {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
#followLink.is-following .unfollow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#followLink.is-following.unfollow .follow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#followLink.is-following.unfollow .following {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#followLink.is-following.unfollow .unfollow {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -182,12 +213,10 @@
|
||||||
|
|
||||||
<% if current_site && current_site != @site %>
|
<% if current_site && current_site != @site %>
|
||||||
<li>
|
<li>
|
||||||
<a id="followLink" href="" onclick="toggleFollow(<%= @site.id %>); return false">
|
<a id="followLink" href="#" onclick="toggleFollow(<%= @site.id %>); return false" class="<% if current_site.is_following? @site %>is-following<% end %>">
|
||||||
<% if current_site.is_following? @site %>
|
<span class="unfollow"><i class="fa fa-times"></i> Unfollow</span>
|
||||||
<i class="fa fa-times"></i> Unfollow
|
<span class="following"><i class="fa fa-check"></i> Following</span>
|
||||||
<% else %>
|
<span class="follow"><i class="fa fa-plus"></i> Follow</span>
|
||||||
<i class="fa fa-plus"></i> Follow
|
|
||||||
<% end %>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -230,15 +259,25 @@
|
||||||
e.target.form.submit()
|
e.target.form.submit()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var link = $('a#followLink');
|
||||||
|
|
||||||
function toggleFollow(id) {
|
function toggleFollow(id) {
|
||||||
$.post('/site/'+id+'/toggle_follow', {csrf_token: '<%= csrf_token %>'}, function(res) {
|
$.post('/site/'+id+'/toggle_follow', {csrf_token: '<%= csrf_token %>'}, function(res) {
|
||||||
if(res.result == 'followed')
|
if(res.result == 'followed')
|
||||||
$('#followLink').html('<i class="fa fa-times"></i> Unfollow')
|
link.addClass('is-following')
|
||||||
|
|
||||||
if(res.result == 'unfollowed')
|
if(res.result == 'unfollowed')
|
||||||
$('#followLink').html('<i class="fa fa-plus"></i> Follow')
|
link.removeClass('is-following')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
link.hover(function() {
|
||||||
|
if (link.hasClass('is-following')) {
|
||||||
|
link.addClass('unfollow');
|
||||||
|
}
|
||||||
|
}, function() {
|
||||||
|
link.removeClass('unfollow');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Add table
Reference in a new issue