redmine_dmsf/app/views/settings/_dmsf_columns.html.erb
2022-06-20 13:27:17 +02:00

46 lines
1.8 KiB
Plaintext

<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-22 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.
%>
<p>
<%= content_tag(:label, l(:field_column_names)) %>
<% columns = DmsfFolder::AVAILABLE_COLUMNS.dup %>
<% columns.concat(extra_columns) if defined?(extra_columns) %>
<% index = columns.index(l(:field_project)) %>
<%# Move Project to the second position %>
<% if index %>
<% columns.insert(0, columns.delete_at(index)) %>
<% end %>
<% cfs = DmsfFileRevisionCustomField.visible.order(:position) %>
<% selected_columns = DmsfFolder::DEFAULT_COLUMNS if selected_columns.blank? %>
<% columns.each_with_index do |column, i| %>
<%= check_box_tag 'settings[dmsf_columns][]', column, selected_columns.include?(column), id: "dmsf_column_#{i}" %>
<%= l("label_column_#{column}").capitalize %>
<br/>
<% end %>
<% columns = cfs.map{ |c| c.name }
columns.each_with_index do |column, i| %>
<%= check_box_tag 'settings[dmsf_columns][]', column, selected_columns.include?(column), id: "dmsf_column_#{i}" %>
<%= h column.capitalize %>
<br/>
<% end %>
</p>