-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'angular_frontend' of github.com:openhq/openhq into show…
…_project * 'angular_frontend' of github.com:openhq/openhq: thin story serialzer and list out recent stories on the projects put template in directives and eager load the users update current_user_serializer and remove default url from avatar rubocop template for avatar user avatars - using gravatar
- Loading branch information
Showing
8 changed files
with
58 additions
and
7 deletions.
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,10 @@ | ||
angular.module("OpenHq").directive("userAvatar", function() { | ||
return { | ||
restrict: "E", | ||
scope: { | ||
user: '=', | ||
size: '=', | ||
}, | ||
template: JST['templates/directives/user_avatar'], | ||
}; | ||
}); |
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/templates/directives/user_avatar.jst.ejs
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,3 @@ | ||
<a href="#" title="{{ user.display_name }}"> | ||
<img alt="{{ user.display_name }}" class="avatar" width="{{ size || 30 }}" src="{{ user.avatar_url }}"> | ||
</a> |
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
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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
class ProjectSerializer < ActiveModel::Serializer | ||
attributes :id, :name, :slug, :owner_id, :created_at, :updated_at, :deleted_at, :team_id | ||
# has_many :users | ||
has_many :users, serializer: UserSerializer | ||
has_many :stories, serializer: ThinStorySerializer | ||
|
||
def stories | ||
object.stories.order(updated_at: :desc).take(5) | ||
end | ||
end |
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,3 @@ | ||
class ThinStorySerializer < ActiveModel::Serializer | ||
attributes :id, :name, :slug, :updated_at | ||
end |
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