Add right-click context menu in calendar (#28067).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@17186 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2018-01-30 08:03:00 +00:00
parent c1f92c7f06
commit 0f4fb452e7
3 changed files with 16 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
<%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do -%>
<table class="cal"> <table class="cal">
<thead> <thead>
<tr><th scope="col" title="<%= l(:label_week) %>" class="week-number"></th><% 7.times do |i| %><th scope="col"><%= day_name( (calendar.first_wday+i)%7 ) %></th><% end %></tr> <tr><th scope="col" title="<%= l(:label_week) %>" class="week-number"></th><% 7.times do |i| %><th scope="col"><%= day_name( (calendar.first_wday+i)%7 ) %></th><% end %></tr>
@@ -11,10 +12,11 @@ while day <= calendar.enddt %>
<p class="day-num"><%= day.day %></p> <p class="day-num"><%= day.day %></p>
<% calendar.events_on(day).each do |i| %> <% calendar.events_on(day).each do |i| %>
<% if i.is_a? Issue %> <% if i.is_a? Issue %>
<div class="<%= i.css_classes %> <%= 'starting' if day == i.start_date %> <%= 'ending' if day == i.due_date %> tooltip"> <div class="<%= i.css_classes %> <%= 'starting' if day == i.start_date %> <%= 'ending' if day == i.due_date %> tooltip hascontextmenu">
<%= "#{i.project} -" unless @project && @project == i.project %> <%= "#{i.project} -" unless @project && @project == i.project %>
<%= link_to_issue i, :truncate => 30 %> <%= link_to_issue i, :truncate => 30 %>
<span class="tip"><%= render_issue_tooltip i %></span> <span class="tip"><%= render_issue_tooltip i %></span>
<%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %>
</div> </div>
<% else %> <% else %>
<span class="icon icon-package"> <span class="icon icon-package">
@@ -30,3 +32,5 @@ end %>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<% end %>
<%= context_menu %>

View File

@@ -928,6 +928,7 @@ p.cal.legend span {display:block;}
.tooltip{position:relative;z-index:24;} .tooltip{position:relative;z-index:24;}
.tooltip:hover{z-index:25;color:#000;} .tooltip:hover{z-index:25;color:#000;}
.tooltip span.tip{display: none; text-align:left;} .tooltip span.tip{display: none; text-align:left;}
.tooltip span.tip a { color: #169 !important; }
div.tooltip:hover span.tip{ div.tooltip:hover span.tip{
display:block; display:block;
@@ -940,6 +941,10 @@ font-size: 0.8em;
color:#505050; color:#505050;
} }
table.cal div.tooltip:hover span.tip {
top: 25px;
}
img.ui-datepicker-trigger { img.ui-datepicker-trigger {
cursor: pointer; cursor: pointer;
vertical-align: middle; vertical-align: middle;

View File

@@ -48,6 +48,12 @@ class CalendarsControllerTest < Redmine::ControllerTest
assert_select 'p.buttons' assert_select 'p.buttons'
end end
end end
# Assert context menu on issues
assert_select 'form[data-cm-url=?]', '/issues/context_menu'
assert_select 'div.issue.hascontextmenu' do
assert_select 'input[name=?][type=?]', 'ids[]', 'checkbox'
end
end end
def test_show_should_run_custom_queries def test_show_should_run_custom_queries