File tree 7 files changed +58
-60
lines changed
controllers/concerns/blacklight/marc
7 files changed +58
-60
lines changed Original file line number Diff line number Diff line change 1
1
/* border between items on marc view */
2
2
$marc_item_separator : 1px solid $text-muted !default ;
3
3
4
- #librarian_view
5
- {
6
- left :-17% ;
7
- text-align :left ;
8
- top :10% ;
9
- width :700px ;
10
- }
11
-
12
- #marc_view
13
- {
14
- text-align :left ;
15
- /* https://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/ */
16
- font-family : " Courier New" , monospace , serif ;
17
- font-size : 1em ;
4
+ .marc_view {
5
+ font-family : $font-family-monospace ;
18
6
19
- .field
20
- {
7
+ .field {
8
+ align-items : flex-start ;
21
9
border-bottom : $marc_item_separator ;
22
- clear :both ;
10
+ display : flex ;
11
+ gap : 2em ;
23
12
}
24
13
25
14
.ind1 , .ind2
@@ -28,13 +17,7 @@ $marc_item_separator: 1px solid $text-muted !default;
28
17
padding : 0 ($spacer / 2 );
29
18
}
30
19
31
- .subfields
32
- {
33
- padding-left :5em ;
34
- }
35
-
36
- .tag_ind
37
- {
38
- float :left ;
39
- }
20
+ .tag_ind {
21
+ flex-shrink : 0 ;
22
+ }
40
23
}
Original file line number Diff line number Diff line change @@ -9,13 +9,20 @@ module Catalog
9
9
end
10
10
11
11
def librarian_view
12
- @response , deprecated_document = search_service . fetch params [ :id ]
13
- @document = ActiveSupport ::Deprecation ::DeprecatedObjectProxy . new ( deprecated_document , "The @document instance variable is deprecated and will be removed in Blacklight-marc 8.0" )
12
+ if Blacklight ::VERSION >= '8'
13
+ @document = search_service . fetch ( params [ :id ] )
14
+ @response = ActiveSupport ::Deprecation ::DeprecatedObjectProxy . new ( @document . response , "The @response instance variable is deprecated and will be removed in Blacklight-marc 8.0" )
15
+
16
+ else
17
+ deprecated_response , @document = search_service . fetch ( params [ :id ] )
18
+ @response = ActiveSupport ::Deprecation ::DeprecatedObjectProxy . new ( deprecated_response , "The @response instance variable is deprecated and will be removed in Blacklight-marc 8.0" )
19
+ end
20
+
14
21
respond_to do |format |
15
22
format . html do
16
23
return render layout : false if request . xhr?
17
24
# Otherwise draw the full page
18
- end
25
+ end
19
26
end
20
27
end
21
28
Original file line number Diff line number Diff line change @@ -39,4 +39,12 @@ def render_endnote_texts(documents)
39
39
end
40
40
val
41
41
end
42
+
43
+ # A URL to refworks export, with an embedded callback URL to this app.
44
+ # the callback URL is to bookmarks#export, which delivers a list of
45
+ # user's bookmarks in 'refworks marc txt' format -- we tell refworks
46
+ # to expect that format.
47
+ def bookmarks_export_url ( format , params = { } )
48
+ bookmarks_url ( params . merge ( format : format , encrypted_user_id : encrypt_user_id ( current_or_guest_user . id ) ) )
49
+ end
42
50
end
Original file line number Diff line number Diff line change 1
- < div id ="marc_view " class ="modal-body ">
2
- <% fields = document . to_marc . find_all { |f | ( '000' ..'999' ) === f . tag } %>
1
+ < div id ="marc_view " class ="marc_view ">
3
2
< div class ="field "> <%= t ( 'blacklight.search.librarian_view.leader' , :leader => document . to_marc . leader ) %> </ div >
4
- <%- fields . each do |field | -%>
5
- <%- unless field . tag . to_s == "940" -%>
3
+ <%- document . to_marc . each do |field | -%>
6
4
< div class ="field ">
7
- < div class ="tag_ind ">
8
- < span class ="tag ">
9
- <%= h ( field . tag ) %>
10
- </ span >
11
5
<%- if field . is_a? ( MARC ::ControlField ) -%>
12
- < span class ="control_field_values ">
13
- <%= h ( field . value ) %>
14
- </ span >
6
+ < div class ="tag_ind ">
7
+ < span class ="tag "> <%= field . tag %> </ span >
8
+ </ div >
9
+ < span class ="control_field_values ">
10
+ <%= h ( field . value ) %>
11
+ </ span >
15
12
<%- else -%>
13
+ < div class ="tag_ind ">
14
+ < span class ="tag "> <%= field . tag %> </ span >
16
15
< div class ="ind1 ">
17
- <%= ! field . indicator1 . blank ? ? field . indicator1 : " " . html_safe -%>
16
+ <%= field . try ( : indicator1) . present ? ? field . indicator1 : " " . html_safe -%>
18
17
</ div >
19
18
< div class ="ind2 ">
20
- <%= ! field . indicator2 . blank ? ? field . indicator2 : " " . html_safe -%>
19
+ <%= field . try ( : indicator2) . present ? ? field . indicator2 : " " . html_safe -%>
21
20
</ div >
22
21
</ div >
23
22
< div class ="subfields ">
24
23
<%- field . each do |sub | -%>
25
- < span class ="sub_code "> <%= h ( sub . code ) %> |</ span > <%= h ( sub . value ) %>
26
- <%- end -%>
27
- <%- end -%>
24
+ < span class ="sub_code "> <%= sub . code %> |</ span > <%= sub . value %>
25
+ <%- end -%>
28
26
</ div >
27
+ <%- end -%>
29
28
</ div >
30
- <%- end -%>
31
29
<%- end -%>
32
30
</ div >
Original file line number Diff line number Diff line change 1
-
2
- < div class ="modal-header ">
3
- < h1 class ="modal-title "> <%= t ( 'blacklight.search.librarian_view.title' ) %> </ h1 >
4
- < button type ="button " class ="blacklight-modal-close close " data-dismiss ="modal " aria-label ="Close ">
5
- < span aria-hidden ="true "> ×</ span >
6
- </ button >
7
- </ div >
8
- <%- if @response . documents . first . respond_to? ( :to_marc ) -%>
9
- <%= render "marc_view" , document : @response . documents . first %>
10
- <%- else %>
11
- <%= t ( 'blacklight.search.librarian_view.empty' ) %>
12
- <%- end -%>
13
-
1
+ <%= render Blacklight::System::ModalComponent.new do |component| %>
2
+ <% component.title { t('blacklight.search.librarian_view.title') } %>
3
+ <%- if @document.respond_to?(:to_marc) -%>
4
+ <%= render "marc_view", document: @document %>
5
+ <%- else %>
6
+ <%= t('blacklight.search.librarian_view.empty') %>
7
+ <%- end -%>
8
+ <% end %>
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
spec . executables = spec . files . grep ( %r{^exe/} ) { |f | File . basename ( f ) }
19
19
spec . require_paths = [ "lib" ]
20
20
21
- spec . add_dependency 'blacklight' , '~> 7.0 '
21
+ spec . add_dependency 'blacklight' , '>= 7.11' , '< 9 '
22
22
spec . add_dependency "library_stdnums"
23
23
spec . add_dependency "rails"
24
24
spec . add_dependency "marc" , ">= 0.4.3" , "< 2.0" # Marc record parser.
Original file line number Diff line number Diff line change 43
43
end
44
44
end
45
45
46
+ describe "#bookmarks_export_url" do
47
+ it "is the bookmark url with an encrypted user token" do
48
+ allow ( helper ) . to receive_messages ( encrypt_user_id : 'xyz' , current_or_guest_user : double ( id : 123 ) )
49
+ url = helper . bookmarks_export_url ( :html )
50
+ expect ( url ) . to eq helper . bookmarks_url ( format : :html , encrypted_user_id : 'xyz' )
51
+ end
52
+ end
46
53
end
You can’t perform that action at this time.
0 commit comments