Permalink
Browse files

updates

  • Loading branch information...
1 parent 69f0aac commit 48db602219273291f9d598872ebdd8f204bcea43 @timothyf timothyf committed Jun 19, 2010
View
1 app/controllers/activities_controller.rb
@@ -29,6 +29,7 @@ def index
format.html # index.html.erb
format.xml { render :xml => @activities }
format.rss { render :layout => false }
+ format.json { render :json => @activities }
end
end
View
6 app/controllers/admin_controller.rb
@@ -471,8 +471,8 @@ def network_description
def privacy_edit
- if HtmlContent.find_by_content_id('privacy')
- @privacy = HtmlContent.find_by_content_id('privacy')
+ if HtmlContent.find_by_title('privacy')
+ @privacy = HtmlContent.find_by_title('privacy')
else
@privacy = HtmlContent.new
end
@@ -486,7 +486,7 @@ def save_privacy
else
privacy = HtmlContent.new
privacy.body = params[:privacy_text]
- privacy.content_id = 'privacy'
+ privacy.title = 'privacy'
privacy.save
end
redirect_to :action => 'settings'
View
1 app/controllers/attendances_controller.rb
@@ -58,6 +58,7 @@ def destroy
respond_to do |format|
format.html { redirect_to event_path(event.id) }
format.xml { head :ok }
+ format.json { head :ok }
end
end
View
7 app/controllers/bug_reports_controller.rb
@@ -27,6 +27,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @bug_reports }
+ format.json { render :json => @bug_reports }
end
end
@@ -36,6 +37,7 @@ def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @bug_report }
+ format.json { render :json => @bug_report }
end
end
@@ -60,9 +62,11 @@ def create
flash[:notice] = 'BugReport was successfully created.'
format.html { redirect_to(bug_reports_url) }
format.xml { render :xml => @bug_report, :status => :created, :location => @bug_report }
+ format.json { render :json => @bug_report, :status => :created, :location => @bug_report }
else
format.html { render :action => "new" }
format.xml { render :xml => @bug_report.errors, :status => :unprocessable_entity }
+ format.json { render :json => @bug_report.errors, :status => :unprocessable_entity }
end
end
end
@@ -75,9 +79,11 @@ def update
flash[:notice] = 'BugReport was successfully updated.'
format.html { redirect_to(@bug_report) }
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @bug_report.errors, :status => :unprocessable_entity }
+ format.json { render :json => @bug_report.errors, :status => :unprocessable_entity }
end
end
end
@@ -89,6 +95,7 @@ def destroy
respond_to do |format|
format.html { redirect_to(bug_reports_url) }
format.xml { head :ok }
+ format.json { head :ok }
end
end
end
View
7 app/controllers/classifieds_controller.rb
@@ -22,6 +22,7 @@ def index
respond_to do |format|
format.html { render :template=>'classifieds/classifieds_list' }
format.xml { render :xml => @classifieds }
+ format.json { render :json => @classifieds }
end
end
@@ -31,6 +32,7 @@ def show
respond_to do |format|
format.html { render :template=>'classifieds/classifieds_show' }
format.xml { render :xml => @classified }
+ format.json { render :json => @classified }
end
end
@@ -53,9 +55,11 @@ def create
flash[:notice] = 'Classified was successfully created.'
format.html { redirect_to(classifieds_path) }
format.xml { render :xml => @classified, :status => :created, :location => @classified }
+ format.json { render :json => @classified, :status => :created, :location => @classified }
else
format.html { render :action => "new" }
format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }
+ format.json { render :json => @classified.errors, :status => :unprocessable_entity }
end
end
end
@@ -68,9 +72,11 @@ def update
flash[:notice] = 'Classified was successfully updated.'
format.html { redirect_to(@classified) }
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }
+ format.json { render :json => @classified.errors, :status => :unprocessable_entity }
end
end
end
@@ -82,6 +88,7 @@ def destroy
respond_to do |format|
format.html { redirect_to(classifieds_url) }
format.xml { head :ok }
+ format.json { head :ok }
end
end
end
View
10 app/controllers/html_contents_controller.rb
@@ -22,16 +22,13 @@ def index
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @html_contents }
+ format.json { render :json => @html_contents }
end
end
def new
@html_content = HtmlContent.new
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @html_content }
- end
end
@@ -53,9 +50,11 @@ def create
end
}
format.xml { render :xml => @html_content, :status => :created, :location => @html_content }
+ format.json { render :json => @html_content, :status => :created, :location => @html_content }
else
format.html { render :action => "new" }
format.xml { render :xml => @html_content.errors, :status => :unprocessable_entity }
+ format.json { render :json => @html_content.errors, :status => :unprocessable_entity }
end
end
end
@@ -74,9 +73,11 @@ def update
end
}
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @html_content.errors, :status => :unprocessable_entity }
+ format.json { render :json => @html_content.errors, :status => :unprocessable_entity }
end
end
end
@@ -88,6 +89,7 @@ def destroy
respond_to do |format|
format.html { redirect_to(html_contents_url) }
format.xml { head :ok }
+ format.json { head :ok }
end
end
end
View
7 app/controllers/photo_albums_controller.rb
@@ -23,6 +23,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @photo_albums }
+ format.json { render :json => @photo_albums }
end
end
@@ -33,6 +34,7 @@ def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @photo_album }
+ format.json { render :json => @photo_album }
end
end
@@ -55,9 +57,11 @@ def create
flash[:notice] = 'PhotoAlbum was successfully created.'
format.html { redirect_to(@photo_album) }
format.xml { render :xml => @photo_album, :status => :created, :location => @photo_album }
+ format.json { render :json => @photo_album, :status => :created, :location => @photo_album }
else
format.html { render :action => "new" }
format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }
+ format.json { render :json => @photo_album.errors, :status => :unprocessable_entity }
end
end
end
@@ -70,9 +74,11 @@ def update
flash[:notice] = 'PhotoAlbum was successfully updated.'
format.html { redirect_to(@photo_album) }
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }
+ format.json { render :json => @photo_album.errors, :status => :unprocessable_entity }
end
end
end
@@ -84,6 +90,7 @@ def destroy
respond_to do |format|
format.html { redirect_to(photo_albums_url) }
format.xml { head :ok }
+ format.json { head :ok }
end
end
View
5 app/controllers/replies_controller.rb
@@ -31,9 +31,11 @@ def create
flash[:notice] = 'Reply was successfully created.'
format.html { redirect_to(@reply) }
format.xml { render :xml => @reply, :status => :created, :location => @reply }
+ format.json { render :json => @reply, :status => :created, :location => @reply }
else
format.html { render :action => "new" }
format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }
+ format.json { render :json => @reply.errors, :status => :unprocessable_entity }
end
end
end
@@ -46,9 +48,11 @@ def update
flash[:notice] = 'Reply was successfully updated.'
format.html { redirect_to(@reply) }
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @reply.errors, :status => :unprocessable_entity }
+ format.json { render :json => @reply.errors, :status => :unprocessable_entity }
end
end
end
@@ -60,6 +64,7 @@ def destroy
respond_to do |format|
format.html { redirect_to(replies_url) }
format.xml { head :ok }
+ format.json { head :ok }
end
end
View
3 app/controllers/wall_posts_controller.rb
@@ -60,9 +60,11 @@ def update
flash[:notice] = 'WallPost was successfully updated.'
format.html { redirect_to(@wall_post) }
format.xml { head :ok }
+ format.json { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @wall_post.errors, :status => :unprocessable_entity }
+ format.json { render :json => @wall_post.errors, :status => :unprocessable_entity }
end
end
end
@@ -75,6 +77,7 @@ def destroy
respond_to do |format|
format.html { render :partial => 'shared/wall_posts', :locals=>{:parent=>@parent}, :layout=>false }
format.xml { head :ok }
+ format.json { head :ok }
end
end
View
34 app/models/user_mailer.rb
@@ -14,27 +14,35 @@
class UserMailer < ActionMailer::Base
+ def initialize
+ @network = Network.find(:first)
+ @url = @network.url
+ @network_name = @network.name
+ @admin_email = @network.admin_email
+ end
+
+
# Send the activation code to users who sign up
def signup_notification(user)
setup_email(user)
@subject += 'Please activate your new account'
- @body[:url] = "http://www.rubymi.org/activate/#{user.activation_code}"
+ @body[:url] = "#{@url}/activate/#{user.activation_code}"
end
# Send a new user signup notification to the site admins
def new_user_signup(user)
setup_admin_email(user)
@subject += 'New User Signup'
- @body[:url] = "http://www.rubymi.org"
+ @body[:url] = "#{@url}"
end
# Send a new user activated notification to the site admins
def new_user_activated(user)
setup_admin_email(user)
@subject += 'New User Activated'
- @body[:url] = "http://www.rubymi.org"
+ @body[:url] = "#{@url}"
end
@@ -59,7 +67,7 @@ def announcement_notification(announcement)
def wall_post_notification(wall_post)
setup_email(wall_post.user)
@subject += 'Wall Post Notification'
- @body[:url] = "http://www.rubymi.org"
+ @body[:url] = "#{@url}"
@content_type = "text/html"
end
@@ -69,7 +77,7 @@ def message_notification(message)
setup_email(message.recipient)
@subject += 'Message Notification'
@body[:message] = message
- @body[:url] = "http://www.rubymi.org"
+ @body[:url] = "#{@url}"
@content_type = "text/html"
end
@@ -78,7 +86,7 @@ def message_notification(message)
def invite_notification(invite)
@recipients = "#{invite.email}"
@from = "#{invite.user.email}"
- @subject = "An Invitation to Join RubyMI "
+ @subject = "An Invitation to Join #{@network_name} "
@sent_on = Time.now
@body[:invite] = invite
@content_type = "text/html"
@@ -88,16 +96,16 @@ def invite_notification(invite)
def activation(user)
setup_email(user)
@subject += 'Your account has been activated!'
- @body[:url] = "http://www.rubymi.org/"
+ @body[:url] = "#{@url}"
end
protected
# Setup an email that will be sent to a single user
def setup_email(user)
@recipients = "#{user.email}"
- @from = "admin@rubymi.org"
- @subject = "[RubyMI] "
+ @from = "#{@admin_email}"
+ @subject = "[#{@network_name}] "
@sent_on = Time.now
@body[:user] = user
end
@@ -107,8 +115,8 @@ def setup_email(user)
def setup_admin_email(user)
emails = User.admins_and_creators.collect { |p| p.email }
@recipients = emails.join(',')
- @from = "admin@rubymi.org"
- @subject = "[RubyMI] "
+ @from = "#{@admin_email}"
+ @subject = "[#{@network_name}] "
@sent_on = Time.now
@body[:user] = user
end
@@ -118,8 +126,8 @@ def setup_admin_email(user)
def setup_all_user_email
emails = User.find(:all).collect { |p| p.email }
@recipients = emails.join(',')
- @from = "admin@rubymi.org"
- @subject = "[RubyMI] "
+ @from = "#{@admin_email}"
+ @subject = "[#{@network_name}] "
@sent_on = Time.now
end
View
11 db/migrate/20100618150950_modify_network.rb
@@ -0,0 +1,11 @@
+class ModifyNetwork < ActiveRecord::Migration
+ def self.up
+ add_column :networks, :url, :string
+ add_column :networks, :admin_email, :string
+ end
+
+ def self.down
+ remove_column :networks, :url
+ remove_column :networks, :admin_email
+ end
+end
View
2 lib/tasks/cms_site_init.rake
@@ -17,6 +17,8 @@ namespace :enginey do
network = Network.create(:name => NETWORK_NAME,
:organization => 'EngineY',
:website => 'http://www.enginey.com',
+ :url => 'http://www.enginey.com',
+ :admin_email => 'admin@rubymi.org',
:description => 'The homepage for the EngineY framework.')
View
2 lib/tasks/engineycom_populate.rake
@@ -18,6 +18,8 @@ namespace :railsnet do
network = Network.create(:name => NETWORK_NAME,
:organization => 'EngineY',
:website => 'http://www.enginey.com',
+ :url => 'http://www.enginey.com',
+ :admin_email => 'admin@rubymi.org',
:description => 'The homepage for the EngineY framework.')
View
2 lib/tasks/personal_blog_populate.rake
@@ -18,6 +18,8 @@ namespace :enginey do
network = Network.create(:name => BLOG_NAME,
:organization => 'Ruby Enthusiasts of Michigan',
:website => 'http://www.rubymi.org',
+ :url => 'http://www.rubymi.org',
+ :admin_email => 'admin@rubymi.org',
:description => 'Welcome to the Ruby Enthusiasts of Michigan website. This site serves as a hub for all of the Ruby related activities and events that happen in and around Michigan.')
View
2 lib/tasks/ruby_mi_populate.rake
@@ -22,6 +22,8 @@ namespace :enginey do
network = Network.create(:name => NETWORK_NAME,
:organization => 'Ruby Enthusiasts of Michigan',
:website => 'http://www.rubymi.org',
+ :url => 'http://www.rubymi.org',
+ :admin_email => 'admin@rubymi.org',
:description => 'Welcome to the Ruby Enthusiasts of Michigan website. This site serves as a hub for all of the Ruby related activities and events that happen in and around Michigan.')

0 comments on commit 48db602

Please sign in to comment.