Browse files

Generated a subscribers_controller. The "Subscribers" tab in Radiant …

…admin now routes to this controller.
  • Loading branch information...
1 parent 378fd1c commit cb1ac6e381299dc229ddfd9b83d3b3d47b4cc39a @nelstrom committed Jun 15, 2008
View
8 app/controllers/subscribers_controller.rb
@@ -0,0 +1,8 @@
+class SubscribersController < ApplicationController
+
+
+ def index
+ @hello = "World"
+ end
+
+end
View
2 app/helpers/subscribers_helper.rb
@@ -0,0 +1,2 @@
+module SubscribersHelper
+end
View
1 app/models/subscriber_list_page.rb
@@ -36,7 +36,6 @@ def process(request, response)
end
elsif @subscriber_list_action == 'unsubscribe'
- # todo: process unsubscription
if @subscriber = Subscriber.find_active_subscriber_by_subscriber_list_and_email(self,
request.parameters[:subscriber][:email])
@subscriber.update_attributes({:unsubscribed_at => Time.now()})
View
3 app/views/subscribers/index.html.erb
@@ -0,0 +1,3 @@
+<h1>Subscribers</h1>
+
+Hello <%= @hello %>
View
10 spec/controllers/subscribers_controller_spec.rb
@@ -0,0 +1,10 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe SubscribersController do
+
+ #Delete this example and add some real ones
+ it "should use SubscribersController" do
+ controller.should be_an_instance_of(SubscribersController)
+ end
+
+end
View
11 spec/helpers/subscribers_helper_spec.rb
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe SubscribersHelper do
+
+ #Delete this example and add some real ones or delete this file
+ it "should include the SubscribersHelper" do
+ included_modules = self.metaclass.send :included_modules
+ included_modules.should include(SubscribersHelper)
+ end
+
+end
View
8 subscriber_lists_extension.rb
@@ -6,13 +6,13 @@ class SubscriberListsExtension < Radiant::Extension
description "Allows you to create one or more lists to which your site's visitors may subscribe, by submitting their email address."
url "http://github.com/nelstrom/radiant-subscriber-lists-extension/tree/master"
- # define_routes do |map|
- # map.connect 'admin/subscriber_lists/:action', :controller => 'admin/subscriber_lists'
- # end
+ define_routes do |map|
+ map.connect 'admin/subscribers/:action', :controller => 'subscribers'
+ end
def activate
SubscriberListPage
- admin.tabs.add "Subscribers", "/admin/subscriber_lists", :after => "Layouts", :visibility => [:all]
+ admin.tabs.add "Subscribers", "/admin/subscribers", :after => "Layouts", :visibility => [:all]
end
def deactivate

0 comments on commit cb1ac6e

Please sign in to comment.