Skip to content

Commit

Permalink
enable flash[:notice] drawing in application.rhtml
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Mikhaylov committed Jul 10, 2008
1 parent 5e0b8a6 commit a2a2374
Show file tree
Hide file tree
Showing 6 changed files with 3,311 additions and 30 deletions.
26 changes: 9 additions & 17 deletions app/controllers/subscribers_controller.rb
Expand Up @@ -5,11 +5,6 @@ class SubscribersController < ApplicationController
def new
@subscriber = Subscriber.new
@subscriber.referrer = request.referer

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @subscriber }
end
end

# POST /subscribers
Expand All @@ -19,18 +14,15 @@ def create

@subscriber.ip = request.remote_ip
@subscriber.user_agent = request.user_agent

#respond_to do |format|
if @subscriber.save
flash[:notice] = 'Subscriber was successfully created.'
#redirect_to ( :action => 'new')
#format.html { redirect_to(@subscriber) }
#format.xml { render :xml => @subscriber, :status => :created, :location => @subscriber }
else
#flash[:notice] = 'error'
render( :action => 'new' )
end
#end

if @subscriber.save
flash[:notice] = 'thank you'
redirect_to (:action => 'new')
else
flash[:notice] = 'error'
render(:action => 'new')
end

end

end
3 changes: 3 additions & 0 deletions app/views/layouts/application.html.erb
Expand Up @@ -12,6 +12,9 @@
<title> Test </title>
</head>
<body>
<% unless flash[:notice].blank? %>
<div id="notification"> <%= flash[:notice] %> </div>
<% end %>
<div class="header">
<%= editable_area('header') %>
</div>
Expand Down
5 changes: 3 additions & 2 deletions app/views/subscribers/new.html.erb
@@ -1,5 +1,6 @@
<h1>New subscriber</h1>
<h1>Welcome to our site</h1>

<h2> </h2>
<% form_for(@subscriber) do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :referrer, :value => @subscriber.referrer %>
Expand All @@ -8,7 +9,7 @@
E-mail: <%= f.text_field :email %>
</p>
<p>
<%= f.submit "Create" %>
<%= f.submit "Ok" %>
</p>
<% end %>

11 changes: 0 additions & 11 deletions config/environment.rb
Expand Up @@ -67,16 +67,5 @@
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector

config.action_mailer.delivery_method = :test


config.action_mailer.smtp_settings = {
:address => "domain.of.smtp.host.net" ,
:port => 25,
:domain => "domain.of.sender.net" ,
:authentication => :login,
:user_name => "dave" ,
:password => "secret"
}

end
Binary file modified db/development.sqlite3
Binary file not shown.

0 comments on commit a2a2374

Please sign in to comment.