Commit 9f4bbf1d74fb4eff7eedd33a8a13db9be8e2117a

Moved project/activities to seperate controller

Commit diff

app/controllers/activities_controller.rb

 
1class ActivitiesController < ApplicationController
2
3 before_filter :find_project
4
5 def index
6 @title, @url_suffix = Project.tab_settings(PRJ_TAB_ACTIVITIES)
7 @members = Member.find_by_project_alpha(@project.id)
8 if @is_member
9 @messages = Message.find_by_project_user(@project.id, current_user.id, 40)
10 else
11 @messages = Message.find_by_project(@project.id, 40)
12 end
13 render :action => "ac_index"
14 end
15
16
17end
toggle raw diff

app/controllers/projects_controller.rb

 
103103 render :action => "ac_forum"
104104 end
105105
106 def activity
107 @title, @url_suffix = Project.tab_settings(PRJ_TAB_ACTIVITY)
108 @members = Member.find_by_project_alpha(@project.id)
109 if @is_member
110 @messages = Message.find_by_project_user(@project.id, current_user.id, 40)
111 else
112 @messages = Message.find_by_project(@project.id, 40)
113 end
114 render :action => "ac_activity_index"
115 end
116
117106 def roadmap
118107 @title, @url_suffix = Project.tab_settings(PRJ_TAB_ROADMAP)
119108 render :action => "ac_roadmap"
toggle raw diff

app/helpers/activities_helper.rb

 
1module ActivitiesHelper
2
3 include ProjectsHelper
4
5end
toggle raw diff

app/helpers/projects_helper.rb

 
5353 out << "<ul id='tabmenu'>"
5454 out << project_tab(active_tab, PRJ_TAB_WIKI)
5555 out << project_tab(active_tab, PRJ_TAB_REPOS)
56 out << project_tab(active_tab, PRJ_TAB_ACTIVITY)
56 out << project_tab(active_tab, PRJ_TAB_ACTIVITIES)
5757 out << project_tab(active_tab, PRJ_TAB_ROADMAP)
5858 out << project_tab(active_tab, PRJ_TAB_TICKETS)
5959 out << project_tab(active_tab, PRJ_TAB_ARTICLES)
100100 end
101101 out << render_right_project_extrainfo
102102 out << render_right_project_contributors
103 when PRJ_TAB_ACTIVITY
103 when PRJ_TAB_ACTIVITIES
104104 out << actionbox_basic(:allow_shortcuts => true)
105105 out << render(:partial => "ac_right_actionbox_post_message") if @is_member
106106 when PRJ_TAB_REPOS
toggle raw diff

app/helpers/wikis_helper.rb

 
11module WikisHelper
22
3 # Gitlab
43 include ProjectsHelper #if $application_mode == MODE_GITLAB
54 include BlueclothHelper
65
toggle raw diff

app/models/project.rb

 
222222 def self.list_for_user(user)
223223 if user != nil then
224224 list = ""
225 projects = Member.find_by_user(user.id)
225 projects = Member.find_by_user(user)
226226 if projects.size > 0 then
227227 start = true
228228 for project in projects
247247 when PRJ_TAB_WIKI
248248 title = "Wiki"
249249 url_suffix = ""
250 when PRJ_TAB_ACTIVITY
250 when PRJ_TAB_ACTIVITIES
251251 title = "Activity"
252 url_suffix = "/activity"
252 url_suffix = "/activities"
253253 when PRJ_TAB_REPOS
254254 title = "Repositories"
255255 url_suffix = "/repos"
toggle raw diff

app/views/activities/_ac_right_actionbox_post_message.html.erb

 
1<% form_for :message, :url => root_path, :html => {:method => :put, :name => 'postmessage', :id => 'input'} do |f| -%>
2
3 <h2>Post Message</h2>
4
5 <p>Add your current activity:</p>
6
7 <%= f.text_area(:activity, :rows => 4) -%>
8
9 <p>
10 <a href="javascript:document.postmessage.submit();" class='function'>Update</a>
11 </p>
12
13
14<% end -%>
toggle raw diff

app/views/activities/ac_index.html.erb

 
1<%= render :partial => "projects/ac_project_header", :locals => { :tab => PRJ_TAB_ACTIVITIES,
2 :subtab => PRJ_TAB_SUBTAB_NONE,
3 :project => @project,
4 :pagetitle => @title } %>
5
6<% if @is_member && @members.size > 1 %>
7<div id='projectmembers'>
8<ul>
9<% @members.each do |m| %>
10 <% if m.user != current_user %>
11 <li><%= m.user.fullname %></li>
12 <% end %>
13<% end %>
14</ul>
15</div>
16<% end %>
17
18<%= div_formattedtext_open %>
19
20<ul>
21<% @messages.each do |m| %>
22 <li>
23 <% unless @is_member %>
24 <strong><%= m.user.fullname %></strong>
25 <% end %>
26 <%= m.activity %>
27 <small>(<%= time_ago_in_words(m.created_at) %>)</small>
28 </li>
29<% end %>
30</ul>
31
32<%= div_formattedtext_close %>
33
34<%= render :partial => "projects/ac_project_footer" %>
toggle raw diff

app/views/projects/_ac_right_actionbox_post_message.html.erb

 
0<% form_for :message, :url => root_path, :html => {:method => :put, :name => 'postmessage', :id => 'input'} do |f| -%>
1
2 <h2>Post Message</h2>
3
4 <p>Add your current activity:</p>
5
6 <%= f.text_area(:activity, :rows => 4) -%>
7
8 <p>
9 <a href="javascript:document.postmessage.submit();" class='function'>Update</a>
10 </p>
11
12
13<% end -%>
toggle raw diff

app/views/projects/ac_activity_index.html.erb

 
0<%= render :partial => "ac_project_header", :locals => { :tab => PRJ_TAB_ACTIVITY,
1 :subtab => PRJ_TAB_SUBTAB_NONE,
2 :project => @project,
3 :pagetitle => @title } %>
4
5<% if @is_member && @members.size > 1 %>
6<div id='projectmembers'>
7<ul>
8<% @members.each do |m| %>
9 <% if m.user != current_user %>
10 <li><%= m.user.fullname %></li>
11 <% end %>
12<% end %>
13</ul>
14</div>
15<% end %>
16
17<%= div_formattedtext_open %>
18
19<ul>
20<% @messages.each do |m| %>
21 <li>
22 <% unless @is_member %>
23 <strong><%= m.user.fullname %></strong>
24 <% end %>
25 <%= m.activity %>
26 <small>(<%= time_ago_in_words(m.created_at) %>)</small>
27 </li>
28<% end %>
29</ul>
30
31<%= div_formattedtext_close %>
32
33<%= render :partial => "ac_project_footer" %>
toggle raw diff

config/initializers/gitlab_config.rb

 
1919
2020# Tabs for project page
2121PRJ_TAB_WIKI = 1
22PRJ_TAB_ACTIVITY = 2
22PRJ_TAB_ACTIVITIES = 2
2323PRJ_TAB_REPOS = 3
2424PRJ_TAB_ROADMAP = 4
2525PRJ_TAB_TICKETS = 5
2626PRJ_TAB_ARTICLES = 6
2727PRJ_TAB_FORUM = 7
28PRJ_TAB_ACTIVITY = 8
29PRJ_TAB_LOG = 9
30PRJ_TAB_CONFIG = 10
28PRJ_TAB_LOG = 8
29PRJ_TAB_CONFIG = 9
3130
3231PRJ_TAB_SUBTAB_NONE = 0
3332
toggle raw diff

config/routes.rb

 
11ActionController::Routing::Routes.draw do |map|
22
3 # The priority is based upon order of creation: first created -> highest priority.
4
5 # Sample of regular route:
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 # Keep in mind you can assign values other than :controller and :action
8
9 # Sample of named route:
10 # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
11 # This route can be invoked with purchase_url(:id => product.id)
12
13 # You can have the root of your site routed by hooking up ''
14 # -- just remember to delete public/index.html.
15 # map.connect '', :controller => "welcome"
16
17 # Allow downloading Web Service WSDL as a file with an extension
18 # instead of a file named 'wsdl'
19 #map.connect ':controller/service.wsdl', :action => 'wsdl'
203 VALID_SHA = /[a-zA-Z0-9~\{\}\^\.\-_]+/
214 map.root :controller => "site", :action => "index"
225
1919 #TODO Note the extra members :repository for Gitlab tabs (should these be added to a function that checks $application_mode?)
2020 map.resources :projects, :member => {:confirm_delete => :get,
2121 :forum => :get,
22 :activity => :get,
2322 :roadmap => :get,
2423 :log => :get,
2524 :config => :get
4848 end
4949 #FIXME these maybe should be down a level
5050 projects.resources(:articles)
51 projects.resources(:activities)
5152 projects.resources(:wikis)
5253 projects.resources(:milestones)
5354 projects.resources(:tickets)
54 #projects.resources(:events)
5555 #projects.resources(:members)
5656 end
5757 #projects.resource :respository
6868 map.about "about", :controller => "site", :action => "about"
6969 map.faq "about/faq", :controller => "site", :action => "faq"
7070
71 #
72 # Gitlab specific routes
73 #
7471 map.resources :articles, :has_many => [:comments], :has_one => [:category, :project]
7572 #map.articles 'archives', :controller => 'articles', :action => 'index'
7673 # Date based archive article links
9696 # Install the default route as the lowest priority.
9797 map.connect ':controller/:action/:id.:format'
9898 map.connect ':controller/:action/:id'
99
99100end
101
toggle raw diff

test/functional/activities_controller_test.rb

 
1require File.dirname(__FILE__) + '/../test_helper'
2
3class ActivitiesControllerTest < ActionController::TestCase
4 # Replace this with your real tests.
5 def test_truth
6 assert true
7 end
8end
toggle raw diff