Skip to content

Commit 77bd26b

Browse files
author
Uditi Mehta
committed
remove unnecessary controller and old logic
1 parent 3e6c270 commit 77bd26b

File tree

3 files changed

+92
-116
lines changed

3 files changed

+92
-116
lines changed

app/preprints/-components/preprint-card/template.hbs

Lines changed: 89 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -8,121 +8,106 @@
88
local-class='card-body {{if (is-mobile) 'mobile'}}'
99
>
1010
<h4 local-class='list-group-item-heading heading' data-test-preprint-card-heading>
11-
{{#if @preprint}}
12-
{{#unless @preprint.public}}
13-
<span>
14-
<FaIcon @icon='lock' />
15-
<EmberTooltip>
16-
{{t 'preprints.preprint_card.private_tooltip'}}
17-
</EmberTooltip>
18-
</span> |
19-
{{/unless}}
20-
<OsfLink
21-
local-class='osf-link {{if (is-mobile) 'mobile'}}'
22-
data-analytics-name='Title'
23-
data-test-preprint-title='{{@preprint.id}}'
24-
@route='resolve-guid'
25-
@models={{array @preprint.id}}
26-
>
27-
{{@preprint.title}}
28-
</OsfLink>
29-
{{else}}
30-
<ContentPlaceholders as |placeholder|>
31-
<placeholder.heading @subtitle={{false}} />
32-
</ContentPlaceholders>
33-
{{/if}}
34-
{{#if @preprint}}
35-
<div local-class='status-label'>
36-
{{#if (eq @preprint.reviewsState 'pending')}}
37-
<span local-class='label label-info'>{{t 'preprints.preprint_card.statuses.pending'}}</span>
38-
{{else if (eq @preprint.reviewsState 'accepted')}}
39-
<span local-class='label label-primary'>{{t 'preprints.preprint_card.statuses.accepted'}}</span>
40-
{{else if (eq @preprint.reviewsState 'rejected')}}
41-
<span local-class='label label-danger'>{{t 'preprints.preprint_card.statuses.rejected'}}</span>
42-
{{/if}}
43-
</div>
44-
{{/if}}
11+
{{#unless @preprint.public}}
12+
<span>
13+
<FaIcon @icon='lock' />
14+
<EmberTooltip>
15+
{{t 'preprints.preprint_card.private_tooltip'}}
16+
</EmberTooltip>
17+
</span> |
18+
{{/unless}}
19+
<OsfLink
20+
local-class='osf-link {{if (is-mobile) 'mobile'}}'
21+
data-analytics-name='Title'
22+
data-test-preprint-title='{{@preprint.id}}'
23+
@route='resolve-guid'
24+
@models={{array @preprint.id}}
25+
>
26+
{{@preprint.title}}
27+
</OsfLink>
28+
<div local-class='status-label'>
29+
{{#if (eq @preprint.reviewsState 'pending')}}
30+
<span local-class='label label-info'>{{t 'preprints.preprint_card.statuses.pending'}}</span>
31+
{{else if (eq @preprint.reviewsState 'accepted')}}
32+
<span local-class='label label-primary'>{{t 'preprints.preprint_card.statuses.accepted'}}</span>
33+
{{else if (eq @preprint.reviewsState 'rejected')}}
34+
<span local-class='label label-danger'>{{t 'preprints.preprint_card.statuses.rejected'}}</span>
35+
{{/if}}
36+
</div>
4537
</h4>
4638
<div data-test-preprint-card-body local-class='body'>
47-
{{#if @preprint}}
48-
<dl>
49-
<div>
50-
<dt data-test-provider-label>
51-
{{t 'preprints.preprint_card.provider'}}
52-
</dt>
53-
<dd data-test-provider-value>
54-
{{@preprint.provider.name}}
55-
</dd>
56-
</div>
57-
<div>
58-
<dt data-test-created-timestamp-label>
59-
{{t 'preprints.preprint_card.date_created'}}
60-
</dt>
61-
<dd data-test-created-timestamp-value>
62-
{{moment-format @preprint.dateCreated 'YYYY-MM-DD'}}
63-
</dd>
64-
</div>
65-
<div>
66-
<dt data-test-updated-timestamp-label>
67-
{{t 'preprints.preprint_card.date_modified'}}
68-
</dt>
69-
<dd data-test-updated-timestamp-value>
70-
{{moment-format @preprint.dateModified 'YYYY-MM-DD'}}
71-
</dd>
72-
</div>
39+
<dl>
40+
<div>
41+
<dt data-test-provider-label>
42+
{{t 'preprints.preprint_card.provider'}}
43+
</dt>
44+
<dd data-test-provider-value>
45+
{{@preprint.provider.name}}
46+
</dd>
47+
</div>
48+
<div>
49+
<dt data-test-created-timestamp-label>
50+
{{t 'preprints.preprint_card.date_created'}}
51+
</dt>
52+
<dd data-test-created-timestamp-value>
53+
{{moment-format @preprint.dateCreated 'YYYY-MM-DD'}}
54+
</dd>
55+
</div>
56+
<div>
57+
<dt data-test-updated-timestamp-label>
58+
{{t 'preprints.preprint_card.date_modified'}}
59+
</dt>
60+
<dd data-test-updated-timestamp-value>
61+
{{moment-format @preprint.dateModified 'YYYY-MM-DD'}}
62+
</dd>
63+
</div>
64+
<div>
65+
<dt data-test-contributors-label>
66+
{{t 'preprints.preprint_card.contributors'}}
67+
</dt>
68+
<dd>
69+
<ContributorList
70+
@model={{@preprint}}
71+
@shouldLinkUsers={{true}}
72+
/>
73+
</dd>
74+
</div>
75+
{{#if (and this.showTags @preprint.tags)}}
7376
<div>
74-
<dt data-test-contributors-label>
75-
{{t 'preprints.preprint_card.contributors'}}
77+
<dt local-class='tags' data-test-tags-label>
78+
{{t 'preprints.preprint_card.tags'}}
7679
</dt>
7780
<dd>
78-
<ContributorList
79-
@model={{@preprint}}
80-
@shouldLinkUsers={{true}}
81+
<TagsWidget
82+
@taggable={{@preprint}}
83+
@inline={{true}}
8184
/>
8285
</dd>
8386
</div>
84-
{{#if (and this.showTags @preprint.tags)}}
85-
<div>
86-
<dt local-class='tags' data-test-tags-label>
87-
{{t 'preprints.preprint_card.tags'}}
88-
</dt>
89-
<dd>
90-
<TagsWidget
91-
@taggable={{@preprint}}
92-
@inline={{true}}
93-
/>
94-
</dd>
95-
</div>
96-
{{/if}}
97-
</dl>
98-
<div local-class='PreprintButtons'>
87+
{{/if}}
88+
</dl>
89+
<div local-class='PreprintButtons'>
90+
<OsfLink
91+
local-class='link'
92+
data-analytics-name='View Preprint'
93+
data-test-view-button='{{@preprint.id}}'
94+
@route='resolve-guid'
95+
@models={{array @preprint.id}}
96+
>
97+
{{t 'preprints.preprint_card.view_button'}}
98+
</OsfLink>
99+
{{#if this.shouldShowUpdateButton}}
99100
<OsfLink
100-
local-class='link'
101-
data-analytics-name='View Preprint'
102-
data-test-view-button='{{@preprint.id}}'
103-
@route='resolve-guid'
104-
@models={{array @preprint.id}}
101+
local-class='link update-button'
102+
data-analytics-name='Edit Preprint'
103+
data-test-update-button='{{@preprint.id}}'
104+
@route='preprints.edit'
105+
@models={{array @preprint.provider.id @preprint.id}}
105106
>
106-
{{t 'preprints.preprint_card.view_button'}}
107+
{{t 'preprints.preprint_card.update_button'}}
107108
</OsfLink>
108-
{{#if this.shouldShowUpdateButton}}
109-
<OsfLink
110-
local-class='link update-button'
111-
data-analytics-name='Edit Preprint'
112-
data-test-update-button='{{@preprint.id}}'
113-
@route='preprints.edit'
114-
@models={{array @preprint.provider.id @preprint.id}}
115-
>
116-
{{t 'preprints.preprint_card.update_button'}}
117-
</OsfLink>
118-
{{/if}}
119-
</div>
120-
121-
{{else}}
122-
<ContentPlaceholders as |placeholder|>
123-
<placeholder.text @lines={{2}} />
124-
</ContentPlaceholders>
125-
{{/if}}
109+
{{/if}}
110+
</div>
126111
</div>
127112
</div>
128113
</div>

app/preprints/my-preprints/controller.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/preprints/my-preprints/template.hbs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
</layout.heading>
1111
<layout.main>
1212
<div local-class='GutterBody'>
13-
{{#if this.preprints.length}}
14-
{{#each this.preprints as |preprint|}}
15-
<Preprints::-Components::PreprintCard @preprint={{preprint}} />
16-
{{/each}}
17-
{{/if}}
13+
{{#each this.model as |preprint|}}
14+
<Preprints::-Components::PreprintCard @preprint={{preprint}} />
15+
{{/each}}
1816
</div>
1917
</layout.main>
2018
</OsfLayout>

0 commit comments

Comments
 (0)