Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

updates

  • Loading branch information...
commit 48db602219273291f9d598872ebdd8f204bcea43 1 parent 69f0aac
Timothy Fisher authored June 19, 2010
1  app/controllers/activities_controller.rb
@@ -29,6 +29,7 @@ def index
29 29
       format.html # index.html.erb
30 30
       format.xml  { render :xml => @activities }
31 31
       format.rss { render :layout => false }
  32
+      format.json { render :json => @activities }
32 33
     end
33 34
   end
34 35
   
6  app/controllers/admin_controller.rb
@@ -471,8 +471,8 @@ def network_description
471 471
   
472 472
   
473 473
   def privacy_edit
474  
-    if HtmlContent.find_by_content_id('privacy')
475  
-      @privacy = HtmlContent.find_by_content_id('privacy')
  474
+    if HtmlContent.find_by_title('privacy')
  475
+      @privacy = HtmlContent.find_by_title('privacy')
476 476
     else
477 477
       @privacy = HtmlContent.new
478 478
     end
@@ -486,7 +486,7 @@ def save_privacy
486 486
     else
487 487
       privacy = HtmlContent.new
488 488
       privacy.body = params[:privacy_text]
489  
-      privacy.content_id = 'privacy'
  489
+      privacy.title = 'privacy'
490 490
       privacy.save
491 491
     end    
492 492
     redirect_to :action => 'settings' 
1  app/controllers/attendances_controller.rb
@@ -58,6 +58,7 @@ def destroy
58 58
     respond_to do |format|
59 59
       format.html { redirect_to event_path(event.id) }
60 60
       format.xml  { head :ok }
  61
+      format.json { head :ok }
61 62
     end
62 63
   end
63 64
   
7  app/controllers/bug_reports_controller.rb
@@ -27,6 +27,7 @@ def index
27 27
     respond_to do |format|
28 28
       format.html # index.html.erb
29 29
       format.xml  { render :xml => @bug_reports }
  30
+      format.json  { render :json => @bug_reports }
30 31
     end
31 32
   end
32 33
 
@@ -36,6 +37,7 @@ def show
36 37
     respond_to do |format|
37 38
       format.html # show.html.erb
38 39
       format.xml  { render :xml => @bug_report }
  40
+      format.json  { render :json => @bug_report }
39 41
     end
40 42
   end
41 43
 
@@ -60,9 +62,11 @@ def create
60 62
         flash[:notice] = 'BugReport was successfully created.'
61 63
         format.html { redirect_to(bug_reports_url) }
62 64
         format.xml  { render :xml => @bug_report, :status => :created, :location => @bug_report }
  65
+        format.json  { render :json => @bug_report, :status => :created, :location => @bug_report }
63 66
       else
64 67
         format.html { render :action => "new" }
65 68
         format.xml  { render :xml => @bug_report.errors, :status => :unprocessable_entity }
  69
+        format.json  { render :json => @bug_report.errors, :status => :unprocessable_entity }
66 70
       end
67 71
     end
68 72
   end
@@ -75,9 +79,11 @@ def update
75 79
         flash[:notice] = 'BugReport was successfully updated.'
76 80
         format.html { redirect_to(@bug_report) }
77 81
         format.xml  { head :ok }
  82
+        format.json { head :ok }
78 83
       else
79 84
         format.html { render :action => "edit" }
80 85
         format.xml  { render :xml => @bug_report.errors, :status => :unprocessable_entity }
  86
+        format.json  { render :json => @bug_report.errors, :status => :unprocessable_entity }
81 87
       end
82 88
     end
83 89
   end
@@ -89,6 +95,7 @@ def destroy
89 95
     respond_to do |format|
90 96
       format.html { redirect_to(bug_reports_url) }
91 97
       format.xml  { head :ok }
  98
+      format.json { head :ok }
92 99
     end
93 100
   end
94 101
 end
7  app/controllers/classifieds_controller.rb
@@ -22,6 +22,7 @@ def index
22 22
     respond_to do |format|
23 23
       format.html { render :template=>'classifieds/classifieds_list' } 
24 24
       format.xml  { render :xml => @classifieds }
  25
+      format.json { render :json => @classifieds }
25 26
     end
26 27
   end
27 28
 
@@ -31,6 +32,7 @@ def show
31 32
     respond_to do |format|
32 33
       format.html { render :template=>'classifieds/classifieds_show' } 
33 34
       format.xml  { render :xml => @classified }
  35
+      format.json  { render :json => @classified }
34 36
     end
35 37
   end
36 38
 
@@ -53,9 +55,11 @@ def create
53 55
         flash[:notice] = 'Classified was successfully created.'
54 56
         format.html { redirect_to(classifieds_path) }
55 57
         format.xml  { render :xml => @classified, :status => :created, :location => @classified }
  58
+        format.json  { render :json => @classified, :status => :created, :location => @classified }
56 59
       else
57 60
         format.html { render :action => "new" }
58 61
         format.xml  { render :xml => @classified.errors, :status => :unprocessable_entity }
  62
+        format.json  { render :json => @classified.errors, :status => :unprocessable_entity }
59 63
       end
60 64
     end
61 65
   end
@@ -68,9 +72,11 @@ def update
68 72
         flash[:notice] = 'Classified was successfully updated.'
69 73
         format.html { redirect_to(@classified) }
70 74
         format.xml  { head :ok }
  75
+        format.json { head :ok }
71 76
       else
72 77
         format.html { render :action => "edit" }
73 78
         format.xml  { render :xml => @classified.errors, :status => :unprocessable_entity }
  79
+        format.json { render :json => @classified.errors, :status => :unprocessable_entity }
74 80
       end
75 81
     end
76 82
   end
@@ -82,6 +88,7 @@ def destroy
82 88
     respond_to do |format|
83 89
       format.html { redirect_to(classifieds_url) }
84 90
       format.xml  { head :ok }
  91
+      format.json { head :ok }
85 92
     end
86 93
   end
87 94
 end
10  app/controllers/html_contents_controller.rb
@@ -22,16 +22,13 @@ def index
22 22
     respond_to do |format|
23 23
       format.html # index.html.erb
24 24
       format.xml  { render :xml => @html_contents }
  25
+      format.json { render :json => @html_contents }
25 26
     end
26 27
   end
27 28
 
28 29
 
29 30
   def new
30 31
     @html_content = HtmlContent.new
31  
-    respond_to do |format|
32  
-      format.html # new.html.erb
33  
-      format.xml  { render :xml => @html_content }
34  
-    end
35 32
   end
36 33
 
37 34
 
@@ -53,9 +50,11 @@ def create
53 50
           end  
54 51
         }
55 52
         format.xml  { render :xml => @html_content, :status => :created, :location => @html_content }
  53
+        format.json  { render :json => @html_content, :status => :created, :location => @html_content }
56 54
       else
57 55
         format.html { render :action => "new" }
58 56
         format.xml  { render :xml => @html_content.errors, :status => :unprocessable_entity }
  57
+        format.json  { render :json => @html_content.errors, :status => :unprocessable_entity }
59 58
       end
60 59
     end
61 60
   end
@@ -74,9 +73,11 @@ def update
74 73
           end  
75 74
          }
76 75
         format.xml  { head :ok }
  76
+        format.json { head :ok }
77 77
       else
78 78
         format.html { render :action => "edit" }
79 79
         format.xml  { render :xml => @html_content.errors, :status => :unprocessable_entity }
  80
+        format.json  { render :json => @html_content.errors, :status => :unprocessable_entity }
80 81
       end
81 82
     end
82 83
   end
@@ -88,6 +89,7 @@ def destroy
88 89
     respond_to do |format|
89 90
       format.html { redirect_to(html_contents_url) }
90 91
       format.xml  { head :ok }
  92
+      format.json { head :ok }
91 93
     end
92 94
   end
93 95
 end
7  app/controllers/photo_albums_controller.rb
@@ -23,6 +23,7 @@ def index
23 23
     respond_to do |format|
24 24
       format.html # index.html.erb
25 25
       format.xml  { render :xml => @photo_albums }
  26
+      format.json  { render :json => @photo_albums }
26 27
     end
27 28
   end
28 29
   
@@ -33,6 +34,7 @@ def show
33 34
     respond_to do |format|
34 35
       format.html # show.html.erb
35 36
       format.xml  { render :xml => @photo_album }
  37
+      format.json  { render :json => @photo_album }
36 38
     end
37 39
   end
38 40
 
@@ -55,9 +57,11 @@ def create
55 57
         flash[:notice] = 'PhotoAlbum was successfully created.'
56 58
         format.html { redirect_to(@photo_album) }
57 59
         format.xml  { render :xml => @photo_album, :status => :created, :location => @photo_album }
  60
+        format.json  { render :json => @photo_album, :status => :created, :location => @photo_album }
58 61
       else
59 62
         format.html { render :action => "new" }
60 63
         format.xml  { render :xml => @photo_album.errors, :status => :unprocessable_entity }
  64
+        format.json  { render :json => @photo_album.errors, :status => :unprocessable_entity }
61 65
       end
62 66
     end
63 67
   end
@@ -70,9 +74,11 @@ def update
70 74
         flash[:notice] = 'PhotoAlbum was successfully updated.'
71 75
         format.html { redirect_to(@photo_album) }
72 76
         format.xml  { head :ok }
  77
+        format.json { head :ok }
73 78
       else
74 79
         format.html { render :action => "edit" }
75 80
         format.xml  { render :xml => @photo_album.errors, :status => :unprocessable_entity }
  81
+        format.json  { render :json => @photo_album.errors, :status => :unprocessable_entity }
76 82
       end
77 83
     end
78 84
   end
@@ -84,6 +90,7 @@ def destroy
84 90
     respond_to do |format|
85 91
       format.html { redirect_to(photo_albums_url) }
86 92
       format.xml  { head :ok }
  93
+      format.json { head :ok }
87 94
     end
88 95
   end
89 96
   
5  app/controllers/replies_controller.rb
@@ -31,9 +31,11 @@ def create
31 31
         flash[:notice] = 'Reply was successfully created.'
32 32
         format.html { redirect_to(@reply) }
33 33
         format.xml  { render :xml => @reply, :status => :created, :location => @reply }
  34
+        format.json  { render :json => @reply, :status => :created, :location => @reply }
34 35
       else
35 36
         format.html { render :action => "new" }
36 37
         format.xml  { render :xml => @reply.errors, :status => :unprocessable_entity }
  38
+        format.json  { render :json => @reply.errors, :status => :unprocessable_entity }
37 39
       end
38 40
     end
39 41
   end
@@ -46,9 +48,11 @@ def update
46 48
         flash[:notice] = 'Reply was successfully updated.'
47 49
         format.html { redirect_to(@reply) }
48 50
         format.xml  { head :ok }
  51
+        format.json { head :ok }
49 52
       else
50 53
         format.html { render :action => "edit" }
51 54
         format.xml  { render :xml => @reply.errors, :status => :unprocessable_entity }
  55
+        format.json  { render :json => @reply.errors, :status => :unprocessable_entity }
52 56
       end
53 57
     end
54 58
   end
@@ -60,6 +64,7 @@ def destroy
60 64
     respond_to do |format|
61 65
       format.html { redirect_to(replies_url) }
62 66
       format.xml  { head :ok }
  67
+      format.json { head :ok }
63 68
     end
64 69
   end
65 70
   
3  app/controllers/wall_posts_controller.rb
@@ -60,9 +60,11 @@ def update
60 60
         flash[:notice] = 'WallPost was successfully updated.'
61 61
         format.html { redirect_to(@wall_post) }
62 62
         format.xml  { head :ok }
  63
+        format.json { head :ok }
63 64
       else
64 65
         format.html { render :action => "edit" }
65 66
         format.xml  { render :xml => @wall_post.errors, :status => :unprocessable_entity }
  67
+        format.json  { render :json => @wall_post.errors, :status => :unprocessable_entity }
66 68
       end
67 69
     end
68 70
   end
@@ -75,6 +77,7 @@ def destroy
75 77
     respond_to do |format|
76 78
       format.html { render :partial => 'shared/wall_posts', :locals=>{:parent=>@parent}, :layout=>false }
77 79
       format.xml  { head :ok }
  80
+      format.json { head :ok }
78 81
     end
79 82
   end
80 83
   
34  app/models/user_mailer.rb
@@ -14,11 +14,19 @@
14 14
 
15 15
 class UserMailer < ActionMailer::Base
16 16
   
  17
+  def initialize
  18
+    @network = Network.find(:first)
  19
+    @url = @network.url
  20
+    @network_name = @network.name
  21
+    @admin_email = @network.admin_email
  22
+  end
  23
+  
  24
+  
17 25
   # Send the activation code to users who sign up
18 26
   def signup_notification(user)
19 27
     setup_email(user)
20 28
     @subject    += 'Please activate your new account'  
21  
-    @body[:url]  = "http://www.rubymi.org/activate/#{user.activation_code}" 
  29
+    @body[:url]  = "#{@url}/activate/#{user.activation_code}" 
22 30
   end
23 31
   
24 32
   
@@ -26,7 +34,7 @@ def signup_notification(user)
26 34
   def new_user_signup(user)
27 35
     setup_admin_email(user)
28 36
     @subject    += 'New User Signup'  
29  
-    @body[:url]  = "http://www.rubymi.org" 
  37
+    @body[:url]  = "#{@url}" 
30 38
   end
31 39
   
32 40
 
@@ -34,7 +42,7 @@ def new_user_signup(user)
34 42
   def new_user_activated(user)
35 43
     setup_admin_email(user)
36 44
     @subject    += 'New User Activated'  
37  
-    @body[:url]  = "http://www.rubymi.org" 
  45
+    @body[:url]  = "#{@url}" 
38 46
   end
39 47
   
40 48
 
@@ -59,7 +67,7 @@ def announcement_notification(announcement)
59 67
   def wall_post_notification(wall_post)
60 68
     setup_email(wall_post.user)
61 69
     @subject    += 'Wall Post Notification'  
62  
-    @body[:url]  = "http://www.rubymi.org" 
  70
+    @body[:url]  = "#{@url}" 
63 71
     @content_type = "text/html"
64 72
   end
65 73
   
@@ -69,7 +77,7 @@ def message_notification(message)
69 77
     setup_email(message.recipient)
70 78
     @subject    += 'Message Notification'  
71 79
     @body[:message] = message
72  
-    @body[:url]  = "http://www.rubymi.org" 
  80
+    @body[:url]  = "#{@url}" 
73 81
     @content_type = "text/html"
74 82
   end
75 83
   
@@ -78,7 +86,7 @@ def message_notification(message)
78 86
   def invite_notification(invite)
79 87
     @recipients  = "#{invite.email}"
80 88
     @from        = "#{invite.user.email}"
81  
-    @subject     = "An Invitation to Join RubyMI "
  89
+    @subject     = "An Invitation to Join #{@network_name} "
82 90
     @sent_on     = Time.now
83 91
     @body[:invite] = invite
84 92
     @content_type = "text/html"
@@ -88,7 +96,7 @@ def invite_notification(invite)
88 96
   def activation(user)
89 97
     setup_email(user)
90 98
     @subject    += 'Your account has been activated!'
91  
-    @body[:url]  = "http://www.rubymi.org/"
  99
+    @body[:url]  = "#{@url}"
92 100
   end
93 101
   
94 102
   
@@ -96,8 +104,8 @@ def activation(user)
96 104
   # Setup an email that will be sent to a single user
97 105
   def setup_email(user)
98 106
     @recipients  = "#{user.email}"
99  
-    @from        = "admin@rubymi.org"
100  
-    @subject     = "[RubyMI] "
  107
+    @from        = "#{@admin_email}"
  108
+    @subject     = "[#{@network_name}] "
101 109
     @sent_on     = Time.now
102 110
     @body[:user] = user
103 111
   end
@@ -107,8 +115,8 @@ def setup_email(user)
107 115
   def setup_admin_email(user)
108 116
     emails = User.admins_and_creators.collect { |p| p.email } 
109 117
     @recipients  = emails.join(',')  
110  
-    @from        = "admin@rubymi.org"
111  
-    @subject     = "[RubyMI] "
  118
+    @from        = "#{@admin_email}"
  119
+    @subject     = "[#{@network_name}] "
112 120
     @sent_on     = Time.now
113 121
     @body[:user] = user 
114 122
   end
@@ -118,8 +126,8 @@ def setup_admin_email(user)
118 126
   def setup_all_user_email
119 127
     emails = User.find(:all).collect { |p| p.email } 
120 128
     @recipients  = emails.join(',')  
121  
-    @from        = "admin@rubymi.org"
122  
-    @subject     = "[RubyMI] "
  129
+    @from        = "#{@admin_email}"
  130
+    @subject     = "[#{@network_name}] "
123 131
     @sent_on     = Time.now
124 132
   end
125 133
   
11  db/migrate/20100618150950_modify_network.rb
... ...
@@ -0,0 +1,11 @@
  1
+class ModifyNetwork < ActiveRecord::Migration
  2
+  def self.up
  3
+    add_column :networks, :url, :string
  4
+    add_column :networks, :admin_email, :string
  5
+  end
  6
+
  7
+  def self.down
  8
+    remove_column :networks, :url
  9
+    remove_column :networks, :admin_email
  10
+  end
  11
+end
2  lib/tasks/cms_site_init.rake
@@ -17,6 +17,8 @@ namespace :enginey do
17 17
       network = Network.create(:name => NETWORK_NAME,
18 18
                      :organization => 'EngineY',
19 19
                      :website => 'http://www.enginey.com',
  20
+                     :url => 'http://www.enginey.com',
  21
+                     :admin_email => 'admin@rubymi.org',
20 22
                      :description => 'The homepage for the EngineY framework.')
21 23
     
22 24
       
2  lib/tasks/engineycom_populate.rake
@@ -18,6 +18,8 @@ namespace :railsnet do
18 18
       network = Network.create(:name => NETWORK_NAME,
19 19
                      :organization => 'EngineY',
20 20
                      :website => 'http://www.enginey.com',
  21
+                     :url => 'http://www.enginey.com',
  22
+                     :admin_email => 'admin@rubymi.org',
21 23
                      :description => 'The homepage for the EngineY framework.')
22 24
     
23 25
       
2  lib/tasks/personal_blog_populate.rake
@@ -18,6 +18,8 @@ namespace :enginey do
18 18
       network = Network.create(:name => BLOG_NAME,
19 19
                      :organization => 'Ruby Enthusiasts of Michigan',
20 20
                      :website => 'http://www.rubymi.org',
  21
+                     :url => 'http://www.rubymi.org',
  22
+                     :admin_email => 'admin@rubymi.org',
21 23
                      :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.')
22 24
     
23 25
       
2  lib/tasks/ruby_mi_populate.rake
@@ -22,6 +22,8 @@ namespace :enginey do
22 22
       network = Network.create(:name => NETWORK_NAME,
23 23
                      :organization => 'Ruby Enthusiasts of Michigan',
24 24
                      :website => 'http://www.rubymi.org',
  25
+                     :url => 'http://www.rubymi.org',
  26
+                     :admin_email => 'admin@rubymi.org',
25 27
                      :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.')
26 28
     
27 29
       

0 notes on commit 48db602

Please sign in to comment.
Something went wrong with that request. Please try again.