summaryrefslogtreecommitdiffstats
path: root/app/views/my
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-30 08:32:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-30 08:32:31 +0000
commitdb5bd2b2de4733b3c900468edf4eb35896e4f723 (patch)
treed6f86917faf3374f1a878f2566857b57b19852d8 /app/views/my
parentf7782c46480f8d5ab995c988ea265d12eb7ad0a9 (diff)
downloadredmine-db5bd2b2de4733b3c900468edf4eb35896e4f723.tar.gz
redmine-db5bd2b2de4733b3c900468edf4eb35896e4f723.zip
My page - Spent time: configurable number of days to display (#8761).
git-svn-id: http://svn.redmine.org/redmine/trunk@15942 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/my')
-rw-r--r--app/views/my/blocks/_timelog.html.erb29
-rw-r--r--app/views/my/update_page.js.erb3
2 files changed, 27 insertions, 5 deletions
diff --git a/app/views/my/blocks/_timelog.html.erb b/app/views/my/blocks/_timelog.html.erb
index 47865b0f0..566831132 100644
--- a/app/views/my/blocks/_timelog.html.erb
+++ b/app/views/my/blocks/_timelog.html.erb
@@ -1,18 +1,37 @@
<%
-entries = timelog_items
+entries, days = timelog_items(settings)
entries_by_day = entries.group_by(&:spent_on)
%>
-<% if User.current.allowed_to?(:log_time, nil, :global => true) %>
+
<div class="contextual">
- <%= link_to l(:button_log_time), new_time_entry_path, :class => "icon icon-add" %>
+ <%= link_to l(:button_log_time), new_time_entry_path, :class => "icon icon-add" if User.current.allowed_to?(:log_time, nil, :global => true) %>
+ <%= link_to_function l(:label_options), "$('#timelog-settings').toggle();", :class => 'icon-only icon-settings' %>
</div>
-<% end %>
<h3>
<%= link_to l(:label_spent_time), time_entries_path(:user_id => 'me') %>
- (<%= l(:label_last_n_days, 7) %>: <%= l_hours_short entries.sum(&:hours) %>)
+ (<%= l(:label_last_n_days, days) %>: <%= l_hours_short entries.sum(&:hours) %>)
</h3>
+
+<div id="timelog-settings" style="display:none;">
+ <%= form_tag({}, :remote => true) do %>
+ <div class="box">
+ <p>
+ <label>
+ <%= l(:button_show) %>:
+ <%= text_field_tag 'settings[timelog][days]', days, :size => 6 %>
+ <%= l(:label_day_plural) %>
+ </label>
+ </p>
+ </div>
+ <p>
+ <%= submit_tag l(:button_save) %>
+ <%= link_to_function l(:button_cancel), "$('#timelog-settings').toggle();" %>
+ </p>
+ <% end %>
+</div>
+
<% if entries.any? %>
<%= form_tag({}, :data => {:cm_url => time_entries_context_menu_path}) do %>
<table class="list time-entries">
diff --git a/app/views/my/update_page.js.erb b/app/views/my/update_page.js.erb
new file mode 100644
index 000000000..5329f77af
--- /dev/null
+++ b/app/views/my/update_page.js.erb
@@ -0,0 +1,3 @@
+<% @updated_blocks.each do |block| %>
+ $("#block-<%= block %>").html("<%= escape_javascript render_block_content(block.to_s, @user) %>");
+<% end %>