Permalink
Browse files

update in registrations

  • Loading branch information...
1 parent 0b7a3b4 commit cb15cb07d68bf4d8f9e896ed57181dcbcf06af3e progressbarsk committed Jul 26, 2011
@@ -11,7 +11,7 @@ class RegistrationsController < Admin::BaseController
before_filter :get_spam_count, :only => [:index, :spam, :approved, :rejected]
def index
- @registrations = @registrations.new
+ @registrations = @registrations.unmoderated
@registrations = @registrations.with_query(params[:search]) if searching?
@registrations = @registrations.paginate({:page => params[:page]})
end
@@ -1,20 +1,36 @@
class RegistrationMailer < ActionMailer::Base
def confirmation(registration, request)
- subject RegistrationSetting.confirmation_subject(Globalize.locale)
+ subject 'Progressbar Hackarspace - Thank You for registration'
recipients registration.email
from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
- reply_to RegistrationSetting.notification_recipients.split(',').first
sent_on Time.now
- @registration = registration
+ @registration = registration
+ end
+
+ def approved_confirmation(registration, user, request)
+ subject 'Progressbar Hackarspace - Your registration was approved! :-)'
+ recipients registration.email
+ from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
+ sent_on Time.now
+ @user = user
+ @registration = registration
+ end
+
+ def rejected_confirmation(registration, request)
+ subject 'Progressbar Hackarspace - Your registration was rejected.'
+ recipients registration.email
+ from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
+ sent_on Time.now
+ @registration = registration
end
def notification(registration, request)
- subject RegistrationSetting.notification_subject
- recipients RegistrationSetting.notification_recipients
+ subject 'New registration'
+ recipients RefinerySetting.find_or_set(:registration_notification_recipients, 'keraml@gmail.com')
from "\"#{RefinerySetting[:site_name]}\" <no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}>"
sent_on Time.now
- @registration = registration
+ @registration = registration
end
end
@@ -5,15 +5,14 @@ class Registration < ActiveRecord::Base
validates :username, :presence => true, :length => { :in => 6..20 }
validates :email, :presence => true, :uniqueness => true, :length => { :in => 6..42 }
validates :personal_info, :presence => true, :length => { :in => 6..250 }
- validates :state, :presence => true, :format => { :with => /new|approved|rejected/ }
+ validates :state, :presence => true, :format => { :with => /unmoderated|approved|rejected/ }
filters_spam :message_field => :personal_info,
:email_field => :email,
:author_field => :username,
:extra_spam_words => %w()
-
- scope :new, :conditions => {:state => 'new'}
+ scope :unmoderated, :conditions => {:state => 'unmoderated'}
scope :approved, :conditions => {:state => 'approved'}
scope :rejected, :conditions => {:state => 'rejected'}
@@ -33,8 +32,8 @@ def approved?
self.state == 'approved'
end
- def new?
- self.state == 'new'
+ def unmoderated?
+ self.state == 'unmoderated'
end
def self.latest(number = 7, include_spam = false)
@@ -0,0 +1,22 @@
+<% content_for :body_content_left do %>
+ <section>
+ <h1 style="text-align: left;">Username</h1>
+ <p>
+ <%=raw @registration.username %>
+ </p>
+ </section>
+ <section>
+ <h1 style="text-align: left;">Email</h1>
+ <p>
+ <%=raw @registration.email %>
+ </p>
+ </section>
+ <section>
+ <h1 style="text-align: left;">Personal Info</h1>
+ <p>
+ <%=raw @registration.personal_info %>
+ </p>
+ </section>
+<% end %>
+
+<%= render :partial => "/shared/content_page" %>
@@ -1,45 +0,0 @@
-<% content_for :body_content_title do %>
- <%= @registration.username %>
-<% end %>
-
-<% content_for :body_content_left do %>
- <section>
- <h1>Username</h1>
- <p>
- <%=raw @registration.username %>
- </p>
- </section>
- <section>
- <h1>Email</h1>
- <p>
- <%=raw @registration.email %>
- </p>
- </section>
- <section>
- <h1>Personal Info</h1>
- <p>
- <%=raw @registration.personal_info %>
- </p>
- </section>
- <section>
- <h1>State</h1>
- <p>
- <%=raw @registration.state %>
- </p>
- </section>
-<% end %>
-
-<% content_for :body_content_right do %>
- <aside>
- <h2><%= t('.other') %></h2>
- <ul id="registrations">
- <% @registrations.each do |registration| %>
- <li>
- <%= link_to registration.username, registration_path(registration) %>
- </li>
- <% end %>
- </ul>
- </aside>
-<% end %>
-
-<%= render :partial => "/shared/content_page" %>
@@ -8,7 +8,7 @@ def self.up
t.string :username, :null => false
t.string :email, :null => false
t.text :personal_info, :null => false
- t.string :state, :null => false, :default => 'new'
+ t.string :state, :null => false, :default => 'unmoderated'
t.integer :position
t.boolean :spam, :default => false

0 comments on commit cb15cb0

Please sign in to comment.