diff --git a/app/controllers/peoples_controller.rb b/app/controllers/peoples_controller.rb
new file mode 100644
index 0000000..cb37c4b
--- /dev/null
+++ b/app/controllers/peoples_controller.rb
@@ -0,0 +1,94 @@
+class PeoplesController < ApplicationController
+ append_before_filter :fetch_people_and_page, :only => [ :show, :edit,
+ :update, :destroy ]
+
+ # GET /peoples
+ # GET /peoples.xml
+ def index
+ @secondary_title = 'Browsing all Peoples'
+ @pages, @peoples = paginate :people, :per_page => 25, :order => 'title ASC',
+ :singular_name => 'people'
+ @tags = Page.tags(:limit => 25, :order => "name DESC",
+ :owner_type => 'People')
+ respond_to do |format|
+ format.html # index.rhtml
+ format.xml { render :xml => @people.to_xml }
+ end
+ end
+
+ # GET /peoples/1
+ # GET /peoples/1.xml
+ def show
+ @secondary_title = 'Detailed Information'
+ respond_to do |format|
+ format.html # show.rhtml
+ format.xml { render :xml => @people.to_xml }
+ end
+ end
+
+ # GET /peoples/new
+ def new
+ @secondary_title = 'Sign up for BarleySodas!'
+ @people = People.new
+ @page = Page.new
+ end
+
+ # GET /peoples/1;edit
+ def edit
+ end
+
+ # POST /peoples
+ # POST /peoples.xml
+ def create
+ @people = People.new(params[:people])
+ @page = Page.new(params[:page])
+ @people.page = @page
+ respond_to do |format|
+ if @people.save
+ flash[:notice] = 'People was successfully created.'
+ format.html { redirect_to people_url(@people.page.title_for_url) }
+ format.xml { head :created,
+ :location => people_url(@people.page.title_for_url) }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @people.errors.to_xml }
+ end
+ end
+ end
+
+ # PUT /peoples/1
+ # PUT /peoples/1.xml
+ def update
+ @people.attributes = params[:people]
+ @page.attributes = params[:page]
+ respond_to do |format|
+ if @people.update_attributes(params[:people])
+ flash[:notice] = 'People was successfully updated.'
+ format.html { redirect_to people_url(@people.page.title_for_url) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @people.errors.to_xml }
+ end
+ end
+ end
+
+ # DELETE /peoples/1
+ # DELETE /peoples/1.xml
+ def destroy
+ @people.destroy
+ respond_to do |format|
+ format.html { redirect_to peoples_url }
+ format.xml { head :ok }
+ end
+ end
+
+ protected
+
+ def fetch_people_and_page
+ @people = People.find_by_title(Page.title_from_url(params[:id]),
+ :include => [ 'page' ])
+ raise ActiveRecord::RecordNotFound.new if @people.nil?
+ @page = @people.page
+ end
+end
diff --git a/app/helpers/peoples_helper.rb b/app/helpers/peoples_helper.rb
new file mode 100644
index 0000000..574fe22
--- /dev/null
+++ b/app/helpers/peoples_helper.rb
@@ -0,0 +1,15 @@
+module PeoplesHelper
+ def new_people_link
+ link_to 'Sign Up!', new_people_path, { :title => 'Sign Up!' }
+ end
+
+ def show_people_link(people)
+ link_to people.title, people_path(people.page.title_for_url),
+ { :title => people.title }
+ end
+
+ def edit_people_link(people)
+ link_to 'Edit People', edit_people_path(people.page.title_for_url),
+ { :title => "Edit #{people.title}" }
+ end
+end
diff --git a/app/models/people.rb b/app/models/people.rb
new file mode 100644
index 0000000..cc1e6e8
--- /dev/null
+++ b/app/models/people.rb
@@ -0,0 +1,6 @@
+##
+# This model represents a user in the system.
+#
+class People < ActiveRecord::Base
+ has_one_tuxwiki_page :owner_class => 'People'
+end
diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml
index e7bd882..160031c 100644
--- a/app/views/layouts/application.rhtml
+++ b/app/views/layouts/application.rhtml
@@ -32,6 +32,7 @@
<%= link_to_unless_current 'Browse Beers', beers_path -%>
<%= link_to_unless_current 'Browse Breweries', breweries_path -%>
<%= link_to_unless_current 'Discussions', discussions_path -%>
+ <%= link_to_unless_current 'Peoples', peoples_path -%>
+ <%= submit_tag "Update" %> +
+<% end %> + +<%= link_to 'Show', people_path(@people) %> | +<%= link_to 'Back', peoples_path %> \ No newline at end of file diff --git a/app/views/peoples/index.rhtml b/app/views/peoples/index.rhtml new file mode 100644 index 0000000..d1c5b9f --- /dev/null +++ b/app/views/peoples/index.rhtml @@ -0,0 +1,14 @@ ++ <%= submit_tag "Create" %> +
+<% end %> + +<%= link_to 'Back', peoples_path %> \ No newline at end of file diff --git a/app/views/peoples/show.rhtml b/app/views/peoples/show.rhtml new file mode 100644 index 0000000..01a4ca2 --- /dev/null +++ b/app/views/peoples/show.rhtml @@ -0,0 +1,7 @@ +<%= render :partial => 'pages/page' %> + +<% content_for :sidebar do -%> + <%= new_people_link -%>