#1269 修复项目--日历信息显示超出边框的BUG

This commit is contained in:
sw 2014-10-09 16:24:12 +08:00
parent 19533f3c50
commit 8b7a775419
2 changed files with 61 additions and 58 deletions

View File

@ -2,38 +2,35 @@
<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project}, <%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project},
:method => :get, :id => 'query_form') do %> :method => :get, :id => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %> <%= hidden_field_tag 'set_filter', '1' %>
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
<div style="<%= @query.new_record? ? "" : "display: none;" %>"> <div style="<%= @query.new_record? ? "" : "display: none;" %>">
<%= render :partial => 'queries/filters', :locals => {:query => @query} %> <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
</div> </div>
</fieldset> </fieldset>
<p style="float:right;">
<p style="float:right;">
<%= link_to_previous_month(@year, @month) %> | <%= link_to_next_month(@year, @month) %> <%= link_to_previous_month(@year, @month) %> | <%= link_to_next_month(@year, @month) %>
</p> </p>
<p class="buttons">
<%= label_tag('month', l(:label_month)) %>
<%= select_month(@month, :prefix => "month", :discard_type => true) %>
<%= label_tag('year', l(:label_year)) %>
<%= select_year(@year, :prefix => "year", :discard_type => true) %>
<p class="buttons"> <%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %>
<%= label_tag('month', l(:label_month)) %> <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, :class => 'icon icon-reload' %>
<%= select_month(@month, :prefix => "month", :discard_type => true) %> </p>
<%= label_tag('year', l(:label_year)) %>
<%= select_year(@year, :prefix => "year", :discard_type => true) %>
<%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %>
<%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, :class => 'icon icon-reload' %>
</p>
<% end %> <% end %>
<%= error_messages_for 'query' %> <%= error_messages_for 'query' %>
<% if @query.valid? %> <% if @query.valid? %>
<%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %> <%= render :partial => 'common/calendar', :locals => {:calendar => @calendar} %>
<p class="legend cal">
<p class="legend cal">
<span class="starting"><%= l(:text_tip_issue_begin_day) %></span> <span class="starting"><%= l(:text_tip_issue_begin_day) %></span>
<span class="ending"><%= l(:text_tip_issue_end_day) %></span> <span class="ending"><%= l(:text_tip_issue_end_day) %></span>
<span class="starting ending"><%= l(:text_tip_issue_begin_end_day) %></span> <span class="starting ending"><%= l(:text_tip_issue_begin_end_day) %></span>
</p> </p>
<% end %> <% end %>
<% content_for :sidebar do %> <% content_for :sidebar do %>

View File

@ -1,15 +1,21 @@
<table class="cal"> <table class="cal" style="width: 100%;table-layout: fixed;">
<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>
</thead> <th scope="col" title="<%= l(:label_week) %>" class="week-number"></th>
<tbody> <% 7.times do |i| %>
<tr> <th scope="col" style='white-space: nowrap;overflow: hidden;text-overflow: ellipsis;'><%= day_name( (calendar.first_wday+i)%7 ) %></th>
<% day = calendar.startdt <% end %>
while day <= calendar.enddt %> </tr>
<%= ("<td class='week-number' title='#{ l(:label_week) }'>#{(day+(11-day.cwday)%7).cweek}</td>".html_safe) if day.cwday == calendar.first_wday %> </thead>
<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if Date.today == day %>"> <tbody>
<p class="day-num"><%= day.day %></p> <tr>
<% calendar.events_on(day).each do |i| %> <% day = calendar.startdt
while day <= calendar.enddt %>
<%= ("<td class='week-number' title='#{ l(:label_week) }'>#{(day+(11-day.cwday)%7).cweek}</td>".html_safe) if day.cwday == calendar.first_wday %>
<td class="<%= day.month==calendar.month ? 'even' : 'odd' %><%= ' today' if Date.today == day %>"
style="word-break: break-all;word-wrap: break-word;">
<p class="day-num"><%= day.day %></p>
<% 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">
<%= h("#{i.project} -") unless @project && @project == i.project %> <%= h("#{i.project} -") unless @project && @project == i.project %>
@ -22,11 +28,11 @@ while day <= calendar.enddt %>
<%= link_to_version i%> <%= link_to_version i%>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>
<%= '</tr><tr>'.html_safe if day.cwday==calendar.last_wday and day!=calendar.enddt %> <%= '</tr><tr>'.html_safe if day.cwday==calendar.last_wday and day!=calendar.enddt %>
<% day = day + 1 <% day = day + 1
end %> end %>
</tr> </tr>
</tbody> </tbody>
</table> </table>