more improvements for profile/feed page

This commit is contained in:
Kyle Drake 2014-04-29 02:07:35 -07:00
parent 5bc66e2524
commit 177e4d3592
9 changed files with 28 additions and 26 deletions

9
app.rb
View file

@ -67,13 +67,13 @@ get '/profile_mockup' do
erb :'profile_mockup', locals: {site: current_site} erb :'profile_mockup', locals: {site: current_site}
end end
get '/profile/:sitename' do |sitename| get '/site/:sitename' do |sitename|
@title = "#{sitename}.neocities.org" @title = "#{sitename}.neocities.org"
site = Site[username: sitename] site = Site[username: sitename]
erb :'profile', locals: {site: site, is_current_site: site == current_site} erb :'site', locals: {site: site, is_current_site: site == current_site}
end end
post '/profile/:sitename/comment' do |sitename| post '/site/:sitename/comment' do |sitename|
require_login require_login
site = Site[username: sitename] site = Site[username: sitename]
@ -85,7 +85,7 @@ post '/profile/:sitename/comment' do |sitename|
) )
end end
redirect "/profile/#{sitename}" redirect "/site/#{sitename}"
end end
get '/tags_mockup' do get '/tags_mockup' do
@ -886,6 +886,7 @@ def signed_in?
end end
def current_site def current_site
return nil if session[:id].nil?
@site ||= Site[id: session[:id]] @site ||= Site[id: session[:id]]
end end

View file

@ -4,6 +4,6 @@ Sequel.migration do
} }
down { down {
DB.drop_column :site_changes, :changes DB.rename_table :site_changes, :changes
} }
end end

View file

@ -54,7 +54,7 @@ class Site < Sequel::Model
HTML_REGEX = /htm|html/ HTML_REGEX = /htm|html/
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED). MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
SCREENSHOT_RESOLUTIONS = ['235x141', '105x63', '270x162', '37x37', '146x88', '302x182', '90x63', '82x62'] SCREENSHOT_RESOLUTIONS = ['235x141', '105x63', '270x162', '37x37', '146x88', '302x182', '90x63', '82x62', '348x205']
THUMBNAIL_RESOLUTIONS = ['105x63'] THUMBNAIL_RESOLUTIONS = ['105x63']
many_to_one :server many_to_one :server

View file

@ -5,7 +5,7 @@
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags. <p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
<% else %> <% else %>
<% site.followings.each do |following| %> <% site.followings.each do |following| %>
<a href="#"><img src="<%= site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a> <a href="/site/<%= site.username %>"><img src="<%= site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View file

@ -1,10 +1,9 @@
<% events.each do |event| %> <% events.each do |event| %>
<% if event.profile_comment_id %> <% if event.profile_comment_id %>
<%== erb :'_news_profile_comment', layout: false, locals: {event: event} %> <%== erb :'_news_profile_comment', layout: false, locals: {profile_comment: event.profile_comment} %>
<% end %> <% end %>
<% end %> <% end %>
<!-- <!--
<div class="news-item follow"> <div class="news-item follow">
<div class="title"> <div class="title">

View file

@ -1,8 +1,8 @@
<div class="news-item comment for-me"> <div class="news-item comment for-me">
<div class="title"> <div class="title">
<div class="icon" style="background-image:url(https://neocities.org/site_screenshots/codeventurer.jpg);"></div> <div class="icon" style="background-image:url(<%= profile_comment.actioning_site.screenshot_url('index.html', '82x62') %>);"></div>
<a href="" class="user">Foo</a> <a href="" class="user"><%= profile_comment.actioning_site.username %></a>
<span class="date"><%= event.profile_comment.created_at.ago %></span> <span class="date"><%= profile_comment.created_at.ago %></span>
<div class="comment"><%= event.profile_comment.message %></div> <div class="comment"><%= profile_comment.message %></div>
</div> </div>
</div> </div>

View file

@ -1,10 +1,10 @@
<% if is_current_site %> <% if (!is_current_site && site.tags_dataset.count > 0) || is_current_site %>
<h3>Tags</h3> <h3>Tags</h3>
<% if site.tags_dataset.count == 0 %> <% if site.tags_dataset.count == 0 %>
<p>You don't have any tags yet. <a href="#">Add some!</a> <p>You don't have any tags yet. <a href="#">Add some!</a>
<% else %> <% else %>
<% site.tags.each do |tag| %> <% site.tags.each do |tag| %>
<a class="tag" href="//neocities.org/tags/<%= tag.name %>"><%= tag.name %></a> <a class="tag" href="/tags/<%= tag.name %>"><%= tag.name %></a>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

View file

@ -107,10 +107,10 @@
</div> </div>
</div> </div>
<a href=""><img src="http://neocities.org/site_screenshots/codeventurer.jpg" style="width:340px" class="large-portrait"></a> <a href=""><img src="<%= site.screenshot_url('index.html', '348x205') %>" style="width:340px" class="large-portrait"></a>
<div style="margin-top: 20px; margin-bottom: 20px" class="txt-Center"> <div style="margin-top: 20px; margin-bottom: 20px" class="txt-Center">
<a href="/profile/<%= site.username %>" class="btn-Action">View Site Profile</a> <a href="/site/<%= site.username %>" class="btn-Action">View Site Profile</a>
</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} %>

View file

@ -3,12 +3,12 @@
<div class="col col-50 signup-Area large"> <div class="col col-50 signup-Area large">
<div class="signup-Form"> <div class="signup-Form">
<fieldset class="content"> <fieldset class="content">
<img class="screenshot" src="http://neocities.org/site_screenshots/codeventurer.jpg" style="width: 358px;height: 215px;"> <img class="screenshot" src="<%= site.screenshot_url('index.html', '348x205') %>" style="width: 358px;height: 215px;">
</fieldset> </fieldset>
</div> </div>
</div> </div>
<div class="col col-50"> <div class="col col-50">
<h2 class="eps title-with-badge"><span>Derp's Website</span> <% if site.supporter? && !site.ended_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? && !site.ended_supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
<p class="site-url"><a href="http://<%= site.username %>.neocities.org" target="_blank">http://<%= site.username %>.neocities.org</a></p> <p class="site-url"><a href="http://<%= site.username %>.neocities.org" target="_blank">http://<%= site.username %>.neocities.org</a></p>
<div class="stats"> <div class="stats">
<div class="stat"><strong><%= site.hits_english %></strong> <span>hits</span></div> <div class="stat"><strong><%= site.hits_english %></strong> <span>hits</span></div>
@ -29,13 +29,15 @@
<div class="container"> <div class="container">
<div class="content misc-page columns right-col"><div class="col-left"> <div class="content misc-page columns right-col"><div class="col-left">
<div class="col col-66"> <div class="col col-66">
<div class="post-comment"> <% if current_site %>
<form method="POST" action="/profile/<%= site.username %>/comment"> <div class="post-comment">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>"> <form method="POST" action="/profile/<%= site.username %>/comment">
<input name="message" type="text" placeholder="Post a message..." maxlength="<%= Site::MAX_COMMENT_SIZE %>"> <input name="csrf_token" type="hidden" value="<%= csrf_token %>">
<button class="btn-Action">Post</button> <input name="message" type="text" placeholder="Post a message..." maxlength="<%= Site::MAX_COMMENT_SIZE %>">
</form> <button class="btn-Action">Post</button>
</div> </form>
</div>
<% end %>
<% if site.latest_events.empty? %> <% if site.latest_events.empty? %>
<div> <div>