Skip to content

Commit

Permalink
Merge pull request #460 from mehulkar/clean
Browse files Browse the repository at this point in the history
Remove City#show and point it all to forbes_city_path.
  • Loading branch information
mehulkar committed Jun 6, 2015
2 parents 921722f + 92489f0 commit ead39f2
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 123 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.css.scss
Expand Up @@ -18,7 +18,7 @@
@import "static/*";
@import "cities/*";

.sessions.new, .jfdi_signup, .forbes_index, .forbes_show {
.sessions.new, .jfdi_signup, .cities.index, .forbes_show {
@extend .light-background;
}

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/attendance_controller.rb
Expand Up @@ -27,7 +27,7 @@ def create
"You're set for tea time! Check your email and add it to your calendar :)"
return redirect_to profile_path, notice: message
else
return redirect_to city_path(@tea_time.city), alert: "Couldn't register for that, sorry :("
return redirect_to forbes_city_path(@tea_time.city), alert: "Couldn't register for that, sorry :("
end
end

Expand Down
25 changes: 4 additions & 21 deletions app/controllers/cities_controller.rb
@@ -1,27 +1,10 @@
class CitiesController < ApplicationController
before_action :set_city, except: [:index, :new, :forbes_index, :forbes_new, :forbes_create]
before_action :set_city, except: [:index, :new, :index, :forbes_new, :forbes_create]
before_action :authenticate_user!, :authorized?, only: [:new, :create, :edit, :update, :destroy]
before_action :away_ye_waitlisted, except: [:forbes_index, :forbes_show, :forbes_new, :forbes_suggest, :forbes_create, :forbes_set_city]
before_action :away_ye_waitlisted, except: [:index, :forbes_show, :forbes_new, :forbes_suggest, :forbes_create, :forbes_set_city]

# GET /cities
# GET /cities.json
def index
if can? :manage, City
@cities = City.all
respond_to do |format|
format.html { render layout: !request.xhr? }
format.json { render json: @cities }
end
else
redirect_to root_path+"#cities"
end
end

def forbes_index
use_new_styles
end

def forbes_show
use_new_styles
end

Expand Down Expand Up @@ -55,9 +38,9 @@ def forbes_set_city
redirect_to forbes_city_path(@city)
end

# GET /cities/:city_code
# GET /:id (city code)
def show
redirect_to forbes_city_path
use_new_styles
end

# GET /cities/new
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/users.html.haml
Expand Up @@ -3,7 +3,7 @@
.row
%h1
-if city
=link_to city.name, city_path(city)
=link_to city.name, forbes_city_path(city)
- else
No Home City
%table.attendees
Expand All @@ -18,4 +18,4 @@
%td= a.email
%td= a.created_at
%td= a.attendances.count

12 changes: 6 additions & 6 deletions app/views/cities/_sched_no_hosts.html.haml
@@ -1,16 +1,16 @@
.row
.narrow.howitworks
- if @city.hosts.empty?
%h3.divider
%h3.divider
= "There are no tea times happening in #{@city.name} at the moment!"
%p
%p
= "We're working to make sure that we have amazing hosts and enough people to ensure that tea time won't just be you and...you. If you've signed up for TWS in #{@city.name}, you'll get an email the second we're ready! If not,"
= link_to "sign up here!", city_path(@city), :class => "city-name #{@city.city_code}"
= link_to "sign up here!", forbes_city_path(@city), :class => "city-name #{@city.city_code}"
- else
%h3.divider
%h3.divider
= "The #{@city.name} hosts are busy collecting stories!"
%p= "They'll most certainly be sharing them at tea time, and when they're back, you'll find some tea times here. Check back soon!"
%p
%p
In the meantime, here are two things you should do:
.wide.action
%ul.two-things
Expand All @@ -24,7 +24,7 @@
Enjoy stories from tea time
%p
= "We share some good stories from tea time, discuss some of the funny things about open communication, and share lots of behind the scenes details about Tea With Strangers on our "
= link_to "facebook page", "http://facebook.com/teawithstrangers"
= link_to "facebook page", "http://facebook.com/teawithstrangers"
and #{link_to 'twitter', 'http://twitter.com/teawstrangers'}.
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffacebook.com%2Fteawithstrangers&amp;width=0&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=false&amp;height=80&amp;appId=360734737286705" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>
<a href="https://twitter.com/teawstrangers" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @teawstrangers</a>
Expand Down
File renamed without changes.
34 changes: 0 additions & 34 deletions app/views/cities/index.html.haml

This file was deleted.

File renamed without changes.
18 changes: 0 additions & 18 deletions app/views/cities/show.html.haml

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/profiles/_user_attendance_info.html.erb
Expand Up @@ -31,7 +31,7 @@
<% elsif !current_user.home_city.nil? && attendances.count.zero? %>
<p>
You're not scheduled for any tea times! Let's change that.
<%= link_to "Go schedule a tea time!", city_path(current_user.home_city) %>
<%= link_to "Go schedule a tea time!", forbes_city_path(current_user.home_city) %>
</p>
<% else %>
<p>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_signup.html.haml
Expand Up @@ -14,6 +14,6 @@
.already
%h4.schedule.button
- if @city
=link_to("Schedule tea time", city_path(@city))
=link_to("Schedule tea time", forbes_city_path(@city))
-else
=link_to("Schedule tea time", city_path(current_user.home_city))
=link_to("Schedule tea time", forbes_city_path(current_user.home_city))
63 changes: 28 additions & 35 deletions config/routes.rb
@@ -1,21 +1,5 @@
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :cities, only: [:index, :create]
resources :hosts, only: [:index]
resources :users do
collection do
get 'self', to: :self
get 'self/interests', to: :interests
patch 'self/interests', to: :update_interests
end
end

end
end

root 'static#index'

get '/about' => 'static#about', as: :about
get '/hosting' => 'static#hosting', as: :hosting
get '/signup' => 'static#jfdi_signup', as: :sign_up
Expand All @@ -29,6 +13,21 @@
get 'logout' => 'devise/sessions#destroy'
end

namespace :api do
namespace :v1 do
resources :cities, only: [:index, :create]
resources :hosts, only: [:index]
resources :users do
collection do
get 'self', to: :self
get 'self/interests', to: :interests
patch 'self/interests', to: :update_interests
end
end

end
end

resources :tea_times do
member do
post '/attendance' => 'attendance#create', as: :attendance
Expand All @@ -39,42 +38,36 @@
end
end

# TODO: You know what to do Tue May 5 2015
get '/cities' => 'cities#forbes_index'
resources :cities do
collection do
get '/suggest' => 'cities#forbes_new', as: :suggest
post '/suggest' => 'cities#forbes_create', as: :suggest_create
get '/suggest' => 'cities#forbes_new', as: :suggest
post '/suggest' => 'cities#forbes_create', as: :suggest_create
end
member do
get '/host/:host_id' => 'hosts#show', as: :host
get '/host/:host_id' => 'hosts#show', as: :host
put '/set', action: 'forbes_set_city', as: :set
end
end

scope(path: 'admin') do
get '/ghost' => 'admin#find'
post '/ghost' => 'admin#ghost'

scope :admin do
get '/ghost' => 'admin#find'
post '/ghost' => 'admin#ghost'
get '/overview' => 'admin#overview'
get '/overview/tea_times' => 'admin#tea_times_overview'
get '/overview/cities' => 'admin#cities_overview'
get '/overview/hosts' => 'admin#host_overview'
get '/users' => 'admin#users'

get '/mail' => 'admin#write_mail'
post '/mail' => 'admin#send_mail'

get '/host' => 'hosts#new', as: :new_host
post '/host' => 'hosts#create', as: :create_host
get '/mail' => 'admin#write_mail'
post '/mail' => 'admin#send_mail'
get '/host' => 'hosts#new', as: :new_host
post '/host' => 'hosts#create', as: :create_host
end


scope(path: 'profile') do
get '/' => 'profiles#show', as: :profile, via: :get
scope :profile do
get '/' => 'profiles#show', as: :profile, via: :get
get '/history' => 'profiles#history', as: :history
get '/tasks' => 'profiles#host_tasks', as: :host_tasks
end

get '/:id' => 'cities#forbes_show', as: :forbes_city
get '/:id' => 'cities#show', as: :forbes_city
end
4 changes: 2 additions & 2 deletions spec/features/user_behaviours_spec.rb
Expand Up @@ -41,7 +41,7 @@

feature 'Tea Time Attendance' do
scenario 'allows a user to sign up' do
visit city_path(@user.home_city)
visit forbes_city_path(@user.home_city)
expect(page.status_code).to eq(200)
click_link('Count Me In')
expect(current_path).to eq tea_time_path(@tt)
Expand All @@ -52,7 +52,7 @@

scenario 'logged out user with account tries to attend' do
sign_out
visit city_path(@user.home_city)
visit forbes_city_path(@user.home_city)
# Should be redirected to the new TWS Sign up experience
expect(current_path).to eq root_path
end
Expand Down

0 comments on commit ead39f2

Please sign in to comment.