0001-Use-button-as-additional-option-for-contextmenu.patch

Felix Gliesche, 2017-08-15 13:59

Download (12.6 KB)

View differences:

app/helpers/application_helper.rb
1222 1222
    content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(html_options))
1223 1223
  end
1224 1224

  
1225
  def link_to_context_menu
1226
    link_to l(:button_actions), '#', title: l(:button_actions), class: 'icon-only icon-actions js-contextmenu'
1227
  end
1228

  
1225 1229
  # Helper to render JSON in views
1226 1230
  def raw_json(arg)
1227 1231
    arg.to_json.to_s.gsub('/', '\/').html_safe
app/helpers/issues_helper.rb
99 99
             content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') +
100 100
             content_tag('td', h(child.status), :class => 'status') +
101 101
             content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') +
102
             content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio'),
102
             content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio') +
103
             content_tag('td', link_to_context_menu, :class => 'buttons'),
103 104
             :class => css)
104 105
    end
105 106
    s << '</table>'
......
114 115
    relations.each do |relation|
115 116
      other_issue = relation.other_issue(issue)
116 117
      css = "issue hascontextmenu #{other_issue.css_classes}"
117
      link = manage_relations ? link_to(l(:label_relation_delete),
118
      buttons = manage_relations ? link_to(l(:label_relation_delete),
118 119
                                  relation_path(relation),
119 120
                                  :remote => true,
120 121
                                  :method => :delete,
......
122 123
                                  :title => l(:label_relation_delete),
123 124
                                  :class => 'icon-only icon-link-break'
124 125
                                 ) : nil
126
      buttons << link_to_context_menu
125 127

  
126 128
      s << content_tag('tr',
127 129
             content_tag('td', check_box_tag("ids[]", other_issue.id, false, :id => nil), :class => 'checkbox') +
......
130 132
             content_tag('td', other_issue.start_date, :class => 'start_date') +
131 133
             content_tag('td', other_issue.due_date, :class => 'due_date') +
132 134
             content_tag('td', other_issue.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(other_issue.done_ratio), :class=> 'done_ratio') +
133
             content_tag('td', link, :class => 'buttons'),
135
             content_tag('td', buttons, :class => 'buttons'),
134 136
             :id => "relation-#{relation.id}",
135 137
             :class => css)
136 138
    end
app/views/issues/_list.html.erb
14 14
      <% query.inline_columns.each do |column| %>
15 15
        <%= column_header(query, column, query_options) %>
16 16
      <% end %>
17
      <th></th>
17 18
    </tr>
18 19
  </thead>
19 20
  <tbody>
......
21 22
  <% if group_name %>
22 23
    <% reset_cycle %>
23 24
    <tr class="group open">
24
      <td colspan="<%= query.inline_columns.size + 1 %>">
25
      <td colspan="<%= query.inline_columns.size + 2 %>">
25 26
        <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
26 27
        <span class="name"><%= group_name %></span> <span class="count"><%= group_count %></span> <span class="totals"><%= group_totals %></span>
27 28
        <%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
......
32 33
  <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
33 34
    <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
34 35
    <%= raw query.inline_columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, issue)}</td>"}.join %>
36
    <td class="buttons"><%= link_to_context_menu %></td>
35 37
  </tr>
36 38
  <% query.block_columns.each do |column|
37 39
       if (text = column_content(column, issue)) && text.present? -%>
38 40
  <tr class="<%= current_cycle %>">
39
    <td colspan="<%= query.inline_columns.size + 1 %>" class="<%= column.css_classes %>">
41
    <td colspan="<%= query.inline_columns.size + 2 %>" class="<%= column.css_classes %>">
40 42
      <% if query.block_columns.count > 1 %>
41 43
        <span><%= column.caption %></span>
42 44
      <% end %>
app/views/my/blocks/_timelog.html.erb
35 35
<th><%= l(:label_project) %></th>
36 36
<th><%= l(:field_comments) %></th>
37 37
<th><%= l(:field_hours) %></th>
38
<th></th>
38 39
</tr></thead>
39 40
<tbody>
40 41
<% entries_by_day.keys.sort.reverse.each do |day| %>
......
42 43
    <td><strong><%= day == User.current.today ? l(:label_today).titleize : format_date(day) %></strong></td>
43 44
    <td colspan="2"></td>
44 45
    <td class="hours"><em><%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %></em></td>
46
    <td></td>
45 47
  </tr>
46 48
  <% entries_by_day[day].each do |entry| -%>
47 49
  <tr id="time-entry-<%= entry.id %>" class="time-entry hascontextmenu">
......
52 54
    <td class="subject"><%= entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
53 55
    <td class="comments"><%= entry.comments %></td>
54 56
    <td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
57
    <td class="buttons"><%= link_to_context_menu %></td>
55 58
  </tr>
56 59
  <% end -%>
57 60
<% end -%>
app/views/timelog/_list.html.erb
45 45
                    :title => l(:button_delete),
46 46
                    :class => 'icon-only icon-del' %>
47 47
    <% end -%>
48
        <%= link_to_context_menu %>
48 49
    </td>
49 50
  </tr>
50 51
  <% @query.block_columns.each do |column|
app/views/versions/index.html.erb
30 30
          <tr class="hascontextmenu">
31 31
            <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
32 32
            <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
33
            <td class="buttons"><%= link_to_context_menu %></td>
33 34
          </tr>
34 35
        <% end -%>
35 36
        </table>
app/views/versions/show.html.erb
44 44
    <tr class="issue hascontextmenu">
45 45
      <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
46 46
      <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
47
      <td class="buttons"><%= link_to_context_menu %></td>
47 48
    </tr>
48 49
  <% end %>
49 50
  </table>
config/locales/de.yml
203 203
  button_update: Aktualisieren
204 204
  button_view: Anzeigen
205 205
  button_watch: Beobachten
206
  button_actions: Aktionen
206 207

  
207 208
  default_activity_design: Design
208 209
  default_activity_development: Entwicklung
config/locales/en.yml
1080 1080
  button_reopen: Reopen
1081 1081
  button_import: Import
1082 1082
  button_filter: Filter
1083
  button_actions: Actions
1083 1084

  
1084 1085
  status_active: active
1085 1086
  status_registered: registered
public/javascripts/context_menu.js
5 5

  
6 6
function contextMenuRightClick(event) {
7 7
  var target = $(event.target);
8
  if (target.is('a')) {return;}
8
  if (target.is('a:not(.js-contextmenu)')) {return;}
9 9
  var tr = target.closest('.hascontextmenu').first();
10 10
  if (tr.length < 1) {return;}
11 11
  event.preventDefault();
......
218 218
  if (!contextMenuObserving) {
219 219
    $(document).click(contextMenuClick);
220 220
    $(document).contextmenu(contextMenuRightClick);
221
    $(document).on('click', '.js-contextmenu', contextMenuRightClick);
221 222
    contextMenuObserving = true;
222 223
  }
223 224
}
public/stylesheets/application.css
230 230
table.list td.checkbox input {padding:0px;}
231 231
table.list td.buttons, div.buttons { white-space:nowrap; text-align: right; }
232 232
table.list td.buttons a, div.buttons a { margin-right: 0.6em; }
233
table.list td.buttons a:last-child, div.buttons a:last-child { margin-right: 0; }
233 234
table.list td.buttons img, div.buttons img {vertical-align:middle;}
234 235
table.list td.reorder {width:15%; white-space:nowrap; text-align:center; }
235 236
table.list table.progress td {padding-right:0px;}
......
474 475

  
475 476
#issue_tree table.issues, #relations table.issues { border: 0; }
476 477
#issue_tree td.checkbox, #relations td.checkbox {display:none;}
477
#relations td.buttons {padding:0;}
478
#relations td.buttons, #issue_tree td.buttons {padding:0;}
478 479

  
479 480
fieldset.collapsible {border-width: 1px 0 0 0;}
480 481
fieldset.collapsible>legend { padding-left: 16px; background: url(../images/arrow_expanded.png) no-repeat 0% 40%; cursor:pointer; }
......
1294 1295
.icon-project { background-image: url(../images/projects.png); }
1295 1296
.icon-add-bullet { background-image: url(../images/bullet_add.png); }
1296 1297
.icon-shared { background-image: url(../images/link.png); }
1298
.icon-actions { background-image: url(../images/3_bullets.png); }
1297 1299

  
1298 1300
.icon-file { background-image: url(../images/files/default.png); }
1299 1301
.icon-file.text-plain { background-image: url(../images/files/text.png); }
1300
-