Skip to content

Commit 7776467

Browse files
committed
enabling local input for citation list
enabling local input for citation list addresses: #164
1 parent 3b8e3e8 commit 7776467

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

views/works/citations.haml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.nav-tabs-padding
2-
%datacite-components-links-tabs{ doi: attributes["doi"], client:client_name }
2+
-### USing HTML because halm transforms objects into attributes
3+
-# %datacite-components-links-tabs{ doi: attributes["doi"], client:client_name, 'data-input': data_input }
4+
<datacite-components-links-tabs doi="#{attributes["doi"]}" client="#{client_name}" data-input='#{list}' />
35

views/works/item.haml

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
- if @work.present? && attributes["citations-over-time"].present?
1414
- gon.chart_citations = attributes["citations-over-time"].map { |d| { "id" => d["year"], "title" => d["year"], "sum" => d["total"] } }
1515
- gon.yop = attributes.fetch("published", nil).to_i
16-
- gon.citation_events = includes.select { |e| e.dig("relationships", "doiForTarget", "data", "id") == attributes["doi"] }
17-
- gon.reference_events = includes.select { |e| e.dig("relationships", "doiForSource", "data", "id") == attributes["doi"] }
16+
- citation_events = includes.select { |e| e.dig("relationships", "doiForTarget", "data", "id") == attributes["doi"] }
17+
- reference_events = includes.select { |e| e.dig("relationships", "doiForSource", "data", "id") == attributes["doi"] }
18+
- list = JSON.generate({:citations => citation_events, :references => reference_events }, quirks_mode: true)
1819
1920
.panel.panel-default
2021
.panel-body
@@ -80,7 +81,7 @@
8081
- if @work.present?
8182
- data_center = @work[:included].find { |i| i.fetch("type", nil) == "data-centers" }
8283
- client_name = data_center.fetch("attributes", {}).fetch("title", nil)
83-
-# = haml :'works/citations', locals: { attributes: attributes, client_name: client_name }
84+
= haml :'works/citations', locals: { attributes: attributes, client_name: client_name, list: list }
8485
- if @work.present? && (attributes["view-count"].to_i + attributes["download-count"].to_i).zero?
8586
.panel-body.alert.alert-simple-info
8687
= "This data repository is not currently reporting usage information. For information on how your repository can submit usage information, please see"

0 commit comments

Comments
 (0)