Project

General

Profile

Feature #8888 » 0001-add-cancel-button-to-new-edit-log-time-page.patch

Marius BĂLTEANU, 2018-06-19 01:09

View differences:

app/helpers/application_helper.rb
1257 1257
    hidden_field_tag('back_url', url, :id => nil) unless url.blank?
1258 1258
  end
1259 1259

  
1260
  def render_cancel_button_tag(fallback_url)
1261
    url = back_url.blank? ? fallback_url : back_url
1262
    link_to l(:button_cancel), url
1263
  end
1264

  
1260 1265
  def check_all_links(form_name)
1261 1266
    link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
1262 1267
    " | ".html_safe +
app/helpers/timelog_helper.rb
114 114
      end
115 115
    end
116 116
  end
117

  
118
  def render_cancel_button_tag_for_time_entry(project)
119
    fallback_path = project ? project_time_entries_path(project) : time_entries_path
120
    render_cancel_button_tag(fallback_path)
121
  end
122

  
117 123
end
app/views/timelog/edit.html.erb
3 3
<%= labelled_form_for @time_entry, :url => time_entry_path(@time_entry), :html => {:multipart => true} do |f| %>
4 4
  <%= render :partial => 'form', :locals => {:f => f} %>
5 5
  <%= submit_tag l(:button_save) %>
6
  <%= render_cancel_button_tag_for_time_entry(@project) %>
6 7
<% end %>
app/views/timelog/new.html.erb
4 4
  <%= render :partial => 'form', :locals => {:f => f} %>
5 5
  <%= submit_tag l(:button_create) %>
6 6
  <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
7
  <%= render_cancel_button_tag_for_time_entry(@project) %>
7 8
<% end %>
    (1-1/1)