Commit d11af17e

mo khan <mo@mokhan.ca>
2014-10-19 00:45:06
update routes to point to cakes controller.
1 parent db4e721
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">
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">
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
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 %>
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>
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>
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>
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 %>
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' %>
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>
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">
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>
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">
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>
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>
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
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
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