Project

General

Profile

« Previous | Next » 

Revision b061724d

Added by Maria Agaphontzev almost 5 years ago

Fixes #25543 - Breadcrumb switcher dosen't work for filters

View differences:

app/models/filter.rb
type.presence
end
def resource_type_label
resource_class.try(:humanize_class_name) || resource_type || N_('(Miscellaneous)')
end
def resource_class
@resource_class ||= self.class.get_resource_class(resource_type)
end
app/views/api/v2/filters/main.json.rabl
extends "api/v2/filters/base"
attributes :search, :resource_type, :unlimited?, :created_at, :updated_at, :override?
attributes :search, :resource_type, :resource_type_label, :unlimited?, :created_at, :updated_at, :override?
child :role do
extends "api/v2/roles/base"
app/views/filters/edit.html.erb
<%=
breadcrumbs(
resource_url: api_filters_path(),
resource_filter: 'role_id=%s' % @filter.role.id,
name_field: "resource_type_label",
items: [
(@role.present? ? { caption: _('Roles'), url: (url_for(roles_path) if authorized_for(hash_for_roles_path)) } : { caption: _("Filters"), url: filters_path }),
({ caption: _("%s filters") % @role.to_s, url: filters_path(role_id: @role.id) } if @role.present?),
{ caption: _('Edit %s') % @filter.to_s },
{
caption: _("Roles"),
url: (url_for(roles_path) if authorized_for(hash_for_roles_path))
},
{
caption: _('%s Filters') % @filter.role.name,
url: (filters_path(:role_id => @filter.role) if authorized_for(hash_for_filters_path))
},
{
caption: _('Edit %s Resource Filter' ) % _(@filter.resource_type_label)
},
].compact
)
%>
app/views/filters/index.html.erb
</td>
<% end %>
<td>
<%= _(filter.resource_class.try(:humanize_class_name) || filter.resource_type || '(Miscellaneous)') %>
<%= _( filter.resource_type_label ) %>
</td>
<td><%= filter.permissions.map(&:name).join(', ') %></td>
<td><%= checked_icon filter.unlimited? %></td>
webpack/assets/javascripts/react_app/components/BreadcrumbBar/components/BreadcrumbSwitcherPopover.js
<EllipsisWithTooltip>
{searchValue && searchValue.length ? (
<SubstringWrapper substring={searchValue}>
{resource.name}
{__(resource.name)}
</SubstringWrapper>
) : (
resource.name
__(resource.name)
)}
</EllipsisWithTooltip>
</ListGroupItem>

Also available in: Unified diff