Skip to content

Commit

Permalink
enabling local input for citation list
Browse files Browse the repository at this point in the history
enabling local input for citation list
addresses: #164
  • Loading branch information
kjgarza committed Feb 27, 2020
1 parent 3b8e3e8 commit 7776467
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion views/works/citations.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.nav-tabs-padding
%datacite-components-links-tabs{ doi: attributes["doi"], client:client_name }
-### USing HTML because halm transforms objects into attributes
-# %datacite-components-links-tabs{ doi: attributes["doi"], client:client_name, 'data-input': data_input }
<datacite-components-links-tabs doi="#{attributes["doi"]}" client="#{client_name}" data-input='#{list}' />

7 changes: 4 additions & 3 deletions views/works/item.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
- if @work.present? && attributes["citations-over-time"].present?
- gon.chart_citations = attributes["citations-over-time"].map { |d| { "id" => d["year"], "title" => d["year"], "sum" => d["total"] } }
- gon.yop = attributes.fetch("published", nil).to_i
- gon.citation_events = includes.select { |e| e.dig("relationships", "doiForTarget", "data", "id") == attributes["doi"] }
- gon.reference_events = includes.select { |e| e.dig("relationships", "doiForSource", "data", "id") == attributes["doi"] }
- citation_events = includes.select { |e| e.dig("relationships", "doiForTarget", "data", "id") == attributes["doi"] }
- reference_events = includes.select { |e| e.dig("relationships", "doiForSource", "data", "id") == attributes["doi"] }
- list = JSON.generate({:citations => citation_events, :references => reference_events }, quirks_mode: true)
.panel.panel-default
.panel-body
Expand Down Expand Up @@ -80,7 +81,7 @@
- if @work.present?
- data_center = @work[:included].find { |i| i.fetch("type", nil) == "data-centers" }
- client_name = data_center.fetch("attributes", {}).fetch("title", nil)
-# = haml :'works/citations', locals: { attributes: attributes, client_name: client_name }
= haml :'works/citations', locals: { attributes: attributes, client_name: client_name, list: list }
- if @work.present? && (attributes["view-count"].to_i + attributes["download-count"].to_i).zero?
.panel-body.alert.alert-simple-info
= "This data repository is not currently reporting usage information. For information on how your repository can submit usage information, please see"
Expand Down

0 comments on commit 7776467

Please sign in to comment.