diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 6c57e0fb..2d04eede 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -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; } diff --git a/app/controllers/attendance_controller.rb b/app/controllers/attendance_controller.rb index ab05325e..d50d1c39 100644 --- a/app/controllers/attendance_controller.rb +++ b/app/controllers/attendance_controller.rb @@ -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 diff --git a/app/controllers/cities_controller.rb b/app/controllers/cities_controller.rb index e8383aa6..4799f8f0 100644 --- a/app/controllers/cities_controller.rb +++ b/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 @@ -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 diff --git a/app/views/admin/users.html.haml b/app/views/admin/users.html.haml index 93528756..b86ce49a 100644 --- a/app/views/admin/users.html.haml +++ b/app/views/admin/users.html.haml @@ -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 @@ -18,4 +18,4 @@ %td= a.email %td= a.created_at %td= a.attendances.count - + diff --git a/app/views/cities/_sched_no_hosts.html.haml b/app/views/cities/_sched_no_hosts.html.haml index 67a949d7..5e523ced 100644 --- a/app/views/cities/_sched_no_hosts.html.haml +++ b/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 @@ -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'}. Follow @teawstrangers diff --git a/app/views/cities/forbes_index.html.erb b/app/views/cities/index.html.erb similarity index 100% rename from app/views/cities/forbes_index.html.erb rename to app/views/cities/index.html.erb diff --git a/app/views/cities/index.html.haml b/app/views/cities/index.html.haml deleted file mode 100644 index 3ce2ea45..00000000 --- a/app/views/cities/index.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -.landscape-header - .blur-layer - .landscape-text - %h1 - Let's get tea. -.container.cities-page - = render partial: 'shared/nav_header' - #cities.row.cities.mobilewide - .wide - .mobilepad - %h3.divider.with-sub - Where we are - %h4.divider-sub - So far, we're in the following cities! - %ul.cities.multiple-hosts - - @cities.each do |city| - = render partial: 'shared/city_hosts_item', locals: {city: city} - - %table - %tr - %th - %th - %th - - - @cities.each do |city| - %tr - %td= city.name - %td= link_to 'Show', city - %td= link_to 'Edit', edit_city_path(city) - %td= link_to 'Destroy', city, :method => :delete, :data => { :confirm => 'Are you sure?' } - - %br - - = link_to 'New City', new_city_path diff --git a/app/views/cities/forbes_show.html.erb b/app/views/cities/show.html.erb similarity index 100% rename from app/views/cities/forbes_show.html.erb rename to app/views/cities/show.html.erb diff --git a/app/views/cities/show.html.haml b/app/views/cities/show.html.haml deleted file mode 100644 index 679f55e2..00000000 --- a/app/views/cities/show.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -- content_for :title do - #{@city.name} | Tea With Strangers -- content_for :description do - Tea With Strangers is all about making meaningful interactions more fun. Meet some strangers in #{@city.name}! - -- content_for :head do - %meta{:property => "og:type", :content => "website"} - %meta{:property => "og:title", :content => "Tea With Strangers in #{@city.name}"} - %meta{:property => "og:image", :content => "#{@city.header_bg.url}"} - %meta{:property => "og:description", :content => "Tea With Strangers is all about making meaningful interactions more fun. Meet some strangers in #{@city.name}!"} -= render partial: 'shared/city_banner' -.container - .city-flash.notice - These old style city pages will be updated to the new style soon! -.container{:class => "#{@city.city_code}"} - = render partial: 'shared/nav_header' - = @city.hosts.empty? ? render(partial: 'city_no_hosts') : render(partial: 'city_has_hosts') -=content_for(:footer) { render partial: 'shared/footer' } diff --git a/app/views/profiles/_user_attendance_info.html.erb b/app/views/profiles/_user_attendance_info.html.erb index dacfbaab..35378f72 100644 --- a/app/views/profiles/_user_attendance_info.html.erb +++ b/app/views/profiles/_user_attendance_info.html.erb @@ -31,7 +31,7 @@ <% elsif !current_user.home_city.nil? && attendances.count.zero? %>

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) %>

<% else %>

diff --git a/app/views/shared/_signup.html.haml b/app/views/shared/_signup.html.haml index e71a5a1d..0193fd80 100644 --- a/app/views/shared/_signup.html.haml +++ b/app/views/shared/_signup.html.haml @@ -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)) diff --git a/config/routes.rb b/config/routes.rb index 9d7c2592..a05d9268 100644 --- a/config/routes.rb +++ b/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 @@ -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 @@ -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 diff --git a/spec/features/user_behaviours_spec.rb b/spec/features/user_behaviours_spec.rb index 6f64a7a9..a784c536 100644 --- a/spec/features/user_behaviours_spec.rb +++ b/spec/features/user_behaviours_spec.rb @@ -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) @@ -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