mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 09:51:57 -04:00
updating entries from overlay
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
# weiter
|
# weiter
|
||||||
#
|
#
|
||||||
|
# - update title / menu item after starting new entry
|
||||||
# - update time entry row after context menu stop (reflect saved time)
|
# - update time entry row after context menu stop (reflect saved time)
|
||||||
|
# - 0:60 anstelle 1:00? Redmine-bug?
|
||||||
#
|
#
|
||||||
# - remember last activity, preselect that in 'new' form
|
# - remember last activity, preselect that in 'new' form
|
||||||
# - same for project, unless we are in a project context
|
# - same for project, unless we are in a project context
|
||||||
@@ -39,8 +41,11 @@ class StopwatchTimersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
# todo update entry
|
@time_entry.safe_attributes = params[:time_entry]
|
||||||
if params[:continue]
|
@success = @time_entry.save
|
||||||
|
if !@success
|
||||||
|
edit
|
||||||
|
elsif params[:continue]
|
||||||
new
|
new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -89,8 +94,12 @@ class StopwatchTimersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new_time_entry
|
def new_time_entry
|
||||||
TimeEntry.new(project: @project, issue: @issue,
|
entry = TimeEntry.new(project: @project, issue: @issue,
|
||||||
user: User.current, spent_on: User.current.today)
|
user: User.current, spent_on: User.current.today)
|
||||||
|
if entry.respond_to?(:author=) # Redmine 4
|
||||||
|
entry.author = User.current
|
||||||
|
end
|
||||||
|
entry
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_optional_data
|
def find_optional_data
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<% time_entry = @time_entries.first %>
|
<% time_entry = @time_entries.first %>
|
||||||
<li>
|
<li>
|
||||||
<% if User.current.is_running_timer? time_entry %>
|
<% if User.current.is_running_timer? time_entry %>
|
||||||
<%= context_menu_link l(:label_stopwatch_stop), stop_stopwatch_timer_path(time_entry, context: '1'), class: 'icon-time', remote: true, method: :put %>
|
<%= context_menu_link l(:label_stopwatch_stop), stop_stopwatch_timer_path(time_entry, context: '1'), class: 'icon icon-time', remote: true, method: :put %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= context_menu_link l(:label_stopwatch_start), start_stopwatch_timer_path(time_entry, context: '1'), class: 'icon-time', remote: true, method: :put %>
|
<%= context_menu_link l(:label_stopwatch_start), start_stopwatch_timer_path(time_entry, context: '1'), class: 'icon icon-time', remote: true, method: :put %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
hideModal();
|
hideModal();
|
||||||
|
window.stopwatch.highlightRunningTimer(
|
||||||
|
<%= raw Stopwatch::Timer.new(User.current).to_json %>
|
||||||
|
);
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
<% if @success %>
|
||||||
hideModal();
|
hideModal();
|
||||||
|
<% else %>
|
||||||
|
$('#ajax-modal').html('<%= j render partial: 'stopwatch_timers/edit' %>');
|
||||||
|
<% end %>
|
||||||
<% if params[:continue] %>
|
<% if params[:continue] %>
|
||||||
$('#ajax-modal').html('<%= j render partial: 'stopwatch_timers/new' %>');
|
$('#ajax-modal').html('<%= j render partial: 'stopwatch_timers/new' %>');
|
||||||
showModal('ajax-modal', '600px');
|
showModal('ajax-modal', '700px');
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
module Stopwatch
|
module Stopwatch
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user