diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index ba1e58d..274939f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -487,7 +487,7 @@ li div.details { opacity: 0.5; } -.comment.highlighted { +.comment:target { background-color: #fffcd7; border-radius: 20px; } @@ -560,6 +560,12 @@ li .comment_folder_button:checked ~ ol.comments li { display: none; } +/* try to force a highlighted comment to stay visible */ +li .comment_folder_button:checked ~ div.comment div.comment_text, +li .comment_folder_button:checked ~ div.comment div.voters { + display: block; +} + li .byline { color: #888; font-size: 9.5pt; diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 204ff7c..2ba3169 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -136,18 +136,6 @@ class StoriesController < ApplicationController @comments = @story.merged_comments.includes(:user, :story, :hat, :votes => :user).arrange_for_user(@user) - @force_show_thread_id = nil - - if params[:comment_short_id] - @comments.each do |c,x| - if c.short_id == params[:comment_short_id] - c.highlighted = true - @force_show_thread_id = c.thread_id - break - end - end - end - respond_to do |format| format.html { @comment = @story.comments.build diff --git a/app/models/comment.rb b/app/models/comment.rb index a23f399..80b0fda 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -10,7 +10,7 @@ class Comment < ActiveRecord::Base :class_name => "Moderation" belongs_to :hat - attr_accessor :current_vote, :previewing, :indent_level, :highlighted + attr_accessor :current_vote, :previewing, :indent_level before_validation :on => :create do self.assign_short_id_and_upvote @@ -429,10 +429,6 @@ class Comment < ActiveRecord::Base self.upvotes - self.downvotes end - def short_id_path - self.story.short_id_path + "/c/#{self.short_id}" - end - def short_id_url Rails.application.root_url + "c/#{self.short_id}" end @@ -446,7 +442,7 @@ class Comment < ActiveRecord::Base end def url - self.story.comments_url + "/comments/#{self.short_id}#c_#{self.short_id}" + self.story.comments_path + "#c_#{self.short_id}" end def vote_summary_for_user(u) diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 51d3337..e5957a7 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,13 +1,10 @@ > -
> +
- <%= comment.highlighted ? "highlighted" : "" %> <%= comment.score <= -1 ? "negative_1" : "" %> <%= comment.score <= -3 ? "negative_3" : "" %> <%= comment.score <= -5 ? "negative_5" : "" %>"> @@ -64,7 +61,7 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ? <% if !comment.previewing %> | - <%= t('.link') %> + <%= t('.link') %> <% if comment.is_editable_by_user?(@user) %> | diff --git a/config/routes.rb b/config/routes.rb index c0e2994..5d47fe2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,12 +91,14 @@ Lobsters::Application.routes.draw do post "keep_as_new" end - get "/s/:id/:title/comments/:comment_short_id" => "stories#show" - get "/s/:id/(:title)" => "stories#show", :format => /html|json/ - get "/c/:id" => "comments#redirect_from_short_id" get "/c/:id.json" => "comments#show_short_id", :format => "json" + # deprecated + get "/s/:story_id/:title/comments/:id" => "comments#redirect_from_short_id" + + get "/s/:id/(:title)" => "stories#show", :format => /html|json/ + get "/u" => "users#tree" get "/u/:username" => "users#show", :as => "user", :format => /html|json/