Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove I'm Feeling Lucky feature

  • Loading branch information...
commit 86af1e7bd6907bd4c1fcaf9e5634f1c511cfb188 1 parent e57ebd2
Veezus Kreist authored
4 app/controllers/vurls_controller.rb
@@ -145,10 +145,6 @@ def redirect
145 145 end
146 146 end
147 147
148   - def random
149   - redirect_to Vurl.random.url
150   - end
151   -
152 148 def safe_url_for(vurl)
153 149 vurl.flagged_as_spam? ? spam_url(slug: vurl.slug) : vurl.url
154 150 end
4 app/models/vurl.rb
@@ -51,10 +51,6 @@ def popular_since(period_ago, options={})
51 51 "
52 52 end
53 53
54   - def random
55   - find(:first, offset: (Vurl.count * rand).to_i)
56   - end
57   -
58 54 def tweet_most_popular_of_the_day
59 55 require 'twitter'
60 56
1  app/views/vurls/new.html.haml
@@ -14,7 +14,6 @@
14 14 = f.label :url, "URL"
15 15 = f.text_field :url
16 16 = f.submit "Vurlify!", class: 'button left'
17   - %button.button.right.lucky_link{url: random_vurls_path} I'm Feeling Lucky
18 17 - content_for :leftcolumn do
19 18 %h2
20 19 Recent popular vurls in the last
2  app/views/vurls/not_found.html.haml
@@ -13,10 +13,8 @@
13 13
14 14 - content_for :leftcolumn do
15 15 %h2 Other actions that might help
16   - %p While you're here, why don't you try the I'm Feeling Lucky feature? It will redirect you to a random vurl from the archives. You may also want to create a new vurl.
17 16 %ul
18 17 %li= link_to 'Create a new vurl', new_vurl_path
19   - %li= link_to "I'm Feeling Lucky", random_vurls_path, class: 'lucky_link'
20 18
21 19 %h2 All-time most popular vurls
22 20 = render partial: 'summary', collection: most_popular_vurls
2  app/views/vurls/spam.html.haml
@@ -21,10 +21,8 @@
21 21 Original URL:
22 22 = link_to current_vurl.url, current_vurl.url
23 23 %h2 Other actions that might help
24   - %p While you're here, why don't you try the I'm Feeling Lucky feature? It will redirect you to a random vurl from the archives. You may also want to create a new vurl.
25 24 %ul
26 25 %li= link_to 'Create a new vurl', new_vurl_path
27   - %li= link_to "I'm Feeling Lucky", random_vurls_path, class: 'lucky_link'
28 26
29 27 %h2 All-time most popular vurls
30 28 = render partial: 'summary', collection: most_popular_vurls
1  config/routes.rb
@@ -17,7 +17,6 @@
17 17 get :title
18 18 end
19 19 collection do
20   - get :random
21 20 get :chart_settings
22 21 get :image_screenshot
23 22 end
1  public/stylesheets/application.css
@@ -25,7 +25,6 @@ form#new_vurl .button.right {
25 25 width: 150px;
26 26 }
27 27 form#new_vurl .button.left {
28   - margin: 0 35px 0 90px;
29 28 width: 130px;
30 29 }
31 30
18 spec/controllers/vurls_controller_spec.rb
@@ -120,24 +120,6 @@
120 120 end
121 121 end
122 122
123   - describe "when redirecting to a random vurl" do
124   - before do
125   - Vurl.stub!(:random).and_return(vurl)
126   - end
127   - it "loads a random vurl" do
128   - Vurl.should_receive(:random).and_return(vurl)
129   - do_get
130   - end
131   - it "redirects to that vurl's url" do
132   - do_get
133   - response.should redirect_to(vurl.url)
134   - end
135   -
136   - def do_get
137   - get :random
138   - end
139   - end
140   -
141 123 describe "#safe_url_for" do
142 124 let(:vurl) { Fabricate(:vurl) }
143 125 context "when the vurl is flagged as spam" do
5 spec/models/vurl_spec.rb
@@ -64,11 +64,6 @@
64 64 end
65 65 end
66 66
67   - describe ".random" do
68   - # Not entirely sure how to test this. Maybe stubbing count and rand and setting
69   - # an expectation that find is called with that offset? - Veezus
70   - end
71   -
72 67 describe ".most_popular" do
73 68 it "returns the correct number of vurls" do
74 69 5.times { Fabricate(:vurl) }

0 comments on commit 86af1e7

Please sign in to comment.
Something went wrong with that request. Please try again.