Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changes

  • Loading branch information...
commit de8492718322f258457f9178292f146f9e060f01 1 parent 6f7cb2f
@timothyf timothyf authored
Showing with 496 additions and 351 deletions.
  1. +3 −3 app/controllers/admin_controller.rb
  2. +85 −0 app/controllers/ey_modules_controller.rb
  3. +1 −2  app/controllers/home_controller.rb
  4. +1 −1  app/controllers/users_controller.rb
  5. +2 −0  app/helpers/ey_modules_helper.rb
  6. +10 −10 app/models/configuration.rb
  7. +1 −0  app/models/widget.rb
  8. +4 −2 app/views/admin/pages.html.erb
  9. +0 −46 app/views/events/_events_profile.html.erb
  10. +0 −52 app/views/forum_posts/_forum_posts_profile.html.erb
  11. +5 −1 app/views/friends/_friends.html.erb
  12. +0 −60 app/views/groups/_groups_home.html.erb
  13. +0 −44 app/views/groups/_groups_profile.html.erb
  14. +4 −2 app/views/layouts/_analytics.html.erb
  15. +5 −7 app/views/layouts/_widgets.html.erb
  16. +4 −2 app/views/layouts/application.html.erb
  17. +17 −0 app/views/layouts/ey_modules.html.erb
  18. +0 −48 app/views/photos/_photos_profile.html.erb
  19. +7 −5 app/views/sessions/new.html.erb
  20. +1 −6 app/views/users/show.html.erb
  21. +57 −0 app/views/widgets/events_profile.html.erb
  22. +60 −0 app/views/widgets/forum_posts_profile.html.erb
  23. +46 −0 app/views/widgets/groups_profile.html.erb
  24. +5 −1 app/views/widgets/links_profile.html.erb
  25. +56 −0 app/views/widgets/photos_profile.html.erb
  26. +5 −1 app/views/widgets/projects_profile.html.erb
  27. +4 −0 config/routes.rb
  28. +9 −0 db/migrate/20100608162220_remove_unused_tables.rb
  29. +13 −0 db/migrate/20100608195539_create_ey_modules.rb
  30. +8 −15 db/schema.rb
  31. +83 −43 lib/tasks/ruby_mi_populate.rake
View
6 app/controllers/admin_controller.rb
@@ -452,8 +452,8 @@ def save_privacy
# Used to display the current Analytics code
def analytics_code
- if HtmlContent.find_by_content_id('analytics')
- @analytics = HtmlContent.find_by_content_id('analytics')
+ if HtmlContent.find_by_title('?analytics?')
+ @analytics = HtmlContent.find_by_title('?analytics?')
else
@analytics = HtmlContent.new
end
@@ -468,7 +468,7 @@ def save_analytics
else
analytics = HtmlContent.new
analytics.body = params[:analytics_text]
- analytics.content_id = 'analytics'
+ analytics.title = '?analytics?'
analytics.save
end
redirect_to :action => 'settings'
View
85 app/controllers/ey_modules_controller.rb
@@ -0,0 +1,85 @@
+class EyModulesController < ApplicationController
+ # GET /ey_modules
+ # GET /ey_modules.xml
+ def index
+ @ey_modules = EyModule.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @ey_modules }
+ end
+ end
+
+ # GET /ey_modules/1
+ # GET /ey_modules/1.xml
+ def show
+ @ey_module = EyModule.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @ey_module }
+ end
+ end
+
+ # GET /ey_modules/new
+ # GET /ey_modules/new.xml
+ def new
+ @ey_module = EyModule.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @ey_module }
+ end
+ end
+
+ # GET /ey_modules/1/edit
+ def edit
+ @ey_module = EyModule.find(params[:id])
+ end
+
+ # POST /ey_modules
+ # POST /ey_modules.xml
+ def create
+ @ey_module = EyModule.new(params[:ey_module])
+
+ respond_to do |format|
+ if @ey_module.save
+ flash[:notice] = 'EyModule was successfully created.'
+ format.html { redirect_to(@ey_module) }
+ format.xml { render :xml => @ey_module, :status => :created, :location => @ey_module }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @ey_module.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /ey_modules/1
+ # PUT /ey_modules/1.xml
+ def update
+ @ey_module = EyModule.find(params[:id])
+
+ respond_to do |format|
+ if @ey_module.update_attributes(params[:ey_module])
+ flash[:notice] = 'EyModule was successfully updated.'
+ format.html { redirect_to(@ey_module) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @ey_module.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /ey_modules/1
+ # DELETE /ey_modules/1.xml
+ def destroy
+ @ey_module = EyModule.find(params[:id])
+ @ey_module.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(ey_modules_url) }
+ format.xml { head :ok }
+ end
+ end
+end
View
3  app/controllers/home_controller.rb
@@ -76,8 +76,7 @@ def index
redirect_to :action => 'install'
else
@section = 'MAIN'
- @page_name = 'home'
- @page = Page.find_by_title('home')
+ @page = Page.find_by_name('home')
@photos = Photo.find(:all, :limit=>6,
:select=>'id, parent_id, filename',
:order => Photo.connection.adapter_name == 'PostgreSQL' ? 'RANDOM()' : 'RAND()',
View
2  app/controllers/users_controller.rb
@@ -192,7 +192,7 @@ def show
else
@section = 'MEMBERS'
end
- @page_name = 'profile'
+ @page = Page.find_by_name('profile')
if @user.twitter_id && @user.display_tweets
@tweets = @user.fetch_tweets
end
View
2  app/helpers/ey_modules_helper.rb
@@ -0,0 +1,2 @@
+module EyModulesHelper
+end
View
20 app/models/configuration.rb
@@ -18,16 +18,16 @@ class Configuration
# The self.get method is not used yet..
- def self.get
- {
- :use_proxy => false,
- :proxy_host => '10.0.6.251',
- :proxy_port => '3128',
- :enable_self_registration => true,
- :max_tweets => 5,
- :enable_facebook_connect => false
- }
- end
+# def self.get
+# {
+# :use_proxy => false,
+# :proxy_host => '10.0.6.251',
+# :proxy_port => '3128',
+# :enable_self_registration => true,
+# :max_tweets => 5,
+# :enable_facebook_connect => false
+# }
+# end
# Sets the configuration (not used yet)
View
1  app/models/widget.rb
@@ -35,5 +35,6 @@
class Widget < ActiveRecord::Base
has_many :widget_layouts
+ belongs_to :ey_module
end
View
6 app/views/admin/pages.html.erb
@@ -16,6 +16,7 @@
<thead>
<th width="50px">ID</th>
<th width="140px">Title</th>
+ <th width="140px">Name</th>
<th width="300px">Actions</th>
</thead>
<tbody>
@@ -23,6 +24,7 @@
<tr>
<td><%= page.id %></td>
<td><%= page.title %></td>
+ <td><%= page.name %></td>
<td>
<%= link_to 'Edit', '/admin/page_edit?id=' + page.id.to_s %> |
<%= link_to 'Delete', '/admin/page_delete?id=' + page.id.to_s, :confirm => 'Are you sure you want to delete this page?' %> |
@@ -65,7 +67,7 @@ page will determine the content for that page.<br/><br/>
<table id="layouts">
<thead>
<th width="50px">ID</th>
- <th width="100px">Page Title</th>
+ <th width="100px">Page Name</th>
<th width="140px">Widget Name</th>
<th width="70px">Col Num</th>
<th width="70px">Row Num</th>
@@ -77,7 +79,7 @@ page will determine the content for that page.<br/><br/>
<tr>
<td><%= layout.id %></td>
<% if layout.page %>
- <td><%= layout.page.title %></td>
+ <td><%= layout.page.name %></td>
<% else %>
<td>null</td>
<% end %>
View
46 app/views/events/_events_profile.html.erb
@@ -1,46 +0,0 @@
-<%#
-Copyright 2009 Timothy Fisher
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-%>
-<div class="module right_side_widget">
- <div class="module_head">
- <div class="head_left">
- <%= image_tag('calendar.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;My Events
- </div>
- <div class="head_right">
- <div id="expand_collapse_btn">
- <a href="javascript:widget_change_display('my_events')">
- <img id="my_events_collapse_img" src="/images/collapse.png"/>
- </a>
- </div>
- </div>
- <div style="clear:both;"></div>
- </div>
- <div class="module_body" id="my_events_body">
- <% @user.events.each do |event| %>
- <div>
- <span class="event_name">
- <%= link_to event.name, event_url(event) %>
- </span><br/>
- <%= event.start_time.to_s(:event_brief) %><br/>
- <%= event.location %>
- </div>
- <% end %>
- <% if @user.events.length == 0 %>
- You have no events scheduled.<br/>
- <%= link_to 'View all events...', events_url() %>
- <% end %>
- <div style="clear:both;"></div>
- </div>
-</div>
View
52 app/views/forum_posts/_forum_posts_profile.html.erb
@@ -1,52 +0,0 @@
-<%#
-Copyright 2009 Timothy Fisher
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-%>
-<div class="module right_side_widget">
- <div class="module_head">
- <div class="head_left">
- <%= image_tag('user_comment.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;My Forum Posts
- </div>
- <div class="head_right">
- <div id="expand_collapse_btn">
- <a href="javascript:widget_change_display('my_forum_posts')">
- <img id="my_forum_posts_collapse_img" src="/images/collapse.png"/>
- </a>
- </div>
- </div>
- <div style="clear:both;"></div>
- </div>
- <div class="module_body" id="my_forum_posts_body">
- <% if @user.forum_posts && @user.forum_posts.length > 0 %>
- <% @user.forum_posts[0..5].each do |post| %>
- <div class="blog_post_brief">
- <%= link_to post.title, forum_post_url(post) %><br/>
- by <%= post.user.name %><br/>
- on <%= post.created_at.to_s(:basic) %>
- </div>
- <% end %>
- <% else %>
- You have not made any posts.<br/>
- <%= link_to 'View forums...', events_url() %>
- <% end %>
- <div style="clear:both;"></div>
- </div>
- <div class="module_foot">
- <div class="foot_left"></div>
- <div class="foot_right">
- <%= link_to 'View All', user_forum_posts_url(@user) %>
- </div>
- <div style="clear:both;"></div>
- </div>
-</div>
View
6 app/views/friends/_friends.html.erb
@@ -36,5 +36,9 @@ limitations under the License.
<% end %>
<% else %>
- You have not added any friends. <%= link_to 'Find some now.', '/users' %>
+ <% if @user == current_user %>
+ You have not added any friends. <%= link_to 'Find some now.', '/users' %>
+ <% else %>
+ User has not added any friends.
+ <% end %>
<% end %>
View
60 app/views/groups/_groups_home.html.erb
@@ -1,60 +0,0 @@
-<%#
-Copyright 2009 Timothy Fisher
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-%>
-<div class="module">
- <div class="module_head">
- <%= render :partial=>'widgets/widget_header', :locals=>{:widget_title=>'Groups'} %>
- </div>
- <div class="module_body">
- <% count = 0 %>
- <% @groups.each do |group | %>
- <% count = count + 1 %>
- <% if (count == @groups.size) %>
- <div class="groups_widget_group last_child">
- <% else %>
- <div class="groups_widget_group">
- <% end %>
- <div class="groups_widget_photo">
- <% if group.profile_photo %>
- <%= link_to image_tag(group.profile_photo.public_filename(:small), :alt=>group.name), group_url(group) %>
- <% else %>
- <%= link_to 'No Photo', group_url(group) %>
- <% end %>
- </div>
- <div class="groups_widget_text">
- <span class="group_name">
- <%= link_to group.name, group_url(group) %>
- </span><br/>
- <%= group.users.size %> members
- </div>
- </div>
- <% end %>
- <% if @groups.length == 0 %>
- No groups exist!
- <% end %>
- <div style="clear:both;"></div>
- </div>
- <div class="module_foot">
- <div class="foot_left">
- <% if logged_in? %>
- <%= link_to 'Add Group', new_group_path %>
- <% end %>
- </div>
- <div class="foot_right">
- <%= link_to 'View All', groups_url %>
- </div>
- <div style="clear:both;"></div>
- </div>
-</div>
View
44 app/views/groups/_groups_profile.html.erb
@@ -1,44 +0,0 @@
-<%#
-Copyright 2009 Timothy Fisher
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-%>
-<div class="module">
- <div class="module_head">
- <div class="head_left">
- <%= image_tag('group.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;My Groups
- </div>
- <div class="head_right">
- <div id="expand_collapse_btn">
- <a href="javascript:widget_change_display('my_groups')">
- <img id="my_groups_collapse_img" src="/images/collapse.png"/>
- </a>
- </div>
- </div>
- <div style="clear:both;"></div>
- </div>
- <div class="module_body" id="my_groups_body">
- <% unless @user.groups.empty? %>
- <% @user.groups.each do |group| %>
- <div class="user_group">
- <% if group.profile_photo %>
- <%= link_to image_tag(group.profile_photo.public_filename(:small)), group_path(group.id) %>
- <% else %>
- <%= link_to 'No Photo', group_path(group.id) %>
- <% end %>
- </div>
- <% end %>
- <% end %>
- <div style="clear:both;"></div>
- </div>
-</div>
View
6 app/views/layouts/_analytics.html.erb
@@ -1,4 +1,6 @@
-<% if HtmlContent.find_by_title('analytics') %>
- <%= HtmlContent.find_by_content_id('analytics').body %>
+<div id="analytics_code">
+<% if HtmlContent.find_by_title('?analytics?') %>
+ <%= HtmlContent.find_by_title('?analytics?').body %>
<% end %>
+</div>
View
12 app/views/layouts/_widgets.html.erb
@@ -1,10 +1,8 @@
-<% if @page_name %>
- <% page = Page.find_by_title(@page_name) %>
- <% if page %>
- <% layouts = page.widget_layouts %>
- <% layouts.each do |layout| %>
- <% layout.widget_name = Widget.find(layout.widget_id).name %>
- <% end %>
+
+<% if @page %>
+ <% layouts = @page.widget_layouts %>
+ <% layouts.each do |layout| %>
+ <% layout.widget_name = Widget.find(layout.widget_id).name %>
<% end %>
<% end %>
View
6 app/views/layouts/application.html.erb
@@ -53,8 +53,10 @@ limitations under the License.
</head>
<body>
-<%= fb_connect_javascript_tag %>
-<%= init_fb_connect('XFBML', :js => :dojo) %>
+<% if Configuration.ENABLE_FACEBOOK_CONNECT %>
+ <%= fb_connect_javascript_tag %>
+ <%= init_fb_connect('XFBML', :js => :dojo) %>
+<% end %>
<div id="content">
<div id="header">
<div id="masthead"></div>
View
17 app/views/layouts/ey_modules.html.erb
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+ <title>EyModules: <%= controller.action_name %></title>
+ <%= stylesheet_link_tag 'scaffold' %>
+</head>
+<body>
+
+<p style="color: green"><%= flash[:notice] %></p>
+
+<%= yield %>
+
+</body>
+</html>
View
48 app/views/photos/_photos_profile.html.erb
@@ -1,48 +0,0 @@
-<%#
-Copyright 2009 Timothy Fisher
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-%>
-<div class="module">
- <div class="module_head">
- <div class="head_left">
- <%= image_tag('photos.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;My Photos
- </div>
- <div class="head_right">
-
- </div>
- <div style="clear:both;"></div>
- </div>
- <div class="module_body" id="my_photos_body">
- <% displayed = 0 %>
- <% @user.photos.each do |photo| %>
- <% if photo.is_profile == false || photo.is_profile == nil %>
- <% displayed = displayed + 1 %>
- <div class="photo_display">
- <%= link_to image_tag(photo.public_filename(:medium)), photo_path(photo.id) %>
- </div>
- <% end %>
- <% end %>
- <% if displayed == 0 %>
- You have not uploaded any photos yet.
- <% end %>
- <div style="clear:both;"></div>
- </div>
- <div class="module_foot">
- <% if logged_in? %>
- <div class="foot_left"><%= link_to 'Add Photos', new_photo_path %></div>
- <% end %>
- <div class="foot_right"><%= link_to 'View All', photos_url %></div>
- <div style="clear:both;"></div>
- </div>
-</div>
View
12 app/views/sessions/new.html.erb
@@ -34,12 +34,14 @@ limitations under the License.
<% end -%>
<div style="clear:both;"></div>
</div>
- <div id="facebook_login">
- <h5>Signin with your Facebook account</h5>
- <div id="facebook_login_button">
- <%= fb_login_button('window.location = "/users/link_facebook_account";')%>
+ <% if Configuration.ENABLE_FACEBOOK_CONNECT %>
+ <div id="facebook_login">
+ <h5>Signin with your Facebook account</h5>
+ <div id="facebook_login_button">
+ <%= fb_login_button('window.location = "/users/link_facebook_account";')%>
+ </div>
</div>
- </div>
+ <% end %>
<div style="clear:both;"></div>
</div>
View
7 app/views/users/show.html.erb
@@ -31,16 +31,13 @@ limitations under the License.
<div id="user_friends" class="user_profile_section">
<%= render :partial => 'friends/friends_widget' %>
</div>
- <div id="user_groups" class="user_profile_section">
- <%= render :partial => 'groups/groups_profile' %>
- </div>
+ <div id="col_1_widgets"></div>
</div>
<div class="column_2">
<div id="col_2_widgets"></div>
<% if @user.twitter_id && @user.display_tweets %>
<%= render :partial => 'tweets/display_tweets' %>
<% end %>
- <%= render :partial => 'photos/photos_profile' %>
<%= render :partial => 'shared/wall_posts_widget', :locals=>{:parent=>@user} %>
</div>
</div>
@@ -48,8 +45,6 @@ limitations under the License.
<div class="col2">
<%= render :partial => 'users/add_friend_widget' %>
<%= render :partial => 'users/user_control_widget' %>
- <%= render :partial => 'events/events_profile' %>
- <%= render :partial => 'forum_posts/forum_posts_profile' %>
<% if current_user == @user %>
<%= render :partial => 'messages/unread_messages_widget' %>
<% end %>
View
57 app/views/widgets/events_profile.html.erb
@@ -0,0 +1,57 @@
+<%#
+Copyright 2009 Timothy Fisher
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+%>
+<% widget_title = "My Events" %>
+
+<% @user = User.find(user_id) %>
+
+<% content_for :module_header do %>
+ <div class="head_left">
+ <%= image_tag('calendar.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;<%= widget_title %>
+ </div>
+ <div class="head_right">
+ <div id="expand_collapse_btn">
+ <a href="javascript:widget_change_display('my_events')">
+ <img id="my_events_collapse_img" src="/images/collapse.png"/>
+ </a>
+ </div>
+ </div>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_body do %>
+ <% @user.events.each do |event| %>
+ <div>
+ <span class="event_name">
+ <%= link_to event.name, event_url(event) %>
+ </span><br/>
+ <%= event.start_time.to_s(:event_brief) %><br/>
+ <%= event.location %>
+ </div>
+ <% end %>
+ <% if @user.events.length == 0 %>
+ <% if @user == current_user %>
+ You have no events scheduled.<br/>
+ <% else %>
+ User has no events scheduled.<br/>
+ <% end %>
+ <%= link_to 'View all events...', events_url() %>
+ <% end %>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_footer do %>
+
+<% end %>
View
60 app/views/widgets/forum_posts_profile.html.erb
@@ -0,0 +1,60 @@
+<%#
+Copyright 2009 Timothy Fisher
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+%>
+<% widget_title = "My Forum Posts" %>
+
+<% @user = User.find(user_id) %>
+
+<% content_for :module_header do %>
+ <div class="head_left">
+ <%= image_tag('user_comment.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;<%= widget_title %>
+ </div>
+ <div class="head_right">
+ <div id="expand_collapse_btn">
+ <a href="javascript:widget_change_display('my_forum_posts')">
+ <img id="my_forum_posts_collapse_img" src="/images/collapse.png"/>
+ </a>
+ </div>
+ </div>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_body do %>
+ <% if @user.forum_posts && @user.forum_posts.length > 0 %>
+ <% @user.forum_posts[0..5].each do |post| %>
+ <div class="blog_post_brief">
+ <%= link_to post.title, forum_post_url(post) %><br/>
+ by <%= post.user.name %><br/>
+ on <%= post.created_at.to_s(:basic) %>
+ </div>
+ <% end %>
+ <% else %>
+ <% if @user == current_user %>
+ You have not made any posts.<br/>
+ <% else %>
+ User has not made any posts.<br/>
+ <% end %>
+ <%= link_to 'View forums...', events_url() %>
+ <% end %>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_footer do %>
+ <div class="foot_left"></div>
+ <div class="foot_right">
+ <%= link_to 'View All', user_forum_posts_url(@user) %>
+ </div>
+ <div style="clear:both;"></div>
+<% end %>
View
46 app/views/widgets/groups_profile.html.erb
@@ -0,0 +1,46 @@
+<%#
+Copyright 2009 Timothy Fisher
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+%>
+<% widget_title = "My Groups" %>
+
+<% @user = User.find(user_id) %>
+
+<% content_for :module_header do %>
+ <div class="head_left">
+ <%= image_tag('group.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;<%= widget_title %>
+ </div>
+ <div class="head_right">
+ <%= show_expand_collapse_btn %>
+ </div>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_body do %>
+ <% unless @user.groups.empty? %>
+ <% @user.groups.each do |group| %>
+ <div class="user_group">
+ <% if group.profile_photo %>
+ <%= link_to image_tag(group.profile_photo.public_filename(:small)), group_path(group.id) %>
+ <% else %>
+ <%= link_to 'No Photo', group_path(group.id) %>
+ <% end %>
+ </div>
+ <% end %>
+ <% end %>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_footer do %>
+<% end %>
View
6 app/views/widgets/links_profile.html.erb
@@ -35,7 +35,11 @@ limitations under the License.
</div>
<% end %>
<% else %>
- You have not posted any links.<br/>
+ <% if @user == current_user %>
+ You have not posted any links.<br/>
+ <% else %>
+ User has not posted any links.<br/>
+ <% end %>
<%= link_to 'View links...', links_url() %>
<% end %>
<div style="clear:both;"></div>
View
56 app/views/widgets/photos_profile.html.erb
@@ -0,0 +1,56 @@
+<%#
+Copyright 2009 Timothy Fisher
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+%>
+<% widget_title = "My Photos" %>
+
+<% @user = User.find(user_id) %>
+
+<% content_for :module_header do %>
+ <div class="head_left">
+ <%= image_tag('photos.png', :alt=>'events', :align=>'absmiddle')%>&nbsp;&nbsp;<%= widget_title %>
+ </div>
+ <div class="head_right">
+
+ </div>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_body do %>
+ <% displayed = 0 %>
+ <% @user.photos.each do |photo| %>
+ <% if photo.is_profile == false || photo.is_profile == nil %>
+ <% displayed = displayed + 1 %>
+ <div class="photo_display">
+ <%= link_to image_tag(photo.public_filename(:medium)), photo_path(photo.id) %>
+ </div>
+ <% end %>
+ <% end %>
+ <% if displayed == 0 %>
+ <% if @user == current_user %>
+ You have not uploaded any photos yet.
+ <% else %>
+ User has not uploaded any photos.
+ <% end %>
+ <% end %>
+ <div style="clear:both;"></div>
+<% end %>
+
+<% content_for :module_footer do %>
+ <% if logged_in? %>
+ <div class="foot_left"><%= link_to 'Add Photos', new_photo_path %></div>
+ <% end %>
+ <div class="foot_right"><%= link_to 'View All', photos_url %></div>
+ <div style="clear:both;"></div>
+<% end %>
View
6 app/views/widgets/projects_profile.html.erb
@@ -35,7 +35,11 @@ limitations under the License.
</div>
<% end %>
<% else %>
- You have not posted any projects.<br/>
+ <% if @user == current_user %>
+ You have not posted any projects.<br/>
+ <% else %>
+ User has not posted any projects.<br/>
+ <% end %>
<%= link_to 'View projects...', projects_url() %>
<% end %>
<div style="clear:both;"></div>
View
4 config/routes.rb
@@ -1,4 +1,8 @@
ActionController::Routing::Routes.draw do |map|
+ map.resources :ey_modules
+
+ map.resources :modules
+
map.resources :follows
map.resources :contents
View
9 db/migrate/20100608162220_remove_unused_tables.rb
@@ -0,0 +1,9 @@
+class RemoveUnusedTables < ActiveRecord::Migration
+ def self.up
+ drop_table :content_pages
+ drop_table :layouts
+ end
+
+ def self.down
+ end
+end
View
13 db/migrate/20100608195539_create_ey_modules.rb
@@ -0,0 +1,13 @@
+class CreateEyModules < ActiveRecord::Migration
+ def self.up
+ create_table :ey_modules do |t|
+ t.string :name
+ t.timestamps
+ end
+ add_column :widgets, :ey_module_id, :integer
+ end
+
+ def self.down
+ drop_table :ey_modules
+ end
+end
View
23 db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100326174110) do
+ActiveRecord::Schema.define(:version => 20100608195539) do
create_table "activities", :force => true do |t|
t.integer "user_id"
@@ -132,11 +132,6 @@
add_index "comments", ["user_id"], :name => "fk_comments_user"
- create_table "content_pages", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
create_table "countries", :force => true do |t|
t.string "name"
t.string "abbreviation"
@@ -169,6 +164,12 @@
t.datetime "updated_at"
end
+ create_table "ey_modules", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "facebook_posts", :force => true do |t|
t.datetime "created_at"
t.datetime "updated_at"
@@ -265,15 +266,6 @@
t.datetime "updated_at"
end
- create_table "layouts", :force => true do |t|
- t.integer "page_id"
- t.integer "widget_id"
- t.integer "col_num"
- t.integer "row_num"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
create_table "links", :force => true do |t|
t.integer "user_id"
t.string "title"
@@ -534,6 +526,7 @@
t.datetime "updated_at"
t.text "description"
t.boolean "profile"
+ t.integer "ey_module_id"
end
end
View
126 lib/tasks/ruby_mi_populate.rake
@@ -345,58 +345,98 @@ namespace :railsnet do
puts 'Creating managed content...'
HtmlContent.create(:title => 'sample_content',
:body => 'This is an example of <b>managed content</b>.');
-
- ##########################################################################
- # Create Widgets
- puts 'Creating widgets...'
- Widget.create(:name => 'members_home', :description => 'Display some members', :profile => false)
- Widget.create(:name => 'groups_home', :description => 'Display some groups', :profile => false)
- Widget.create(:name => 'events_home', :description => 'Display upcoming events', :profile => false)
- Widget.create(:name => 'announcements_home', :description => 'Display recent announcements', :profile => false)
- Widget.create(:name => 'activity_feed_home', :description => 'Display recent activities', :profile => false)
- Widget.create(:name => 'blog_posts_home', :description => 'Display recent blog posts', :profile => false)
- Widget.create(:name => 'links_home', :description => 'Display some links', :profile => false)
- Widget.create(:name => 'projects_home', :description => 'Display some projects', :profile => false)
- Widget.create(:name => 'job_posts_home', :description => 'Display recent job posts', :profile => false)
- Widget.create(:name => 'forum_posts_home', :description => 'Display recent forum posts', :profile => false)
- Widget.create(:name => 'photos_home', :description => 'Slide show of photos', :profile => false)
- Widget.create(:name => 'html_content_home', :description => 'Managed Content Widget', :profile => false)
-
- Widget.create(:name => 'status_posts_profile', :description => 'Display users status posts', :profile => true)
- Widget.create(:name => 'about_me_profile', :description => 'Display users bio', :profile => true)
- Widget.create(:name => 'blog_posts_profile', :description => 'Display users blog posts', :profile => true)
- Widget.create(:name => 'activity_feed_profile', :description => 'Display users activities', :profile => true)
- Widget.create(:name => 'links_profile', :description => 'Display users links', :profile => true)
- Widget.create(:name => 'projects_profile', :description => 'Display users projects', :profile => true)
+
+
+ ##########################################################################
+ # Create Modules and widgets
+ puts 'Creating modules and widgets...'
+ mod_id = EyModule.create(:name => 'blog_posts')
+ Widget.create(:ey_module_id => mod_id, :name => 'blog_posts_home', :description => 'Display recent blog posts', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'blog_posts_profile', :description => 'Display users blog posts', :profile => true)
+
+ mod_id = EyModule.create(:name => 'members')
+ Widget.create(:ey_module_id => mod_id, :name => 'members_home', :description => 'Display some members', :profile => false)
+
+ mod_id = EyModule.create(:name => 'groups')
+ Widget.create(:ey_module_id => mod_id, :name => 'groups_home', :description => 'Display some groups', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'groups_profile', :description => 'Display users groups', :profile => true)
+
+ mod_id = EyModule.create(:name => 'events')
+ Widget.create(:ey_module_id => mod_id, :name => 'events_home', :description => 'Display upcoming events', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'events_profile', :description => 'Display users events', :profile => true)
+
+ mod_id = EyModule.create(:name => 'announcements')
+ Widget.create(:ey_module_id => mod_id, :name => 'announcements_home', :description => 'Display recent announcements', :profile => false)
+
+ mod_id = EyModule.create(:name => 'activity_feed')
+ Widget.create(:ey_module_id => mod_id, :name => 'activity_feed_home', :description => 'Display recent activities', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'activity_feed_profile', :description => 'Display users activities', :profile => true)
+
+ mod_id = EyModule.create(:name => 'links')
+ Widget.create(:ey_module_id => mod_id, :name => 'links_home', :description => 'Display some links', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'links_profile', :description => 'Display users links', :profile => true)
+
+ mod_id = EyModule.create(:name => 'projects')
+ Widget.create(:ey_module_id => mod_id, :name => 'projects_home', :description => 'Display some projects', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'projects_profile', :description => 'Display users projects', :profile => true)
+
+ mod_id = EyModule.create(:name => 'job_posts')
+ Widget.create(:ey_module_id => mod_id, :name => 'job_posts_home', :description => 'Display recent job posts', :profile => false)
+
+ mod_id = EyModule.create(:name => 'forum_posts')
+ Widget.create(:ey_module_id => mod_id, :name => 'forum_posts_home', :description => 'Display recent forum posts', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'forum_posts_profile', :description => 'Display users forum posts', :profile => true)
+
+ mod_id = EyModule.create(:name => 'photos')
+ Widget.create(:ey_module_id => mod_id, :name => 'photos_home', :description => 'Slide show of photos', :profile => false)
+ Widget.create(:ey_module_id => mod_id, :name => 'photos_profile', :description => 'Slide show of photos', :profile => true)
+
+ mod_id = EyModule.create(:name => 'html_content')
+ Widget.create(:ey_module_id => mod_id, :name => 'html_content_home', :description => 'Managed Content Widget', :profile => false)
+
+ mod_id = EyModule.create(:name => 'status_posts')
+ Widget.create(:ey_module_id => mod_id, :name => 'status_posts_profile', :description => 'Display users status posts', :profile => true)
+
+ mod_id = EyModule.create(:name => 'about_me')
+ Widget.create(:ey_module_id => mod_id, :name => 'about_me_profile', :description => 'Display users bio', :profile => true)
+
##########################################################################
# Create Pages
puts 'Creating pages...'
- Page.create(:title => 'home', :name => 'RubyMI Home')
- Page.create(:title => 'profile', :name => 'User Profile')
+ home_pg = Page.create(:name => 'home', :title => 'RubyMI Home')
+ prof_pg = Page.create(:name => 'profile', :title => 'User Profile')
##########################################################################
# Create Layouts
puts 'Creating layouts...'
- WidgetLayout.create(:widget_id => 1, :page_id => 1, :col_num => 1)
- WidgetLayout.create(:widget_id => 2, :page_id => 1, :col_num => 1)
- WidgetLayout.create(:widget_id => 3, :page_id => 1, :col_num => 1)
- WidgetLayout.create(:widget_id => 4, :page_id => 1, :col_num => 2)
- WidgetLayout.create(:widget_id => 5, :page_id => 1, :col_num => 2)
- WidgetLayout.create(:widget_id => 6, :page_id => 1, :col_num => 2)
- WidgetLayout.create(:widget_id => 7, :page_id => 1, :col_num => 2)
- WidgetLayout.create(:widget_id => 8, :page_id => 1, :col_num => 2)
- WidgetLayout.create(:widget_id => 9, :page_id => 1, :col_num => 3)
- WidgetLayout.create(:widget_id => 10, :page_id => 1, :col_num => 3)
- WidgetLayout.create(:widget_id => 11, :page_id => 1, :col_num => 3)
- WidgetLayout.create(:widget_id => 12, :page_id => 1, :col_num => 3, :html_content_id => 1)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("members_home").id, :page_id => home_pg.id, :col_num => 1)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("groups_home").id, :page_id => home_pg.id, :col_num => 1)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("events_home").id, :page_id => home_pg.id, :col_num => 1)
+
+ WidgetLayout.create(:widget_id => Widget.find_by_name("announcements_home").id, :page_id => home_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("activity_feed_home").id, :page_id => home_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("blog_posts_home").id, :page_id => home_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("links_home").id, :page_id => home_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("projects_home").id, :page_id => home_pg.id, :col_num => 2)
+
+ WidgetLayout.create(:widget_id => Widget.find_by_name("job_posts_home").id, :page_id => home_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("forum_posts_home").id, :page_id => home_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("photos_home").id, :page_id => home_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("html_content_home").id, :page_id => home_pg.id, :col_num => 3, :html_content_id => 1)
+
+ WidgetLayout.create(:widget_id => Widget.find_by_name("groups_profile").id, :page_id => prof_pg.id, :col_num => 1)
+
+ WidgetLayout.create(:widget_id => Widget.find_by_name("status_posts_profile").id, :page_id => prof_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("about_me_profile").id, :page_id => prof_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("blog_posts_profile").id, :page_id => prof_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("activity_feed_profile").id, :page_id => prof_pg.id, :col_num => 2)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("photos_profile").id, :page_id => prof_pg.id, :col_num => 2)
- WidgetLayout.create(:widget_id => 13, :page_id => 2, :col_num => 2)
- WidgetLayout.create(:widget_id => 14, :page_id => 2, :col_num => 2)
- WidgetLayout.create(:widget_id => 15, :page_id => 2, :col_num => 2)
- WidgetLayout.create(:widget_id => 16, :page_id => 2, :col_num => 2)
- WidgetLayout.create(:widget_id => 17, :page_id => 2, :col_num => 3)
- WidgetLayout.create(:widget_id => 18, :page_id => 2, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("events_profile").id, :page_id => prof_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("forum_posts_profile").id, :page_id => prof_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("links_profile").id, :page_id => prof_pg.id, :col_num => 3)
+ WidgetLayout.create(:widget_id => Widget.find_by_name("projects_profile").id, :page_id => prof_pg.id, :col_num => 3)
puts 'Database population done!'
end
Please sign in to comment.
Something went wrong with that request. Please try again.