summaryrefslogtreecommitdiffstats
path: root/app/views/timelog
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 08:38:35 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 08:38:35 +0000
commit216a153421b05bce4d4e64b590889b740367b92e (patch)
treea01c6009db7d9aefc80ea09b073e1ca48131ffab /app/views/timelog
parentaffeabcc526449057b29ca636f456234a87798b6 (diff)
downloadredmine-216a153421b05bce4d4e64b590889b740367b92e.tar.gz
redmine-216a153421b05bce4d4e64b590889b740367b92e.zip
Update activities list when changing project/issue id on the time entry form (#19656).
git-svn-id: http://svn.redmine.org/redmine/trunk@14287 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/timelog')
-rw-r--r--app/views/timelog/_form.html.erb13
-rw-r--r--app/views/timelog/new.js.erb1
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) %>');