Skip to content

Commit 21995c8

Browse files
authored
[ENG-2277] My registrations page (#1180)
* prelim * moar * more and more * and some more * styling fixes * add more padding between cards * make styling consistent * CR followup * moar styling fixes * fix draft-registration-card delete * fix tests * demo followup * more demo follow up * add moar tests for the node card * add tests for my-registrations-list component * modify weird tests
1 parent 7e727bd commit 21995c8

File tree

16 files changed

+399
-42
lines changed

16 files changed

+399
-42
lines changed

lib/osf-components/addon/components/draft-registration-card/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
data-test-draft-card-delete
9898
@smallSecondary={{true}}
9999
@icon='trash-alt'
100-
@delete={{action this.delete}}
100+
@delete={{action this.confirmDelete}}
101101
@modalTitle={{t 'general.please_confirm'}}
102102
@modalBody={{t 'osf-components.draft-registration-card.delete_draft_confirm'}}
103103
local-class='DraftRegistrationCard__delete'

lib/osf-components/addon/components/node-card/styles.scss

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@
3434
}
3535

3636
.NodeCard__body dt,
37-
dd {
37+
.NodeCard__body dd {
3838
display: inline-block;
39+
max-width: 80%;
40+
margin-right: 5px;
3941
}
4042

4143
.NodeCard__body dl {
4244
margin-bottom: 10px;
4345
}
4446

47+
.NodeCard__body > dl > div {
48+
display: flex;
49+
}
50+
4551
.NodeCard__dropdown {
4652
padding-left: 5px;
4753

@@ -72,14 +78,12 @@ dd {
7278
}
7379
}
7480

81+
.NodeCard__tags {
82+
margin-top: 2px;
83+
}
84+
7585
.NodeCard__description {
76-
font-weight: 300;
7786
text-overflow: ellipsis;
78-
display: block;
79-
white-space: nowrap;
8087
overflow: hidden;
81-
}
82-
83-
.NodeCard__tags {
84-
margin-top: 2px;
88+
white-space: nowrap;
8589
}

lib/osf-components/addon/components/node-card/template.hbs

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
local-class='NodeCard'
55
>
66
<h4 class='list-group-item-heading' local-class='NodeCard__heading' data-test-node-card-heading>
7-
<span class='f-w-lg'>
7+
<span>
88
{{#if @node}}
99
{{#unless @node.public}}
1010
<span>
@@ -97,47 +97,60 @@
9797
<div data-test-node-card-body local-class='NodeCard__body'>
9898
{{#if @node}}
9999
<dl>
100-
<dt>
101-
{{t (concat 'node_card.' @node.nodeType '.timestamp_label')}}
102-
</dt>
103-
<dd>
104-
{{moment-format @node.dateCreated 'YYYY-MM-DD h:mm A'}}
105-
</dd>
106100
{{#if @node.isRegistration}}
107-
<div
108-
data-test-registration-template-name
109-
>
110-
<dt
111-
data-test-registration-template-label
112-
>
101+
<div data-test-registration-template-name>
102+
<dt data-test-registration-template-label>
113103
{{t 'node_card.registration_template'}}
114104
</dt>
115105
<dd>
116106
{{@node.registrationSchema.name}}
117107
</dd>
118108
</div>
109+
<div data-test-registration-registry>
110+
<dt data-test-registration-registry-label>
111+
{{t 'node_card.registry'}}
112+
</dt>
113+
<dd data-test-registration-registry-name>
114+
{{@node.provider.name}}
115+
</dd>
116+
</div>
119117
{{/if}}
120-
<dt
121-
data-test-contributors-label
122-
>
123-
{{t 'node_card.contributors'}}
124-
</dt>
125-
<dd>
126-
<ContributorList
127-
@model={{@node}}
128-
@shouldLinkUsers={{true}}
129-
/>
130-
</dd>
131-
<div
132-
data-test-description
133-
local-class='NodeCard__description'
134-
>
118+
<div data-test-created-timestamp>
119+
<dt data-test-created-timestamp-label>
120+
{{t (concat 'node_card.' @node.nodeType '.timestamp_label')}}
121+
</dt>
122+
<dd data-test-created-timestamp-value>
123+
{{moment @node.dateCreated}}
124+
</dd>
125+
</div>
126+
<div data-test-updated-timestamp>
127+
<dt data-test-updated-timestamp-label>
128+
{{t 'node_card.last_updated'}}
129+
</dt>
130+
<dd data-test-updated-timestamp-value>
131+
{{moment @node.dateModified}}
132+
</dd>
133+
</div>
134+
<div data-test-contributors>
135+
<dt
136+
data-test-contributors-label
137+
>
138+
{{t 'node_card.contributors'}}
139+
</dt>
140+
<dd>
141+
<ContributorList
142+
@model={{@node}}
143+
@shouldLinkUsers={{true}}
144+
/>
145+
</dd>
146+
</div>
147+
<div data-test-description>
135148
<dt
136149
data-test-description-label
137150
>
138151
{{t 'node_card.description'}}
139152
</dt>
140-
<dd>
153+
<dd local-class='NodeCard__description'>
141154
{{@node.description}}
142155
</dd>
143156
</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.FlexContainer {
2+
display: flex;
3+
justify-content: center;
4+
}
5+
6+
.NoContentContainer {
7+
padding-top: 100px;
8+
text-align: center;
9+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<ContentPlaceholders as |placeholder|>
2+
<PaginatedList::All
3+
@modelName='draft-registration'
4+
@usePlaceholders={{false}}
5+
as |list|
6+
>
7+
<list.item as |draftRegistration|>
8+
{{#if draftRegistration}}
9+
<DraftRegistrationCard
10+
@draftRegistration={{draftRegistration}}
11+
@onDelete={{action list.doReload 1}}
12+
/>
13+
{{else}}
14+
{{placeholder.text lines=1}}
15+
{{/if}}
16+
</list.item>
17+
<list.empty local-class='FlexContainer'>
18+
<div local-class='NoContentContainer'>
19+
<p data-test-draft-list-no-general>
20+
{{t 'registries.myRegistrationsList.noGeneral'}}
21+
</p>
22+
<p data-test-draft-list-no-drafts>
23+
{{t 'registries.myRegistrationsList.noDrafts'}}
24+
</p>
25+
<OsfLink
26+
@route='registries.branded.new'
27+
@models={{array 'osf'}}
28+
data-test-add-new-button
29+
>
30+
<Button @type='create'>
31+
{{t 'registries.myRegistrationsList.createRegistration'}}
32+
</Button>
33+
</OsfLink>
34+
</div>
35+
</list.empty>
36+
</PaginatedList::All>
37+
</ContentPlaceholders>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.FlexContainer {
2+
display: flex;
3+
justify-content: center;
4+
}
5+
6+
.NoContentContainer {
7+
padding-top: 100px;
8+
text-align: center;
9+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<ContentPlaceholders as |placeholder|>
2+
<PaginatedList::HasMany
3+
@model={{@user}}
4+
@relationshipName='registrations'
5+
@usePlaceholders={{false}}
6+
as |list|
7+
>
8+
<list.item as |registration|>
9+
{{#if registration}}
10+
<NodeCard
11+
@node={{registration}}
12+
@showTags={{true}}
13+
/>
14+
{{else}}
15+
{{placeholder.text lines=1}}
16+
{{/if}}
17+
</list.item>
18+
<list.empty local-class='FlexContainer'>
19+
<div local-class='NoContentContainer'>
20+
<p data-test-draft-list-no-general>
21+
{{t 'registries.myRegistrationsList.noGeneral'}}
22+
</p>
23+
<p data-test-draft-list-no-registrations>
24+
{{t 'registries.myRegistrationsList.noRegistrations'}}
25+
</p>
26+
<OsfLink
27+
@route='registries.branded.new'
28+
@models={{array 'osf'}}
29+
data-test-add-new-button
30+
>
31+
<Button @type='create'>
32+
{{t 'registries.myRegistrationsList.createRegistration'}}
33+
</Button>
34+
</OsfLink>
35+
</div>
36+
</list.empty>
37+
</PaginatedList::HasMany>
38+
</ContentPlaceholders>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'osf-components/components/registries/my-registrations-list/drafts/template';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'osf-components/components/registries/my-registrations-list/registrations/template';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Controller from '@ember/controller';
2+
import { inject as service } from '@ember/service';
3+
4+
import { action } from '@ember/object';
5+
import { tracked } from '@glimmer/tracking';
6+
import CurrentUserService from 'ember-osf-web/services/current-user';
7+
8+
export default class MyRegistrationsController extends Controller {
9+
@service currentUser!: CurrentUserService;
10+
11+
queryParams = ['tab'];
12+
@tracked tab = 'submitted';
13+
14+
@action
15+
changeTab(newTabId: string) {
16+
this.tab = newTabId;
17+
}
18+
}

0 commit comments

Comments
 (0)