mirror of
https://github.com/redmine/redmine.git
synced 2026-05-07 03:36:36 +02:00
Adds #current_version? method to wiki content.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7972 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -86,7 +86,7 @@ class WikiController < ApplicationController
|
||||
end
|
||||
@editable = editable?
|
||||
@sections_editable = @editable && User.current.allowed_to?(:edit_wiki_pages, @page.project) &&
|
||||
@content.version == @page.content.version &&
|
||||
@content.current_version? &&
|
||||
Redmine::WikiFormatting.supports_section_edit?
|
||||
|
||||
render :action => 'show'
|
||||
|
||||
@@ -45,6 +45,11 @@ class WikiContent < ActiveRecord::Base
|
||||
notified.collect(&:mail)
|
||||
end
|
||||
|
||||
# Return true if the content is the current page content
|
||||
def current_version?
|
||||
true
|
||||
end
|
||||
|
||||
class Version
|
||||
belongs_to :page, :class_name => '::WikiPage', :foreign_key => 'page_id'
|
||||
belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'
|
||||
@@ -101,6 +106,11 @@ class WikiContent < ActiveRecord::Base
|
||||
page.project
|
||||
end
|
||||
|
||||
# Return true if the content is the current page content
|
||||
def current_version?
|
||||
page.content.version == self.version
|
||||
end
|
||||
|
||||
# Returns the previous version or nil
|
||||
def previous
|
||||
@previous ||= WikiContent::Version.find(:first,
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<div class="contextual">
|
||||
<% if @editable %>
|
||||
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %>
|
||||
<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.current_version? %>
|
||||
<%= watcher_tag(@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') if @content.version == @page.content.version %>
|
||||
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.current_version? %>
|
||||
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
|
||||
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %>
|
||||
<%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') unless @content.current_version? %>
|
||||
<% end %>
|
||||
<%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
|
||||
</div>
|
||||
|
||||
<%= wiki_page_breadcrumb(@page) %>
|
||||
|
||||
<% if @content.version != @page.content.version %>
|
||||
<% unless @content.current_version? %>
|
||||
<p>
|
||||
<%= link_to(("\xc2\xab " + l(:label_previous)),
|
||||
:action => 'show', :id => @page.title, :project_id => @page.project,
|
||||
|
||||
Reference in New Issue
Block a user