Merge remote-tracking branch 'official/master' into saltation
[gitorious:taladars-gitorious-saltation.git] / app / views / site / dashboard.html.erb
1  <%
2 #--
3 #   Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
4 #
5 #   This program is free software: you can redistribute it and/or modify
6 #   it under the terms of the GNU Affero General Public License as published by
7 #   the Free Software Foundation, either version 3 of the License, or
8 #   (at your option) any later version.
9 #
10 #   This program is distributed in the hope that it will be useful,
11 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #   GNU Affero General Public License for more details.
14 #
15 #   You should have received a copy of the GNU Affero General Public License
16 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #++
18 %>
19
20 <% @page_title = "Your dashboard" -%>
21 <%= breadcrumbs_from(@user) -%>
22
23 <div class="with_divider">
24   <div id="left" class="w-510">
25     <div class="user-profile">
26       <%= link_to(avatar(@user, { :size => 64 }), @user, {:class => "avatar"}) %>
27       <div class="profile-data">
28         <h1>~<%= link_to h(@user.login), @user -%></h1>
29
30         <ul class="details">
31           <% unless @user.fullname.blank? %>
32             <li><%= h(@user.fullname) -%></li>
33           <% end %>
34           <% if @user.public_email? -%>
35           <li class="email">
36             <%= mail_to(@user.email, mangled_mail(@user.email), :encode => "javascript") -%>
37           </li>
38           <% end -%>
39           <% if @user.url %>
40           <li><a rel="me" href="<%=h @user.url -%>"><%=h @user.url -%></a></li>
41           <% end -%>
42           <li>
43             <%= t("views.users.member_for") %>
44             <%= time_ago_in_words(@user.created_at) %>
45           </li>
46         </ul>
47       </div>
48
49       <ul class="buttons">
50         <% if is_current_user?(@user)  -%>
51         <li>
52           <%= link_button_link_to(t("views.keys.manage_ssh_keys"),
53             user_keys_path(current_user), :class => "key") -%>
54         </li>
55         <li>
56           <%= link_button_link_to(t("views.aliases.manage_aliases"),
57                 user_aliases_path(current_user), :class => "alias") -%>
58         </li>
59         <li>
60           <%= link_button_link_to(t("views.users.edit_action"), edit_user_url(current_user),
61                 :class => "edit_account") -%>
62         </li>
63         <li>
64           <%= link_button_link_to(t("views.users.chg_passwd_action"), password_user_path(current_user),
65                 :class => "edit_account_password") -%>
66         </li>
67         <li>
68           <%= link_button_link_to(t("views.users.favorites_action"), favorites_path, 
69                 :class => "show_favorites") -%>
70         </li>
71         <% end -%>
72       </ul>
73       <div class="clear"></div>
74     </div>
75         <div class="content-container w-510">
76     <h2 class="activities">
77         <% if showing_newsfeed? %>
78                 Your news feed
79         <% else %>
80                 <%= t("views.site.dashboard.activities") -%>
81         <% end %>
82                 <%= feed_icon @atom_auto_discovery_url -%>
83         <% if is_current_user?(@user) -%>
84         <small>(<%= newsfeed_or_user_events_link -%>)</small>
85         <% end -%>
86     </h2>
87     
88 <% if @events.empty? -%>
89       <p class="hint">
90         <%= personified(@user, "You have", "#{@user.title} has") -%> no news.
91       </p>
92     <% else -%>
93       <div id="user_events" class="w-510">
94         <%= render :partial => "events/events", :locals => { :events => @events, :container_css_class => "w-510" } -%>
95       </div>
96     <% end -%>
97   </div>
98         </div>
99   <div id="right" class="w-390">
100     <% pull_box("Open merge requests for you", :class => "merge-requests pull-box-390") do %>
101       <ul>
102         <% @user.review_repositories_with_open_merge_request_count.each do |repo| %>
103           <li>
104             <%= link_to(repo.url_path + ": " + repo.open_merge_request_count,
105                  repo_owner_path(repo, [repo.project, repo, :merge_requests])) %> <span class="hint"><%= private_abbr(repo) %></span>
106           </li>
107         <% end %>
108       </ul>
109     <% end if show_merge_request_count_for_user?(@user) %>
110
111
112     <% pull_box("You are watching", :class => "your-favorites favorite pull-box-390") do %>
113       <div class="filters">
114         <ul>
115                         <li><strong>Sort by:</strong></li>
116           <% if is_current_user?(@user) -%>
117             <li><a class="foreign" href="#not-mine">Not yours</a></li>
118             <li><a class="mine" href="#mine">Yours</a></li>
119           <% end -%>
120           <li>
121             <a href="#merge-requests" class="merge-requests">Merge requests</a>
122           </li>
123           <li>
124             <a href="#repos" class="repositories">Repositories</a>
125           </li>
126           <li><a href="#all" class="all">All</a></li>
127         </ul>
128       </div>
129       <ul class="with_icons">
130         <% @favorites.each do |favorite| %>
131           <li class="<%= css_classes_for(favorite) -%>">
132             <%= link_to_watchable(favorite) -%> <span class="hint"><%= private_abbr(favorite) %></span>
133           </li>
134         <% end %>
135         <% if @favorites.blank? -%>
136           <p class="hint"><%= no_watchings_notice_for(@user) -%></p>
137         <% end -%>
138       </ul>
139     <% end %>
140
141     <% pull_box("Your projects", :class => "your-projects pull-box-390") do -%>
142       <ul class="with_icons">
143       <% @projects.each do |project| -%>
144         <li class="project">
145           <%= link_to h(project.title), project -%> <span class="hint"><%= private_abbr(project) %></span>
146         </li>
147       <% end -%>
148
149       </ul>
150       <% if is_current_user?(@user) -%>
151         <div class="pull-box-links">    
152       <%= link_button_link_to(t("views.projects.create_new"), new_project_path, {
153             :id => "new-project-button"}) %>
154         </div>
155       <% end -%>
156     <% end -%>
157
158     <% pull_box("Your repositories", :class => "your-repositories pull-box-390") do -%>
159     <% if @repositories.blank? -%>
160       <% if is_current_user?(@user) -%>
161                 
162       
163         You currently do not have any repository clones. You can clone
164         a repository you wish to contribute to by going to a
165         repository overview page and clicking the "Clone repository" button
166         in the repository information box.</p>
167                 
168       <% else -%>
169        <p class="hint"> <%=h @user.title -%> currently does not have any repository clones.</p>
170       <% end -%>
171     <% else -%>
172       <ul class="with_icons">
173         <% @repositories.each do |repo| -%>
174           <li class="repository">
175             <%= link_to h(repo.url_path),
176                   repo_owner_path(repo, [repo.project, repo]) -%> <span class="hint"><%= private_abbr(repo) %></span>
177           </li>
178         <% end -%>
179       </ul>
180     <% end -%>
181 <% end %>
182
183         <% pull_box("Your team memberships", :class => "teams pull-box-390") do -%>
184       <ul>
185       <% @user.groups.each do |group| -%>
186         <li style="clear:left">
187           <span style="float:left; padding: 2px 10px 2px 2px">
188             <%= image_tag(group.avatar.url(:thumb), :alt => "Avatar", :width => "16") %>
189           </span>
190           <%= link_to h(group.name), group_path(group) -%>
191         </li>
192       <% end -%>
193       </ul>
194     <% end unless @user.groups.blank? -%>
195
196   </div>
197   <div class="clear"></div>
198 </div>