Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

basic play functionality

  • Loading branch information...
commit ef49afbadb7e49ab7baf590e22e45ec5d65ade12 1 parent 4c422b3
@KentonWhite authored
View
4 app/controllers/mazes_controller.rb
@@ -8,6 +8,8 @@ def index
def show
@maze = current_user.mazes.find(params[:id])
+ @node = @maze.nodes.first
+ redirect_to maze_node_url(@maze, @node)
end
def new
@@ -18,7 +20,7 @@ def create
@maze = current_user.mazes.new(params[:maze])
if @maze.save
flash[:notice] = "Successfully created maze."
- redirect_to new_maze_node_path(@maze)
+ redirect_to new_maze_node_url(@maze)
else
render :action => 'new'
end
View
2  app/views/nodes/_show_links.html.erb
@@ -2,6 +2,6 @@
<% @links.each do |link| %>
<p>
<%= link_to link.text, maze_node_path(@maze, link.to_node_id) %>
- <%= link_to 'Edit', edit_maze_node_link_path(@maze, @node, link) %>
+ <%= link_to 'Edit', edit_maze_node_link_path(@maze, @node, link) if edit %>
</p>
<% end %>
View
2  app/views/nodes/edit.html.erb
@@ -3,7 +3,7 @@
<%= render 'form' %>
<p>
-<%= render :partial => 'show_links' %>
+<%= render :partial => 'show_links', :locals => {:edit => true} %>
</p>
<p>
View
4 app/views/nodes/show.html.erb
@@ -9,5 +9,7 @@
<%= @node.content %>
</p>
<p>
-<%= render :partial => 'show_links' %>
+<%= render :partial => 'show_links', :locals => {:edit => nil} %>
</p>
+
+<p><%= link_to 'Quit', mazes_path %></p>
Please sign in to comment.
Something went wrong with that request. Please try again.