#1384修复wiki注释超出边框的问题

This commit is contained in:
sw 2014-10-22 10:16:08 +08:00
parent 42f3fbd4b8
commit 56ac9222ef
3 changed files with 131 additions and 111 deletions

View File

@ -1,57 +1,62 @@
<%= wiki_page_breadcrumb(@page) %>
<script src="http://<%= Setting.host_name%>/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<h3><%= h @page.pretty_title %></h3>
<h3>
<%= h @page.pretty_title %>
</h3>
<%= form_for @content, :as => :content,
:url => {:action => 'update', :id => @page.title},
:html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| %>
<%= f.hidden_field :version %>
<% if @section %>
<%= hidden_field_tag 'section', @section %>
<%= hidden_field_tag 'section_hash', @section_hash %>
<% end %>
<%= error_messages_for 'content' %>
<%= f.hidden_field :version %>
<% if @section %>
<%= hidden_field_tag 'section', @section %>
<%= hidden_field_tag 'section_hash', @section_hash %>
<% end %>
<%= error_messages_for 'content' %>
<div class="actions" style="max-width:680px">
<p style="max-width:680px;"><%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %></p>
<p style="max-width:680px;">
<%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %>
</p>
<script type="text/javascript">
var ckeditor=CKEDITOR.replace('editor02',{height: '300'});
</script>
</div>
<div class="box tabular">
<%#= text_area_tag 'content[text]', @text, :cols => 100, :rows => 25,
:class => 'wiki-edit', :accesskey => accesskey(:edit) %>
<div class="box tabular">
<% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %>
<%= fields_for @page do |fp| %>
<p>
<label>
<%= l(:field_parent_title) %>
</label>
<%= fp.select :parent_id,content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %>
</p>
<% end %>
<% end %>
<!--p style="max-width:680px"><input id="editor02" required="true" /><%#= f.text_area :comments, :required => true, :id => 'editor02' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script-->
<p style="width: 100%;">
<label>
<%= l(:field_comments) %>
</label>
<%= f.text_field :comments, :style => "width:75%;" %>
</p>
<p>
<label>
<%=l(:label_attachment_plural)%>
</label>
<%= render :partial => 'attachments/form' %>
</p>
</div>
<% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %>
<%= fields_for @page do |fp| %>
<p>
<label><%= l(:field_parent_title) %></label>
<%= fp.select :parent_id,
content_tag('option', '', :value => '') +
wiki_page_options_for_select(@wiki.pages.all(:include => :parent) -
@page.self_and_descendants, @page.parent) %>
<%= submit_tag l(:button_save) %>
</p>
<% end %>
<%= wikitoolbar_for 'content_text' %>
<% end %>
<p style="width: 100%;"><label><%= l(:field_comments) %></label><%= f.text_field :comments, :style => "width:75%;" %></p>
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div>
<p><%= submit_tag l(:button_save) %>
<%#= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %></p>
<%= wikitoolbar_for 'content_text' %>
<% end %>
<div id="preview" class="wiki"></div>
<% content_for :header_tags do %>
<%= robot_exclusion_tag %>
<% end %>
<% html_title @page.pretty_title %>

View File

@ -8,35 +8,51 @@
:project_id => @page.project, :id => @page.title},
:method => :get) do %>
<table class="list wiki-page-versions">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:field_updated_on) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
<th></th>
</tr></thead>
<tbody>
<% show_diff = @versions.size > 1 %>
<% line_num = 1 %>
<% @versions.each do |ver| %>
<tr class="wiki-page-version <%= cycle("odd", "even") %>">
<td class="id"><%= link_to h(ver.version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => ver.version %></td>
<td class="checkbox"><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked', true);") if show_diff && (line_num < @versions.size) %></td>
<td class="checkbox"><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %></td>
<td class="updated_on"><%= format_time(ver.updated_on) %></td>
<td class="author"><%= link_to_user ver.author %></td>
<td class="comments"><%=h ver.comments %></td>
<td class="buttons">
<%= link_to l(:button_annotate), :action => 'annotate', :id => @page.title, :version => ver.version %>
<%= delete_link wiki_page_path(@page, :version => ver.version) if User.current.allowed_to?(:delete_wiki_pages, @page.project) && @version_count > 1 %>
</td>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
<thead>
<tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:field_updated_on) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
<th></th>
</tr>
</thead>
<tbody>
<% show_diff = @versions.size > 1 %>
<% line_num = 1 %>
<% @versions.each do |ver| %>
<tr class="wiki-page-version <%= cycle("odd", "even") %>">
<td class="id">
<%= link_to h(ver.version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => ver.version %>
</td>
<td class="checkbox">
<%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked', true);") if show_diff && (line_num < @versions.size) %>
</td>
<td class="checkbox">
<%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %>
</td>
<td class="updated_on">
<%= format_time(ver.updated_on) %>
</td>
<td class="author">
<%= link_to_user ver.author %>
</td>
<td class="comments" style="word-break: break-all;word-wrap: break-word;" title="<%= h ver.comments%>">
<%=h ver.comments.truncate(25,ommision:'...') %>
</td>
<td class="buttons">
<%= link_to l(:button_annotate), :action => 'annotate', :id => @page.title, :version => ver.version %>
<%= delete_link wiki_page_path(@page, :version => ver.version) if User.current.allowed_to?(:delete_wiki_pages, @page.project) && @version_count > 1 %>
</td>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
<%= submit_tag l(:label_view_diff), :class => 'small' if show_diff %>
<span class="pagination"><%= pagination_links_full @version_pages, @version_count %></span>
<span class="pagination">
<%= pagination_links_full @version_pages, @version_count %>
</span>
<% end %>

View File

@ -1,61 +1,62 @@
<div class="contextual">
<% if @editable %>
<% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
<%= watcher_link(@page, User.current) %>
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>
<% else %>
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') %>
<% end %>
<% end %>
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
<% if @editable %>
<% if @content.current_version? %>
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
<%= watcher_link(@page, User.current) %>
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>
<% else %>
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') %>
<% end %>
<% end %>
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
</div>
<%= wiki_page_breadcrumb(@page) %>
<% unless @content.current_version? %>
<p>
<%= link_to(("\xc2\xab " + l(:label_previous)),
:action => 'show', :id => @page.title, :project_id => @page.project,
:version => @content.previous.version) + " - " if @content.previous %>
<%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %>
<%= '('.html_safe + link_to(l(:label_diff), :controller => 'wiki', :action => 'diff',
:id => @page.title, :project_id => @page.project,
:version => @content.version) + ')'.html_safe if @content.previous %> -
<%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show',
:id => @page.title, :project_id => @page.project,
:version => @content.next.version) + " - " if @content.next %>
<%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => nil) %>
<br />
<em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)
%>, <%= format_time(@content.updated_on) %> </em><br />
<%=h @content.comments %>
<%= link_to(("\xc2\xab " + l(:label_previous)),
:action => 'show', :id => @page.title, :project_id => @page.project,
:version => @content.previous.version) + " - " if @content.previous %>
<%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %>
<%= '('.html_safe + link_to(l(:label_diff), :controller => 'wiki', :action => 'diff',
:id => @page.title, :project_id => @page.project,
:version => @content.version) + ')'.html_safe if @content.previous %> -
<%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show',
:id => @page.title, :project_id => @page.project,
:version => @content.next.version) + " - " if @content.next %>
<%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => nil) %>
<br />
<em>
<%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)%>,
<%= format_time(@content.updated_on) %>
</em>
<br />
<%=h @content.comments %>
</p>
<hr />
<% end %>
<%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
<%= link_to_attachments @page %>
<% if @editable && authorize_for('wiki', 'add_attachment') %>
<div id="wiki_add_attachment">
<p><%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;",
:id => 'attach_files_link' %></p>
<%= form_tag({:controller => 'wiki', :action => 'add_attachment',
:project_id => @project, :id => @page.title},
:multipart => true, :id => "add_attachment_form",
:style => "display:none;") do %>
<div class="box">
<p><%= render :partial => 'attachments/form' %></p>
</div>
<%= submit_tag l(:button_add) %>
<%= link_to l(:button_cancel), {}, :onclick => "$('#add_attachment_form').hide(); return false;" %>
<% end %>
</div>
<div id="wiki_add_attachment">
<p>
<%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;",
:id => 'attach_files_link' %></p>
<%= form_tag({:controller => 'wiki', :action => 'add_attachment',
:project_id => @project, :id => @page.title},
:multipart => true, :id => "add_attachment_form",
:style => "display:none;") do %>
<div class="box">
<p>
<%= render :partial => 'attachments/form' %>
</p>
</div>
<%= submit_tag l(:button_add) %>
<%= link_to l(:button_cancel), {}, :onclick => "$('#add_attachment_form').hide(); return false;" %>
<% end %>
</div>
<% end %>
<% other_formats_links do |f| %>
@ -63,9 +64,7 @@
<%= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %>
<%= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %>
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
<% content_for :sidebar do %>
<%= render :partial => 'sidebar' %>
<% end %>
<% html_title @page.pretty_title %>