Permalink
Browse files

Added "Create new event" link to events index.

  • Loading branch information...
1 parent 1b18a01 commit eeb5120ad773be2d54f1979387b042028446b8e7 @nelstrom nelstrom committed Jun 4, 2009
Showing with 8 additions and 8 deletions.
  1. +3 −3 app/controllers/page_events_controller.rb
  2. +5 −5 app/views/page_events/index.rhtml
View
6 app/controllers/page_events_controller.rb
@@ -1,7 +1,9 @@
class PageEventsController < ApplicationController
-
+
def index
+ @events_index_page = Page.find_by_class_name("EventArchivePage")
+
if !params[:year].blank? and !params[:month].blank?
@date = Time.local(params[:year], params[:month])
else
@@ -25,8 +27,6 @@ def index
end
end
- # debugger
-
@current_events = Page.events_by_month(@date)
end
end
View
10 app/views/page_events/index.rhtml
@@ -4,9 +4,9 @@
<div id="calendar_head">
<%= link_to_month( @last_month, @last_month_count, "prev adjacent", "Previous month" ) %>
- <%= link_to_month( @next_month, @next_month_count, "next adjacent", "Next month" ) %>
+ <%= link_to_month( @next_month, @next_month_count, "next adjacent", "Following month" ) %>
<%= link_to_month( @last_eventful_month, @last_eventful_month_count, "prev eventful", "Previous month in which events occur" ) %>
- <%= link_to_month( @next_eventful_month, @next_eventful_month_count, "next eventful", "Next month in which events occur" ) %>
+ <%= link_to_month( @next_eventful_month, @next_eventful_month_count, "next eventful", "Following month in which events occur" ) %>
<h2><%= @date.strftime("%B") %></h2>
</div>
@@ -56,6 +56,6 @@
</table>
-
-
-
+<% if @events_index_page %>
+ <%= link_to "Create new event", new_admin_page_child_path(@events_index_page.id), :title => "Create an event at #{@events_index_page.url}" %>
+<% end %>

0 comments on commit eeb5120

Please sign in to comment.