Commit c5c26861 authored by csillag's avatar csillag

Create directive for displaying the user name

parent deac73d9
......@@ -687,6 +687,10 @@ blockquote {
.user {
font-weight: bold;
font-size: 1.1em;
&:hover {
color: $linkColorHover;
cursor: pointer;
}
}
.body {
......@@ -735,6 +739,15 @@ blockquote {
}
}
// Temporary hack until sidebar and displayer are unified
.annotation-displayer {
.user {
&:hover {
color: $linkColorHover;
cursor: pointer;
}
}
}
//THREADING////////////////////////////////
//Threaded discussion specific
......@@ -806,7 +819,7 @@ blockquote {
opacity: 0.8;
}
.user {
.indicators {
display: run-in;
margin-right: .25em;
}
......
......@@ -340,6 +340,23 @@ notification = ['$filter', ($filter) ->
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'])
.directive('authentication', authentication)
.directive('markdown', markdown)
......@@ -350,8 +367,10 @@ angular.module('h.directives', ['ngSanitize'])
.directive('tabReveal', tabReveal)
.directive('tags', tags)
.directive('thread', thread)
.directive('username', username)
.directive('userPicker', userPicker)
.directive('ngBlur', ngBlur)
.directive('repeatAnim', repeatAnim)
.directive('notification', notification)
......@@ -40,11 +40,6 @@ fuzzyTime = (date) ->
userName = (user) ->
(user?.match /^acct:([^@]+)/)?[1]
userLink = (user, url) ->
name = (user?.match /^acct:([^@]+)/)?[1]
prefix = url.replace /\/\w+\/$/, ''
prefix + '/u/' + name
elide = (text, split_length) ->
if text.length > split_length
text = text.substring 0,split_length
......@@ -56,5 +51,4 @@ angular.module('h.filters', [])
.filter('converter', -> (new Converter()).makeHtml)
.filter('fuzzyTime', -> fuzzyTime)
.filter('userName', -> userName)
.filter('userLink', -> userLink)
.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