Skip to content

Commit aea1206

Browse files
committed
move a lot of directives into attrs
1 parent 9319e9f commit aea1206

33 files changed

Lines changed: 355 additions & 344 deletions

client/directives/accountsSelect/directiveAccountsSelect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function accountsSelect (
1010
$state
1111
) {
1212
return {
13-
restrict: 'E',
13+
restrict: 'A',
1414
templateUrl: 'viewAccountsSelect',
1515
scope: {
1616
data: '='
Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
1-
header.row.account-header.load(
2-
ng-show = "data.activeAccount"
1+
ol.accounts-group(
2+
ng-class = "{ \
3+
in: isChangeAccount \
4+
}"
5+
ng-click = "isChangeAccount = !isChangeAccount; \
6+
$event.stopPropagation();"
37
)
4-
ol.accounts-group(
5-
ng-class = "{ \
6-
in: isChangeAccount \
7-
}"
8-
ng-click = "isChangeAccount = !isChangeAccount; \
9-
$event.stopPropagation();"
10-
)
11-
li.accounts-group-item
12-
a.account.load(
13-
ng-show = "data.activeAccount.gravitar()"
14-
)
15-
img.gravatar(
16-
height = "24"
17-
ng-src = "{{ data.activeAccount.gravitar() }}"
18-
width = "24"
19-
)
20-
span.account-name.text-overflow {{ data.activeAccount.oauthName() }}
21-
//- icons-arrow-down only for first account
22-
svg.iconnables.icons-arrow-down
23-
use(
24-
xlink:href = "#icons-arrow-down"
25-
)
26-
//- current user (if user is not active)
27-
li.accounts-group-item(
28-
ng-if = "data.user !== data.activeAccount"
29-
ng-click = "$event.stopPropagation(); \
30-
selectActiveAccount(data.user)"
31-
)
32-
a.account
33-
img.gravatar(
34-
height = "24"
35-
ng-src = "{{ data.user.gravitar() }}"
36-
width = "24"
37-
)
38-
span.account-name.text-overflow {{ data.user.oauthName() }}
39-
//- Orgs that are not the active account
40-
li.accounts-group-item(
41-
ng-click = "$event.stopPropagation(); \
42-
selectActiveAccount(org)"
43-
ng-if = "org !== data.activeAccount"
44-
ng-repeat = "org in data.orgs.models"
8+
li.accounts-group-item
9+
a.account.load(
10+
ng-show = "data.activeAccount.gravitar()"
4511
)
46-
a.account
47-
img.gravatar(
48-
height = "24"
49-
ng-src = "{{ org.gravitar() }}"
50-
width = "24"
12+
img.gravatar(
13+
height = "24"
14+
ng-src = "{{ data.activeAccount.gravitar() }}"
15+
width = "24"
16+
)
17+
span.account-name.text-overflow {{ data.activeAccount.oauthName() }}
18+
//- icons-arrow-down only for first account
19+
svg.iconnables.icons-arrow-down
20+
use(
21+
xlink:href = "#icons-arrow-down"
5122
)
52-
span.account-name.text-overflow {{ org.oauthName() }}
23+
//- current user (if user is not active)
24+
li.accounts-group-item(
25+
ng-if = "data.user !== data.activeAccount"
26+
ng-click = "$event.stopPropagation(); \
27+
selectActiveAccount(data.user)"
28+
)
29+
a.account
30+
img.gravatar(
31+
height = "24"
32+
ng-src = "{{ data.user.gravitar() }}"
33+
width = "24"
34+
)
35+
span.account-name.text-overflow {{ data.user.oauthName() }}
36+
//- Orgs that are not the active account
37+
li.accounts-group-item(
38+
ng-click = "$event.stopPropagation(); \
39+
selectActiveAccount(org)"
40+
ng-if = "org !== data.activeAccount"
41+
ng-repeat = "org in data.orgs.models"
42+
)
43+
a.account
44+
img.gravatar(
45+
height = "24"
46+
ng-src = "{{ org.gravitar() }}"
47+
width = "24"
48+
)
49+
span.account-name.text-overflow {{ org.oauthName() }}

client/directives/activePanel/directiveActivePanel.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,14 @@ function activePanel(
2424
user
2525
) {
2626
return {
27-
restrict: 'E',
27+
restrict: 'A',
2828
templateUrl: 'viewActivePanel',
2929
scope: {
3030
isDarkTheme: '=',
31-
// instance: '=',
32-
// build: '=',
33-
// setupData: '=',
34-
// container: '=',
3531
openItems: '=',
3632
currentModel: '=', // CurrentModel houses the original model without changes
37-
stateModel: '=' // The StateModel is where changes will be applied
38-
// readOnly: '=',
39-
// update: '=' // true: save file when content changes
33+
stateModel: '=', // The StateModel is where changes will be applied
34+
item: '='
4035
},
4136
link: function ($scope, element, attrs) {
4237

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,44 @@
1-
//- don't use ng-if here, use ng-show
2-
.active-panel(
3-
ng-class = "{\
4-
'loaded': (item === openItems.activeHistory.last()),\
5-
'ace-runnable-dark': isDarkTheme\
6-
}"
7-
ng-repeat = "item in openItems.models"
8-
ng-show = "item === openItems.activeHistory.last()"
1+
.spinner-container.spinner-backdrop.spinner-md(
2+
ng-class = "{in: loading}"
3+
ng-include = "'spinner'"
94
)
105

11-
.spinner-container.spinner-backdrop.spinner-md(
12-
ng-class = "{in: loading}"
13-
ng-include = "'spinner'"
14-
)
15-
16-
log-build(
17-
ng-if = "item.state.type === 'BuildStream'"
18-
)
6+
.logs(
7+
log-build
8+
ng-if = "item.state.type === 'BuildStream'"
9+
)
1910

20-
log-box(
21-
ng-if = "item.state.type === 'LogView'"
22-
)
11+
log-box(
12+
ng-if = "item.state.type === 'LogView'"
13+
)
2314

24-
pre.pre(
25-
ng-class = "{readonly: data.readOnly}"
26-
ng-if = "item.state.type === 'File'"
27-
ng-init = "wrapperFunc = actions.wrapWithItem(item)"
28-
ng-model = "openItems.activeHistory.last().state.body"
29-
readonly = "{{ (data.readOnly) ? 'true' : 'false' }}"
30-
ui-ace = "{ \
31-
onLoad: wrapperFunc, \
32-
onFocus: actions.onFocus \
33-
}"
34-
)
15+
pre.pre(
16+
ng-class = "{readonly: data.readOnly}"
17+
ng-if = "item.state.type === 'File'"
18+
ng-init = "wrapperFunc = actions.wrapWithItem(item)"
19+
ng-model = "openItems.activeHistory.last().state.body"
20+
readonly = "{{ (data.readOnly) ? 'true' : 'false' }}"
21+
ui-ace = "{ \
22+
onLoad: wrapperFunc, \
23+
onFocus: actions.onFocus \
24+
}"
25+
)
3526

36-
.term-container(
37-
ng-if = "item.state.type === 'Terminal'"
27+
.term-container(
28+
ng-if = "item.state.type === 'Terminal'"
29+
)
30+
term.terminal(
31+
item = "item"
3832
)
39-
term.terminal(
40-
item = "item"
41-
)
42-
span.js-char-width 0
33+
span.js-char-width 0
4334

44-
web-view(
45-
ng-if = "item.state.type === 'WebView'"
46-
)
35+
web-view(
36+
ng-if = "item.state.type === 'WebView'"
37+
)
4738

48-
button.btn.silver.editor-status(
49-
disabled
50-
ng-if = "(data.readOnly && item.state.type === 'File') || \
51-
(item.state.type === 'EnvVars' && item.state.readOnly)"
52-
type = "button"
53-
) Readonly
39+
button.btn.silver.editor-status(
40+
disabled
41+
ng-if = "(data.readOnly && item.state.type === 'File') || \
42+
(item.state.type === 'EnvVars' && item.state.readOnly)"
43+
type = "button"
44+
) Readonly

client/directives/addTab/directiveAddTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function addTab(
88
$state
99
) {
1010
return {
11-
restrict: 'E',
11+
restrict: 'A',
1212
templateUrl: 'viewAddTab',
1313
scope: {
1414
openItems: '='
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
div
2-
a.btn.btn-sm.white.btn-icon.add-tab(
3-
ng-class = "{active: popoverAddTab.data.show}"
4-
toggle-pop-over
5-
toggle-pop-over-model = "popoverAddTab.data.show"
6-
)
7-
svg.iconnables.icons-add
8-
use(
9-
xlink:href = "#icons-add"
10-
)
11-
pop-over(
12-
actions = "popoverAddTab.actions"
13-
data = "popoverAddTab.data"
14-
popover-options = "{\"right\":8,\"top\":45}"
15-
template = "viewPopoverAddTab"
1+
a.btn.btn-sm.white.btn-icon.add-tab(
2+
ng-class = "{active: popoverAddTab.data.show}"
3+
toggle-pop-over
4+
toggle-pop-over-model = "popoverAddTab.data.show"
5+
)
6+
svg.iconnables.icons-add
7+
use(
8+
xlink:href = "#icons-add"
169
)
10+
pop-over(
11+
actions = "popoverAddTab.actions"
12+
data = "popoverAddTab.data"
13+
popover-options = "{\"right\":8,\"top\":45}"
14+
template = "viewPopoverAddTab"
15+
)

client/directives/editRepoCommit/directiveEditRepoCommit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function editRepoCommit(
1414
user
1515
) {
1616
return {
17-
restrict: 'E',
17+
restrict: 'A',
1818
templateUrl: 'viewEditRepoCommit',
1919
scope: {
2020
acv: '=appCodeVersion',
Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,66 @@
1-
li.repository-group-item
2-
svg.iconnables.icons-git
1+
svg.iconnables.icons-git
2+
use(
3+
xlink:href = "#icons-git"
4+
)
5+
h3.repository-title {{ acv.attrs.repo }}
6+
7+
//- if instance.instance and behind latest
8+
button.btn.btn-xs.white.repository-update(
9+
ng-click = "selectLatestCommit()"
10+
ng-if = "!showEditGearMenu && commitsBehind"
11+
tooltip = "Fast-forward {{ unsavedAcv.attrs.branch }} \
12+
({{ commitsBehind ? \
13+
commitsBehind+' commits behind' : \
14+
'To latest' }})"
15+
tooltip-options = "{\"class\":\"bottom\",\"top\":24}"
16+
) {{ commitsBehind }}
17+
svg.iconnables.icons-update
318
use(
4-
xlink:href = "#icons-git"
19+
xlink:href = "#icons-update"
520
)
6-
h3.repository-title {{ acv.attrs.repo }}
7-
8-
//- if instance.instance and behind latest
9-
button.btn.btn-xs.white.repository-update(
10-
ng-click = "selectLatestCommit()"
11-
ng-if = "!showEditGearMenu && commitsBehind"
12-
tooltip = "Fast-forward {{ unsavedAcv.attrs.branch }} \
13-
({{ commitsBehind ? \
14-
commitsBehind+' commits behind' : \
15-
'To latest' }})"
16-
tooltip-options = "{\"class\":\"bottom\",\"top\":24}"
17-
) {{ commitsBehind }}
18-
svg.iconnables.icons-update
19-
use(
20-
xlink:href = "#icons-update"
21-
)
2221

23-
//-
24-
if instance.setup || instance.instanceEdit
25-
button.btn.btn-xs.white.repository-actions(
26-
ng-class = "{ \
27-
active: popoverRepoActions.data.show \
28-
}"
29-
toggle-pop-over
30-
toggle-pop-over-model = "popoverRepoActions.data.show"
31-
type = "button"
32-
ng-if = "showEditGearMenu"
33-
)
34-
svg.iconnables.icons-gear
35-
use(
36-
xlink:href = "#icons-gear"
37-
)
38-
pop-over(
39-
actions = "popoverRepoActions.actions"
40-
data = "popoverRepoActions.data"
41-
popover-options = "{\"left\":-97,\"top\":34}"
42-
template = "viewPopoverRepoActions"
22+
//-
23+
if instance.setup || instance.instanceEdit
24+
button.btn.btn-xs.white.repository-actions(
25+
ng-class = "{ \
26+
active: popoverRepoActions.data.show \
27+
}"
28+
toggle-pop-over
29+
toggle-pop-over-model = "popoverRepoActions.data.show"
30+
type = "button"
31+
ng-if = "showEditGearMenu"
32+
)
33+
svg.iconnables.icons-gear
34+
use(
35+
xlink:href = "#icons-gear"
4336
)
44-
45-
//- add .pending for orange
46-
.commit.load(
47-
ng-class = "{ \
48-
pending: (showPendingClassWhenSelectedOutdatedCommit && \
49-
(build.contextVersions.models[0].appCodeVersions.models.length > 1) && \
50-
acv.attrs.commit !== unsavedAcv.attrs.commit) \
51-
}"
52-
toggle-pop-over
53-
toggle-pop-over-model = "popoverCommitSelect.data.show"
54-
)
55-
.commit-message {{ activeCommit.attrs.commit.message }}
56-
svg.iconnables.icons-commit
57-
use(
58-
xlink:href = "#icons-commit"
59-
)
60-
span.commit-author {{ activeCommit.attrs.author.login }}
61-
time.commit-time {{ activeCommit.attrs.commit.author.date | timeAgo }}
6237
pop-over(
63-
actions = "popoverCommitSelect.actions"
64-
data = "popoverCommitSelect.data"
65-
popover-options = "{\"top\":34}"
66-
template = "viewPopoverCommitSelect"
38+
actions = "popoverRepoActions.actions"
39+
data = "popoverRepoActions.data"
40+
popover-options = "{\"left\":-97,\"top\":34}"
41+
template = "viewPopoverRepoActions"
6742
)
43+
44+
//- add .pending for orange
45+
.commit.load(
46+
ng-class = "{ \
47+
pending: (showPendingClassWhenSelectedOutdatedCommit && \
48+
(build.contextVersions.models[0].appCodeVersions.models.length > 1) && \
49+
acv.attrs.commit !== unsavedAcv.attrs.commit) \
50+
}"
51+
toggle-pop-over
52+
toggle-pop-over-model = "popoverCommitSelect.data.show"
53+
)
54+
.commit-message {{ activeCommit.attrs.commit.message }}
55+
svg.iconnables.icons-commit
56+
use(
57+
xlink:href = "#icons-commit"
58+
)
59+
span.commit-author {{ activeCommit.attrs.author.login }}
60+
time.commit-time {{ activeCommit.attrs.commit.author.date | timeAgo }}
61+
pop-over(
62+
actions = "popoverCommitSelect.actions"
63+
data = "popoverCommitSelect.data"
64+
popover-options = "{\"top\":34}"
65+
template = "viewPopoverCommitSelect"
66+
)

0 commit comments

Comments
 (0)