Last active
December 22, 2015 17:29
-
-
Save blmarket/6506197 to your computer and use it in GitHub Desktop.
One-page app to display only your board comments
This file contains hidden or 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
angular.module 'trello-comments', [ 'ngResource' ] | |
Trello.authorize { | |
interactive: false | |
} | |
CommentsCtrl = ($scope, $resource) -> | |
$scope.board_id = '519394de1fb3e3b9110042c7' | |
$scope.comments = [ ] | |
$scope.authorized = Trello.authorized # beware, it's function. | |
$scope.authorize = -> | |
Trello.authorize { | |
type: 'popup' | |
scope: { read: true, write: false } | |
success: -> | |
return unless Trello.authorized() | |
$scope.fetchComments() unless $scope.authorized | |
$scope.authorized = true | |
return | |
} | |
return | |
$scope.fetchComments = -> | |
Trello.get "boards/#{ $scope.board_id }/actions", { | |
limit: 100, filter: 'commentCard' | |
}, (data) -> | |
$scope.$apply -> $scope.comments = data | |
return | |
return | |
$scope.openCard = (card_id) -> | |
Trello.get "cards/#{ card_id }", (data) -> | |
window.open data.url, 'somename' | |
return | |
return | |
# comments_api.query (comments) -> | |
# $scope.comments = comments | |
return |
This file contains hidden or 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
module.exports = (grunt) -> | |
grunt.initConfig | |
pkg: grunt.file.readJSON 'package.json' | |
coffee: compile: | |
options: bare: true | |
files: 'dist/controller.js': './controller.coffee' | |
jade: compile: | |
options: pretty: true | |
files: 'dist/index.html': [ 'index.jade' ] | |
grunt.loadNpmTasks 'grunt-contrib-coffee' | |
grunt.loadNpmTasks 'grunt-contrib-jade' | |
grunt.registerTask 'default', [ 'coffee', 'jade' ] | |
This file contains hidden or 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
doctype 5 | |
html(ng-app='trello-comments') | |
head | |
meta(charset='utf-8') | |
title hello world | |
link(rel='stylesheet', href='//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css') | |
// angular should be in head element. | |
script(src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'). | |
script(src='//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js'). | |
script(src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-resource.min.js"). | |
script(src='https://api.trello.com/1/client.js?key=adeb0ccecf390e026e59bfa483ed83eb'). | |
script(src='./controller.js'). | |
body | |
.container(ng-controller='CommentsCtrl') | |
h2 Source code is available at | |
a(href='https://gist.github.com/blmarket/6506197') Gist | |
h3 버그 때문에 그러니 링크는 click만 해주세요; | |
div(ng-if='!authorized()') | |
a(ng-click='authorize()') Log in | |
div(ng-if='authorized()', ng-init="fetchComments()") | |
input(type='text', ng-model='board_id') | |
a.btn.btn-default(ng-click='fetchComments()') Refresh | |
ul | |
li(ng-repeat='cmt in comments') | |
p @{{cmt.memberCreator.fullName}}: {{cmt.data.text}} on | |
a(href='https://trello.com/c/{{cmt.data.card.id}}', target="_blank") \#{{cmt.data.card.idShort}} | |
script(src='//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js'). |
This file contains hidden or 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
{ | |
"name": "trello-comments", | |
"version": "0.0.0", | |
"description": "Track only comments on trello", | |
"main": "index.js", | |
"scripts": { | |
"prepublish": "grunt" | |
}, | |
"author": "blmarket", | |
"license": "MIT", | |
"dependencies": {}, | |
"devDependencies": { | |
"grunt-cli": "~0.1.9", | |
"grunt": "~0.4.1", | |
"grunt-contrib-coffee": "~0.7.0", | |
"grunt-contrib-jade": "~0.8.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why do you have ngResource? you don't seem to use it