Commit c5c26861 authored by csillag's avatar csillag

Create directive for displaying the user name

parent deac73d9
...@@ -687,6 +687,10 @@ blockquote { ...@@ -687,6 +687,10 @@ blockquote {
.user { .user {
font-weight: bold; font-weight: bold;
font-size: 1.1em; font-size: 1.1em;
&:hover {
color: $linkColorHover;
cursor: pointer;
}
} }
.body { .body {
...@@ -735,6 +739,15 @@ blockquote { ...@@ -735,6 +739,15 @@ blockquote {
} }
} }
// Temporary hack until sidebar and displayer are unified
.annotation-displayer {
.user {
&:hover {
color: $linkColorHover;
cursor: pointer;
}
}
}
//THREADING//////////////////////////////// //THREADING////////////////////////////////
//Threaded discussion specific //Threaded discussion specific
...@@ -806,7 +819,7 @@ blockquote { ...@@ -806,7 +819,7 @@ blockquote {
opacity: 0.8; opacity: 0.8;
} }
.user { .indicators {
display: run-in; display: run-in;
margin-right: .25em; margin-right: .25em;
} }
......
...@@ -340,6 +340,23 @@ notification = ['$filter', ($filter) -> ...@@ -340,6 +340,23 @@ notification = ['$filter', ($filter) ->
templateUrl: 'notification.html' templateUrl: 'notification.html'
] ]
username = ['$filter', '$window', ($filter, $window) ->
link: (scope, elem, attr, ctrl) ->
return unless ctrl?
ctrl.$render = ->
scope.uname = ($filter 'userName') ctrl.$viewValue
scope.uclick = (event) ->
event.stopPropagation()
$window.open "/u/" + scope.uname
require: '?ngModel'
restrict: 'E'
template: '<span class="user" ng-click="uclick($event)">{{uname}}</span>'
]
angular.module('h.directives', ['ngSanitize']) angular.module('h.directives', ['ngSanitize'])
.directive('authentication', authentication) .directive('authentication', authentication)
.directive('markdown', markdown) .directive('markdown', markdown)
...@@ -350,8 +367,10 @@ angular.module('h.directives', ['ngSanitize']) ...@@ -350,8 +367,10 @@ angular.module('h.directives', ['ngSanitize'])
.directive('tabReveal', tabReveal) .directive('tabReveal', tabReveal)
.directive('tags', tags) .directive('tags', tags)
.directive('thread', thread) .directive('thread', thread)
.directive('username', username)
.directive('userPicker', userPicker) .directive('userPicker', userPicker)
.directive('ngBlur', ngBlur) .directive('ngBlur', ngBlur)
.directive('repeatAnim', repeatAnim) .directive('repeatAnim', repeatAnim)
.directive('notification', notification) .directive('notification', notification)
...@@ -40,11 +40,6 @@ fuzzyTime = (date) -> ...@@ -40,11 +40,6 @@ fuzzyTime = (date) ->
userName = (user) -> userName = (user) ->
(user?.match /^acct:([^@]+)/)?[1] (user?.match /^acct:([^@]+)/)?[1]
userLink = (user, url) ->
name = (user?.match /^acct:([^@]+)/)?[1]
prefix = url.replace /\/\w+\/$/, ''
prefix + '/u/' + name
elide = (text, split_length) -> elide = (text, split_length) ->
if text.length > split_length if text.length > split_length
text = text.substring 0,split_length text = text.substring 0,split_length
...@@ -56,5 +51,4 @@ angular.module('h.filters', []) ...@@ -56,5 +51,4 @@ angular.module('h.filters', [])
.filter('converter', -> (new Converter()).makeHtml) .filter('converter', -> (new Converter()).makeHtml)
.filter('fuzzyTime', -> fuzzyTime) .filter('fuzzyTime', -> fuzzyTime)
.filter('userName', -> userName) .filter('userName', -> userName)
.filter('userLink', -> userLink)
.filter('elide', -> elide) .filter('elide', -> elide)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment