A better navigation in found results #667
This commit is contained in:
parent
cc5ffb7b28
commit
9b9abd6eb8
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
42
lib/redmine_dmsf/hooks/views/search_view_hooks.rb
Normal file
42
lib/redmine_dmsf/hooks/views/search_view_hooks.rb
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user