aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/index_controller.rb19
-rw-r--r--app/controllers/list_controller.rb16
-rw-r--r--app/controllers/new_controller.rb51
-rw-r--r--app/controllers/request_controller.rb45
-rw-r--r--app/views/body/show.rhtml2
-rw-r--r--app/views/layouts/default.rhtml4
-rw-r--r--app/views/user/index.rhtml2
7 files changed, 47 insertions, 92 deletions
diff --git a/app/controllers/index_controller.rb b/app/controllers/index_controller.rb
deleted file mode 100644
index e15e72fdd..000000000
--- a/app/controllers/index_controller.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# controllers/index_controller.rb:
-# Main page of site.
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: index_controller.rb,v 1.2 2007-10-09 17:29:43 francis Exp $
-
-class IndexController < ApplicationController
- def index
- respond_to do |format|
- format.html
- end
- end
-
- private
-
-end
-
diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb
deleted file mode 100644
index 0bd336573..000000000
--- a/app/controllers/list_controller.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# app/controllers/list_controller.rb:
-# Show all of the FOI requests in the system.
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: list_controller.rb,v 1.3 2007-10-09 17:29:43 francis Exp $
-
-class ListController < ApplicationController
- def index
- @info_request_pages, @info_requests = paginate :info_requests, :per_page => 25, :order => "created_at desc"
- end
-
- private
-
-end
diff --git a/app/controllers/new_controller.rb b/app/controllers/new_controller.rb
deleted file mode 100644
index 1da6f1398..000000000
--- a/app/controllers/new_controller.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# app/controllers/new_controller.rb:
-# Interface for building a new FOI request.
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: new_controller.rb,v 1.4 2007-10-10 16:06:17 francis Exp $
-
-class NewController < ApplicationController
- def index
- # render index.rhtml template
- end
-
- def create
- # Create both FOI request and the first request message
- @info_request = InfoRequest.new(params[:info_request])
- @outgoing_message = OutgoingMessage.new(params[:outgoing_message].merge({
- :status => 'ready',
- :message_type => 'initial_request'
- }))
- @info_request.outgoing_messages << @outgoing_message
- @outgoing_message.info_request = @info_request
-
- # This automatically saves dependent objects, such as @info_request, in the same transaction
- if not @info_request.valid?
- render :action => 'index'
- elsif authenticated?
- @info_request.user = authenticated_user
- @info_request.save
- flash[:notice] = "Your Freedom of Information request has been created."
- redirect_to :controller => 'request', :id => @info_request
- end
-
- # Save both models
-# valid = @info_request.valid?
-# valid &&= @outgoing_message.valid? # XXX maybe there is a nicer way of preventing lazy boolean evaluation than this
-# if valid
-# if authenticated?
-# @info_request.save!
-# @outgoing_message.save!
-# end
-# else
-# render :action => 'index'
-# end
- end
-
- private
-
-end
-
-
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index e860d43ef..3b278d728 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -4,13 +4,54 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_controller.rb,v 1.2 2007-10-09 17:29:43 francis Exp $
+# $Id: request_controller.rb,v 1.3 2007-10-15 22:26:37 louise Exp $
class RequestController < ApplicationController
- def index
+
+ def show
@info_request = InfoRequest.find(params[:id])
end
+ def list
+ @info_request_pages, @info_requests = paginate :info_requests, :per_page => 25, :order => "created_at desc"
+ end
+
+ def frontpage
+ end
+
+ def create
+ # Create both FOI request and the first request message
+ @info_request = InfoRequest.new(params[:info_request])
+ @outgoing_message = OutgoingMessage.new(params[:outgoing_message].merge({
+ :status => 'ready',
+ :message_type => 'initial_request'
+ }))
+ @info_request.outgoing_messages << @outgoing_message
+ @outgoing_message.info_request = @info_request
+
+ # This automatically saves dependent objects, such as @info_request, in the same transaction
+ if not @info_request.valid?
+ render :action => 'new'
+ elsif authenticated?
+ @info_request.user = authenticated_user
+ @info_request.save
+ flash[:notice] = "Your Freedom of Information request has been created."
+ redirect_to :controller => 'request', :action => "show", :id => @info_request
+ end
+
+ # Save both models
+# valid = @info_request.valid?
+# valid &&= @outgoing_message.valid? # XXX maybe there is a nicer way of preventing lazy boolean evaluation than this
+# if valid
+# if authenticated?
+# @info_request.save!
+# @outgoing_message.save!
+# end
+# else
+# render :action => 'index'
+# end
+ end
+
private
end
diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml
index f454a8b4d..2519a9362 100644
--- a/app/views/body/show.rhtml
+++ b/app/views/body/show.rhtml
@@ -5,7 +5,7 @@
<p>Freedom of Information requests made to this body:</p>
<ul>
<% for info_request in @public_body.info_requests %>
-<li><%= link_to h(info_request.title), :controller => 'request', :action => 'index', :id => info_request %></li>
+<li><%= link_to h(info_request.title), :controller => 'request', :action => 'show', :id => info_request %></li>
<% end %>
</ul>
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 1153ce602..fe519a4ad 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -23,9 +23,9 @@
<% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>
<div id="logged_in_bar">
<% if @user %>
- Hello, <%=h(@user.name)%>! (<%= link_to "Logout", :action => 'signout', :r => request.request_uri %>)
+ Hello, <%=h(@user.name)%>! (<%= link_to "Logout", :controller => 'user', :action => 'signout', :r => request.request_uri %>)
<% else %>
- Hello! (<%= link_to "Login or register", { :action => 'signin', :r => request.request_uri } %>)
+ Hello! (<%= link_to "Login or register", { :controller => 'user', :action => 'signin', :r => request.request_uri } %>)
<% end %>
</div>
<% end %>
diff --git a/app/views/user/index.rhtml b/app/views/user/index.rhtml
index 535eab8d9..fe314a07e 100644
--- a/app/views/user/index.rhtml
+++ b/app/views/user/index.rhtml
@@ -11,7 +11,7 @@
<p>Freedom of Information requests made by this person:</p>
<ul>
<% for info_request in display_user.info_requests %>
- <li><%= link_to h(info_request.title), :controller => 'request', :action => 'index', :id => info_request %></li>
+ <li><%= link_to h(info_request.title), :controller => 'request', :action => 'show', :id => info_request %></li>
<% end %>
</ul>
<% end %>