Merge violasong

This commit is contained in:
Kyle Drake 2014-11-13 23:53:49 -08:00
commit 578246668e
19 changed files with 1544 additions and 1775 deletions

View file

@ -21,15 +21,33 @@ class Numeric
end
end
def format_large_numbers
if self > 999999999
return sprintf "%.2fB", (self/1000000000.0)
elsif self > 999999
return sprintf "%.2fM", (self/1000000.0)
elsif self > 999
return sprintf "%.2fK", (self/1000.0)
def format_large_number
if self > 9999
if self > 999999999
unit_char = 'B' #billion
unit_amount = 1000000000.0
elsif self > 999999
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
return self
if self > 999
return self.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
else
return self
end
end
end

View file

@ -930,14 +930,6 @@ class Site < Sequel::Model
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)
SCREENSHOT_RESOLUTIONS.each do |res|
begin

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

View file

@ -258,8 +258,33 @@
@media (max-device-width:480px), screen and (max-width:800px){
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}
}

View file

@ -721,14 +721,14 @@ a.tag:hover {
margin-left: 0;
}
.interior .header-Outro .stats {
margin-bottom: 1.2em;
margin-bottom: 1.3em;
float: left;
width: 100%;
margin-top: 2em;
margin-top: 1.9em;
}
.interior .header-Outro .stats strong {
font-size: 1.5em;
font-weight: bold;
font-weight: normal;
color: #DAEEA5;
}
.interior .header-Outro .stats span {
@ -739,8 +739,9 @@ a.tag:hover {
}
.interior .header-Outro .stats .stat {
float: left;
width: 90px;
text-align: center;
margin-right: 28px;
color: #84997E;
}
.interior .header-Outro .stats .stat.tips {
width: 60px;
@ -842,17 +843,17 @@ a.tag:hover {
.supporter-badge {
background:url(/img/supporter.png);
width: 99px;
height: 26px;
float: left;
margin-top: 7px;
margin-left: 10px;
height: 24px;
background-size: 99px;
display: inline-block;
}
.title-with-badge {
float: left;
width: 100%;
margin-bottom: 3px;
}
.title-with-badge span {
float: left;
margin-right: 5px;
}
.section {
padding: 55px 8%;
@ -1389,7 +1390,13 @@ a.tag:hover {
padding: 25px 40px 40px 40px;
}
.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 {
margin-top: 10px;
}

View file

@ -29,12 +29,12 @@
.username {
float: left;
overflow: hidden;
width: 70%;
width: 63%;
}
.site-stats {
float: right;
overflow: hidden;
width: 28%;
width: 35%;
text-align: right;
}
.site-tags {

View file

@ -8,13 +8,13 @@
<nav class="footer-Nav col col-40">
<ul class="tiny h-Nav">
<li><a href="/about" title="About Neocities">About</a></li>
<li><a href="/blog" title="Neocities Blog">Blog</a></li>
<li><a href="/api" title="Neocities API">API</a></li>
<li><a href="/press" title="Neocities Press">Press</a></li>
<li><a href="/terms" title="Neocities Terms of Use" rel="nofollow">Terms</a></li>
<li><a href="/privacy" title="Neocities Privacy Policy" rel="nofollow">Privacy</a></li>
<li><a href="/contact" title="Contact Us" rel="nofollow">Contact</a></li>
<li><a href="/about">About</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/api">API</a></li>
<li><a href="/press">Press</a></li>
<li><a href="/terms" rel="nofollow">Terms</a></li>
<li><a href="/privacy" rel="nofollow">Privacy</a></li>
<li><a href="/contact" rel="nofollow">Contact</a></li>
</ul>
</nav>
</div> <!-- end .row -->

View file

@ -8,29 +8,29 @@
<ul class="h-Nav constant-Nav">
<li>
<a href="/browse" title="Browse Neocities member websites">Websites</a>
<a href="/browse">Websites</a>
</li>
<li>
<a href="/about" title="About Neocities">About</a>
<a href="/about">About</a>
</li>
<li>
<a href="/tutorials" title="Learn to code with these tutorials">Tutorials</a>
<a href="/tutorials">Tutorials</a>
</li>
<li>
<a href="/api" title="Neocities Developers API">API</a>
<a href="/api">API</a>
</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>
</ul>
<ul class="status-Nav">
<% if !signed_in? %>
<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>
<a href="/signin" class="sign-In" title="Sign into your account">Sign In</a>
<a href="/signin" class="sign-In">Sign In</a>
</li>
<% else %>
<li class="dropdown">

View file

@ -90,7 +90,7 @@
<% event.comments.each do |comment| %>
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username, :stripe_customer_id).first %>
<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>
<span class="date">
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>

View file

@ -2,7 +2,7 @@
<% site = profile_comment.site_dataset.select(:id, :username, :stripe_customer_id).first %>
<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 %>
<a href="/site/<%= current_site.username %>" class="you">You</a>

View file

@ -80,9 +80,9 @@
<div class="site-stats">
<a href="/site/<%= site.username %>">
<% if params[:sort_by] == 'hits' %>
<%= site.hits %>&nbsp;hit<%= site.hits == 1 ? '' : 's' %>
<%= site.hits.format_large_number %>&nbsp;hit<%= site.hits == 1 ? '' : 's' %>
<% else %>
<%= site.views %>&nbsp;view<%= site.views == 1 ? '' : 's' %>
<%= site.views.format_large_number %>&nbsp;view<%= site.views == 1 ? '' : 's' %>
<% end %>
</a>
</div>

View file

@ -62,12 +62,12 @@
<div class="site-info">
<div class="username">
<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>
</div>
<div class="site-stats">
<a href="/site/<%= suggested_site.username %>">
<%= suggested_site.views %>&nbsp;view<%= suggested_site.views == 1 ? '' : 's' %>
<%= suggested_site.views.format_large_number %>&nbsp;view<%= suggested_site.views == 1 ? '' : 's' %>
</a>
</div>
<div class="site-tags">
@ -97,9 +97,9 @@
<% end %>
</div>
<div class="col col-50">
<div><strong><%= site.views_english %></strong> unique views</div>
<div><strong><%= site.hits_english %></strong> hits</div>
<div><strong><%= site.follows_dataset.count %></strong> followers</div>
<div><strong><%= site.views.format_large_number %></strong> unique views</div>
<div><strong><%= site.hits.format_large_number %></strong> hits</div>
<div><strong><%= site.follows_dataset.count.format_large_number %></strong> followers</div>
</div>
</div>

View file

@ -50,22 +50,22 @@
</a>
<ul class="h-Nav constant-Nav">
<li>
<a href="/" title="back to the start">Neocities</a>
<a href="/">Neocities</a>
</li>
<li>
<a href="/browse" title="Browse Neocities member websites">Websites</a>
<a href="/browse">Websites</a>
</li>
<li>
<a href="/about" title="About Neocities">About</a>
<a href="/about">About</a>
</li>
<li>
<a href="/tutorials" title="Learn to code with these tutorials">Tutorials</a>
<a href="/tutorials">Tutorials</a>
</li>
<li>
<a href="/api" title="Neocities Developers API">API</a>
<a href="/api">API</a>
</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>
</ul>
@ -73,7 +73,7 @@
<% if !signed_in? %>
<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>
<% else %>
<li>

View file

@ -32,17 +32,13 @@
<p><a href="mailto:press@neocities.org"><i class="fa fa-envelope-o"></i> press@neocities.org</a></p>
<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">
<a href="/img/neocitieslogotext.svg" download="neocitieslogotext.svg"><img src="/img/neocitieslogotext.svg" style="width:180px;"></a>
<p><a href="/img/neocitieslogotext.svg" download="neocitieslogotext.svg"><i class="fa fa-arrow-circle-down"></i> Download SVG</a></p>
<a href="/img/neocitieslogo.svg" download="neocitieslogo.svg"><img src="/img/neocitieslogo.svg" style="width:100px; margin: -5px 0;"></a>
<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 class="brand-asset">
<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>

View file

@ -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>
<p class="site-url"><a href="/surf/<%= site.username %>"><%= site.host %></a></p>
<div class="stats">
<div class="stat"><strong><%= site.views_english %></strong> <span>views</span></div>
<div class="stat"><strong><%= site.hits_english %></strong> <span>hits</span></div>
<div class="stat"><strong><%= site.follows_dataset.count %></strong> <span>followers</span></div>
<div class="stat"><strong><%= site.views.format_large_number %></strong> <span>views</span></div>
<div class="stat"><strong><%= site.hits.format_large_number %></strong> <span>hits</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>
<div class="actions">
@ -107,8 +107,8 @@
<% end %>
</strong>
</div>
<div class="stat"><span>Number of updates</span><strong><%= site.changed_count %></strong></div>
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%B %-d, %Y') %></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>
<%== erb :'_follows', layout: false, locals: {site: site, is_current_site: site == current_site} %>

View file

@ -137,6 +137,37 @@
display:none!important;
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>
</head>
<body>
@ -182,12 +213,10 @@
<% if current_site && current_site != @site %>
<li>
<a id="followLink" href="" onclick="toggleFollow(<%= @site.id %>); return false">
<% if current_site.is_following? @site %>
<i class="fa fa-times"></i> Unfollow
<% else %>
<i class="fa fa-plus"></i> Follow
<% end %>
<a id="followLink" href="#" onclick="toggleFollow(<%= @site.id %>); return false" class="<% if current_site.is_following? @site %>is-following<% end %>">
<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>
</li>
<% end %>
@ -230,15 +259,25 @@
e.target.form.submit()
})
var link = $('a#followLink');
function toggleFollow(id) {
$.post('/site/'+id+'/toggle_follow', {csrf_token: '<%= csrf_token %>'}, function(res) {
if(res.result == 'followed')
$('#followLink').html('<i class="fa fa-times"></i> Unfollow')
link.addClass('is-following')
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>
</body>
</html>