time entry form fixes

- issue selection selects the project accordingly
- issue / project selection updates available activities
- move project / issue selector to top. more logical this way, since
making a selection there may change the available activities
This commit is contained in:
Jens Kraemer
2021-10-05 04:30:31 +08:00
parent b4af7e0eb3
commit 317aa08365
4 changed files with 21 additions and 6 deletions

View File

@@ -73,6 +73,17 @@ class StopwatchTimersController < ApplicationController
render json: @timer.to_json
end
def update_form
if id = params[:time_entry_id].presence
@time_entry = TimeEntry.visible.find id
else
@time_entry = TimeEntry.new
end
@time_entry.safe_attributes = params[:time_entry]
rescue ActiveRecord::RecordNotFound
head 404
end
private
def find_timer
@@ -82,7 +93,6 @@ class StopwatchTimersController < ApplicationController
def find_time_entry
@time_entry = time_entries.find params[:id]
end
def load_todays_entries