An option to prevent inheritance of CF #676

This commit is contained in:
Karel Picman 2017-02-17 14:52:35 +01:00
parent 4483cfcf42
commit b7eff2156d
22 changed files with 150 additions and 17 deletions

View File

@ -49,6 +49,7 @@
<div class="splitcontentright">
<div class="custom_fields">
<% @revision.custom_field_values.each do |value| %>
<% value.value = nil if value.custom_field.dmsf_not_inheritable %>
<p><%= custom_field_tag_with_label(:dmsf_file_revision, value) %></p>
<% end %>
</div>

View File

@ -47,6 +47,7 @@
<div class="splitcontentright">
<div class="custom_fields">
<% upload.custom_values.each do |value| %>
<% value.value = nil if value.custom_field.dmsf_not_inheritable %>
<p><%= custom_field_tag_with_label "commited_files[#{i}]", value %></p>
<% end %>
</div>

View File

@ -54,7 +54,8 @@
<% upload.custom_values.each do |value| %>
<p>
<%= label_tag('', h(value.custom_field.name)) %>
<%= h(value) %>
<% value.value = nil if value.custom_field.dmsf_not_inheritable %>
<%= h(value.value) %>
</p>
<% end %>
</div>

View File

@ -354,4 +354,5 @@ cs:
label_dmsf_keep_documents_locked: Ponechat dokumenty zamčené
note_dmsf_keep_documents_locked: Dokumenty zůstanou i po schválení zamčené.
note_global: (globální)
note_global: (globální)
field_dmsf_not_inheritable: Není dědičné

View File

@ -351,4 +351,5 @@ de:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ en:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ es:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ fr:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ it: # Italian strings thx 2 Matteo Arceci!
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ ja:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ pl:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ pt-BR:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ ru:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ sl:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ zh-TW:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -354,4 +354,5 @@ zh:
label_dmsf_keep_documents_locked: Keep documents locked
note_dmsf_keep_documents_locked: Documents will be kept locked when approved
note_global: (global)
note_global: (global)
field_dmsf_not_inheritable: Not inheritable

View File

@ -1,5 +1,30 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2016-17 carlolars
#
# 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.
class AddRevisionToDmsfLock < ActiveRecord::Migration
def change
add_column :dmsf_locks, :revision, :integer
def up
add_column :dmsf_locks, :revision, :integer, :null => true
end
def down
remove_column :dmsf_locks, :revision
end
end

View File

@ -1,5 +1,30 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2016-17 carlolars
#
# 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.
class AddDmsfFileLastRevisionIdToDmsfLock < ActiveRecord::Migration
def change
def up
rename_column :dmsf_locks, :revision, :dmsf_file_last_revision_id
end
def down
rename_column :dmsf_locks, :dmsf_file_last_revision_id, :revision
end
end

View File

@ -0,0 +1,29 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
#
# 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.
class AddDmsfNotInheritableToCustomFields < ActiveRecord::Migration
def up
add_column :custom_fields, :dmsf_not_inheritable, :boolean, :null => true
end
def down
remove_column :custom_fields, :dmsf_not_inheritable
end
end

Binary file not shown.

View File

@ -59,6 +59,7 @@ require 'redmine_dmsf/hooks/views/view_projects_form_hook'
require 'redmine_dmsf/hooks/views/base_view_hooks'
require 'redmine_dmsf/hooks/views/my_account_view_hooks'
require 'redmine_dmsf/hooks/views/issue_view_hooks'
require 'redmine_dmsf/hooks/views/custom_field_view_hooks'
require 'redmine_dmsf/hooks/helpers/issues_helper_hooks'
# Macros

View File

@ -0,0 +1,37 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
#
# 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.
module RedmineDmsf
module Hooks
include Redmine::Hook
class DmsfViewListener < Redmine::Hook::ViewListener
def view_custom_fields_form_dmsf_file_revision_custom_field(context={})
if context.is_a?(Hash) && context[:form]
# Add the inheritable option
f = context[:form]
"<p>#{f.check_box :dmsf_not_inheritable}</p>"
end
end
end
end
end