diff --git a/app/controllers/application.rb b/app/controllers/application.rb index ce9283a..854ac72 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -92,15 +92,9 @@ class ApplicationController < ActionController::Base ] cond_var = { :model_title => tfu, - :help_owner_type => 'Help' } - # specific overrides for help, this has an owner type but it is just a Page - if obj_type == 'help' - cond_ary << 'owner_type = :help_owner_type' - obj_type = 'pages' - elsif obj_type == 'pages' - cond_ary << 'owner_type IS NULL' - end + cond_ary << 'owner_type IS NULL' if obj_type == 'pages' + # the eventual name of the instance variable, like +@page+ obj_name = obj_type.singularize diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb deleted file mode 100644 index c456904..0000000 --- a/app/controllers/help_controller.rb +++ /dev/null @@ -1,98 +0,0 @@ -class HelpController < ApplicationController - append_before_filter :fetch_model, - :only => [ :show, :edit, :update, :destroy ] - - # GET /help - # GET /help.xml - def index - @page = Page.find_by_title_and_owner_type 'HomePage', 'Help' - @content_title = 'BarleySodas Help' - @secondary_title = '' - @tags = Page.tags(:limit => 25, :order => 'name DESC', - :owner_type => 'Help') - end - - # GET /help/1 - # GET /help/1.xml - def show - @secondary_title = '' - respond_to do |format| - format.html # show.rhtml - format.xml { render :xml => @page.to_xml } - end - end - - # GET /help/new - def new - @page = Page.new - @page.title = params[:new_title] if params[:new_title] - @secondary_title = 'Creating help page' - end - - # GET /help/1;edit - def edit - @secondary_title = 'Updating help page' - end - - # POST /help - # POST /help.xml - def create - @page = Page.new(params[:page]) - @page.owner_type = 'Help' - respond_to do |format| - if @page.save - flash[:notice] = 'Help was successfully created.' - format.html { - if @page.title == 'HomePage' - redirect_to :controller => 'help', :action => 'index' - else - redirect_to help_url({ :id => @page.title_for_url }) - end - } - format.xml { head :created, - :location => help_url({ :id => @page.title_for_url }) } - else - format.html { - @secondary_title = 'Creating help page' - render :action => "new" - } - format.xml { render :xml => @page.errors.to_xml } - end - end - end - - # PUT /help/1 - # PUT /help/1.xml - def update - @page.attributes = params[:page] - respond_to do |format| - if @page.save - flash[:notice] = 'Help was successfully updated.' - format.html { - if @page.title == 'HomePage' - redirect_to :controller => 'help', :action => 'index' - else - redirect_to help_url({ :id => @page.title_for_url }) - end - } - format.xml { head :ok } - else - format.html { - @secondary_title = 'Updating help page' - render :action => "edit" - } - format.xml { render :xml => @page.errors.to_xml, :status => 400 } - end - end - end - - # DELETE /help/1 - # DELETE /help/1.xml - def destroy - @page.destroy - respond_to do |format| - format.html { redirect_to :controller => 'help', :action => 'index' } - format.xml { head :ok } - end - end -end diff --git a/app/helpers/help_helper.rb b/app/helpers/help_helper.rb deleted file mode 100644 index ba75291..0000000 --- a/app/helpers/help_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -module HelpHelper - def show_help_link(page, better_title = 'Show') - link_to better_title, help_path({ :id => page.title_for_url }), - { :title => page.title } - end - - def edit_help_link(page) - link_to 'Edit Help Page', edit_help_path({ :id => page.title_for_url }), - { :title => "Edit Help Page #{page.title}" } - end -end diff --git a/app/views/help/edit.rhtml b/app/views/help/edit.rhtml deleted file mode 100644 index c02a020..0000000 --- a/app/views/help/edit.rhtml +++ /dev/null @@ -1,12 +0,0 @@ -<%= error_messages_for :page %> - -<% form_for(:help, :url => help_path({ :id => @page.title_for_url }), :html => { :method => :put }) do |f| %> - <%= render :partial => 'pages/page_form' %> -
- <%= submit_tag "Update" %> -
-<% end %> - -<% content_for :sidebar do -%> - <%= show_help_link(@page) unless @page.title == 'HomePage' -%>- <%= text_field 'page', 'title' %> -
- <%= render :partial => 'pages/page_form' %> -- <%= submit_tag "Create" %> -
-<% end %> \ No newline at end of file diff --git a/app/views/help/show.rhtml b/app/views/help/show.rhtml deleted file mode 100644 index 7064640..0000000 --- a/app/views/help/show.rhtml +++ /dev/null @@ -1,6 +0,0 @@ -<%= render :partial => 'pages/page' %> - -<% content_for :sidebar do -%> - <%= edit_help_link(@page) -%>