-
Notifications
You must be signed in to change notification settings - Fork 605
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
Team page #790
Merged
Merged
Team page #790
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
850f693
route to page /team or /user should change according to owner kind
natboehm 1a9d58a
owners are separated into owner_team and owner_user, this solves the …
natboehm 2a33f2b
Team information visible on /team route
natboehm 5b4ca02
fixes disappearing github link problem on team page
natboehm d0e0282
remove owners from hbs template and fix ember import error
natboehm f2dd45a
traded expect for unwrap in owner encodable
natboehm 60ac320
backend tests and associated helper functions for testing new /teams …
natboehm 4a72903
changes to make linter happy when running front end tests
natboehm e2c1a3c
Added frontend tests for team and user pages, currently one failure o…
natboehm fe02763
added PaginationMixin so that number of results displays correctly
natboehm 7b0661e
cargo fmt
natboehm e1794d3
combine get_org and get_team into one function that gets the github url
natboehm 500f9af
Extract owner_team and owner_user from krate.rs into Owner and Team
natboehm ca637bc
delete console.log
natboehm 6da41f9
delete whitespace
natboehm f8e595a
add url to user fixture data that fixes test error
natboehm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Ember from 'ember'; | ||
import PaginationMixin from '../mixins/pagination'; | ||
|
||
const { computed } = Ember; | ||
|
||
export default Ember.Controller.extend(PaginationMixin, { | ||
queryParams: ['page', 'per_page', 'sort'], | ||
page: '1', | ||
per_page: 10, | ||
sort: 'alpha', | ||
|
||
totalItems: computed.readOnly('model.crates.meta.total'), | ||
|
||
currentSortBy: computed('sort', function() { | ||
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import DS from 'ember-data'; | ||
import Ember from 'ember'; | ||
|
||
export default DS.Model.extend({ | ||
email: DS.attr('string'), | ||
name: DS.attr('string'), | ||
login: DS.attr('string'), | ||
api_token: DS.attr('string'), | ||
avatar: DS.attr('string'), | ||
url: DS.attr('string'), | ||
kind: DS.attr('string'), | ||
org_name: Ember.computed('login', function() { | ||
let login = this.get('login'); | ||
let login_split = login.split(':'); | ||
return login_split[1]; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Route.extend({ | ||
queryParams: { | ||
page: { refreshedModel: true }, | ||
sort: { refreshedModel: true }, | ||
}, | ||
data: {}, | ||
|
||
setupController(controller, model) { | ||
this._super(controller, model); | ||
|
||
controller.set('fetchingFeed', true); | ||
controller.set('crates', this.get('data.crates')); | ||
}, | ||
|
||
model(params) { | ||
const { team_id } = params; | ||
return this.store.find('team', team_id).then( | ||
(team) => { | ||
params.team_id = team.get('id'); | ||
return Ember.RSVP.hash({ | ||
crates: this.store.query('crate', params), | ||
team | ||
}); | ||
}, | ||
(e) => { | ||
if (e.errors.any(e => e.detail === 'Not Found')) { | ||
console.log(params); | ||
this | ||
.controllerFor('application') | ||
.set('nextFlashError', `User '${params.team_id}' does not exist`); | ||
return this.replaceWith('index'); | ||
} | ||
} | ||
); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<div id='crates-heading'> | ||
<div class="wide"> | ||
<div class='info'> | ||
{{user-avatar user=model.team size='medium'}} | ||
<div class='team-info'> | ||
<h1> | ||
{{ model.team.org_name }} | ||
</h1> | ||
<h2> | ||
{{ model.team.name }} | ||
</h2> | ||
</div> | ||
{{#user-link user=model.team}} | ||
<img alt="GitHub profile" title="GitHub profile" src="/assets/GitHub-Mark-32px.png"/> | ||
{{/user-link}} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id='user-profile'> | ||
<div class='info'> | ||
{{! TODO: reduce duplication with templates/crates.hbs }} | ||
|
||
<div id='results'> | ||
<div class='nav'> | ||
<span class='amt small'> | ||
Displaying | ||
<span class='cur'>{{ currentPageStart }}-{{ currentPageEnd }}</span> | ||
of <span class='total'>{{ totalItems }}</span> total results | ||
</span> | ||
</div> | ||
|
||
<div class='sort'> | ||
<span class='small'>Sort by</span> | ||
{{#rl-dropdown-container class="dropdown-container"}} | ||
{{#rl-dropdown-toggle tagName="a" class="dropdown"}} | ||
<img class="sort" src="/assets/sort.png"/> | ||
{{ currentSortBy }} | ||
<span class='arrow'></span> | ||
{{/rl-dropdown-toggle}} | ||
|
||
{{#rl-dropdown tagName="ul" class="dropdown" closeOnChildClick="a:link"}} | ||
<li> | ||
{{#link-to (query-params sort="alpha")}} | ||
Alphabetical | ||
{{/link-to}} | ||
</li> | ||
<li> | ||
{{#link-to (query-params sort="downloads")}} | ||
Downloads | ||
{{/link-to}} | ||
</li> | ||
{{/rl-dropdown}} | ||
{{/rl-dropdown-container}} | ||
</div> | ||
</div> | ||
|
||
<div id='crates' class='white-rows'> | ||
{{#each model.crates as |crate|}} | ||
{{crate-row crate=crate}} | ||
{{/each}} | ||
</div> | ||
|
||
<div class='pagination'> | ||
{{#link-to (query-params page=prevPage) class="prev" rel="prev" title="previous page"}} | ||
<img class="left-pag" src="/assets/left-pag.png"/> | ||
{{/link-to}} | ||
{{#each pages as |page|}} | ||
{{#link-to (query-params page=page)}}{{ page }}{{/link-to}} | ||
{{/each}} | ||
{{#link-to (query-params page=nextPage) class="next" rel="next" title="next page"}} | ||
<img class="right-pag" src="/assets/right-pag.png"/> | ||
{{/link-to}} | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// jscs:disable validateQuoteMarks | ||
export default { | ||
"teams": [ | ||
{ | ||
"avatar": "https://avatars.githubusercontent.com/u/565790?v=3", | ||
"email": "someone@example.com", | ||
"id": 2, | ||
"kind": "team", | ||
"login": "github:org:thehydroimpulse", | ||
"name": "Team Daniel Fagnan", | ||
"url": "https://github.com/thehydroimpulse" | ||
}, | ||
{ | ||
"avatar": "https://avatars.githubusercontent.com/u/9447137?v=3", | ||
"email": null, | ||
"id": 303, | ||
"kind": "team", | ||
"login": "github:org:blabaere", | ||
"name": "Team Benoît Labaere", | ||
"url": "https://github.com/blabaere" | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// jscs:disable validateQuoteMarks | ||
export default { | ||
"team": { | ||
"avatar": "https://avatars.githubusercontent.com/u/565790?v=3", | ||
"id": 1, | ||
"login": "github:org_test:thehydroimpulseteam", | ||
"name": "thehydroimpulseteam", | ||
"url": "https://github.com/thehydroimpulse", | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// jscs:disable validateQuoteMarks | ||
export default { | ||
"user": { | ||
"avatar": "https://avatars.githubusercontent.com/u/565790?v=3", | ||
"email": "someone@example.com", | ||
"id": 1, | ||
"login": "thehydroimpulse", | ||
"name": "Daniel Fagnan" | ||
} | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a debugging
console.log
left in here :)