Merge branch 'release/1-0-2' into stable

Conflicts:
	doc/CHANGELOG.md
	lib/open_project/documents/version.rb
pull/6827/head
Jens Ulferts 11 years ago
commit f3f01c923e
  1. 27
      README.md
  2. 1
      app/models/document.rb
  3. 5
      doc/CHANGELOG.md
  4. 2
      lib/open_project/documents/engine.rb
  5. 2
      lib/open_project/documents/version.rb
  6. 51
      spec/lib/redmine/access_control_spec.rb
  7. 7
      spec/models/document_spec.rb

@ -6,6 +6,8 @@ This plugin adds features to connect and categorize documents with your project.
Under `Modules >> Administration >> Enumerations` you can find the section `Document categories`
where you can define several document categories that projects can use to categorize their documents.
Documents can be enabled for every project individually. Simply activate the `Documents` module in the project settings.
When you go to any of your projects you can see the entry `Documents` in the main menu. There you can
attach new documents to the project by following the `New document` link located in the top right corner of the page.
@ -39,6 +41,31 @@ This plugin contains migrations. To migrate the database, run:
`rake db:migrate`
Tests
-----
Assuming you have to following directory structure:
```
.
├── openproject
├── openproject-documents
```
Replace the openproject-document ``Gemfile.plugins`` entry with the following:
```
gem "openproject-documents", path: "../openproject-documents"
```
You run the specs with the following commands:
```
cd openproject
rake db:test:load # this needs to be done only once
rspec ../openproject-documents
```
Deinstallation
--------------

@ -39,6 +39,7 @@ class Document < ActiveRecord::Base
acts_as_journalized
acts_as_event title: Proc.new { |o| "#{Document.model_name.human}: #{o.title}" },
url: Proc.new { |o| { controller: '/documents', action: 'show', id: o.id } },
datetime: :created_on,
author: ( Proc.new do |o|
o.attachments.find(:first, order: "#{Attachment.table_name}.created_on ASC").try(:author)
end)

@ -32,6 +32,11 @@ See doc/COPYRIGHT.rdoc for more details.
# Changelog
## 1.0.2
* `#7679` Fix: Permissions not nested in 'documents' project module
* `#5650` Fix: Acts as event datetime
## 1.0.1
* `#5361` Add missing journal data migration

@ -46,8 +46,10 @@ module OpenProject::Documents
:caption => :label_document_plural,
:html => { :class => 'icon2 icon-book1' }
project_module :documents do |map|
permission :manage_documents, {:documents => [:new, :create, :edit, :update, :destroy, :add_attachment]}, :require => :loggedin
permission :view_documents, :documents => [:index, :show, :download]
end
Redmine::Notifiable.all << Redmine::Notifiable.new('document_added')

@ -31,6 +31,6 @@
module OpenProject
module Documents
VERSION = "1.0.1"
VERSION = "1.0.2"
end
end

@ -0,0 +1,51 @@
#-- copyright
# OpenProject Documents Plugin
#
# Former OpenProject Core functionality extracted into a plugin.
#
# Copyright (C) 2009-2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.dirname(__FILE__) + '/../../spec_helper'
describe Redmine::AccessControl do
describe 'manage documents permission' do
it 'should be part of the documents project module' do
permission = Redmine::AccessControl.permission(:manage_documents)
expect(permission.project_module).to eql(:documents)
end
end
describe 'view documents permission' do
it 'should be part of the documents project module' do
permission = Redmine::AccessControl.permission(:view_documents)
expect(permission.project_module).to eql(:documents)
end
end
end

@ -101,4 +101,11 @@ describe Document do
end
end
describe "acts as event" do
let(:now) { Time.now }
let(:document) { FactoryGirl.build(:document,
created_on: now) }
it { expect(document.event_datetime).to eq(now) }
end
end

Loading…
Cancel
Save