Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/adapters/current-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Ember from 'ember';
import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
session: Ember.inject.service(),

buildURL(modelName, id, snapshot, requestType) {
if (requestType === 'findRecord') {
if (parseInt(id) === parseInt(this.get('session.session.authenticated.user_id'))) {
return this.urlForCurrentUser();
}
}
return this._super(...arguments);
},

urlForCurrentUser() {
var url = [];
var host = Ember.get(this, 'host');
var prefix = this.urlPrefix();

url.push(encodeURIComponent('user'));

if (prefix) { url.unshift(prefix); }

url = url.join('/');
if (!host && url) { url = '/' + url; }

return url;
}
});
4 changes: 2 additions & 2 deletions app/components/slugged-route-model-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['slugged-route-model-details'],

isOrganization: Ember.computed.equal('sluggedRoute.modelType', 'organization'),
isUser: Ember.computed.equal('sluggedRoute.modelType', 'user')
belongsToOrganization: Ember.computed.equal('sluggedRoute.ownerType', 'Organization'),
belongsToUser: Ember.computed.equal('sluggedRoute.ownerType', 'User'),
});
22 changes: 22 additions & 0 deletions app/components/user-menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Ember from 'ember';

export default Ember.Component.extend({
classNames: ['user-menu'],
classNameBindings: ['menuHidden:menu-hidden:menu-visible'],

session: Ember.inject.service(),

menuHidden: true,

actions: {
toggle: function() {
this.toggleProperty('menuHidden');
},
hide: function() {
this.set('menuHidden', true);
},
invalidateSession: function() {
this.get('session').invalidate();
}
}
});
3 changes: 3 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<meta name="description" content="Collaborate on tech projects with social impact.">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="icon" href="https://d3pgew4wbk2vb1.cloudfront.net/icons/favicon.png">
<link rel="icon" href="https://d3pgew4wbk2vb1.cloudfront.net/icons/favicon-32.png" sizes="32x32">

{{content-for 'head'}}

<link rel="stylesheet" href="assets/vendor.css">
Expand Down
3 changes: 3 additions & 0 deletions app/models/current-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import User from 'code-corps-ember/models/user';

export default User.extend();
4 changes: 2 additions & 2 deletions app/models/organization.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DS from 'ember-data';
import Model from 'code-corps-ember/models/model';
import Owner from 'code-corps-ember/models/owner';

var attr = DS.attr;

export default Model.extend({
export default Owner.extend({
name: attr(),
slug: attr(),
});
File renamed without changes.
4 changes: 2 additions & 2 deletions app/models/slugged-route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DS from 'ember-data';

export default DS.Model.extend({
model: DS.belongsTo('model', { async: true, polymorphic: true }),
modelType: DS.attr('string'),
owner: DS.belongsTo('owner', { async: true, polymorphic: true }),
ownerType: DS.attr('string'),
slug: DS.attr('string'),
});
14 changes: 12 additions & 2 deletions app/models/user.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import DS from 'ember-data';
import Model from 'code-corps-ember/models/model';
import Owner from 'code-corps-ember/models/owner';
import Ember from 'ember';

export default Model.extend({
export default Owner.extend({
name: DS.attr('string'),
username: DS.attr('string'),
website: DS.attr('string'),
twitter: DS.attr('string'),
biography: DS.attr('string'),
email: DS.attr('string'),
password: DS.attr('string'),
photoThumbUrl: DS.attr('string'),
photoLargeUrl: DS.attr('string'),
createdAt: DS.attr('date'),
organizations: DS.hasMany('organization', { async: true }),
atUsername: Ember.computed('username', function() {
return `@${this.get('username')}`;
}),
twitterUrl: Ember.computed('twitter', function() {
return `https://twitter.com/${this.get('twitter')}`;
})
});
17 changes: 17 additions & 0 deletions app/services/session.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Ember from 'ember';
import ESASession from "ember-simple-auth/services/session";

export default ESASession.extend({

store: Ember.inject.service(),

setCurrentUser: function() {
if (this.get('isAuthenticated')) {
let id = this.get('session.authenticated.user_id');
this.get('store').findRecord('current-user', id).then((user) => {
this.set('currentUser', user);
});
}
}.observes('isAuthenticated')

});
3 changes: 2 additions & 1 deletion app/styles/_fonts.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);
$header-font-family: "proxima-nova", sans-serif;
$body-font-family: "open-sans", sans-serif;
11 changes: 11 additions & 0 deletions app/styles/_header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.site-logo {
margin: 0;
line-height: 50px;
}

.logo {
$file: "/assets/images/icons/cc-logo";
@include background-image-retina($file, "png", 234px, 50px);
display: inline-block;
text-indent: -9999px;
}
40 changes: 40 additions & 0 deletions app/styles/_misc.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@mixin arrow-down {
content: "";
display: inline-block;
width: 0;
height: 0;
vertical-align: middle;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 6px solid $dark-text;
border-bottom: none;
}

@mixin arrow-up {
content: "";
display: inline-block;
width: 0;
height: 0;
vertical-align: middle;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 6px solid $dark-text;
border-top: none;
}

.css-truncate-target {
display: inline-block;
max-width: 125px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: top;
}

.border-top {
border-top: 1px solid;
}

.border-gray-light {
border-color: $border-light;
}
11 changes: 8 additions & 3 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@
@import "inputs";
@import "forms";
@import "alerts";
@import "misc";

@import "main";

@import "header";

@import "components/editor-with-preview";
@import "components/error-wrapper";
@import "components/login-form";
@import "components/post-details";
@import "components/post-item";
@import "components/post-title";
@import "components/project-details";
@import "components/project-menu";
@import "components/project-post-list";
@import "components/signup-form";
@import "components/editor-with-preview";
@import "components/post-title";
@import "components/post-details";
@import "components/user-details";
@import "components/user-menu";
48 changes: 48 additions & 0 deletions app/styles/components/user-details.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@mixin detail-icon($type) {
&:before {
$file: "/assets/images/icons/" + $type;
@include background-image-retina($file, "png", 16px, 16px);
content: "";
display: inline-block;
width: 16px;
height: 16px;
margin: 0px 5px -2px 0;
}
}

.user-details {
@include span-columns(3);
img {
width: 100%;
border-radius: 4px;
}

h2 {
margin: 10px 0;
}

.username {
font-size: 16px;
font-weight: 500;
color: $light-text;
}

.details {
margin: 10px 0;
padding: 10px 0;
font-size: 14px;
color: $light-text;

li {
padding: 4px 0;
}

.twitter {
@include detail-icon('twitter');
}

.website {
@include detail-icon('link');
}
}
}
Loading