diff options
Diffstat (limited to 'app/views/timelog')
-rw-r--r-- | app/views/timelog/_form.html.erb | 13 | ||||
-rw-r--r-- | app/views/timelog/new.js.erb | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb index 9b078013d..cf665cb63 100644 --- a/app/views/timelog/_form.html.erb +++ b/app/views/timelog/_form.html.erb @@ -26,9 +26,22 @@ </div> <%= javascript_tag do %> +<% if @time_entry.new_record? %> + $(document).ready(function(){ + $('#time_entry_project_id, #time_entry_issue_id').change(function(){ + $.ajax({ + url: '<%= escape_javascript new_time_entry_path(:format => 'js') %>', + type: 'post', + data: $('#new_time_entry').serialize() + }); + }); + }); +<% end %> + observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { select: function(event, ui) { $('#time_entry_issue').text(ui.item.label); + $('#time_entry_issue_id').blur(); } }); <% end %> diff --git a/app/views/timelog/new.js.erb b/app/views/timelog/new.js.erb new file mode 100644 index 000000000..f76cbb84f --- /dev/null +++ b/app/views/timelog/new.js.erb @@ -0,0 +1 @@ +$('#time_entry_activity_id').html('<%= escape_javascript options_for_select(activity_collection_for_select_options(@time_entry), @time_entry.activity_id) %>'); |