0005-Replace-tags-with-helper.patch

Takashi Kato, 2022-03-21 22:32

Download (19.3 KB)

View differences:

app/views/activities/_activities.html.erb
3 3
<h3><%= format_activity_day(day) %></h3>
4 4
<dl>
5 5
<% sort_activity_events(events_by_day[day]).each do |e, in_group| -%>
6
  <dt class="<%= e.event_type %> icon icon-<%= e.event_type %> <%= "grouped" if in_group %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
7
  <%= avatar(e.event_author) if e.respond_to?(:event_author) %>
8
  <span class="time"><%= format_time(e.event_datetime, false) %></span>
9
  <%= content_tag('span', e.project, :class => 'project') if @project.nil? || @project != e.project %>
10
  <%= link_to format_activity_title(e.event_title), e.event_url %>
11
  </dt>
6
  <%= tag.dt class: [e.event_type, :icon, "icon-#{e.event_type}", ("grouped" if in_group), (User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author) ? 'me' : nil] do %>
7
    <%= avatar(e.event_author) if e.respond_to?(:event_author) %>
8
    <span class="time"><%= format_time(e.event_datetime, false) %></span>
9
    <%= content_tag('span', e.project, :class => 'project') if @project.nil? || @project != e.project %>
10
    <%= link_to format_activity_title(e.event_title), e.event_url %>
11
  <% end %>
12 12
  <dd class="<%= "grouped" if in_group %>"><span class="description"><%= format_activity_description(e.event_description) %></span>
13 13
  <span class="author"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span></dd>
14 14
<% end -%>
app/views/admin/info.html.erb
6 6
<% @checklist.each do |label, result| %>
7 7
  <tr>
8 8
    <td class="name"><%= label.is_a?(Symbol) ? l(label) : label %></td>
9
    <td class="tick"><span class="icon-only <%= (result ? 'icon-ok' : 'icon-error') %>"></span></td>
9
    <td class="tick"><%= tag.span class: ['icon-only', result ? 'icon-ok' : 'icon-error' ] %></td>
10 10
  </tr>
11 11
<% end %>
12 12
</table>
app/views/attachments/edit_all.html.erb
11 11
  <% @attachments.each do |attachment| %>
12 12
    <tr>
13 13
      <td colspan="2">
14
        <span class="icon icon-attachment"><%= attachment.filename_was %></span>
14
        <%= tag.span attachment.filename_was, class: 'icon icon-attachment' %>
15 15
        <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
16 16
        <span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
17 17
      </td>
app/views/boards/show.html.erb
38 38
  <tbody>
39 39
  <% @topics.each do |topic| %>
40 40
    <tr id="message-<%= topic.id %>" class="message <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
41
      <td class="subject icon <%= 'icon-sticky' if topic.sticky? %> <%= 'icon-locked' if topic.locked? %>"><%= link_to topic.subject, board_message_path(@board, topic) %></td>
41
      <%= tag.td link_to(topic.subject, board_message_path(@board, topic)), class: ['subject', 'icon', ('icon-sticky' if topic.sticky?), ('icon-locked' if topic.locked?)] %>
42 42
      <td class="author"><%= link_to_user(topic.author) %></td>
43 43
      <td class="created_on"><%= format_time(topic.created_on) %></td>
44 44
      <td class="reply-count"><%= topic.replies_count %></td>
app/views/common/_calendar.html.erb
29 29
  <%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %>
30 30
  </div>
31 31
  <% else %>
32
  <span class="icon icon-package">
32
  <%= tag.span(class: 'icon icon-package') do %>
33 33
    <%= "#{i.project} -" unless @project && @project == i.project %>
34 34
    <%= link_to_version i %>
35
  </span>
35
  <% end %>
36 36
  <% end %>
37 37
<% end %>
38 38
</td>
app/views/custom_field_enumerations/index.html.erb
6 6
  <ul id="custom_field_enumerations" class="flat">
7 7
  <% @custom_field.enumerations.each_with_index do |value, position| %>
8 8
    <li>
9
      <span class="icon-only icon-sort-handle sort-handle"></span>
9
      <%= tag.span class: 'icon-only icon-sort-handle sort-handle' %>
10 10
      <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position, :class => 'position' %>
11 11
      <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40 %>
12 12
      <%= hidden_field_tag "custom_field_enumerations[#{value.id}][active]", 0 %>
app/views/issue_statuses/index.html.erb
25 25
  <td><%= checked_image status.is_closed? %></td>
26 26
  <td>
27 27
    <% unless WorkflowTransition.where('old_status_id = ? OR new_status_id = ?', status.id, status.id).exists? %>
28
      <span class="icon icon-warning">
28
      <%= tag.span(class: 'icon icon-warning') do %>
29 29
        <%= l(:text_status_no_workflow) %> (<%= link_to l(:button_edit), edit_workflows_path(:used_statuses_only => 0) %>)
30
      </span>
30
      <% end %>
31 31
    <% end %>
32 32
  </td>
33 33
  <td class="buttons">
app/views/issues/_attributes.html.erb
7 7
  <%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true},
8 8
                :onchange => "updateIssueFrom('#{escape_javascript(update_issue_form_path(@project, @issue))}', this)" %>
9 9
  <% if @issue.transition_warning %>
10
    <span class="icon-only icon-warning" title="<%= @issue.transition_warning %>"><%= @issue.transition_warning %></span>
10
    <%= tag.span @issue.transition_warning, class: 'icon-only icon-warning', title: @issue.transition_warning %>
11 11
  <% end %>
12 12
</p>
13 13
<%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %>
app/views/issues/index.html.erb
59 59
  <% end %>
60 60
  <%= export_csv_encoding_select_tag %>
61 61
  <% if @issue_count > Setting.issues_export_limit.to_i %>
62
  <p class="icon icon-warning">
62
  <%= tag.p(class: 'icon icon-warning') do %>
63 63
    <%= l(:setting_issues_export_limit) %>: <%= Setting.issues_export_limit.to_i %>
64
  </p>
64
  <% end %>
65 65
  <% end %>
66 66
  <p class="buttons">
67 67
    <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
app/views/messages/show.html.erb
35 35

  
36 36
<% unless @replies.empty? %>
37 37
<div id="replies">
38
<h3 class="comments icon icon-comments"><%= l(:label_reply_plural) %> (<%= @reply_count %>)</h3>
38
<%= tag.h3 "#{l(:label_reply_plural)}(#{@reply_count})", class: 'comments icon icon-comments' %>
39 39
<% if !@topic.locked? && authorize_for('messages', 'reply') && @replies.size >= 3 %>
40 40
  <p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content', :scroll => "message_content" %></p>
41 41
<% end %>
app/views/projects/_members_box.html.erb
1 1
  <% if @principals_by_role.any? %>
2 2
  <div class="members box">
3
    <h3 class="icon icon-group"><%=l(:label_member_plural)%></h3>
3
    <%= tag.h3 l(:label_member_plural), class: 'icon icon-group' %>
4 4
    <% @principals_by_role.keys.sort.each do |role| %>
5 5
      <p><span class="label"><%= role %>:</span> <%= @principals_by_role[role].sort.collect{|p| link_to_principal(p, :class => p.is_a?(Group) ? 'icon icon-group' : nil)}.join(", ").html_safe %></p>
6 6
    <% end %>
app/views/projects/index.html.erb
20 20

  
21 21
<% if User.current.logged? %>
22 22
<p style="text-align:right;">
23
<span class="icon icon-user my-project"><%= l(:label_my_projects) %></span>
24
<span class="icon icon-bookmarked-project"><%= l(:label_my_bookmarks) %></span>
23
<%= tag.span l(:label_my_projects), class: 'icon icon-user my-project' %>
24
<%= tag.span l(:label_my_bookmarks), class: 'icon icon-bookmarked-project' %>
25 25
</p>
26 26
<% end %>
27 27

  
app/views/projects/settings/_members.html.erb
19 19
  <% members.each do |member| %>
20 20
  <% next if member.new_record? %>
21 21
  <tr id="member-<%= member.id %>" class="member">
22
  <td class="name icon icon-<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
22
  <%= tag.td link_to_user(member.principal), class: "name icon icon-#{member.principal.class.name.downcase}" %>
23 23
  <td class="roles">
24 24
    <span id="member-<%= member.id %>-roles"><%= member.roles.sort.collect(&:to_s).join(', ') %></span>
25 25
    <div id="member-<%= member.id %>-form"></div>
app/views/projects/settings/_versions.html.erb
34 34
  <tbody>
35 35
<% @versions.each do |version| %>
36 36
    <tr class="version <%=h version.status %> <%= 'shared' if version.project != @project %>">
37
    <td class="name <%= 'icon icon-shared' if version.project != @project %>"><%= link_to_version version %></td>
37
    <%= tag.td link_to_version(version), :class => ['name', ('icon icon-shared' if version.project != @project)] %>
38 38
    <td class="tick"><%= checked_image(version.id == @project.default_version_id) %></td>
39 39
    <td class="date"><%= format_date(version.effective_date) %></td>
40 40
    <td class="description"><%= version.description %></td>
app/views/projects/show.html.erb
24 24
<h2><%=l(:label_overview)%></h2>
25 25

  
26 26
<% unless @project.active? %>
27
  <p class="warning"><span class="icon icon-lock"><%= l(:text_project_closed) %></span></p>
27
  <p class="warning"><%= tag.span l(:text_project_closed), class: 'icon icon-lock' %></p>
28 28
<% end %>
29 29

  
30 30
<div class="splitcontent">
......
47 47

  
48 48
  <% if User.current.allowed_to?(:view_issues, @project) %>
49 49
  <div class="issues box">
50
    <h3 class="icon icon-issue">
50
    <%= tag.h3(class: 'icon icon-issue') do %>
51 51
      <%=l(:label_issue_tracking)%>&nbsp;
52 52
      <%= link_to l(:label_details),
53 53
            project_issues_report_details_path(@project, :detail => 'tracker'),
54 54
            :class => 'icon-only icon-zoom-in',
55 55
            :title => l(:label_details) %>
56
    </h3>
56
    <% end %>
57 57
    <% if @trackers.present? %>
58 58
    <table class="list issue-report">
59 59
      <thead>
......
99 99

  
100 100
  <% if User.current.allowed_to?(:view_time_entries, @project) %>
101 101
  <div class="spent_time box">
102
    <h3 class="icon icon-time"><%= l(:label_time_tracking) %></h3>
102
    <%= tag.h3 l(:label_time_tracking), class: 'icon icon-time' %>
103 103
    <ul>
104 104
      <% if @total_estimated_hours.present? %>
105 105
        <li><%= l(:field_estimated_hours) %>: <%= l_hours(@total_estimated_hours) %>
......
123 123
<div class="splitcontentright">
124 124
  <% if @news.any? && authorize_for('news', 'index') %>
125 125
  <div class="news box">
126
    <h3 class="icon icon-news"><%=l(:label_news_latest)%></h3>
126
    <%= tag.h3 l(:label_news_latest), class: 'icon icon-news' %>
127 127
    <%= render :partial => 'news/news', :collection => @news %>
128 128
    <p><%= link_to l(:label_news_view_all), project_news_index_path(@project) %></p>
129 129
  </div>
......
133 133

  
134 134
  <% if @subprojects.any? %>
135 135
  <div class="projects box">
136
    <h3 class="icon icon-projects"><%=l(:label_subproject_plural)%></h3>
136
    <%= tag.h3 l(:label_subproject_plural), class: 'icon icon-projects' %>
137 137
	<ul class="subprojects">
138 138
	  <% @subprojects.each do |project| %>
139 139
	  <li><%= link_to(project.name, project_path(project), :class => project.css_classes).html_safe %></li>
app/views/roles/index.html.erb
17 17
  <td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td>
18 18
  <td>
19 19
    <% unless role.builtin? || role.workflow_rules.exists? %>
20
      <span class="icon icon-warning">
20
      <%= tag.span(class: 'icon icon-warning') do %>
21 21
        <%= l(:text_role_no_workflow) %> (<%= link_to l(:button_edit), edit_workflows_path(:role_id => role) %>)
22
      </span>
22
      <% end %>
23 23
    <% end %>
24 24
  </td>
25 25
  <td class="buttons">
app/views/search/index.html.erb
48 48
    <h3><%= l(:label_result_plural) %> (<%= @result_count %>)</h3>
49 49
    <dl id="search-results">
50 50
      <% @results.each do |e| %>
51
        <dt class="<%= e.event_type %> icon icon-<%= e.event_type %>">
51
        <%= tag.dt class: "#{e.event_type} icon icon-#{e.event_type}" do %>
52 52
          <%= content_tag('span', e.project, :class => 'project') unless @project == e.project %>
53 53
          <%= link_to(highlight_tokens(e.event_title.truncate(255), @tokens), e.event_url) %>
54
        </dt>
54
        <% end %>
55 55
        <dd><span class="description"><%= highlight_tokens(e.event_description, @tokens) %></span>
56 56
        <span class="author"><%= format_time(e.event_datetime) %></span></dd>
57 57
      <% end %>
app/views/settings/_repositories.html.erb
23 23
      </td>
24 24
      <td>
25 25
        <% if enabled %>
26
          <span class="icon <%= (scm_class.scm_available ? 'icon-ok' : 'icon-error') %>"></span>
26
          <%= tag.span class: ['icon', (scm_class.scm_available ? 'icon-ok' : 'icon-error')] %>
27 27
          <%= scm_class.scm_command %>
28 28
        <% end %>
29 29
      </td>
app/views/trackers/index.html.erb
21 21
  <td class="description"><%= tracker.description %></td>
22 22
  <td>
23 23
    <% unless tracker.workflow_rules.exists? %>
24
      <span class="icon icon-warning">
24
      <%= tag.span(class: 'icon icon-warning') do %>
25 25
        <%= l(:text_tracker_no_workflow) %> (<%= link_to l(:button_edit), edit_workflows_path(:tracker_id => tracker) %>)
26
      </span>
26
      <% end %>
27 27
    <% end %>
28 28
  </td>
29 29
  <td class="buttons">
app/views/versions/index.html.erb
22 22
      </div>
23 23
    <% end %>
24 24
    <header>
25
      <h3 class="icon icon-package version inline-flex"><%= link_to_version version, :name => version_anchor(version) %></h3>
25
      <%= tag.h3(class: 'icon icon-package version inline-flex') do %>
26
        <%= link_to_version version, :name => version_anchor(version) %>
27
      <% end %>
26 28
      <span class="badge badge-status-<%= version.status %>"><%= l("version_status_#{version.status}") %></span>
27 29
    </header>
28 30
    <%= render :partial => 'versions/overview', :locals => {:version => version} %>
extra/sample_plugin/app/views/example/say_goodbye.html.erb
1 1
<h2>Good Bye</h2>
2 2

  
3
<p class="icon icon-example-works"><%= l(:text_say_goodbye) %></p>
3
<%= tag.p l(:text_say_goodbye), :class => 'icon icon-example-works' %>
4 4

  
5 5
<% content_for :header_tags do %>
6 6
  <%= stylesheet_link_tag 'example', :plugin => 'sample_plugin', :media => "screen" %>
extra/sample_plugin/app/views/example/say_hello.html.erb
1 1
<h2>Hello</h2>
2 2

  
3
<p class="icon icon-example-works"><%= l(:text_say_hello) %></p>
3
<%= tag.p l(:text_say_hello), :class => 'icon icon-example-works' %>
4 4

  
5 5
<p><label>Example setting</label>: <%= @value %></p>
6 6

  
7
-