diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 1d0db3f5..2069b36c 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -69,7 +69,7 @@ class DmsfFile < ActiveRecord::Base Redmine::Search.cache_store.delete("DmsfFile-#{o.id}") else # Set desc to an empty string if o.description is nil - desc = o.description.nil? ? "" : o.description + desc = o.description.nil? ? '' : o.description desc += ' / ' if o.description.present? && o.last_revision.comment.present? desc += o.last_revision.comment if o.last_revision.comment.present? end diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index 8280491b..263b8cf3 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -61,6 +61,7 @@ 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/views/search_view_hooks' require 'redmine_dmsf/hooks/helpers/issues_helper_hooks' # Macros diff --git a/lib/redmine_dmsf/hooks/views/search_view_hooks.rb b/lib/redmine_dmsf/hooks/views/search_view_hooks.rb new file mode 100644 index 00000000..baed61d0 --- /dev/null +++ b/lib/redmine_dmsf/hooks/views/search_view_hooks.rb @@ -0,0 +1,42 @@ +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2011-17 Karel Pičman +# +# 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 + + class ViewSearchFormHook < Redmine::Hook::ViewListener + + def view_search_index_container(context={}) + if context && context[:object].is_a?(DmsfFile) + dmsf_file = context[:object] + title = '' + if dmsf_file.dmsf_folder_id + dmsf_folder = DmsfFolder.find_by_id dmsf_file.dmsf_folder_id + title = dmsf_folder.title if dmsf_folder + else + title = dmsf_file.project.name + end + link_to(h(title), + dmsf_folder_path(:id => dmsf_file.project, :folder_id => dmsf_file.dmsf_folder_id), + :class => 'icon icon-folder') + ' / ' + end + end + + end + end +end \ No newline at end of file