Browse Source

Use button as additional option for contextmenu (#26655).

Patch by Felix Gliesche.


git-svn-id: http://svn.redmine.org/redmine/trunk@17252 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.0.0
Go MAEDA 6 years ago
parent
commit
a17661e8d8

+ 4
- 0
app/helpers/application_helper.rb View File

content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(html_options)) content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(html_options))
end end


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

# Helper to render JSON in views # Helper to render JSON in views
def raw_json(arg) def raw_json(arg)
arg.to_json.to_s.gsub('/', '\/').html_safe arg.to_json.to_s.gsub('/', '\/').html_safe

+ 5
- 3
app/helpers/issues_helper.rb View File

content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') + content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') +
content_tag('td', h(child.status), :class => 'status') + content_tag('td', h(child.status), :class => 'status') +
content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') + content_tag('td', link_to_user(child.assigned_to), :class => 'assigned_to') +
content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio'),
content_tag('td', child.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(child.done_ratio), :class=> 'done_ratio') +
content_tag('td', link_to_context_menu, :class => 'buttons'),
:class => css) :class => css)
end end
s << '</table>' s << '</table>'
relations.each do |relation| relations.each do |relation|
other_issue = relation.other_issue(issue) other_issue = relation.other_issue(issue)
css = "issue hascontextmenu #{other_issue.css_classes}" css = "issue hascontextmenu #{other_issue.css_classes}"
link = manage_relations ? link_to(l(:label_relation_delete),
buttons = manage_relations ? link_to(l(:label_relation_delete),
relation_path(relation), relation_path(relation),
:remote => true, :remote => true,
:method => :delete, :method => :delete,
:title => l(:label_relation_delete), :title => l(:label_relation_delete),
:class => 'icon-only icon-link-break' :class => 'icon-only icon-link-break'
) : nil ) : nil
buttons << link_to_context_menu


s << content_tag('tr', s << content_tag('tr',
content_tag('td', check_box_tag("ids[]", other_issue.id, false, :id => nil), :class => 'checkbox') + content_tag('td', check_box_tag("ids[]", other_issue.id, false, :id => nil), :class => 'checkbox') +
content_tag('td', other_issue.start_date, :class => 'start_date') + content_tag('td', other_issue.start_date, :class => 'start_date') +
content_tag('td', other_issue.due_date, :class => 'due_date') + content_tag('td', other_issue.due_date, :class => 'due_date') +
content_tag('td', other_issue.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(other_issue.done_ratio), :class=> 'done_ratio') + content_tag('td', other_issue.disabled_core_fields.include?('done_ratio') ? '' : progress_bar(other_issue.done_ratio), :class=> 'done_ratio') +
content_tag('td', link, :class => 'buttons'),
content_tag('td', buttons, :class => 'buttons'),
:id => "relation-#{relation.id}", :id => "relation-#{relation.id}",
:class => css) :class => css)
end end

+ 4
- 2
app/views/issues/_list.html.erb View File

<% query.inline_columns.each do |column| %> <% query.inline_columns.each do |column| %>
<%= column_header(query, column, query_options) %> <%= column_header(query, column, query_options) %>
<% end %> <% end %>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% if group_name %> <% if group_name %>
<% reset_cycle %> <% reset_cycle %>
<tr class="group open"> <tr class="group open">
<td colspan="<%= query.inline_columns.size + 1 %>">
<td colspan="<%= query.inline_columns.size + 2 %>">
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span> <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<span class="name"><%= group_name %></span> <span class="count"><%= group_count %></span> <span class="totals"><%= group_totals %></span> <span class="name"><%= group_name %></span> <span class="count"><%= group_count %></span> <span class="totals"><%= group_totals %></span>
<%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}", <%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
<% query.inline_columns.each do |column| %> <% query.inline_columns.each do |column| %>
<%= content_tag('td', column_content(column, issue), :class => column.css_classes) %> <%= content_tag('td', column_content(column, issue), :class => column.css_classes) %>
<% end %> <% end %>
<td class="buttons"><%= link_to_context_menu %></td>
</tr> </tr>
<% query.block_columns.each do |column| <% query.block_columns.each do |column|
if (text = column_content(column, issue)) && text.present? -%> if (text = column_content(column, issue)) && text.present? -%>
<tr class="<%= current_cycle %>"> <tr class="<%= current_cycle %>">
<td colspan="<%= query.inline_columns.size + 1 %>" class="<%= column.css_classes %>">
<td colspan="<%= query.inline_columns.size + 2 %>" class="<%= column.css_classes %>">
<% if query.block_columns.count > 1 %> <% if query.block_columns.count > 1 %>
<span><%= column.caption %></span> <span><%= column.caption %></span>
<% end %> <% end %>

+ 3
- 0
app/views/my/blocks/_timelog.html.erb View File

<th><%= l(:label_project) %></th> <th><%= l(:label_project) %></th>
<th><%= l(:field_comments) %></th> <th><%= l(:field_comments) %></th>
<th><%= l(:field_hours) %></th> <th><%= l(:field_hours) %></th>
<th></th>
</tr></thead> </tr></thead>
<tbody> <tbody>
<% entries_by_day.keys.sort.reverse_each do |day| %> <% entries_by_day.keys.sort.reverse_each do |day| %>
<td><strong><%= day == User.current.today ? l(:label_today).titleize : format_date(day) %></strong></td> <td><strong><%= day == User.current.today ? l(:label_today).titleize : format_date(day) %></strong></td>
<td colspan="2"></td> <td colspan="2"></td>
<td class="hours"><em><%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %></em></td> <td class="hours"><em><%= html_hours(format_hours(entries_by_day[day].sum(&:hours))) %></em></td>
<td></td>
</tr> </tr>
<% entries_by_day[day].each do |entry| -%> <% entries_by_day[day].each do |entry| -%>
<tr id="time-entry-<%= entry.id %>" class="time-entry hascontextmenu"> <tr id="time-entry-<%= entry.id %>" class="time-entry hascontextmenu">
<td class="subject"><%= entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td> <td class="subject"><%= entry.project %> <%= h(' - ') + link_to_issue(entry.issue, :truncate => 50) if entry.issue %></td>
<td class="comments"><%= entry.comments %></td> <td class="comments"><%= entry.comments %></td>
<td class="hours"><%= html_hours(format_hours(entry.hours)) %></td> <td class="hours"><%= html_hours(format_hours(entry.hours)) %></td>
<td class="buttons"><%= link_to_context_menu %></td>
</tr> </tr>
<% end -%> <% end -%>
<% end -%> <% end -%>

+ 1
- 0
app/views/timelog/_list.html.erb View File

:title => l(:button_delete), :title => l(:button_delete),
:class => 'icon-only icon-del' %> :class => 'icon-only icon-del' %>
<% end -%> <% end -%>
<%= link_to_context_menu %>
</td> </td>
</tr> </tr>
<% @query.block_columns.each do |column| <% @query.block_columns.each do |column|

+ 1
- 0
app/views/versions/index.html.erb View File

<tr class="hascontextmenu"> <tr class="hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td> <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
<td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td> <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
<td class="buttons"><%= link_to_context_menu %></td>
</tr> </tr>
<% end -%> <% end -%>
</table> </table>

+ 1
- 0
app/views/versions/show.html.erb View File

<tr class="issue hascontextmenu"> <tr class="issue hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td> <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
<td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td> <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
<td class="buttons"><%= link_to_context_menu %></td>
</tr> </tr>
<% end %> <% end %>
</table> </table>

+ 1
- 0
config/locales/de.yml View File

button_update: Aktualisieren button_update: Aktualisieren
button_view: Anzeigen button_view: Anzeigen
button_watch: Beobachten button_watch: Beobachten
button_actions: Aktionen


default_activity_design: Design default_activity_design: Design
default_activity_development: Entwicklung default_activity_development: Entwicklung

+ 1
- 0
config/locales/en.yml View File

button_reopen: Reopen button_reopen: Reopen
button_import: Import button_import: Import
button_filter: Filter button_filter: Filter
button_actions: Actions


status_active: active status_active: active
status_registered: registered status_registered: registered

BIN
public/images/3_bullets.png View File


+ 2
- 1
public/javascripts/context_menu.js View File



function contextMenuRightClick(event) { function contextMenuRightClick(event) {
var target = $(event.target); var target = $(event.target);
if (target.is('a')) {return;}
if (target.is('a:not(.js-contextmenu)')) {return;}
var tr = target.closest('.hascontextmenu').first(); var tr = target.closest('.hascontextmenu').first();
if (tr.length < 1) {return;} if (tr.length < 1) {return;}
event.preventDefault(); event.preventDefault();
if (!contextMenuObserving) { if (!contextMenuObserving) {
$(document).click(contextMenuClick); $(document).click(contextMenuClick);
$(document).contextmenu(contextMenuRightClick); $(document).contextmenu(contextMenuRightClick);
$(document).on('click', '.js-contextmenu', contextMenuRightClick);
contextMenuObserving = true; contextMenuObserving = true;
} }
} }

+ 3
- 1
public/stylesheets/application.css View File

table.list td.checkbox input {padding:0px;} table.list td.checkbox input {padding:0px;}
table.list td.buttons, div.buttons { white-space:nowrap; text-align: right; } table.list td.buttons, div.buttons { white-space:nowrap; text-align: right; }
table.list td.buttons a, div.buttons a { margin-right: 0.6em; } table.list td.buttons a, div.buttons a { margin-right: 0.6em; }
table.list td.buttons a:last-child, div.buttons a:last-child { margin-right: 0; }
table.list td.buttons img, div.buttons img {vertical-align:middle;} table.list td.buttons img, div.buttons img {vertical-align:middle;}
table.list td.reorder {width:15%; white-space:nowrap; text-align:center; } table.list td.reorder {width:15%; white-space:nowrap; text-align:center; }
table.list table.progress td {padding-right:0px;} table.list table.progress td {padding-right:0px;}


#issue_tree table.issues, #relations table.issues { border: 0; } #issue_tree table.issues, #relations table.issues { border: 0; }
#issue_tree td.checkbox, #relations td.checkbox {display:none;} #issue_tree td.checkbox, #relations td.checkbox {display:none;}
#relations td.buttons {padding:0;}
#relations td.buttons, #issue_tree td.buttons {padding:0;}


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


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

+ 4
- 1
public/stylesheets/responsive.css View File

width: 33.33%; /* three columns for all cells that are not subject */ width: 33.33%; /* three columns for all cells that are not subject */
} }


#issue_tree .issues, #issue_tree .issue,
#relations .issues, #relations .issue { #relations .issues, #relations .issue {
position: relative; /* needed for .buttons positioning */ position: relative; /* needed for .buttons positioning */
} }


/* positioniong of unline button */ /* positioniong of unline button */
#issue_tree .issue > td.buttons,
#relations .issue > td.buttons { #relations .issue > td.buttons {
text-align: right; text-align: right;
position: absolute; position: absolute;
padding-right: 0; padding-right: 0;
} }


#issue_tree .issue .buttons a,
#relations .issue .buttons a { #relations .issue .buttons a {
vertical-align: middle; vertical-align: middle;
padding-right: 5px;
} }


#issue_tree .issue > td.subject,
#relations .issue > td.subject { #relations .issue > td.subject {
padding-right: 25px; /* this is the spaces that .buttons uses next to subject */ padding-right: 25px; /* this is the spaces that .buttons uses next to subject */
} }

Loading…
Cancel
Save