Skip to content

Commit

Permalink
Merge branch 'main' into 18883_bulk_selected_issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tyroneyeh authored Jul 19, 2022
2 parents 03b37ce + d6779c7 commit 0e53de3
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 33 deletions.
5 changes: 3 additions & 2 deletions cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,10 @@ func runListUsers(c *cli.Context) error {
}
}
} else {
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\n")
twofa := user_model.UserList(users).GetTwoFaStatus()
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\t2FA\n")
for _, u := range users {
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin)
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin, twofa[u.ID])
}

}
Expand Down
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"pretty-ms": "7.0.1",
"sortablejs": "1.15.0",
"swagger-ui-dist": "4.11.1",
"tippy.js": "6.3.7",
"tributejs": "5.1.3",
"uint8-to-base64": "0.2.0",
"vue": "2.6.14",
Expand Down
1 change: 1 addition & 0 deletions routers/web/org/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func Members(ctx *context.Context) {
}
opts.PublicOnly = !isMember && !ctx.Doer.IsAdmin
}
ctx.Data["PublicOnly"] = opts.PublicOnly

total, err := organization.CountOrgMembers(opts)
if err != nil {
Expand Down
42 changes: 22 additions & 20 deletions templates/org/member/members.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,30 @@
{{end}}
</div>
</div>
<div class="ui three wide column center">
<div class="meta">
{{$.locale.Tr "org.members.member_role"}}
</div>
<div class="meta">
<strong>{{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock"}} {{$.locale.Tr "org.members.owner"}}{{else}}{{$.locale.Tr "org.members.member"}}{{end}}</strong>
</div>
</div>
<div class="ui two wide column center">
<div class="meta">
{{$.locale.Tr "admin.users.2fa"}}
{{if not .PublicOnly}}
<div class="ui three wide column center">
<div class="meta">
{{$.locale.Tr "org.members.member_role"}}
</div>
<div class="meta">
<strong>{{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock"}} {{$.locale.Tr "org.members.owner"}}{{else}}{{$.locale.Tr "org.members.member"}}{{end}}</strong>
</div>
</div>
<div class="meta">
<strong>
{{if index $.MembersTwoFaStatus .ID}}
<span class="text green">{{svg "octicon-check"}}</span>
{{else}}
{{svg "octicon-x"}}
{{end}}
</strong>
<div class="ui two wide column center">
<div class="meta">
{{$.locale.Tr "admin.users.2fa"}}
</div>
<div class="meta">
<strong>
{{if index $.MembersTwoFaStatus .ID}}
<span class="text green">{{svg "octicon-check"}}</span>
{{else}}
{{svg "octicon-x"}}
{{end}}
</strong>
</div>
</div>
</div>
{{end}}
<div class="ui three wide column">
<div class="text right">
{{if eq $.SignedUser.ID .ID}}
Expand Down
17 changes: 6 additions & 11 deletions web_src/js/features/contextpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import $ from 'jquery';
import Vue from 'vue';
import ContextPopup from '../components/ContextPopup.vue';
import {parseIssueHref} from '../utils.js';
import {createTippy} from '../modules/tippy.js';

export default function initContextPopups() {
const refIssues = $('.ref-issue');
Expand All @@ -16,7 +17,6 @@ export default function initContextPopups() {
if (!owner) return;

const el = document.createElement('div');
el.className = 'ui custom popup hidden';
el.innerHTML = '<div></div>';
this.parentNode.insertBefore(el, this.nextSibling);

Expand All @@ -33,17 +33,12 @@ export default function initContextPopups() {
el.textContent = 'ContextPopup failed to load';
}

$(this).popup({
variation: 'wide',
delay: {
show: 250
},
createTippy(this, {
content: el,
interactive: true,
onShow: () => {
view.$emit('load-context-popup', {owner, repo, index}, () => {
$(this).popup('reposition');
});
},
popup: $(el),
view.$emit('load-context-popup', {owner, repo, index});
}
});
});
}
12 changes: 12 additions & 0 deletions web_src/js/modules/tippy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import tippy from 'tippy.js';

export function createTippy(target, opts) {
return tippy(target, {
appendTo: document.body,
placement: 'top-start',
animation: false,
allowHTML: true,
arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`,
...opts,
});
}
1 change: 1 addition & 0 deletions web_src/less/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@import "./features/imagediff.less";
@import "./features/codeeditor.less";
@import "./features/projects.less";
@import "./modules/tippy.less";
@import "./markup/content.less";
@import "./markup/codecopy.less";
@import "./code/linebutton.less";
Expand Down
84 changes: 84 additions & 0 deletions web_src/less/modules/tippy.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* styles are based on node_modules/tippy.js/dist/tippy.css */

.tippy-box[data-animation="fade"][data-state="hidden"] {
opacity: 0;
}

[data-tippy-root] {
max-width: calc(100vw - 10px);
}

.tippy-box {
position: relative;
background-color: var(--color-body);
color: var(--color-secondary-dark-6);
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius);
font-size: 1rem;
transition-property: transform, visibility, opacity;
}

.tippy-content {
position: relative;
padding: 1rem;
z-index: 1;
}

.tippy-box[data-placement^="top"] > .tippy-svg-arrow {
bottom: 0;
}

.tippy-box[data-placement^="top"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="top"] > .tippy-svg-arrow > svg {
top: 16px;
transform: rotate(180deg);
}

.tippy-box[data-placement^="bottom"] > .tippy-svg-arrow {
top: 0;
}

.tippy-box[data-placement^="bottom"] > .tippy-svg-arrow > svg {
bottom: 16px;
}

.tippy-box[data-placement^="left"] > .tippy-svg-arrow {
right: 0;
}

.tippy-box[data-placement^="left"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="left"] > .tippy-svg-arrow > svg {
transform: rotate(90deg);
top: calc(50% - 3px);
left: 11px;
}

.tippy-box[data-placement^="right"] > .tippy-svg-arrow {
left: 0;
}

.tippy-box[data-placement^="right"] > .tippy-svg-arrow::after,
.tippy-box[data-placement^="right"] > .tippy-svg-arrow > svg {
transform: rotate(-90deg);
top: calc(50% - 3px);
right: 11px;
}

.tippy-svg-arrow {
width: 16px;
height: 16px;
text-align: initial;
}

.tippy-svg-arrow,
.tippy-svg-arrow > svg {
position: absolute;
}

.tippy-svg-arrow-outer {
fill: var(--color-secondary);
}

.tippy-svg-arrow-inner {
fill: var(--color-body);
}

0 comments on commit 0e53de3

Please sign in to comment.