summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-10-18 18:45:06 -0600
committermo khan <mo@mokhan.ca>2014-10-18 18:45:06 -0600
commitd11af17e3cbc3622fae5f7cec5c31a2f44ebdf41 (patch)
tree3adb32253ec0522c93b3f8f146497d94bbcbef7b
parentdb4e721c0e1b733794531234e3401a454a75f233 (diff)
update routes to point to cakes controller.
-rw-r--r--app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs2
-rw-r--r--app/assets/javascripts/backbone/templates/cakes/show.jst.ejs2
-rw-r--r--app/services/application/handlers/publish_cake_to_twitter.rb2
-rw-r--r--app/views/admin/activities/_comment.html.erb2
-rw-r--r--app/views/admin/activities/_favorite.html.erb2
-rw-r--r--app/views/admin/users/show.html.erb2
-rw-r--r--app/views/cakes/_index.html.erb4
-rw-r--r--app/views/cakes/_show.html.erb4
-rw-r--r--app/views/cakes/index.html.erb4
-rw-r--r--app/views/cakes/show.html.erb2
-rw-r--r--app/views/favorites/index.html.erb2
-rw-r--r--app/views/my/dashboard/_creation.html.erb2
-rw-r--r--app/views/photos/index.html.erb2
-rw-r--r--app/views/photos/show.html.erb6
-rw-r--r--app/views/search/index.html.erb2
-rw-r--r--config/routes.rb2
-rw-r--r--spec/features/creations_spec.rb2
-rw-r--r--spec/routing/favorites_routing_spec.rb12
18 files changed, 24 insertions, 32 deletions
diff --git a/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs b/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs
index 4ff92702..997a7826 100644
--- a/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs
+++ b/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs
@@ -11,7 +11,7 @@
<a href="#cakes/<%= id %>/edit">
<i class="fa fa-edit"></i> edit
</a>
- <a href="<%= Routes.creation_favorites_path(id) %>">
+ <a href="<%= Routes.cakes_favorites_path(id) %>">
<i class="fa fa-heart"></i> fanclub
</a>
<span class="badge badge-warning">
diff --git a/app/assets/javascripts/backbone/templates/cakes/show.jst.ejs b/app/assets/javascripts/backbone/templates/cakes/show.jst.ejs
index 1c31fa86..f9a18c86 100644
--- a/app/assets/javascripts/backbone/templates/cakes/show.jst.ejs
+++ b/app/assets/javascripts/backbone/templates/cakes/show.jst.ejs
@@ -7,7 +7,7 @@
<a class="btn add-photo">
<i class="icon-plus"></i><strong>Add Photo</strong>
</a>
- <a href="<%= Routes.creation_favorites_path(id) %>" class="btn">
+ <a href="<%= Routes.cakes_favorites_path(id) %>" class="btn">
<i class="icon-heart"></i> <strong>Fan Club</strong>
</a>
<a id="remove-cake-button" class="btn btn-danger pull-right">
diff --git a/app/services/application/handlers/publish_cake_to_twitter.rb b/app/services/application/handlers/publish_cake_to_twitter.rb
index 0ae62237..ccc204a7 100644
--- a/app/services/application/handlers/publish_cake_to_twitter.rb
+++ b/app/services/application/handlers/publish_cake_to_twitter.rb
@@ -19,7 +19,7 @@ class PublishCakeToTwitter
end
def tweet_for(cake)
- "#{cake.name} By #{cake.user.name} on #{routes.creation_url(cake)}!"
+ "#{cake.name} By #{cake.user.name} on #{routes.cake_url(cake)}!"
end
def routes
diff --git a/app/views/admin/activities/_comment.html.erb b/app/views/admin/activities/_comment.html.erb
index 8f0f71f6..648a17ee 100644
--- a/app/views/admin/activities/_comment.html.erb
+++ b/app/views/admin/activities/_comment.html.erb
@@ -1,7 +1,7 @@
<div>
<i class="fa fa-comment icon-large"></i>
<%= avatar_for(subject.user, size: 24) %>
- <%= link_to subject.user.name, profile_path(subject.user) %> commented on <%= link_to subject.creation.name, creation_path(subject.creation) %>
+ <%= link_to subject.user.name, profile_path(subject.user) %> commented on <%= link_to subject.creation.name, cake_path(subject.creation) %>
<small><%= time_ago_in_words(subject.created_at) %> ago.</small>
<blockquote>
<%= subject.text %>
diff --git a/app/views/admin/activities/_favorite.html.erb b/app/views/admin/activities/_favorite.html.erb
index c39c1a47..86a2efdd 100644
--- a/app/views/admin/activities/_favorite.html.erb
+++ b/app/views/admin/activities/_favorite.html.erb
@@ -3,7 +3,7 @@
<i class="fa fa-heart icon-large"></i>
<%= avatar_for(subject.user, size: 24) %>
<%= link_to subject.user.name, profile_path(subject.user) %> added
- <%= link_to subject.creation.name, creation_path(subject.creation) %> to their favorites
+ <%= link_to subject.creation.name, cake_path(subject.creation) %> to their favorites
<small><%= time_ago_in_words(subject.created_at) %> ago.</small>
</p>
</div>
diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb
index ffc6e0d1..7df5b868 100644
--- a/app/views/admin/users/show.html.erb
+++ b/app/views/admin/users/show.html.erb
@@ -62,7 +62,7 @@
<% cache creation do %>
<tr>
<td>
- <%= link_to creation_path(creation) do %>
+ <%= link_to cake_path(creation) do %>
<%= image_tag creation.primary_image.url_for(:thumb), class: 'thumbnail', style: "width:65px;" %>
<% end %>
</td>
diff --git a/app/views/cakes/_index.html.erb b/app/views/cakes/_index.html.erb
index 22c9d76f..333ca4ea 100644
--- a/app/views/cakes/_index.html.erb
+++ b/app/views/cakes/_index.html.erb
@@ -5,11 +5,11 @@
<% cache creation do %>
<li class="span2">
<div class="thumbnail">
- <%= link_to creation do %>
+ <%= link_to cake_path(creation) do %>
<%= image_tag creation.primary_image.url_for(:thumb) %>
<% end %>
<div class="caption">
- <h4><%= link_to shrink(creation.name, 12), creation %></h4>
+ <h4><%= link_to shrink(creation.name, 12), cake_path(creation) %></h4>
<p><%= link_to shrink(creation.user.name, 20), profile_path(creation.user) %></p>
</div>
</div>
diff --git a/app/views/cakes/_show.html.erb b/app/views/cakes/_show.html.erb
index e45ef838..f19c0fb3 100644
--- a/app/views/cakes/_show.html.erb
+++ b/app/views/cakes/_show.html.erb
@@ -3,12 +3,12 @@
<img class="thumbnail" src="<%= @primary_image.url_for(:large) %>" alt="<%= @creation.name %>" />
</div>
<div class="span6">
- <h1><%= link_to @creation.name, creation_path(@creation) %></h1>
+ <h1><%= link_to @creation.name, cake_path(@creation) %></h1>
<% if user_signed_in? && current_user != @creation.user %>
<% if current_user.already_likes(@creation) %>
<i class="fa fa-star fa-4x pull-right"></i>
<% else %>
- <%= link_to creation_favorites_path(creation_id: @creation.id), method: :post, id: 'add-to-favorites-button', class: 'pull-right' do %>
+ <%= link_to cake_favorites_path(cake_id: @creation.id), method: :post, id: 'add-to-favorites-button', class: 'pull-right' do %>
<i class="fa fa-star-o fa-4x"></i>
<% end %>
<% end %>
diff --git a/app/views/cakes/index.html.erb b/app/views/cakes/index.html.erb
index 586a714d..1f31f44b 100644
--- a/app/views/cakes/index.html.erb
+++ b/app/views/cakes/index.html.erb
@@ -19,8 +19,8 @@
<div id="bakery">
<div class="row-fluid">
<ul class="nav nav-tabs">
- <li class="<%= params[:sort].blank? || params[:sort] == "newest" ? "active" : "" %>"><%= link_to "Newest", newest_creations_path %></li>
- <li class="<%= params[:sort] == "oldest" ? "active" : "" %>"><%= link_to "Oldest", oldest_creations_path %></li>
+ <li class="<%= params[:sort].blank? || params[:sort] == "newest" ? "active" : "" %>"><%= link_to "Newest", newest_cakes_path %></li>
+ <li class="<%= params[:sort] == "oldest" ? "active" : "" %>"><%= link_to "Oldest", oldest_cakes_path %></li>
</ul>
</div>
<%= render partial: 'index' %>
diff --git a/app/views/cakes/show.html.erb b/app/views/cakes/show.html.erb
index db6dfb08..303ad914 100644
--- a/app/views/cakes/show.html.erb
+++ b/app/views/cakes/show.html.erb
@@ -11,7 +11,7 @@
<ul class="thumbnails">
<% @creation.photos.each do |photo| %>
<li class="span2">
- <%= link_to creation_path(@creation, photo_id: photo.id), remote: true do %>
+ <%= link_to cake_path(@creation, photo_id: photo.id), remote: true do %>
<%= image_tag(photo.url_for(:thumb), :class => "thumbnail") %>
<% end %>
</li>
diff --git a/app/views/favorites/index.html.erb b/app/views/favorites/index.html.erb
index 573e7675..a406b57c 100644
--- a/app/views/favorites/index.html.erb
+++ b/app/views/favorites/index.html.erb
@@ -1,7 +1,7 @@
<% provide(:title, "#{@creation.name} by #{@creation.user.name} - fanclub") -%>
<div class="row-fluid">
<div class="span12">
- <h1> Fans of <%= link_to @creation.name, creation_path(@creation) %> </h1>
+ <h1> Fans of <%= link_to @creation.name, cake_path(@creation) %> </h1>
<ul class="thumbnails">
<% @creation.favorites.each do |favorite| %>
<li class="span3">
diff --git a/app/views/my/dashboard/_creation.html.erb b/app/views/my/dashboard/_creation.html.erb
index 61ef6c48..72d1663e 100644
--- a/app/views/my/dashboard/_creation.html.erb
+++ b/app/views/my/dashboard/_creation.html.erb
@@ -9,7 +9,7 @@
<%= link_to my_root_path(anchor: "cakes/#{item.id}/edit") do %>
<i class="fa fa-pencil-square-o"></i> edit
<% end %>
- <%= link_to creation_favorites_path(:creation_id => item.id) do %>
+ <%= link_to cake_favorites_path(cake_id: item.id) do %>
<i class="fa fa-heart"></i> fanclub
<% end %>
</p>
diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb
index 977a65ab..72b4acd3 100644
--- a/app/views/photos/index.html.erb
+++ b/app/views/photos/index.html.erb
@@ -1,6 +1,6 @@
<div class="row-fluid">
<div class="span12">
- <%= link_to "&laquo; Back to creation".html_safe, creation_path(@creation) %>
+ <%= link_to "&laquo; Back to creation".html_safe, cake_path(@creation) %>
<div class="row-fluid">
<div class="span3">&nbsp;</div>
<div class="span6">
diff --git a/app/views/photos/show.html.erb b/app/views/photos/show.html.erb
index 9da770c4..cd91c020 100644
--- a/app/views/photos/show.html.erb
+++ b/app/views/photos/show.html.erb
@@ -1,7 +1,7 @@
<div class="row-fluid">
<div class="span12">
- <h1><%= link_to @creation.name, creation_path(@creation) %></h1>
- <%= link_to creation_photo_path(@creation, @photo) do %>
+ <h1><%= link_to @creation.name, cake_path(@creation) %></h1>
+ <%= link_to cake_photo_path(@creation, @photo) do %>
<%= image_tag(@photo.url_for(:original), :class => "thumbnail") %>
<% end %>
</div>
@@ -12,7 +12,7 @@
<ul class="thumbnails">
<% @creation.photos.each do |photo| %>
<li class="span2">
- <%= link_to creation_photo_path(@creation, photo) do %>
+ <%= link_to cake_photo_path(@creation, photo) do %>
<%= image_tag(photo.url_for(:thumb), class: "thumbnail") %>
<% end %>
</li>
diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb
index 2b002e38..3fc3c010 100644
--- a/app/views/search/index.html.erb
+++ b/app/views/search/index.html.erb
@@ -22,7 +22,7 @@
<% cache creation do %>
<tr>
<td>
- <%= link_to creation_path(creation) do %>
+ <%= link_to cake_path(creation) do %>
<%= image_tag creation.primary_image.url_for(:thumb), class: 'thumbnail', style: "width:65px;" %>
<% end %>
</td>
diff --git a/config/routes.rb b/config/routes.rb
index d37ab07c..bd22f5fb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -60,7 +60,7 @@ Cake::Application.routes.draw do
# sitemap
get "/sitemap.xml", to: "sitemap#index", defaults: { format: :xml }
- root to: "creations#index"
+ root to: "cakes#index"
namespace :api, defaults: { :format => 'json' } do
namespace :v1 do
diff --git a/spec/features/creations_spec.rb b/spec/features/creations_spec.rb
index 7edeedf4..a16c5da7 100644
--- a/spec/features/creations_spec.rb
+++ b/spec/features/creations_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe "Creations", js: true do
describe "GET /creations" do
before :each do
- visit creations_path
+ visit cakes_path
end
it "loads the page" do
diff --git a/spec/routing/favorites_routing_spec.rb b/spec/routing/favorites_routing_spec.rb
index 019ee0b0..3319f7ff 100644
--- a/spec/routing/favorites_routing_spec.rb
+++ b/spec/routing/favorites_routing_spec.rb
@@ -3,19 +3,11 @@ require "rails_helper"
describe FavoritesController do
describe "routing" do
it "routes to #index" do
- { get: "/cakes/1/favorites" }.should route_to({
- :controller => "favorites",
- :action => "index",
- :creation_id => "1"
- })
+ expect(get: "/cakes/1/favorites").to route_to(controller: "favorites", action: "index", cake_id: "1")
end
it "routes to #create" do
- { post: "/cakes/1/favorites" }.should route_to({
- :controller => "favorites",
- :action => "create",
- :creation_id => "1"
- })
+ expect(post: "/cakes/1/favorites").to route_to(controller: "favorites", action: "create", cake_id: "1")
end
end
end