Skip to content

Commit

Permalink
#641 Project column
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Mar 1, 2017
1 parent 3e03f0c commit 865db59
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/dmsf_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def get_display_params
@file_approval_allowed = User.current.allowed_to?(:file_approval, @project)
tag = params[:custom_field_id].present? && params[:custom_value].present?
@folder = nil if tag
@extra_columns = [l(:label_document_url), l(:label_last_revision_id)]
@extra_columns = [l(:field_project), l(:label_document_url), l(:label_last_revision_id)]
if @tree_view
@locked_for_user = false
else
Expand Down
2 changes: 2 additions & 0 deletions app/models/dmsf_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ def extension

def to_csv(columns, level)
csv = []
# Project
csv << self.project.name if columns.include?(l(:field_project))
# Id
csv << self.id if columns.include?('id')
# Title
Expand Down
2 changes: 2 additions & 0 deletions app/models/dmsf_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ def propfind_cache_key

def to_csv(columns, level)
csv = []
# Project
csv << self.project.name if columns.include?(l(:field_project))
# Id
csv << self.id if columns.include?('id')
# Title
Expand Down
2 changes: 2 additions & 0 deletions app/models/dmsf_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def is_file?
def to_csv(columns, level)
csv = []
if self.target_type == 'DmsfUrl'
# Project
csv << self.project.name if columns.include?(l(:field_project))
# Id
csv << self.id if columns.include?('id')
# Title
Expand Down
5 changes: 5 additions & 0 deletions app/views/settings/_dmsf_columns.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<%= 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 = CustomField.where(:type => 'DmsfFileRevisionCustomField').order(:position) %>
<% columns.concat(cfs.map{ |c| c.name }) %>
<% selected_columns = settings[:dmsf_columns] %>
Expand Down

0 comments on commit 865db59

Please sign in to comment.