Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide tab #83

Merged
merged 10 commits into from Jul 21, 2020
Expand Up @@ -21,7 +21,7 @@ export default Controller.extend({
if (this.model.members.length >= this.offset + 50) {
this.set("loading", true);
this.set("offset", this.offset + 50);
ajax(`/assign/members/${this.groupName}?offset=${this.offset}`).then(
ajax(`/assign/members/${this.group.name}?offset=${this.offset}`).then(
result => {
this.members.pushObjects(result.members);
this.set("loading", false);
Expand Down
@@ -1,7 +1,7 @@
import Route from "@ember/routing/route";
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";

export default Route.extend({
export default DiscourseRoute.extend({
model() {
return ajax(`/assign/members/${this.modelFor("group").get("name")}`);
},
Expand All @@ -10,7 +10,7 @@ export default Route.extend({
controller.setProperties({
model,
members: [],
groupName: this.modelFor("group").get("name")
group: this.modelFor("group")
});

controller.findMembers(true);
Expand Down
Expand Up @@ -3,6 +3,11 @@ export default Ember.Component.extend({

init() {
this._super(...arguments);
this.set("canAssign", this.currentUser && this.currentUser.can_assign);
this.set(
"displayAssignTab",
this.currentUser &&
this.currentUser.can_assign &&
this.group.assignment_count > 0
);
}
});
Expand Up @@ -4,6 +4,6 @@
{{/link-to}}
{{else}}
{{#link-to "group.assignments.show" filter}}
{{i18n 'discourse_assign.group_everyone'}}
{{i18n 'discourse_assign.group_everyone'}} ({{assignment_count}})
{{/link-to}}
{{/if}}
@@ -1,8 +1,8 @@
{{#if canAssign}}
{{#if displayAssignTab}}
<ul class ='nav-pills'>
<li>
{{#link-to 'group.assignments' group}}
{{d-icon "user-plus" class="glyph"}}{{i18n 'discourse_assign.group_assignments'}}{{concat ' (' group.assignment_count concat ')'}}
{{#link-to "group.assignments"}}
{{d-icon "user-plus" class="glyph"}}{{i18n 'discourse_assign.group_assignments'}} ({{group.assignment_count}})
{{/link-to}}
</li>
</ul>
Expand Down
@@ -1,7 +1,7 @@
<section class="user-secondary-navigation">
{{#mobile-nav class="activity-nav" desktopClass="action-list activity-list nav-stacked" currentPath=router._router.currentPath}}
{{#load-more selector=".activity-nav li" action=(action "loadMore")}}
{{group-assignments-filter show-avatar=false filter="everyone" routeType=route_type}}
{{group-assignments-filter show-avatar=false filter="everyone" routeType=route_type assignment_count=group.assignment_count}}
{{#each members as |member|}}
{{group-assignments-filter show-avatar=true filter=member routeType=route_type}}
{{/each}}
Expand Down