Skip to content

Commit c2c1300

Browse files
authored
Merge pull request #161 from crosscite/enable_citations_display_to_production
enable citations display to production
2 parents effec2d + 162d9e4 commit c2c1300

File tree

1 file changed

+24
-48
lines changed

1 file changed

+24
-48
lines changed

views/works/item.haml

+24-48
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
- citations_chart = remove_duplicated_counts(citations,metrics.fetch(:citations_histogram, {}), attributes.fetch("published", nil).to_i )
2222
- gon.chart_citations = citations_chart.fetch("years", [])
2323
- gon.yop = attributes.fetch("published", nil).to_i
24-
- if ENV['RACK_ENV'] == 'production' && !is_admin_or_staff? && !is_beta_tester? ### TODO: Remove soon. set temporaly to send to production
25-
- citations = 0 ### TODO: Remove soon. set temporaly to send to production
24+
2625
2726
.panel.panel-default
2827
.panel-body
@@ -41,34 +40,20 @@
4140
%a{:href => attributes["license"]}
4241
= license_img(attributes["license"])
4342
44-
- if ENV['RACK_ENV'] != 'production' || is_admin_or_staff? || is_beta_tester?
45-
.panel-footer
46-
- if (views + downloads + citations).zero?
43+
.panel-footer
44+
- if (views + downloads + citations).zero?
45+
%span.metrics{id: "summary-citations"}
46+
.fa.fa-info-circle
47+
No citations were reported. No usage information was reported.
48+
- else
49+
- if citations.positive?
4750
%span.metrics{id: "summary-citations"}
48-
.fa.fa-info-circle
49-
No citations were reported. No usage information was reported.
51+
.fa.fa-quote-left
52+
= pluralize(citations, "citation")
5053
- else
51-
- if citations.positive?
52-
%span.metrics{id: "summary-citations"}
53-
.fa.fa-quote-left
54-
= pluralize(citations, "citation")
55-
- else
56-
%span.metrics
57-
.fa.fa-info-circle
58-
No citations were reported.
59-
- if (views + downloads).positive?
60-
%span.metrics{id: "summary-views"}
61-
.fa.fa-eye
62-
= pluralize(views, "view")
63-
%span.metrics{id: "summary-downloads"}
64-
.fa.fa-download
65-
= pluralize(downloads, "download")
66-
- else
67-
%span.metrics{id: "summary-views"}
68-
.fa.fa-info-circle
69-
No usage information was reported.
70-
- else
71-
.panel-footer
54+
%span.metrics
55+
.fa.fa-info-circle
56+
No citations were reported.
7257
- if (views + downloads).positive?
7358
%span.metrics{id: "summary-views"}
7459
.fa.fa-eye
@@ -97,23 +82,14 @@
9782
- if user_signed_in? && is_person?
9883
= haml :'works/claim', locals: { item: item }
9984

100-
- if ENV['RACK_ENV'] != 'production' || is_admin_or_staff? || is_beta_tester?
101-
- if @work.present? && (views + downloads + citations).positive?
102-
= haml :'works/visualisation', locals: { attributes: attributes, views: views, downloads: downloads, citations: citations }
103-
- if @work.present?
104-
- data_center = @work[:included].find { |i| i.fetch("type", nil) == "data-centers" }
105-
- client_name = data_center.fetch("attributes", {}).fetch("title", nil)
106-
= haml :'works/citations', locals: { attributes: attributes, client_name: client_name, citations: citations, duplicated: has_duplicated, summary: metrics}
107-
- if @work.present? && (views + downloads).zero?
108-
.panel-body.alert.alert-simple-info
109-
= "This data repository is not currently reporting usage information. For information on how your repository can submit usage information, please see"
110-
%a{href: 'https://support.datacite.org/docs/views-and-downloads'}
111-
our documentation.
112-
- else
113-
- if @work.present? && (views + downloads).positive?
114-
= haml :'works/visualisation', locals: { attributes: attributes, views: views, downloads: downloads, citations: citations }
115-
- else
116-
.panel-body.alert.alert-simple-info
117-
= "This data repository is not currently reporting usage information. For information on how your repository can submit usage information, please see"
118-
%a{href: 'https://support.datacite.org/docs/views-and-downloads'}
119-
our documentation.
85+
- if @work.present? && (views + downloads + citations).positive?
86+
= haml :'works/visualisation', locals: { attributes: attributes, views: views, downloads: downloads, citations: citations }
87+
- if @work.present?
88+
- data_center = @work[:included].find { |i| i.fetch("type", nil) == "data-centers" }
89+
- client_name = data_center.fetch("attributes", {}).fetch("title", nil)
90+
= haml :'works/citations', locals: { attributes: attributes, client_name: client_name, citations: citations, duplicated: has_duplicated, summary: metrics}
91+
- if @work.present? && (views + downloads).zero?
92+
.panel-body.alert.alert-simple-info
93+
= "This data repository is not currently reporting usage information. For information on how your repository can submit usage information, please see"
94+
%a{href: 'https://support.datacite.org/docs/views-and-downloads'}
95+
our documentation.

0 commit comments

Comments
 (0)