From 56ac9222eff587ddaf4546b1b4f4637355d2e101 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 22 Oct 2014 10:16:08 +0800 Subject: [PATCH] =?UTF-8?q?#1384=E4=BF=AE=E5=A4=8Dwiki=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E8=B6=85=E5=87=BA=E8=BE=B9=E6=A1=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/wiki/edit.html.erb | 71 +++++++++++++----------- app/views/wiki/history.html.erb | 74 +++++++++++++++---------- app/views/wiki/show.html.erb | 97 ++++++++++++++++----------------- 3 files changed, 131 insertions(+), 111 deletions(-) diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 30e8b73ae..89dcfdb7a 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -1,57 +1,62 @@ <%= wiki_page_breadcrumb(@page) %> -

<%= h @page.pretty_title %>

+

+ <%= h @page.pretty_title %> +

<%= 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' %>
-

<%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %>

+

+ <%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %> +

-
-<%#= text_area_tag 'content[text]', @text, :cols => 100, :rows => 25, - :class => 'wiki-edit', :accesskey => accesskey(:edit) %> +
+ <% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %> + <%= fields_for @page do |fp| %> +

+ + <%= fp.select :parent_id,content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %> +

+ <% end %> + <% end %> - +

+ + <%= f.text_field :comments, :style => "width:75%;" %> +

+

+ + <%= render :partial => 'attachments/form' %> +

+
-<% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %> - <%= fields_for @page do |fp| %>

- - <%= 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) %>

- <% end %> + <%= wikitoolbar_for 'content_text' %> <% end %> - -

<%= f.text_field :comments, :style => "width:75%;" %>

-

<%= render :partial => 'attachments/form' %>

-
- -

<%= submit_tag l(:button_save) %> - <%#= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>

-<%= wikitoolbar_for 'content_text' %> -<% end %> -
- <% content_for :header_tags do %> <%= robot_exclusion_tag %> <% end %> - <% html_title @page.pretty_title %> diff --git a/app/views/wiki/history.html.erb b/app/views/wiki/history.html.erb index 17cb19118..19a577d69 100644 --- a/app/views/wiki/history.html.erb +++ b/app/views/wiki/history.html.erb @@ -8,35 +8,51 @@ :project_id => @page.project, :id => @page.title}, :method => :get) do %> - - - - - - - - - - -<% show_diff = @versions.size > 1 %> -<% line_num = 1 %> -<% @versions.each do |ver| %> -"> - - - - - - - - -<% line_num += 1 %> -<% end %> - + + + + + + + + + + + + + <% show_diff = @versions.size > 1 %> + <% line_num = 1 %> + <% @versions.each do |ver| %> + "> + + + + + + + + + <% line_num += 1 %> + <% end %> +
#<%= l(:field_updated_on) %><%= l(:field_author) %><%= l(:field_comments) %>
<%= link_to h(ver.version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => ver.version %><%= 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) %><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %><%= format_time(ver.updated_on) %><%= link_to_user ver.author %><%=h ver.comments %> - <%= 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 %> -
#<%= l(:field_updated_on) %><%= l(:field_author) %><%= l(:field_comments) %>
+ <%= link_to h(ver.version), :action => 'show', :id => @page.title, :project_id => @page.project, :version => ver.version %> + + <%= 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) %> + + <%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %> + + <%= format_time(ver.updated_on) %> + + <%= link_to_user ver.author %> + + <%=h ver.comments.truncate(25,ommision:'...') %> + + <%= 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 %> +
<%= submit_tag l(:label_view_diff), :class => 'small' if show_diff %> -<%= pagination_links_full @version_pages, @version_count %> + + <%= pagination_links_full @version_pages, @version_count %> + <% end %> diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index b4386b754..eff1e9d77 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -1,61 +1,62 @@
-<% 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') %>
- <%= wiki_page_breadcrumb(@page) %> - <% unless @content.current_version? %>

- <%= 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) %> -
- <%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous) - %>, <%= format_time(@content.updated_on) %>
- <%=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) %> +
+ + <%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)%>, + <%= format_time(@content.updated_on) %> + +
+ <%=h @content.comments %>


<% end %> - <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> - <%= link_to_attachments @page %> - <% if @editable && authorize_for('wiki', 'add_attachment') %> -
-

<%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;", - :id => 'attach_files_link' %>

-<%= form_tag({:controller => 'wiki', :action => 'add_attachment', - :project_id => @project, :id => @page.title}, - :multipart => true, :id => "add_attachment_form", - :style => "display:none;") do %> -
-

<%= render :partial => 'attachments/form' %>

-
-<%= submit_tag l(:button_add) %> -<%= link_to l(:button_cancel), {}, :onclick => "$('#add_attachment_form').hide(); return false;" %> -<% end %> -
+
+

+ <%= link_to l(:label_attachment_new), {}, :onclick => "$('#add_attachment_form').show(); return false;", + :id => 'attach_files_link' %>

+ <%= form_tag({:controller => 'wiki', :action => 'add_attachment', + :project_id => @project, :id => @page.title}, + :multipart => true, :id => "add_attachment_form", + :style => "display:none;") do %> +
+

+ <%= render :partial => 'attachments/form' %> +

+
+ <%= submit_tag l(:button_add) %> + <%= link_to l(:button_cancel), {}, :onclick => "$('#add_attachment_form').hide(); return false;" %> + <% end %> +
<% 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 %>