0001-Reduce-view-code-duplication-by-using-a-nested-layou.patch

Jan from Planio www.plan.io, 2016-02-17 10:47

Download (3.32 KB)

View differences:

app/views/attachments/diff.html.erb
1
<h2><%=h @attachment.filename %></h2>
2

  
3
<div class="attachments">
4
<p><%= "#{@attachment.description} - " unless @attachment.description.blank? %>
5
   <span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
6
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
7
   <span class="size">(<%= number_to_human_size @attachment.filesize %>)</span></p>
8
</div>
1
<%= render :layout => 'layouts/file' do %>
9 2
<%= form_tag({}, :method => 'get') do %>
10 3
  <p>
11 4
    <%= l(:label_view_diff) %>:
......
14 7
  </p>
15 8
<% end %>
16 9
<%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type, :diff_style => nil} %>
17

  
18
<% html_title @attachment.filename %>
19

  
20
<% content_for :header_tags do -%>
21
    <%= stylesheet_link_tag "scm" -%>
22
<% end -%>
10
<% end %>
app/views/attachments/file.html.erb
1
<h2><%=h @attachment.filename %></h2>
2

  
3
<div class="attachments">
4
<p><%= "#{@attachment.description} - " unless @attachment.description.blank? %>
5
   <span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
6
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
7
   <span class="size">(<%= number_to_human_size @attachment.filesize %>)</span></p>
8

  
9
</div>
1
<%= render :layout => 'layouts/file' do %>
10 2
&nbsp;
11 3
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>
12

  
13
<% html_title @attachment.filename %>
14

  
15
<% content_for :header_tags do -%>
16
    <%= stylesheet_link_tag "scm" -%>
17
<% end -%>
4
<% end %>
app/views/layouts/_file.html.erb
1
<h2><%=h @attachment.filename %></h2>
2

  
3
<div class="attachments">
4
<p><%= "#{@attachment.description} - " unless @attachment.description.blank? %>
5
   <span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
6
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
7
   <span class="size">(<%= number_to_human_size @attachment.filesize %>)</span></p>
8
</div>
9
<%= yield %>
10

  
11
<% html_title @attachment.filename %>
12

  
13
<% content_for :header_tags do -%>
14
    <%= stylesheet_link_tag "scm" -%>
15
<% end -%>
0
-