Skip to content

Instantly share code, notes, and snippets.

@iamblue
Created July 10, 2014 13:06
Show Gist options
  • Select an option

  • Save iamblue/b431c87f561d448c982a to your computer and use it in GitHub Desktop.

Select an option

Save iamblue/b431c87f561d448c982a to your computer and use it in GitHub Desktop.
process
const proccessFrameDirective = ($timeout)->
{
retrict: \A
templateUrl: "/views/layout/project/item/comment.html"
link: (scope, elem, attr) !->
$timeout ->
scope.commentarr.push elem[0]offsetHeight
,100
scope.steparr.push Number(attr.step)
switch attr.step
| \0 =>
scope.cstep = 0
scope.commentTitle = attr.steptitle
scope.commentContent = attr.stepcontent
scope.commentPicUrl = attr.steppicurl
scope.created = attr.createdat
| \1 =>
scope.cstep = 1
scope.targetvotenum = scope.vdata.targetVoteNum
scope.nowvotenum = scope.vdata.nowVoteNum
if scope.nowvotenum >= scope.targetvotenum
scope.percentwidth = 100
else
scope.percentwidth = Number (scope.nowvotenum / scope.targetvotenum)*100
scope.step1summaryTitle = attr.steptitle
scope.step1summaryContent = attr.stepcontent
# console.log attr.steponvotetime
scope.stepdownvotetime = attr.stepdownvotetime
scope.steponvotetime = attr.steponvotetime
| \2 =>
scope.cstep = 3
scope.step3downvotetime = attr.stepdownvotetime
scope.step3onvotetime = attr.steponvotetime
scope.step3title = attr.steptitle
scope.step3desc = attr.stepcontent
| \3 =>
scope.cstep = 4
scope.step4downvotetime = attr.stepdownvotetime
scope.step4onvotetime = attr.steponvotetime
scope.step4title = attr.steptitle
scope.step4desc = attr.stepcontent
| \4 =>
scope.cstep = 5
scope.step5downvotetime = attr.stepdownvotetime
scope.step5onvotetime = attr.steponvotetime
scope.step5title = attr.steptitle
scope.step5desc = attr.stepcontent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment