From 15d5c331ebc15caee6d8acf89d81b506102c8fa4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 4 Oct 2014 07:23:14 +0000 Subject: Let the new time_entry form be submitted without project (#17954). git-svn-id: http://svn.redmine.org/redmine/trunk@13422 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/issues/show.html.erb | 2 +- app/views/timelog/_form.html.erb | 8 +++++--- app/views/timelog/new.html.erb | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'app/views') diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 5a855c9a5..e5a3298668 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -61,7 +61,7 @@ end end if User.current.allowed_to?(:view_time_entries, @project) - rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), project_issue_time_entries_path(@project, @issue)) : "-"), :class => 'spent-time' + rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), issue_time_entries_path(@issue)) : "-"), :class => 'spent-time' end end %> <%= render_custom_fields_rows(@issue) %> diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb index 3256feaac..b51f98dad 100644 --- a/app/views/timelog/_form.html.erb +++ b/app/views/timelog/_form.html.erb @@ -3,10 +3,12 @@
<% if @time_entry.new_record? %> - <% if params[:project_id] || @time_entry.issue %> - <%= f.hidden_field :project_id %> + <% if params[:project_id] %> + <%= hidden_field_tag 'project_id', params[:project_id] %> + <% elsif params[:issue_id] %> + <%= hidden_field_tag 'issue_id', params[:issue_id] %> <% else %> -

<%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).all, :selected => @time_entry.project), :required => true %>

+

<%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).all, :selected => @time_entry.project, :include_blank => true) %>

<% end %> <% end %>

diff --git a/app/views/timelog/new.html.erb b/app/views/timelog/new.html.erb index 95253e82f..84bf7dae1 100644 --- a/app/views/timelog/new.html.erb +++ b/app/views/timelog/new.html.erb @@ -1,7 +1,6 @@

<%= l(:label_spent_time) %>

<%= labelled_form_for @time_entry, :url => time_entries_path do |f| %> - <%= hidden_field_tag 'project_id', params[:project_id] if params[:project_id] %> <%= render :partial => 'form', :locals => {:f => f} %> <%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> -- cgit v1.2.3