Merge branch 'master' of gitorious.org:+fiit/gitorious/gitorious-fiit-mainline
[gitorious:gitorious-fiit-mainline.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         <% if(GitoriousConfig["authenticators"].index("password") != nil) -%>
64         <li>
65           <%= link_button_link_to(t("views.users.chg_passwd_action"), password_user_path(current_user),
66                 :class => "edit_account_password") -%>
67         </li>
68         <li>
69           <%= link_button_link_to(t("views.users.favorites_action"), favorites_path, 
70                 :class => "show_favorites") -%>
71         </li>
72         <% end -%>
73                 <% end -%>
74       </ul>
75       <div class="clear"></div>
76     </div>
77         <div class="content-container w-510">
78     <h2 class="activities">
79         <% if showing_newsfeed? %>
80                 Your news feed
81         <% else %>
82                 <%= t("views.site.dashboard.activities") -%>
83         <% end %>
84                 <%= feed_icon @atom_auto_discovery_url -%>
85         <% if is_current_user?(@user) -%>
86         <small>(<%= newsfeed_or_user_events_link -%>)</small>
87         <% end -%>
88     </h2>
89
90 <% if @events.empty? -%>
91       <p class="hint">
92         <%= personified(@user, "You have", "#{@user.title} has") -%> no news.
93       </p>
94     <% else -%>
95       <div id="user_events" class="w-510">
96         <%= render :partial => "events/events", :locals => { :events => @events, :container_css_class => "w-510" } -%>
97       </div>
98     <% end -%>
99   </div>
100         </div>
101   <div id="right" class="w-390">
102     <% pull_box("Open merge requests for you", :class => "merge-requests pull-box-390") do %>
103       <ul>
104         <% @user.review_repositories_with_open_merge_request_count.each do |repo| %>
105           <li>
106             <%= link_to(repo.url_path + ": " + repo.open_merge_request_count,
107                  repo_owner_path(repo, [repo.project, repo, :merge_requests])) %>
108           </li>
109         <% end %>
110       </ul>
111     <% end if show_merge_request_count_for_user?(@user) %>
112
113
114     <% pull_box("You are watching", :class => "your-favorites favorite pull-box-390") do %>
115       <div class="filters">
116         <ul>
117                         <li><strong>Sort by:</strong></li>
118           <% if is_current_user?(@user) -%>
119             <li><a class="foreign" href="#not-mine">Not yours</a></li>
120             <li><a class="mine" href="#mine">Yours</a></li>
121           <% end -%>
122           <li>
123             <a href="#merge-requests" class="merge-requests">Merge requests</a>
124           </li>
125           <li>
126             <a href="#repos" class="repositories">Repositories</a>
127           </li>
128           <li><a href="#all" class="all">All</a></li>
129         </ul>
130       </div>
131       <ul class="with_icons">
132         <% @favorites.each do |favorite| %>
133           <li class="<%= css_classes_for(favorite) -%>">
134             <%= link_to_watchable(favorite) -%>
135           </li>
136         <% end %>
137         <% if @favorites.blank? -%>
138           <p class="hint"><%= no_watchings_notice_for(@user) -%></p>
139         <% end -%>
140       </ul>
141     <% end %>
142
143     <% pull_box("Your projects", :class => "your-projects pull-box-390") do -%>
144       <ul class="with_icons">
145       <% @projects.each do |project| -%>
146         <li class="project">
147           <%= link_to h(project.title), project -%>
148         </li>
149       <% end -%>
150
151       </ul>
152       <% if is_current_user?(@user) -%>
153         <div class="pull-box-links">
154       <%= link_button_link_to(t("views.projects.create_new"), new_project_path, {
155             :id => "new-project-button"}) %>
156         </div>
157       <% end -%>
158     <% end -%>
159
160     <% pull_box("Your repositories", :class => "your-repositories pull-box-390") do -%>
161     <% if @repositories.blank? -%>
162       <% if is_current_user?(@user) -%>
163
164
165         You currently do not have any repository clones. You can clone
166         a repository you wish to contribute to by going to a
167         repository overview page and clicking the "Clone repository" button
168         in the repository information box.</p>
169
170       <% else -%>
171        <p class="hint"> <%=h @user.title -%> currently does not have any repository clones.</p>
172       <% end -%>
173     <% else -%>
174       <ul class="with_icons">
175         <% @repositories.each do |repo| -%>
176           <li class="repository">
177             <%= link_to h(repo.url_path),
178                   repo_owner_path(repo, [repo.project, repo]) -%>
179           </li>
180         <% end -%>
181       </ul>
182     <% end -%>
183 <% end %>
184
185         <% pull_box("Your team memberships", :class => "teams pull-box-390") do -%>
186       <ul>
187       <% @user.groups.each do |group| -%>
188         <li style="clear:left">
189           <span style="float:left; padding: 2px 10px 2px 2px">
190             <%= image_tag(group.avatar.url(:thumb), :alt => "Avatar", :width => "16") %>
191           </span>
192           <%= link_to h(group.name), group_path(group) -%>
193         </li>
194       <% end -%>
195       </ul>
196     <% end unless @user.groups.blank? -%>
197
198   </div>
199   <div class="clear"></div>
200 </div>