Removed more documents code from the core

pull/327/head
Sebastian Schuster 11 years ago
parent 42d9e478b2
commit 29326ef503
  1. 10
      app/helpers/application_helper.rb
  2. 10
      app/views/help/wiki_syntax_detailed.html.erb
  3. 1
      config/settings.yml
  4. 4
      lib/redmine/default_data/loader.rb
  5. 1
      lib/redmine/notifiable.rb
  6. 17
      spec/factories/document_category_factory.rb
  7. 19
      spec/factories/document_factory.rb
  8. 37
      spec/helpers/application_helper_spec.rb
  9. 14
      test/fixtures/documents.yml
  10. 10
      test/fixtures/journals.yml
  11. 9
      test/fixtures/roles.yml
  12. 4
      test/fixtures/user_preferences.yml
  13. 4
      test/unit/helpers/application_helper_test.rb
  14. 2
      test/unit/lib/redmine/notifiable_test.rb

@ -707,11 +707,6 @@ module ApplicationHelper
:class => work_package_css_classes(work_package),
:title => "#{truncate(work_package.subject, :length => 100)} (#{work_package.status.try(:name)})")
end
when 'document'
if document = Document.visible.find_by_id(oid)
link = link_to h(document.title), {:only_path => only_path, :controller => '/documents', :action => 'show', :id => document},
:class => 'document'
end
when 'version'
if version = Version.visible.find_by_id(oid)
link = link_to h(version.name), {:only_path => only_path, :controller => '/versions', :action => 'show', :id => version},
@ -740,11 +735,6 @@ module ApplicationHelper
# removes the double quotes if any
name = identifier.gsub(%r{^"(.*)"$}, "\\1")
case prefix
when 'document'
if project && document = project.documents.visible.find_by_title(name)
link = link_to h(document.title), {:only_path => only_path, :controller => '/documents', :action => 'show', :id => document},
:class => 'document'
end
when 'version'
if project && version = project.versions.visible.find_by_name(name)
link = link_to h(version.name), {:only_path => only_path, :controller => '/versions', :action => 'show', :id => version},

@ -78,16 +78,6 @@ See doc/COPYRIGHT.rdoc for more details.
<p>Links to other resources:</p>
<ul>
<li>Documents:
<ul>
<li><strong>document#17</strong> (link to document with id 17)</li>
<li><strong>document:Greetings</strong> (link to the document with title "Greetings")</li>
<li><strong>document:"Some document"</strong> (double quotes can be used when document title contains spaces)</li>
<li><strong>sandbox:document:"Some document"</strong> (link to a document with title "Some document" in other project "sandbox")</li>
</ul></li>
</ul>
<ul>
<li>Versions:
<ul>

@ -157,7 +157,6 @@ default_projects_modules:
default:
- boards
- calendar
- documents
- issue_tracking
- news
- repository

@ -55,7 +55,6 @@ module Redmine
:log_time,
:view_time_entries,
:comment_news,
:view_documents,
:view_wiki_pages,
:view_wiki_edits,
:edit_wiki_pages,
@ -76,7 +75,6 @@ module Redmine
:log_time,
:view_time_entries,
:comment_news,
:view_documents,
:view_wiki_pages,
:view_wiki_edits,
:add_messages,
@ -92,7 +90,6 @@ module Redmine
:view_calendar,
:view_time_entries,
:comment_news,
:view_documents,
:view_wiki_pages,
:view_wiki_edits,
:add_messages,
@ -103,7 +100,6 @@ module Redmine
:permissions => [:view_issues,
:view_calendar,
:view_time_entries,
:view_documents,
:view_wiki_pages,
:view_wiki_edits,
:browse_repository,

@ -27,7 +27,6 @@ module Redmine
notifications << Notifiable.new('issue_priority_updated', 'issue_updated')
notifications << Notifiable.new('news_added')
notifications << Notifiable.new('news_comment_added')
notifications << Notifiable.new('document_added')
notifications << Notifiable.new('file_added')
notifications << Notifiable.new('message_posted')
notifications << Notifiable.new('wiki_content_added')

@ -1,17 +0,0 @@
#-- copyright
# OpenProject is a project management system.
#
# Copyright (C) 2012-2013 the OpenProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
factory :document_category do
project
sequence(:name) { |n| "I am Category No. #{n}" }
end
end

@ -1,19 +0,0 @@
#-- copyright
# OpenProject is a project management system.
#
# Copyright (C) 2012-2013 the OpenProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
FactoryGirl.define do
factory :document do
project
category :factory => :document_category
sequence(:description) { |n| "I am a document's description No. #{n}" }
sequence(:title) { |n| "I am the document No. #{n}" }
end
end

@ -77,7 +77,7 @@ describe ApplicationHelper do
let(:project_member) { FactoryGirl.create :user,
:member_in_project => project,
:member_through_role => FactoryGirl.create(:role,
:permissions => [:view_work_packages, :edit_work_packages, :view_documents,
:permissions => [:view_work_packages, :edit_work_packages,
:browse_repository, :view_changesets, :view_wiki_pages]) }
let(:issue) { FactoryGirl.create :issue,
:project => project,
@ -138,7 +138,7 @@ describe ApplicationHelper do
let(:project_member) { FactoryGirl.create :user,
:member_in_project => project,
:member_through_role => FactoryGirl.create(:role,
:permissions => [:view_work_packages, :edit_work_packages, :view_documents,
:permissions => [:view_work_packages, :edit_work_packages,
:browse_repository, :view_changesets, :view_wiki_pages]) }
let(:issue) { FactoryGirl.create :issue,
:project => project,
@ -209,39 +209,6 @@ describe ApplicationHelper do
end
end
context "Document links" do
let(:document) { FactoryGirl.create :document,
:title => 'Test document',
:project => project }
let(:document_link) { link_to('Test document',
{:controller => 'documents', :action => 'show', :id => document.id},
:class => 'document') }
context "Plain link" do
subject { textilizable("document##{document.id}") }
it { should eq("<p>#{document_link}</p>") }
end
context "Link with document name" do
subject { textilizable("document##{document.id}") }
it { should eq("<p>#{document_link}</p>") }
end
context "Escaping plain link" do
subject { textilizable("!document##{document.id}") }
it { should eq("<p>document##{document.id}</p>") }
end
context "Escaping link with document name" do
subject { textilizable('!document:"Test document"') }
it { should eq('<p>document:"Test document"</p>') }
end
end
context "Version link" do
let(:version) { FactoryGirl.create :version,
:name => '1.0',

@ -1,14 +0,0 @@
documents_001:
created_on: 2007-01-27 15:08:27 +01:00
project_id: 1
title: "Test document"
id: 1
description: "Document description"
category_id: 1
documents_002:
created_on: 2007-02-12 15:08:27 +01:00
project_id: 1
title: "An other document"
id: 2
description: ""
category_id: 1

@ -152,16 +152,6 @@ journals_013:
notes: "An attachment on an issue"
journaled_id: 7
changed_data: --- {}
journals_014:
id: 14
type: "AttachmentJournal"
activity_type: "documents"
created_at: <%= 2.days.ago.to_date.to_s(:db) %>
version: 1
user_id: 2
notes: "An attachment on a document"
journaled_id: 2
changed_data: --- {}
journals_015:
id: 15
type: "MessageJournal"

@ -31,8 +31,6 @@ roles_001:
- :delete_time_entries
- :manage_news
- :comment_news
- :view_documents
- :manage_documents
- :view_wiki_pages
- :export_wiki_pages
- :view_wiki_edits
@ -79,8 +77,6 @@ roles_002:
- :edit_own_time_entries
- :manage_news
- :comment_news
- :view_documents
- :manage_documents
- :view_wiki_pages
- :view_wiki_edits
- :edit_wiki_pages
@ -118,8 +114,6 @@ roles_003:
- :view_time_entries
- :manage_news
- :comment_news
- :view_documents
- :manage_documents
- :view_wiki_pages
- :view_wiki_edits
- :edit_wiki_pages
@ -148,8 +142,6 @@ roles_004:
- :log_time
- :view_time_entries
- :comment_news
- :view_documents
- :manage_documents
- :view_wiki_pages
- :view_wiki_edits
- :edit_wiki_pages
@ -169,7 +161,6 @@ roles_005:
- :add_issue_notes
- :view_calendar
- :view_time_entries
- :view_documents
- :view_wiki_pages
- :view_wiki_edits
- :browse_repository

@ -5,7 +5,6 @@ user_preferences_001:
:my_page_layout:
left:
- latestnews
- documents
right:
- issuesassignedtome
top:
@ -20,7 +19,6 @@ user_preferences_002:
:my_page_layout:
left:
- latestnews
- documents
right:
- issuesassignedtome
top:
@ -28,4 +26,4 @@ user_preferences_002:
id: 2
user_id: 3
hide_mail: false
hide_mail: false

@ -26,7 +26,7 @@ class ApplicationHelperTest < ActionView::TestCase
@project_member = FactoryGirl.create :user,
:member_in_project => @project,
:member_through_role => FactoryGirl.create(:role,
:permissions => [:view_work_packages, :edit_work_packages, :view_documents,
:permissions => [:view_work_packages, :edit_work_packages,
:browse_repository, :view_changesets, :view_wiki_pages])
@issue = FactoryGirl.create :issue, :project => @project, :author => @project_member, :type => @project.types.first
@ -46,7 +46,7 @@ class ApplicationHelperTest < ActionView::TestCase
def request
@request ||= ActionController::TestRequest.new
end
def test_auto_links
to_test = {
'http://foo.bar' => '<a class="external" href="http://foo.bar">http://foo.bar</a>',

@ -18,7 +18,7 @@ class Redmine::NotifiableTest < ActiveSupport::TestCase
def test_all
assert_equal 12, Redmine::Notifiable.all.length
%w(issue_added issue_updated issue_note_added issue_status_updated issue_priority_updated news_added news_comment_added document_added file_added message_posted wiki_content_added wiki_content_updated).each do |notifiable|
%w(issue_added issue_updated issue_note_added issue_status_updated issue_priority_updated news_added news_comment_added file_added message_posted wiki_content_added wiki_content_updated).each do |notifiable|
assert Redmine::Notifiable.all.collect(&:name).include?(notifiable), "missing #{notifiable}"
end
end

Loading…
Cancel
Save