add_context_menu_in_calendar_v2.patch

Mizuki ISHIKAWA, 2018-01-26 07:20

Download (2.63 KB)

View differences:

app/views/common/_calendar.html.erb
1
<%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do -%>
1 2
<table class="cal">
2 3
<thead>
3 4
<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 12
<p class="day-num"><%= day.day %></p>
12 13
<% calendar.events_on(day).each do |i| %>
13 14
  <% if i.is_a? Issue %>
14
  <div class="<%= i.css_classes %> <%= 'starting' if day == i.start_date %> <%= 'ending' if day == i.due_date %> tooltip">
15
  <div class="<%= i.css_classes %> <%= 'starting' if day == i.start_date %> <%= 'ending' if day == i.due_date %> tooltip hascontextmenu">
15 16
  <%= "#{i.project} -" unless @project && @project == i.project %>
16 17
  <%= link_to_issue i, :truncate => 30 %>
17 18
  <span class="tip"><%= render_issue_tooltip i %></span>
19
  <%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %>
18 20
  </div>
19 21
  <% else %>
20 22
  <span class="icon icon-package">
......
30 32
</tr>
31 33
</tbody>
32 34
</table>
35
<% end %>
36
<%= context_menu %>
public/stylesheets/application.css
928 928
.tooltip{position:relative;z-index:24;}
929 929
.tooltip:hover{z-index:25;color:#000;}
930 930
.tooltip span.tip{display: none; text-align:left;}
931
.tooltip span.tip a { color: #169 !important; }
931 932

  
932 933
div.tooltip:hover span.tip{
933 934
display:block;
......
940 941
color:#505050;
941 942
}
942 943

  
944
table.cal div.tooltip:hover span.tip {
945
  top: 25px;
946
}
947

  
943 948
img.ui-datepicker-trigger {
944 949
  cursor: pointer;
945 950
  vertical-align: middle;
test/functional/calendars_controller_test.rb
124 124
    assert_response :success
125 125
    assert_select 'h2', :text => 'Open issues grouped by tracker'
126 126
  end
127

  
128
  def test_show_should_have_a_context_menu_for_each_issue
129
    get :show
130
    assert_select 'form[data-cm-url=?]', '/issues/context_menu'
131
    assert_select 'div.issue.hascontextmenu' do
132
      assert_select 'input[name=?][type=?]', 'ids[]', 'checkbox'
133
    end
134
  end
127 135
end