fixup header current page stuff
This commit is contained in:
parent
dd9966c0a3
commit
b01f9e9027
|
@ -260,14 +260,13 @@ div#inside {
|
|||
}
|
||||
|
||||
.headerlinks a {
|
||||
color: #666;
|
||||
color: #777;
|
||||
text-decoration: none;
|
||||
padding-right: 0.75em;
|
||||
}
|
||||
|
||||
#headerright {
|
||||
float: right;
|
||||
color: #888;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
@ -276,6 +275,10 @@ div#inside {
|
|||
padding-left: 0.75em;
|
||||
}
|
||||
|
||||
#header a.cur_url {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
||||
/* footer */
|
||||
|
||||
|
|
|
@ -144,6 +144,9 @@ class CommentsController < ApplicationController
|
|||
end
|
||||
|
||||
def threads
|
||||
@title = "Your Threads"
|
||||
@cur_url = "/threads"
|
||||
|
||||
@threads = @user.recent_threads(20).map{|r|
|
||||
cs = Comment.ordered_for_story_or_thread_for_user(nil, r, @user)
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ class HomeController < ApplicationController
|
|||
@rss_link ||= "<link rel=\"alternate\" type=\"application/rss+xml\" " <<
|
||||
"title=\"RSS 2.0\" href=\"/rss\" />"
|
||||
|
||||
@title = ""
|
||||
@cur_url = "/"
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :action => "index" }
|
||||
format.rss { render :action => "rss", :layout => false }
|
||||
|
@ -16,13 +19,12 @@ class HomeController < ApplicationController
|
|||
def newest
|
||||
@stories = find_stories_for_user_and_tag_and_newest(@user, nil, true)
|
||||
|
||||
@page_title = "Newest Stories"
|
||||
@title = "Newest Stories"
|
||||
@cur_url = "/newest"
|
||||
|
||||
@rss_link = "<link rel=\"alternate\" type=\"application/rss+xml\" " <<
|
||||
"title=\"RSS 2.0 - Newest Items\" href=\"/newest.rss\" />"
|
||||
|
||||
@title = "Newest Stories"
|
||||
@title_url = "/newest"
|
||||
@newest = true
|
||||
|
||||
respond_to do |format|
|
||||
|
@ -35,16 +37,14 @@ class HomeController < ApplicationController
|
|||
@tag = Tag.find_by_tag!(params[:tag])
|
||||
@stories = find_stories_for_user_and_tag_and_newest(@user, @tag, false)
|
||||
|
||||
@page_title = @tag.description
|
||||
@title = @tag.description.blank?? @tag.tag : @tag.description
|
||||
@cur_url = tag_url(@tag.tag)
|
||||
|
||||
@rss_link = "<link rel=\"alternate\" type=\"application/rss+xml\" " <<
|
||||
"title=\"RSS 2.0 - Tagged #{CGI.escape(@tag.tag)} " <<
|
||||
"(#{CGI.escape(@tag.description)})\" href=\"/t/" +
|
||||
"#{CGI.escape(@tag.tag)}.rss\" />"
|
||||
|
||||
@title = @tag.description.blank?? @tag.tag : @tag.description
|
||||
@title_url = tag_url(@tag.tag)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :action => "index" }
|
||||
format.rss { render :action => "rss", :layout => false }
|
||||
|
|
|
@ -8,7 +8,8 @@ class StoriesController < ApplicationController
|
|||
before_filter :find_story, :only => [ :destroy, :edit, :undelete, :update ]
|
||||
|
||||
def create
|
||||
@page_title = "Submit a New Story"
|
||||
@title = "Submit Story"
|
||||
@cur_url = "/stories/new"
|
||||
|
||||
# we don't allow the url to be changed, so we have to set it manually
|
||||
@story = Story.new(params[:story].reject{|k,v| k == "url" })
|
||||
|
@ -58,8 +59,8 @@ class StoriesController < ApplicationController
|
|||
flash[:error] = "You cannot edit that story."
|
||||
return redirect_to "/"
|
||||
end
|
||||
|
||||
@page_title = "Edit Story"
|
||||
|
||||
@title = "Edit Story"
|
||||
end
|
||||
|
||||
def fetch_url_title
|
||||
|
@ -74,10 +75,10 @@ class StoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@page_title = "Submit a New Story"
|
||||
@title = "Submit Story"
|
||||
@cur_url = "/stories/new"
|
||||
|
||||
@story = Story.new
|
||||
@story.story_type = "link"
|
||||
|
||||
if !params[:url].blank?
|
||||
@story.url = params[:url]
|
||||
|
|
|
@ -2,20 +2,24 @@
|
|||
<div id="headerleft">
|
||||
<a id="l_holder" class="boring" href="/"></a>
|
||||
|
||||
<% if @title %>
|
||||
<% links = { "/" => "Home", "/newest" => "Newest Stories" } %>
|
||||
<% if @user %>
|
||||
<% links.merge!({ "/threads" => "Your Threads",
|
||||
"/stories/new" => "Submit Story" }) %>
|
||||
<% end %>
|
||||
<% links.merge!({ "/search" => "Search" }) %>
|
||||
|
||||
<% if @cur_url.present? && !links.keys.include?(@cur_url) %>
|
||||
<span id="headertitle">
|
||||
<a href="<%= @title_url %>"><%= @title %></a>
|
||||
<a href="<%= @cur_url %>"><%= @title %></a>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<span class="headerlinks">
|
||||
<a href="/">Home</a>
|
||||
|
||||
<a href="/newest">Newest</a>
|
||||
<% if @user %>
|
||||
<a href="/threads">Your Threads</a>
|
||||
<% links.each do |u,v| %>
|
||||
<a href="<%= u %>" <%= u == @cur_url ? raw("class=\"cur_url\"") :
|
||||
"" %>><%= v %></a>
|
||||
<% end %>
|
||||
<a href="/stories/new">Submit Story</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<link rev="canonical" rel="self alternate shorter shorturl shortlink"
|
||||
href="<%= @short_url %>" />
|
||||
<% end %>
|
||||
<title><%= @page_title ? "#{@page_title} | Lobsters" : "Lobsters" %></title>
|
||||
<title><%= @title.present? ? "#{@title} | Lobsters" : "Lobsters" %></title>
|
||||
<%= stylesheet_link_tag "application", :media => "all" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= csrf_meta_tags %>
|
||||
|
|
Loading…
Reference in a new issue