Revision 912:5e80956cc792 app/views/my

View differences:

app/views/my/_block.html.erb
1
<div id="block_<%= block_name.dasherize %>" class="mypage-box">
2

  
3
    <div style="float:right;margin-right:16px;z-index:500;">
4
    <%= link_to_remote "", {
5
        :url => { :action => "remove_block", :block => block_name },
6
        :complete => "removeBlock('block_#{block_name.dasherize}')" },
7
        :class => "close-icon"
8
         %>
9
    </div>
10

  
11
    <div class="handle">
12
    <%= render :partial => "my/blocks/#{block_name}", :locals => { :user => user } %>
13
    </div>
14
</div>
app/views/my/_block.rhtml
1
<div id="block_<%= block_name.dasherize %>" class="mypage-box">
2

  
3
    <div style="float:right;margin-right:16px;z-index:500;">
4
    <%= link_to_remote "", {
5
        :url => { :action => "remove_block", :block => block_name },
6
        :complete => "removeBlock('block_#{block_name.dasherize}')" },
7
        :class => "close-icon"
8
         %>        
9
    </div>
10
     
11
    <div class="handle">
12
	<%= render :partial => "my/blocks/#{block_name}", :locals => { :user => user } %>
13
	</div>
14
</div>
app/views/my/_sidebar.html.erb
1
<h3><%=l(:label_my_account)%></h3>
2

  
3
<p><%=l(:field_login)%>: <strong><%= link_to_user(@user, :format => :username) %></strong><br />
4
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>
5

  
6

  
7
<h4><%= l(:label_feeds_access_key) %></h4>
8

  
9
<p>
10
<% if @user.rss_token %>
11
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
12
<% else %>
13
<%= l(:label_missing_feeds_access_key) %>
14
<% end %>
15
(<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>)
16
</p>
17

  
18
<% if Setting.rest_api_enabled? %>
19
<h4><%= l(:label_api_access_key) %></h4>
20
<div>
21
  <%= link_to_function(l(:button_show), "$('api-access-key').toggle();")%>
22
  <pre id='api-access-key' class='autoscroll'><%= h(@user.api_key) %></pre>
23
</div>
24
<%= javascript_tag("$('api-access-key').hide();") %>
25
<p>
26
<% if @user.api_token %>
27
<%= l(:label_api_access_key_created_on, distance_of_time_in_words(Time.now, @user.api_token.created_on)) %>
28
<% else %>
29
<%= l(:label_missing_api_access_key) %>
30
<% end %>
31
(<%= link_to l(:button_reset), {:action => 'reset_api_key'}, :method => :post %>)
32
</p>
33
<% end %>
app/views/my/_sidebar.rhtml
1
<h3><%=l(:label_my_account)%></h3>
2

  
3
<p><%=l(:field_login)%>: <strong><%= link_to_user(@user, :format => :username) %></strong><br />
4
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %></p>
5

  
6

  
7
<h4><%= l(:label_feeds_access_key) %></h4>
8

  
9
<p>
10
<% if @user.rss_token %>
11
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
12
<% else %>
13
<%= l(:label_missing_feeds_access_key) %>
14
<% end %>
15
(<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>)
16
</p>
17

  
18
<% if Setting.rest_api_enabled? %>
19
<h4><%= l(:label_api_access_key) %></h4>
20
<div>
21
  <%= link_to_function(l(:button_show), "$('api-access-key').toggle();")%>
22
  <pre id='api-access-key' class='autoscroll'><%= h(@user.api_key) %></pre>
23
</div>
24
<%= javascript_tag("$('api-access-key').hide();") %>
25
<p>
26
<% if @user.api_token %>
27
<%= l(:label_api_access_key_created_on, distance_of_time_in_words(Time.now, @user.api_token.created_on)) %>
28
<% else %>
29
<%= l(:label_missing_api_access_key) %>
30
<% end %>
31
(<%= link_to l(:button_reset), {:action => 'reset_api_key'}, :method => :post %>)
32
</p>
33
<% end %>
app/views/my/account.html.erb
1
<%= javascript_include_tag "ssamr_institutions" %>
2

  
3
<div class="contextual">
4
<%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %>
5
<%= call_hook(:view_my_account_contextual, :user => @user)%>
6
</div>
7

  
8
<h2><%=l(:label_my_account)%></h2>
9
<%= error_messages_for 'user' %>
10

  
11
<% form_for :user, @user, :url => { :action => "account" },
12
                          :builder => TabularFormBuilder,
13
                          :lang => current_language,
14
                          :html => { :id => 'my_account_form' } do |f| %>
15

  
16

  
17
<div class="splitcontentleft">
18
<fieldset class="box tabular">
19
  <legend><%=l(:label_information_plural)%></legend>
20
  <p><%= f.text_field :firstname, :required => true %></p>
21
  <p><%= f.text_field :lastname, :required => true %></p>
22
  <p><%= f.text_field :mail, :required => true %></p>
23
  <p><%= f.select :language, lang_options_for_select %></p>
24
  <% if Setting.openid? %>
25
  <p><%= f.text_field :identity_url  %></p>
26
  <% end %>
27

  
28
  <% @user.custom_field_values.select(&:editable?).each do |value| %>
29
    <p><%= custom_field_tag_with_label :user, value %></p>
30
  <% end %>
31

  
32
  <%= call_hook(:view_my_account, :user => @user, :form => f) %>
33
</fieldset>
34

  
35
<h3><%=l(:label_ssamr_details)%></h3>
36
<div class="box tabular">
37
    <% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>
38
       <p>
39
         <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 25, :required => true, :class => 'wiki-edit' %>
40
       </p>
41

  
42

  
43
            <p><label for="institution"><%=l("field_ssamr_user_detail.institution")%> <span class="required">*</span></label>
44
			<nobr>
45
              <%= ssamr_user_detail.radio_button :institution_type, true %>
46
              <%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name, {:selected => @selected_institution_id, :prompt => true} ).gsub('&amp;', '&') %>
47
            </nobr>
48
			</p>
49

  
50
            <p>
51
				<nobr>
52
               		<%= ssamr_user_detail.radio_button :institution_type, false %> Other:
53
               		<%= ssamr_user_detail.text_field :other_institution, :size => 19 %>
54
            	</nobr>
55
            </p>
56
    <% end %>
57
</div>
58

  
59

  
60
<%= submit_tag l(:button_save) %>
61
</div>
62

  
63
<div class="splitcontentright">
64
<fieldset class="box">
65
  <legend><%=l(:field_mail_notification)%></legend>
66
  <%= render :partial => 'users/mail_notifications' %>
67
</fieldset>
68

  
69
<fieldset class="box tabular">
70
  <legend><%=l(:label_preferences)%></legend>
71
  <%= render :partial => 'users/preferences' %>
72
</fieldset>
73

  
74
</div>
75
<% end %>
76

  
77

  
78

  
79

  
80

  
81

  
82

  
83

  
84

  
85
<% content_for :sidebar do %>
86
<%= render :partial => 'sidebar' %>
87
<% end %>
88

  
89
<% html_title(l(:label_my_account)) -%>
app/views/my/account.rhtml
1
<%= javascript_include_tag "ssamr_institutions" %>
2

  
3
<div class="contextual">
4
<%= link_to(l(:button_change_password), :action => 'password') if @user.change_password_allowed? %>
5
<%= call_hook(:view_my_account_contextual, :user => @user)%>
6
</div>
7
<h2><%=l(:label_my_account)%></h2>
8
<%= error_messages_for 'user' %>
9

  
10
<% form_for :user, @user, :url => { :action => "account" }, 
11
                          :builder => TabularFormBuilder, 
12
                          :lang => current_language,
13
                          :html => { :id => 'my_account_form' } do |f| %>
14

  
15

  
16
<div class="splitcontentleft">
17
<h3><%=l(:label_information_plural)%></h3>
18
<div class="box tabular">
19
<p><%= f.text_field :firstname, :required => true %></p>
20
<p><%= f.text_field :lastname, :required => true %></p>
21
<p><%= f.text_field :mail, :required => true %></p>
22
<p><%= f.select :language, lang_options_for_select %></p>
23
<% if Setting.openid? %>
24
<p><%= f.text_field :identity_url  %></p>
25
<% end %>
26

  
27
<% @user.custom_field_values.select(&:editable?).each do |value| %>
28
	<p><%= custom_field_tag_with_label :user, value %></p>
29
<% end %>
30

  
31
<%= call_hook(:view_my_account, :user => @user, :form => f) %>
32
</div>
33

  
34
<h3><%=l(:label_ssamr_details)%></h3>
35
<div class="box tabular">
36
    <% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>
37
       <p>
38
         <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 25, :required => true, :class => 'wiki-edit' %>
39
       </p>
40

  
41

  
42
            <p><label for="institution"><%=l("field_ssamr_user_detail.institution")%> <span class="required">*</span></label>
43
			<nobr>
44
              <%= ssamr_user_detail.radio_button :institution_type, true %>
45
              <%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name, {:selected => @selected_institution_id, :prompt => true} ).gsub('&amp;', '&') %>
46
            </nobr>
47
			</p>
48

  
49
            <p>
50
				<nobr>
51
               		<%= ssamr_user_detail.radio_button :institution_type, false %> Other:
52
               		<%= ssamr_user_detail.text_field :other_institution, :size => 19 %>
53
            	</nobr>
54
            </p>
55
    <% end %>
56
</div>
57

  
58

  
59
<%= submit_tag l(:button_save) %>
60
</div>
61

  
62
<div class="splitcontentright">
63
<h3><%=l(:field_mail_notification)%></h3>
64
<div class="box">
65
<%= render :partial => 'users/mail_notifications' %>
66
</div>
67

  
68
<h3><%=l(:label_preferences)%></h3>
69
<div class="box tabular">
70
<%= render :partial => 'users/preferences' %>
71
</div>
72

  
73
</div>
74
<% end %>
75

  
76

  
77

  
78

  
79

  
80

  
81

  
82

  
83

  
84
<% content_for :sidebar do %>
85
<%= render :partial => 'sidebar' %>
86
<% end %>
87

  
88
<% html_title(l(:label_my_account)) -%>
app/views/my/blocks/_calendar.html.erb
1
<h3><%= l(:label_calendar) %></h3>
2

  
3
<% calendar = Redmine::Helpers::Calendar.new(Date.today, current_language, :week)
4
   calendar.events = Issue.visible.find :all,
5
                     :conditions => ["#{Issue.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", calendar.startdt, calendar.enddt, calendar.startdt, calendar.enddt],
6
                     :include => [:project, :tracker, :priority, :assigned_to] unless @user.projects.empty? %>
7

  
8
<%= render :partial => 'common/calendar', :locals => {:calendar => calendar } %>
app/views/my/blocks/_calendar.rhtml
1
<h3><%= l(:label_calendar) %></h3>
2

  
3
<% calendar = Redmine::Helpers::Calendar.new(Date.today, current_language, :week)
4
   calendar.events = Issue.visible.find :all,
5
                     :conditions => ["#{Issue.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", calendar.startdt, calendar.enddt, calendar.startdt, calendar.enddt],
6
                     :include => [:project, :tracker, :priority, :assigned_to] unless @user.projects.empty? %>
7

  
8
<%= render :partial => 'common/calendar', :locals => {:calendar => calendar } %>
app/views/my/blocks/_documents.html.erb
1
<h3><%=l(:label_document_plural)%></h3>
2

  
3
<% project_ids = @user.projects.select {|p| @user.allowed_to?(:view_documents, p)}.collect(&:id) %>
4
<%= render(:partial => 'documents/document',
5
           :collection => Document.find(:all,
6
                         :limit => 10,
7
                         :order => "#{Document.table_name}.created_on DESC",
8
                         :conditions => "#{Document.table_name}.project_id in (#{project_ids.join(',')})",
9
                         :include => [:project])) unless project_ids.empty? %>
app/views/my/blocks/_documents.rhtml
1
<h3><%=l(:label_document_plural)%></h3>
2

  
3
<% project_ids = @user.projects.select {|p| @user.allowed_to?(:view_documents, p)}.collect(&:id) %>
4
<%= render(:partial => 'documents/document',
5
           :collection => Document.find(:all,
6
                         :limit => 10,
7
                         :order => "#{Document.table_name}.created_on DESC",
8
                         :conditions => "#{Document.table_name}.project_id in (#{project_ids.join(',')})",
9
                         :include => [:project])) unless project_ids.empty? %>
app/views/my/blocks/_issuesassignedtome.html.erb
1
<h3><%=l(:label_assigned_to_me_issues)%> (<%= Issue.visible.open.count(:conditions => {:assigned_to_id => ([User.current.id] + User.current.group_ids)})%>)</h3>
2

  
3
<% assigned_issues = Issue.visible.open.find(:all,
4
                                :conditions => {:assigned_to_id => ([User.current.id] + User.current.group_ids)},
5
                                :limit => 10,
6
                                :include => [ :status, :project, :tracker, :priority ],
7
                                :order => "#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC") %>
8
<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
9
<% if assigned_issues.length > 0 %>
10
<p class="small"><%= link_to l(:label_issue_view_all), :controller => 'issues',
11
                                                       :action => 'index',
12
                                                       :set_filter => 1,
13
                                                       :assigned_to_id => 'me',
14
                                                       :sort => 'priority:desc,updated_on:desc' %></p>
15
<% end %>
16

  
17
<% content_for :header_tags do %>
18
<%= auto_discovery_link_tag(:atom,
19
                            {:controller => 'issues', :action => 'index', :set_filter => 1,
20
                             :assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key},
21
                            {:title => l(:label_assigned_to_me_issues)}) %>
22
<% end %>
app/views/my/blocks/_issuesassignedtome.rhtml
1
<h3><%=l(:label_assigned_to_me_issues)%> (<%= Issue.visible.open.count(:conditions => {:assigned_to_id => User.current.id})%>)</h3>
2

  
3
<% assigned_issues = Issue.visible.open.find(:all, 
4
                                :conditions => {:assigned_to_id => User.current.id},
5
                                :limit => 10, 
6
                                :include => [ :status, :project, :tracker, :priority ], 
7
                                :order => "#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC") %>
8
<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
9
<% if assigned_issues.length > 0 %>
10
<p class="small"><%= link_to l(:label_issue_view_all), :controller => 'issues',
11
																											 :action => 'index',
12
																											 :set_filter => 1,
13
																											 :assigned_to_id => 'me',
14
																											 :sort => 'priority:desc,updated_on:desc' %></p>
15
<% end %>
16

  
17
<% content_for :header_tags do %>
18
<%= auto_discovery_link_tag(:atom, 
19
                            {:controller => 'issues', :action => 'index', :set_filter => 1,
20
                             :assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key},
21
                            {:title => l(:label_assigned_to_me_issues)}) %>
22
<% end %>
app/views/my/blocks/_issuesreportedbyme.html.erb
1
<h3><%=l(:label_reported_issues)%> (<%= Issue.visible.count(:conditions => { :author_id => User.current.id }) %>)</h3>
2

  
3
<% reported_issues = Issue.visible.find(:all,
4
                                :conditions => { :author_id => User.current.id },
5
                                :limit => 10,
6
                                :include => [ :status, :project, :tracker ],
7
                                :order => "#{Issue.table_name}.updated_on DESC") %>
8
<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>
9
<% if reported_issues.length > 0 %>
10
<p class="small"><%= link_to l(:label_issue_view_all), :controller => 'issues',
11
                                                       :action => 'index',
12
                                                       :set_filter => 1,
13
                                                       :status_id => '*',
14
                                                       :author_id => 'me',
15
                                                       :sort => 'updated_on:desc' %></p>
16
<% end %>
17

  
18
<% content_for :header_tags do %>
19
<%= auto_discovery_link_tag(:atom,
20
                            {:controller => 'issues', :action => 'index', :set_filter => 1,
21
                             :author_id => 'me', :format => 'atom', :key => User.current.rss_key},
22
                            {:title => l(:label_reported_issues)}) %>
23
<% end %>
app/views/my/blocks/_issuesreportedbyme.rhtml
1
<h3><%=l(:label_reported_issues)%> (<%= Issue.visible.count(:conditions => { :author_id => User.current.id }) %>)</h3>
2

  
3
<% reported_issues = Issue.visible.find(:all, 
4
                                :conditions => { :author_id => User.current.id },
5
                                :limit => 10, 
6
                                :include => [ :status, :project, :tracker ], 
7
                                :order => "#{Issue.table_name}.updated_on DESC") %>
8
<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>
9
<% if reported_issues.length > 0 %>
10
<p class="small"><%= link_to l(:label_issue_view_all), :controller => 'issues',
11
																											 :action => 'index',
12
																											 :set_filter => 1,
13
																											 :status_id => '*',
14
																											 :author_id => 'me',
15
																											 :sort => 'updated_on:desc' %></p>
16
<% end %>
17

  
18
<% content_for :header_tags do %>
19
<%= auto_discovery_link_tag(:atom, 
20
                            {:controller => 'issues', :action => 'index', :set_filter => 1,
21
                             :author_id => 'me', :format => 'atom', :key => User.current.rss_key},
22
                            {:title => l(:label_reported_issues)}) %>
23
<% end %>
app/views/my/blocks/_issueswatched.html.erb
1
<h3><%=l(:label_watched_issues)%> (<%= Issue.visible.watched_by(user.id).count %>)</h3>
2
<% watched_issues = Issue.visible.on_active_project.watched_by(user.id).recently_updated.with_limit(10) %>
3

  
4
<%= render :partial => 'issues/list_simple', :locals => { :issues => watched_issues } %>
5
<% if watched_issues.length > 0 %>
6
<p class="small"><%= link_to l(:label_issue_view_all_watched), :controller => 'issues',
7
                                                       :action => 'index',
8
                                                       :set_filter => 1,
9
                                                       :watcher_id => 'me',
10
                                                       :sort => 'updated_on:desc' %></p>
11
<% end %>
app/views/my/blocks/_issueswatched.rhtml
1
<h3><%=l(:label_watched_issues)%> (<%= Issue.visible.watched_by(user.id).count %>)</h3>
2
<% watched_issues = Issue.visible.on_active_project.watched_by(user.id).recently_updated.with_limit(10) %>
3

  
4
<%= render :partial => 'issues/list_simple', :locals => { :issues => watched_issues } %>
5
<% if watched_issues.length > 0 %>
6
<p class="small"><%= link_to l(:label_issue_view_all_watched), :controller => 'issues',
7
																											 :action => 'index',
8
																											 :set_filter => 1,
9
																											 :watcher_id => 'me',
10
																											 :sort => 'updated_on:desc' %></p>
11
<% end %>
app/views/my/blocks/_news.html.erb
1
<h3><%=l(:label_news_latest)%></h3>
2

  
3
<%= render(:partial => 'news/news',
4
            :collection => News.find(:all,
5
                                     :limit => 10,
6
                                     :order => "#{News.table_name}.created_on DESC",
7
                                     :conditions => "#{News.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
8
                                     :include => [:project, :author])) unless @user.projects.empty? %>
app/views/my/blocks/_news.rhtml
1
<h3><%=l(:label_news_latest)%></h3>
2

  
3
<%= render(:partial => 'news/news', 
4
            :collection => News.find(:all,
5
                                     :limit => 10,
6
                                     :order => "#{News.table_name}.created_on DESC",
7
                                     :conditions => "#{News.table_name}.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
8
                                     :include => [:project, :author])) unless @user.projects.empty? %>
app/views/my/blocks/_timelog.html.erb
1
<h3><%=l(:label_spent_time)%> (<%= l(:label_last_n_days, 7) %>)</h3>
2
<%
3
entries = TimeEntry.find(:all,
4
        :conditions => ["#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", @user.id, Date.today - 6, Date.today],
5
        :include => [:activity, :project, {:issue => [:tracker, :status]}],
6
        :order => "#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC")
7
entries_by_day = entries.group_by(&:spent_on)
8
%>
9

  
10
<div class="total-hours">
11
<p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
12
</div>
13

  
14
<% if entries.any? %>
15
<table class="list time-entries">
16
<thead><tr>
17
<th><%= l(:label_activity) %></th>
18
<th><%= l(:label_project) %></th>
19
<th><%= l(:field_comments) %></th>
20
<th><%= l(:field_hours) %></th>
21
<th></th>
22
</tr></thead>
23
<tbody>
24
<% entries_by_day.keys.sort.reverse.each do |day| %>
25
    <tr class="odd">
26
    <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
27
    <td colspan="2"></td>
28
    <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
29
    <td></td>
30
    </tr>
31
    <% entries_by_day[day].each do |entry| -%>
32
    <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
33
    <td class="activity"><%=h entry.activity %></td>
34
    <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
35
    <td class="comments"><%=h entry.comments %></td>
36
    <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
37
    <td align="center">
38
    <% if entry.editable_by?(@user) -%>
39
        <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
40
                                           :title => l(:button_edit) %>
41
        <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry},
42
                                             :confirm => l(:text_are_you_sure),
43
                                             :method => :delete,
44
                                             :title => l(:button_delete) %>
45
    <% end -%>
46
    </td>
47
    </tr>
48
    <% end -%>
49
<% end -%>
50
</tbody>
51
</table>
52
<% end %>
app/views/my/blocks/_timelog.rhtml
1
<h3><%=l(:label_spent_time)%> (<%= l(:label_last_n_days, 7) %>)</h3>
2
<% 
3
entries = TimeEntry.find(:all,
4
				:conditions => ["#{TimeEntry.table_name}.user_id = ? AND #{TimeEntry.table_name}.spent_on BETWEEN ? AND ?", @user.id, Date.today - 6, Date.today],
5
				:include => [:activity, :project, {:issue => [:tracker, :status]}],
6
				:order => "#{TimeEntry.table_name}.spent_on DESC, #{Project.table_name}.name ASC, #{Tracker.table_name}.position ASC, #{Issue.table_name}.id ASC")
7
entries_by_day = entries.group_by(&:spent_on)
8
%>
9

  
10
<div class="total-hours">
11
<p><%= l(:label_total) %>: <%= html_hours("%.2f" % entries.sum(&:hours).to_f) %></p>
12
</div>
13

  
14
<% if entries.any? %>
15
<table class="list time-entries">
16
<thead><tr>
17
<th><%= l(:label_activity) %></th>
18
<th><%= l(:label_project) %></th>
19
<th><%= l(:field_comments) %></th>
20
<th><%= l(:field_hours) %></th>
21
<th></th>
22
</tr></thead>
23
<tbody>
24
<% entries_by_day.keys.sort.reverse.each do |day| %>
25
    <tr class="odd">
26
    <td><strong><%= day == Date.today ? l(:label_today).titleize : format_date(day) %></strong></td>
27
    <td colspan="2"></td>
28
    <td class="hours"><em><%= html_hours("%.2f" % entries_by_day[day].sum(&:hours).to_f) %></em></td>
29
    <td></td>
30
    </tr>
31
    <% entries_by_day[day].each do |entry| -%>
32
    <tr class="time-entry" style="border-bottom: 1px solid #f5f5f5;">
33
    <td class="activity"><%=h entry.activity %></td>
34
    <td class="subject"><%=h entry.project %> <%= ' - ' + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
35
    <td class="comments"><%=h entry.comments %></td>
36
    <td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
37
    <td align="center">
38
    <% if entry.editable_by?(@user) -%>
39
        <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry},
40
                                           :title => l(:button_edit) %>
41
        <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry},
42
                                             :confirm => l(:text_are_you_sure),
43
                                             :method => :delete,
44
                                             :title => l(:button_delete) %>
45
    <% end -%>
46
    </td>
47
    </tr>
48
    <% end -%>
49
<% end -%>
50
</tbody>
51
</table>
52
<% end %>
app/views/my/page.html.erb
1
<div class="contextual">
2
    <%= link_to l(:label_personalize_page), :action => 'page_layout' %>
3
    <%= '| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
4
</div>
5

  
6
<h2><%=l(:label_my_page)%></h2>
7

  
8
<div id="list-top">
9
  <% @blocks['top'].each do |b|
10
     next unless MyController::BLOCKS.keys.include? b  %>
11
  <div class="mypage-box">
12
    <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
13
  </div>
14
  <% end if @blocks['top'] %>
15
</div>
16

  
17
<div id="list-left" class="splitcontentleft">
18
  <% @blocks['left'].each do |b|
19
     next unless MyController::BLOCKS.keys.include? b %>
20
  <div class="mypage-box">
21
    <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
22
  </div>
23
  <% end if @blocks['left'] %>
24
</div>
25

  
26
<div id="list-right" class="splitcontentright">
27
  <% @blocks['right'].each do |b|
28
     next unless MyController::BLOCKS.keys.include? b %>
29
  <div class="mypage-box">
30
    <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
31
  </div>
32
  <% end if @blocks['right'] %>
33
</div>
34

  
35
<%= context_menu :controller => 'issues', :action => 'context_menu' %>
36

  
37
<% html_title(l(:label_my_page)) -%>
app/views/my/page.rhtml
1
<div class="contextual">
2
    <%= link_to l(:label_personalize_page), :action => 'page_layout' %>
3
    <%= '| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
4
</div>
5

  
6
<h2><%=l(:label_my_page)%></h2>
7

  
8
<div id="list-top">
9
	<% @blocks['top'].each do |b| 
10
	   next unless MyController::BLOCKS.keys.include? b	%>
11
	<div class="mypage-box">        
12
		<%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
13
	</div>
14
	<% end if @blocks['top'] %>
15
</div>
16

  
17
<div id="list-left" class="splitcontentleft">
18
	<% @blocks['left'].each do |b| 
19
	   next unless MyController::BLOCKS.keys.include? b %>
20
	<div class="mypage-box">        
21
		<%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
22
	</div>
23
	<% end if @blocks['left'] %>
24
</div>
25

  
26
<div id="list-right" class="splitcontentright">
27
	<% @blocks['right'].each do |b| 
28
	   next unless MyController::BLOCKS.keys.include? b %>
29
	<div class="mypage-box">        
30
		<%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
31
	</div>
32
	<% end if @blocks['right'] %>
33
</div>
34

  
35
<%= context_menu :controller => 'issues', :action => 'context_menu' %>
36

  
37
<% html_title(l(:label_my_page)) -%>
app/views/my/page_layout.html.erb
1
<script language="JavaScript">
2
//<![CDATA[
3
function recreateSortables() {
4
    Sortable.destroy('list-top');
5
    Sortable.destroy('list-left');
6
    Sortable.destroy('list-right');
7

  
8
  Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'top') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
9
  Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'left') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
10
  Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'right') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
11
}
12

  
13
function updateSelect() {
14
    s = $('block-select')
15
    for (var i = 0; i < s.options.length; i++) {
16
        if ($('block_' + s.options[i].value)) {
17
            s.options[i].disabled = true;
18
        } else {
19
            s.options[i].disabled = false;
20
        }
21
    }
22
    s.options[0].selected = true;
23
}
24

  
25
function afterAddBlock() {
26
    recreateSortables();
27
    updateSelect();
28
}
29

  
30
function removeBlock(block) {
31
    Effect.DropOut(block);
32
    updateSelect();
33
}
34
//]]>
35
</script>
36

  
37
<div class="contextual">
38
<% form_tag({:action => "add_block"}, :id => "block-form") do %>
39
<%= label_tag('block-select', l(:label_my_page_block)) %>:
40
<%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select" %>
41
<%= link_to_remote l(:button_add),
42
           {:url => { :action => "add_block" },
43
            :with => "Form.serialize('block-form')",
44
            :update => "list-top",
45
            :position => :top,
46
            :complete => "afterAddBlock();"
47
           }, :class => 'icon icon-add'
48
             %>
49
<% end %>
50
<%= link_to l(:button_back), {:action => 'page'}, :class => 'icon icon-cancel' %>
51
</div>
52

  
53
<h2><%=l(:label_my_page)%></h2>
54

  
55
<div id="list-top" class="block-receiver">
56
  <% @blocks['top'].each do |b|
57
     next unless MyController::BLOCKS.keys.include? b %>
58
  <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
59
  <% end if @blocks['top'] %>
60
</div>
61

  
62
<div id="list-left" class="splitcontentleft block-receiver">
63
  <% @blocks['left'].each do |b|
64
     next unless MyController::BLOCKS.keys.include? b %>
65
  <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
66
  <% end if @blocks['left'] %>
67
</div>
68

  
69
<div id="list-right" class="splitcontentright block-receiver">
70
  <% @blocks['right'].each do |b|
71
     next unless MyController::BLOCKS.keys.include? b %>
72
  <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
73
  <% end if @blocks['right'] %>
74
</div>
75

  
76
<%= sortable_element 'list-top',
77
      :tag => 'div',
78
      :only => 'mypage-box',
79
      :handle => "handle",
80
      :dropOnEmpty => true,
81
      :containment => ['list-top', 'list-left', 'list-right'],
82
      :constraint => false,
83
      :url => { :action => "order_blocks", :group => "top" }
84
       %>
85

  
86
<%= sortable_element 'list-left',
87
      :tag => 'div',
88
      :only => 'mypage-box',
89
      :handle => "handle",
90
      :dropOnEmpty => true,
91
      :containment => ['list-top', 'list-left', 'list-right'],
92
      :constraint => false,
93
      :url => { :action => "order_blocks", :group => "left" }
94
       %>
95

  
96
<%= sortable_element 'list-right',
97
      :tag => 'div',
98
      :only => 'mypage-box',
99
      :handle => "handle",
100
      :dropOnEmpty => true,
101
      :containment => ['list-top', 'list-left', 'list-right'],
102
      :constraint => false,
103
      :url => { :action => "order_blocks", :group => "right" }
104
       %>
105

  
106
<%= javascript_tag "updateSelect()" %>
107
<% html_title(l(:label_my_page)) -%>
app/views/my/page_layout.rhtml
1
<script language="JavaScript">
2
//<![CDATA[
3
function recreateSortables() {
4
    Sortable.destroy('list-top');
5
    Sortable.destroy('list-left');
6
    Sortable.destroy('list-right');
7
    
8
	Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'top') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
9
	Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'left') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
10
	Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('<%= url_for(:controller => 'my', :action => 'order_blocks', :group => 'right') %>', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
11
}
12

  
13
function updateSelect() {
14
    s = $('block-select')
15
    for (var i = 0; i < s.options.length; i++) {
16
        if ($('block_' + s.options[i].value)) {
17
            s.options[i].disabled = true;
18
        } else {
19
            s.options[i].disabled = false;
20
        }
21
    }
22
    s.options[0].selected = true;
23
}
24

  
25
function afterAddBlock() {
26
    recreateSortables();
27
    updateSelect();
28
}
29

  
30
function removeBlock(block) {
31
    Effect.DropOut(block);
32
    updateSelect();
33
}
34
//]]>
35
</script>
36

  
37
<div class="contextual">
38
<% form_tag({:action => "add_block"}, :id => "block-form") do %>
39
<%= label_tag('block-select', l(:label_my_page_block)) %>:
40
<%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select" %>
41
<%= link_to_remote l(:button_add),
42
           {:url => { :action => "add_block" },
43
            :with => "Form.serialize('block-form')",
44
            :update => "list-top",
45
            :position => :top,
46
            :complete => "afterAddBlock();"
47
           }, :class => 'icon icon-add'
48
             %>
49
<% end %>
50
<%= link_to l(:button_back), {:action => 'page'}, :class => 'icon icon-cancel' %>
51
</div>
52

  
53
<h2><%=l(:label_my_page)%></h2>
54

  
55
<div id="list-top" class="block-receiver">
56
	<% @blocks['top'].each do |b| 
57
	   next unless MyController::BLOCKS.keys.include? b %>
58
	<%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
59
	<% end if @blocks['top'] %>
60
</div>
61

  
62
<div id="list-left" class="splitcontentleft block-receiver">
63
	<% @blocks['left'].each do |b| 
64
	   next unless MyController::BLOCKS.keys.include? b %>
65
	<%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
66
	<% end if @blocks['left'] %>
67
</div>
68

  
69
<div id="list-right" class="splitcontentright block-receiver">
70
	<% @blocks['right'].each do |b| 
71
	   next unless MyController::BLOCKS.keys.include? b %>
72
	<%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
73
	<% end if @blocks['right'] %>
74
</div>
75

  
76
<%= sortable_element 'list-top',
77
      :tag => 'div',
78
      :only => 'mypage-box',
79
      :handle => "handle",
80
      :dropOnEmpty => true,
81
      :containment => ['list-top', 'list-left', 'list-right'],
82
      :constraint => false,
83
      :url => { :action => "order_blocks", :group => "top" }
84
       %>
85
      
86
      
87
<%= sortable_element 'list-left', 
88
      :tag => 'div',
89
      :only => 'mypage-box',
90
      :handle => "handle",
91
      :dropOnEmpty => true,
92
      :containment => ['list-top', 'list-left', 'list-right'],
93
      :constraint => false,
94
      :url => { :action => "order_blocks", :group => "left" }
95
       %>
96
      
97
<%= sortable_element 'list-right', 
98
      :tag => 'div',
99
      :only => 'mypage-box',
100
      :handle => "handle",
101
      :dropOnEmpty => true,
102
      :containment => ['list-top', 'list-left', 'list-right'],
103
      :constraint => false,
104
      :url => { :action => "order_blocks", :group => "right" }
105
       %>
106
      
107
<%= javascript_tag "updateSelect()" %>
108
<% html_title(l(:label_my_page)) -%>
app/views/my/password.html.erb
1
<h2><%=l(:button_change_password)%></h2>
2

  
3
<%= error_messages_for 'user' %>
4

  
5
<% form_tag({}, :class => "tabular") do %>
6
<div class="box">
7
<p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
8
<%= password_field_tag 'password', nil, :size => 25 %></p>
9

  
10
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
11
<%= password_field_tag 'new_password', nil, :size => 25 %><br />
12
<em><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
13

  
14
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
15
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
16
</div>
17
<%= submit_tag l(:button_apply) %>
18
<% end %>
19

  
20
<% content_for :sidebar do %>
21
<%= render :partial => 'sidebar' %>
22
<% end %>
app/views/my/password.rhtml
1
<h2><%=l(:button_change_password)%></h2>
2

  
3
<%= error_messages_for 'user' %>
4

  
5
<% form_tag({}, :class => "tabular") do %>
6
<div class="box">
7
<p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
8
<%= password_field_tag 'password', nil, :size => 25 %></p>
9

  
10
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
11
<%= password_field_tag 'new_password', nil, :size => 25 %><br />
12
<em><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
13

  
14
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
15
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
16
</div>
17
<%= submit_tag l(:button_apply) %>
18
<% end %>
19

  
20
<% content_for :sidebar do %>
21
<%= render :partial => 'sidebar' %>
22
<% end %>

Also available in: Unified diff