blacklight-spotlight 4.1.2 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spotlight/spotlight.esm.js +27 -24
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +27 -24
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +19 -1
- data/app/components/spotlight/breadcrumbs_component.html.erb +19 -0
- data/app/components/spotlight/breadcrumbs_component.rb +23 -0
- data/app/components/spotlight/exhibit_navbar_component.html.erb +25 -0
- data/app/components/spotlight/exhibit_navbar_component.rb +12 -0
- data/app/components/spotlight/tag_list_form_component.html.erb +14 -0
- data/app/components/spotlight/tag_list_form_component.rb +13 -0
- data/app/controllers/concerns/spotlight/controller.rb +9 -1
- data/app/controllers/spotlight/about_pages_controller.rb +1 -1
- data/app/controllers/spotlight/admin_users_controller.rb +2 -2
- data/app/controllers/spotlight/appearances_controller.rb +3 -3
- data/app/controllers/spotlight/browse_controller.rb +2 -2
- data/app/controllers/spotlight/bulk_updates_controller.rb +6 -1
- data/app/controllers/spotlight/catalog_controller.rb +11 -10
- data/app/controllers/spotlight/contacts_controller.rb +5 -5
- data/app/controllers/spotlight/custom_fields_controller.rb +5 -5
- data/app/controllers/spotlight/custom_search_fields_controller.rb +5 -5
- data/app/controllers/spotlight/dashboards_controller.rb +4 -4
- data/app/controllers/spotlight/exhibits_controller.rb +6 -5
- data/app/controllers/spotlight/feature_pages_controller.rb +5 -5
- data/app/controllers/spotlight/home_pages_controller.rb +2 -2
- data/app/controllers/spotlight/job_trackers_controller.rb +3 -3
- data/app/controllers/spotlight/metadata_configurations_controller.rb +3 -3
- data/app/controllers/spotlight/pages_controller.rb +2 -2
- data/app/controllers/spotlight/resources_controller.rb +4 -4
- data/app/controllers/spotlight/roles_controller.rb +3 -3
- data/app/controllers/spotlight/search_configurations_controller.rb +3 -3
- data/app/controllers/spotlight/searches_controller.rb +4 -4
- data/app/controllers/spotlight/sites_controller.rb +4 -4
- data/app/controllers/spotlight/tags_controller.rb +3 -3
- data/app/controllers/spotlight/translations_controller.rb +3 -3
- data/app/javascript/spotlight/admin/edit_in_place.js +27 -0
- data/app/javascript/spotlight/admin/index.js +0 -2
- data/app/models/breadcrumb.rb +15 -0
- data/app/models/spotlight/analytics/ga.rb +2 -2
- data/app/views/shared/_exhibit_navbar.html.erb +2 -24
- data/app/views/shared/_masthead.html.erb +1 -1
- data/app/views/spotlight/exhibits/_form.html.erb +1 -1
- data/app/views/spotlight/exhibits/_new_exhibit_form.html.erb +1 -1
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +16 -5
- data/app/views/spotlight/metadata_configurations/edit.html.erb +2 -2
- data/config/locales/spotlight.en.yml +4 -0
- data/lib/generators/spotlight/templates/catalog_controller.rb +1 -0
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +4 -0
- data/lib/spotlight/engine.rb +2 -9
- data/lib/spotlight/version.rb +1 -1
- data/spec/support/views/test_view_helpers.rb +0 -1
- metadata +10 -26
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +0 -39
- data/app/javascript/spotlight/admin/appearance.js +0 -22
- data/app/views/shared/_breadcrumbs.html.erb +0 -7
@@ -40,9 +40,9 @@ module Spotlight
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def attach_breadcrumbs
|
43
|
-
add_breadcrumb
|
44
|
-
add_breadcrumb
|
45
|
-
add_breadcrumb
|
43
|
+
add_breadcrumb(t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit)
|
44
|
+
add_breadcrumb(t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit))
|
45
|
+
add_breadcrumb(t(:'spotlight.curation.sidebar.translations'))
|
46
46
|
end
|
47
47
|
|
48
48
|
def exhibit_params
|
@@ -43,5 +43,32 @@ export default class {
|
|
43
43
|
return false;
|
44
44
|
});
|
45
45
|
})
|
46
|
+
|
47
|
+
$("[data-behavior='restore-default']").each(function(){
|
48
|
+
var hidden = $("[data-default-value]", $(this));
|
49
|
+
var value = $($("[data-in-place-edit-target]", $(this)).data('in-place-edit-target'), $(this));
|
50
|
+
var button = $("[data-restore-default]", $(this));
|
51
|
+
|
52
|
+
hidden.on('keypress', function(e) {
|
53
|
+
if(e.which == 13) {
|
54
|
+
hidden.trigger('blur');
|
55
|
+
return false;
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
59
|
+
hidden.on('blur', function(){
|
60
|
+
if( $(this).val() == $(this).data('default-value') ) {
|
61
|
+
button.addClass('d-none');
|
62
|
+
} else {
|
63
|
+
button.removeClass('d-none');
|
64
|
+
}
|
65
|
+
});
|
66
|
+
button.on('click', function(e){
|
67
|
+
e.preventDefault();
|
68
|
+
hidden.val(hidden.data('default-value'));
|
69
|
+
value.text(hidden.data('default-value'));
|
70
|
+
button.hide();
|
71
|
+
});
|
72
|
+
});
|
46
73
|
}
|
47
74
|
}
|
@@ -8,7 +8,6 @@ import 'Path.Drag'
|
|
8
8
|
|
9
9
|
import AddAnother from 'spotlight/admin/add_another'
|
10
10
|
import AddNewButton from 'spotlight/admin/add_new_button'
|
11
|
-
import Appearance from 'spotlight/admin/appearance'
|
12
11
|
import BlacklightConfiguration from 'spotlight/admin/blacklight_configuration'
|
13
12
|
import CopyEmailAddress from 'spotlight/admin/copy_email_addresses'
|
14
13
|
import Croppable from 'spotlight/admin/croppable'
|
@@ -60,7 +59,6 @@ export default class {
|
|
60
59
|
connect() {
|
61
60
|
new AddAnother().connect()
|
62
61
|
new AddNewButton().connect()
|
63
|
-
new Appearance().connect()
|
64
62
|
new CopyEmailAddress().connect()
|
65
63
|
new Croppable().connect()
|
66
64
|
new EditInPlace().connect()
|
@@ -37,8 +37,8 @@ module Spotlight
|
|
37
37
|
filter: Google::Analytics::Data::V1beta::Filter.new(
|
38
38
|
field_name: 'pagePath',
|
39
39
|
string_filter: Google::Analytics::Data::V1beta::Filter::StringFilter.new(
|
40
|
-
match_type: :
|
41
|
-
value: path
|
40
|
+
match_type: :PARTIAL_REGEXP,
|
41
|
+
value: "^#{path}(/.*)?$"
|
42
42
|
)
|
43
43
|
)
|
44
44
|
)
|
@@ -1,24 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<% if resource_masthead? %>
|
4
|
-
<%= link_to(current_exhibit.title, spotlight.exhibit_path(current_exhibit), class: 'navbar-brand') %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<ul class="navbar-nav <%= resource_masthead? ? 'justify-content-md-end' : 'mr-auto me-auto' %>">
|
8
|
-
<li class="nav-item <%= "active" if current_page?([spotlight, current_exhibit]) %>"><%= link_to t(:'spotlight.curation.nav.home'), [spotlight, current_exhibit], class: 'nav-link' %></li>
|
9
|
-
<% current_exhibit.main_navigations.displayable.each do |navigation| %>
|
10
|
-
<%= render partial: "shared/#{navigation.nav_type}_navbar", locals: { navigation: navigation } %>
|
11
|
-
<% end %>
|
12
|
-
</ul>
|
13
|
-
<% if should_render_spotlight_search_bar? %>
|
14
|
-
<div class="navbar-right navbar-nav exhibit-search-form mt-3 mt-md-0">
|
15
|
-
<%= render Blacklight::SearchBarComponent.new(
|
16
|
-
url: search_action_url,
|
17
|
-
advanced_search_url: search_action_url(action: 'advanced_search'),
|
18
|
-
params: search_state.params_for_search.except(:qt),
|
19
|
-
autocomplete_path: suggest_index_catalog_path
|
20
|
-
) %>
|
21
|
-
</div>
|
22
|
-
<% end %>
|
23
|
-
</div>
|
24
|
-
</div>
|
1
|
+
<%- Spotlight.deprecator.warn("_exhibit_navbar.html.erb will be removed. Customize the exhibit navbar using components instead.") %>
|
2
|
+
<%= render (blacklight_config&.exhibit_navbar_component || Spotlight::ExhibitNavbarComponent).new %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= f.text_field :title, disabled: !default_language?, help: !default_language? ? t('.uneditable_non_default_language') : '' %>
|
4
4
|
<%= f.text_field :subtitle %>
|
5
5
|
<%= f.text_area :description %>
|
6
|
-
<%=
|
6
|
+
<%= render Spotlight::TagListFormComponent.new(form: f) %>
|
7
7
|
<%= f.form_group(:contact_emails, label: { text: nil, class: nil, for: 'exhibit_contact_email_0' }, class: 'form-group mb-3', help: nil) do %>
|
8
8
|
<%= f.fields_for :contact_emails do |contact| %>
|
9
9
|
<%= render partial: 'contact', locals: {exhibit: @exhibit, contact: contact} %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= bootstrap_form_for @exhibit, url: ((spotlight.exhibit_path(@exhibit) if @exhibit.persisted?) || spotlight.exhibits_path), layout: :horizontal, label_col: 'col-md-2', control_col: 'col-md-10' do |f| %>
|
2
2
|
<%= f.text_field :title, label: t(:'.fields.title.label'), help: t(:'.fields.title.help_block') %>
|
3
3
|
<%= f.text_field :slug, label: t(:'.fields.slug.label'), help: t(:'.fields.slug.help_block') %>
|
4
|
-
<%=
|
4
|
+
<%= render Spotlight::TagListFormComponent.new(form: f) %>
|
5
5
|
|
6
6
|
<%= render 'initial_resources_form', locals: { f: f } %>
|
7
7
|
|
@@ -1,12 +1,23 @@
|
|
1
|
-
|
1
|
+
<% default_field_label = local_assigns.dig(:config, :original, :label) %>
|
2
|
+
|
3
|
+
<tr data-id="<%= key.parameterize %>" class="dd-item" data-behavior="restore-default">
|
2
4
|
<%= f.fields_for key do |field| %>
|
3
5
|
<td>
|
4
6
|
<%= field.hidden_field :weight, 'data-property' => 'weight' %>
|
5
|
-
<div class="handle-wrap
|
7
|
+
<div class="handle-wrap d-flex">
|
6
8
|
<div class="dd-handle dd3-handle"><%= t :drag %></div>
|
7
|
-
<
|
8
|
-
|
9
|
-
|
9
|
+
<div class="flex-grow-1 align-self-center">
|
10
|
+
<span data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
|
11
|
+
<a href="#edit-in-place" class="field-label edit-in-place align-self-center"><%= config.display_label %></a>
|
12
|
+
<%= field.hidden_field :label, value: config.display_label, class: 'metadata-label-edit form-control form-control-sm', data: {:"edit-field-target" => 'true', default_value: default_field_label} %>
|
13
|
+
</span>
|
14
|
+
</div>
|
15
|
+
<% if default_field_label %>
|
16
|
+
<div class="restore-default">
|
17
|
+
<%= button_tag t(:'.restore_default'), data: {:"restore-default" => true}, class: "btn btn-secondary btn-sm #{'d-none' if config.display_label == default_field_label}" %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
10
21
|
</td>
|
11
22
|
<td class="checkbox-cell text-center">
|
12
23
|
<%= field.check_box_without_bootstrap :show, checked: config.show, disabled: !config.immutable.show.nil?, hide_label: true %>
|
@@ -8,10 +8,10 @@
|
|
8
8
|
|
9
9
|
<p class="instructions"><%= t :'.instructions' %></p>
|
10
10
|
|
11
|
-
<table id="nested-fields" class="table table-striped dd-table">
|
11
|
+
<table id="nested-fields" class="metadata-configuration table table-striped dd-table">
|
12
12
|
<thead>
|
13
13
|
<tr>
|
14
|
-
<th><%= t :'.field.label' %></th>
|
14
|
+
<th class="w-50"><%= t :'.field.label' %></th>
|
15
15
|
<th class="text-center">
|
16
16
|
<div>
|
17
17
|
<%= t :'.view.show' %>
|
@@ -707,6 +707,8 @@ en:
|
|
707
707
|
select_all: Select all
|
708
708
|
view:
|
709
709
|
show: Item details
|
710
|
+
metadata_field:
|
711
|
+
restore_default: Restore default
|
710
712
|
pages:
|
711
713
|
edit:
|
712
714
|
header: Edit page
|
@@ -721,6 +723,8 @@ en:
|
|
721
723
|
index:
|
722
724
|
about_pages:
|
723
725
|
header: About pages
|
726
|
+
bulk_updates:
|
727
|
+
header: Bulk updates
|
724
728
|
feature_pages:
|
725
729
|
header: Feature pages
|
726
730
|
home_pages_header: Homepage
|
@@ -16,6 +16,7 @@ class CatalogController < ApplicationController
|
|
16
16
|
# Blacklight 8 sets a default value to 'advanced'
|
17
17
|
config.json_solr_path = nil
|
18
18
|
config.header_component = Spotlight::HeaderComponent
|
19
|
+
config.exhibit_navbar_component = Spotlight::ExhibitNavbarComponent
|
19
20
|
config.document_solr_path = 'get'
|
20
21
|
config.document_unique_id_param = 'ids'
|
21
22
|
|
@@ -83,6 +83,10 @@
|
|
83
83
|
# Spotlight::Engine.config.ga_debug_mode = false
|
84
84
|
# end
|
85
85
|
|
86
|
+
# ==> Customizable settings for site tags
|
87
|
+
# When set the free text tag list field becomes multiple selection checklist
|
88
|
+
# Spotlight::Engine.config.site_tags = []
|
89
|
+
|
86
90
|
# ==> Sir Trevor Widget Configuration
|
87
91
|
# These are set by default by Spotlight's configuration,
|
88
92
|
# but you can customize them here, or in the SirTrevorRails::Block#custom_block_types method
|
data/lib/spotlight/engine.rb
CHANGED
@@ -27,15 +27,6 @@ module Spotlight
|
|
27
27
|
# rubocop:disable Metrics/ClassLength
|
28
28
|
class Engine < ::Rails::Engine
|
29
29
|
isolate_namespace Spotlight
|
30
|
-
# Breadcrumbs on rails must be required outside of an initializer or it doesn't get loaded.
|
31
|
-
require 'breadcrumbs_on_rails/breadcrumbs'
|
32
|
-
require 'breadcrumbs_on_rails/action_controller'
|
33
|
-
|
34
|
-
initializer 'breadcrumbs_on_rails.initialize' do
|
35
|
-
ActiveSupport.on_load(:action_controller) do
|
36
|
-
include BreadcrumbsOnRails::ActionController
|
37
|
-
end
|
38
|
-
end
|
39
30
|
|
40
31
|
require 'carrierwave'
|
41
32
|
require 'redcarpet' # required for markdown support in github/markup https://github.com/github/markup#markups
|
@@ -145,6 +136,8 @@ module Spotlight
|
|
145
136
|
config.full_image_field = :full_image_url_ssm
|
146
137
|
config.thumbnail_field = :thumbnail_url_ssm
|
147
138
|
|
139
|
+
Spotlight::Engine.config.site_tags = nil
|
140
|
+
|
148
141
|
# Defaults to the blacklight_config.index.title_field:
|
149
142
|
config.upload_title_field = nil # UploadFieldConfig.new(...)
|
150
143
|
config.upload_description_field = :spotlight_upload_description_tesim
|
data/lib/spotlight/version.rb
CHANGED
@@ -14,7 +14,6 @@ module Spotlight
|
|
14
14
|
view.send(:extend, Spotlight::CropHelper)
|
15
15
|
view.send(:extend, Spotlight::PagesHelper)
|
16
16
|
view.send(:extend, Blacklight::ComponentHelperBehavior)
|
17
|
-
view.send(:extend, BreadcrumbsOnRails::ActionController::HelperMethods)
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-spotlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-10-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activejob-status
|
@@ -121,26 +121,6 @@ dependencies:
|
|
121
121
|
- - "<"
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '6'
|
124
|
-
- !ruby/object:Gem::Dependency
|
125
|
-
name: breadcrumbs_on_rails
|
126
|
-
requirement: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '3.0'
|
131
|
-
- - "<"
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '5'
|
134
|
-
type: :runtime
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
requirements:
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: '3.0'
|
141
|
-
- - "<"
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: '5'
|
144
124
|
- !ruby/object:Gem::Dependency
|
145
125
|
name: cancancan
|
146
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -921,7 +901,6 @@ files:
|
|
921
901
|
- app/assets/stylesheets/spotlight/_view_larger.scss
|
922
902
|
- app/assets/stylesheets/spotlight/browse_group_categories_block.scss
|
923
903
|
- app/assets/stylesheets/spotlight/typeahead.scss
|
924
|
-
- app/builders/spotlight/bootstrap_breadcrumbs_builder.rb
|
925
904
|
- app/components/blacklight/icons/arrow_alt_circle_left_component.rb
|
926
905
|
- app/components/blacklight/icons/arrow_alt_circle_right_component.rb
|
927
906
|
- app/components/blacklight/icons/arrow_back_ios_component.rb
|
@@ -941,14 +920,20 @@ files:
|
|
941
920
|
- app/components/spotlight/analytics/aggregation_component.rb
|
942
921
|
- app/components/spotlight/analytics/dashboard_component.html.erb
|
943
922
|
- app/components/spotlight/analytics/dashboard_component.rb
|
923
|
+
- app/components/spotlight/breadcrumbs_component.html.erb
|
924
|
+
- app/components/spotlight/breadcrumbs_component.rb
|
944
925
|
- app/components/spotlight/document_admin_table_component.html.erb
|
945
926
|
- app/components/spotlight/document_admin_table_component.rb
|
946
927
|
- app/components/spotlight/document_component.rb
|
928
|
+
- app/components/spotlight/exhibit_navbar_component.html.erb
|
929
|
+
- app/components/spotlight/exhibit_navbar_component.rb
|
947
930
|
- app/components/spotlight/header_component.html.erb
|
948
931
|
- app/components/spotlight/header_component.rb
|
949
932
|
- app/components/spotlight/icon_component.rb
|
950
933
|
- app/components/spotlight/solr_document_legacy_embed_component.html.erb
|
951
934
|
- app/components/spotlight/solr_document_legacy_embed_component.rb
|
935
|
+
- app/components/spotlight/tag_list_form_component.html.erb
|
936
|
+
- app/components/spotlight/tag_list_form_component.rb
|
952
937
|
- app/controllers/concerns/spotlight/base.rb
|
953
938
|
- app/controllers/concerns/spotlight/catalog.rb
|
954
939
|
- app/controllers/concerns/spotlight/config.rb
|
@@ -1016,7 +1001,6 @@ files:
|
|
1016
1001
|
- app/javascript/spotlight/admin/add_another.js
|
1017
1002
|
- app/javascript/spotlight/admin/add_image_selector.js
|
1018
1003
|
- app/javascript/spotlight/admin/add_new_button.js
|
1019
|
-
- app/javascript/spotlight/admin/appearance.js
|
1020
1004
|
- app/javascript/spotlight/admin/blacklight_configuration.js
|
1021
1005
|
- app/javascript/spotlight/admin/block_mixins/autocompleteable.js
|
1022
1006
|
- app/javascript/spotlight/admin/block_mixins/formable.js
|
@@ -1092,6 +1076,7 @@ files:
|
|
1092
1076
|
- app/mailers/spotlight/indexing_complete_mailer.rb
|
1093
1077
|
- app/mailers/spotlight/invitation_mailer.rb
|
1094
1078
|
- app/models/ability.rb
|
1079
|
+
- app/models/breadcrumb.rb
|
1095
1080
|
- app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb
|
1096
1081
|
- app/models/concerns/spotlight/blacklight_configuration_defaults.rb
|
1097
1082
|
- app/models/concerns/spotlight/browse_category_search_builder.rb
|
@@ -1207,7 +1192,6 @@ files:
|
|
1207
1192
|
- app/views/shared/_about_navbar.html.erb
|
1208
1193
|
- app/views/shared/_analytics.html.erb
|
1209
1194
|
- app/views/shared/_body_preamble.html.erb
|
1210
|
-
- app/views/shared/_breadcrumbs.html.erb
|
1211
1195
|
- app/views/shared/_browse_navbar.html.erb
|
1212
1196
|
- app/views/shared/_curated_features_navbar.html.erb
|
1213
1197
|
- app/views/shared/_exhibit_navbar.html.erb
|
@@ -1602,7 +1586,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1602
1586
|
- !ruby/object:Gem::Version
|
1603
1587
|
version: '0'
|
1604
1588
|
requirements: []
|
1605
|
-
rubygems_version: 3.
|
1589
|
+
rubygems_version: 3.4.19
|
1606
1590
|
signing_key:
|
1607
1591
|
specification_version: 4
|
1608
1592
|
summary: Enable librarians, curators, and others who are responsible for digital collections
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spotlight
|
4
|
-
# The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder.
|
5
|
-
# It provides basic functionalities to render a breadcrumb navigation according to Bootstrap's conventions.
|
6
|
-
#
|
7
|
-
# BootstrapBreadcrumbsBuilder accepts a limited set of options:
|
8
|
-
#
|
9
|
-
# You can use it with the :builder option on render_breadcrumbs:
|
10
|
-
# <%= render_breadcrumbs :builder => Spotlight::BootstrapBreadcrumbsBuilder %>
|
11
|
-
#
|
12
|
-
class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder
|
13
|
-
include ActionView::Helpers::OutputSafetyHelper
|
14
|
-
|
15
|
-
def render
|
16
|
-
return '' if @elements.blank?
|
17
|
-
|
18
|
-
@context.content_tag(:ul, class: 'breadcrumb') do
|
19
|
-
safe_join(@elements.uniq.map { |e| render_element(e) })
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def render_element(element)
|
24
|
-
current = @context.current_page?(compute_path(element)) || element.options&.dig(:current)
|
25
|
-
|
26
|
-
html_class = 'active' if current
|
27
|
-
|
28
|
-
@context.content_tag(:li, class: "breadcrumb-item truncated-value #{html_class}") do
|
29
|
-
@context.link_to_unless(current, element_label(element), compute_path(element), element.options&.except(:current))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def element_label(element)
|
36
|
-
@context.content_tag(:span) { compute_name(element) }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
export default class {
|
2
|
-
connect(){
|
3
|
-
$("[data-behavior='restore-default']").each(function(){
|
4
|
-
var hidden = $("[data-default-value]", $(this));
|
5
|
-
var value = $($("[data-in-place-edit-target]", $(this)).data('in-place-edit-target'), $(this));
|
6
|
-
var button = $("[data-restore-default]", $(this));
|
7
|
-
hidden.on('blur', function(){
|
8
|
-
if( $(this).val() == $(this).data('default-value') ) {
|
9
|
-
button.addClass('d-none');
|
10
|
-
} else {
|
11
|
-
button.removeClass('d-none');
|
12
|
-
}
|
13
|
-
});
|
14
|
-
button.on('click', function(e){
|
15
|
-
e.preventDefault();
|
16
|
-
hidden.val(hidden.data('default-value'));
|
17
|
-
value.text(hidden.data('default-value'));
|
18
|
-
button.hide();
|
19
|
-
});
|
20
|
-
});
|
21
|
-
}
|
22
|
-
}
|