A better navigation in found results #667

This commit is contained in:
Karel Picman 2017-04-14 06:48:52 +02:00
parent cc5ffb7b28
commit 9b9abd6eb8
3 changed files with 44 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,42 @@
# 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
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