chore(examples): remove ancient examples from the tree
Let these poor scripts retire, goodness. Closes #6398 Closes #3310
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
body {
|
||||
background: -webkit-gradient(linear, left top, left 100, from(#bbb), to(#fff));
|
||||
background-repeat: no-repeat;
|
||||
margin: 0px;
|
||||
font-family: sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
body > div {
|
||||
border-top: 1px solid white;
|
||||
border-bottom: 1px solid black;
|
||||
text-align: center;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#CCC), to(#888));
|
||||
-webkit-background-origin: padding; -webkit-background-clip: content;
|
||||
}
|
||||
body > div button {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
body > div span:FIRST-CHILD {
|
||||
float: left;
|
||||
font-family: monospace;
|
||||
font-size: 1.5em;
|
||||
color: black;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
body > div span:last-child {
|
||||
float: right;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body > ul > li {
|
||||
border: 1px solid black;
|
||||
margin: 15px 5px;
|
||||
padding: 0;
|
||||
-webkit-box-shadow: 5px 5px 5px #888;
|
||||
}
|
||||
|
||||
body > ul > li > h1 {
|
||||
margin: 0;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#999));
|
||||
font-size: 13px;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
h1 > img,
|
||||
li > img {
|
||||
max-height: 30px;
|
||||
max-width: 30px;
|
||||
vertical-align: middle;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
a > img {
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
body > ul > li > h1 > a:last-child {
|
||||
float: right;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
body > ul > li > div {
|
||||
background-color: white;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
body > ul > li ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin-left: 5px;
|
||||
border-left: 5px solid lightgray;
|
||||
}
|
||||
|
||||
body > ul > li ul > li {
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html xmlns:ng="http://angularjs.org">
|
||||
<head>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
|
||||
<script type="text/javascript" src="http://angularjs.org/ng/js/angular-debug.js#autobind"></script>
|
||||
<script type="text/javascript" src="buzz.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="http://angularjs.org/ng/css/angular.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="buzz.css"/>
|
||||
</head>
|
||||
<body ng:init="$window.$root = this" ng:controller="BuzzController">
|
||||
<div>
|
||||
<span><angular/> Buzz</span>
|
||||
<span>
|
||||
filter:
|
||||
<input type="text" ng:model="filterText"/>
|
||||
</span>
|
||||
<span>
|
||||
user:
|
||||
<input type="text" ng:model="userId" required/>
|
||||
<button ng:click="$location.hashPath = userId">fetch</button>
|
||||
</span>
|
||||
</div>
|
||||
<ul>
|
||||
<li ng:repeat="item in activities.data.items.$filter(filterText)">
|
||||
<h1>
|
||||
<img ng:src="{{item.actor.thumbnailUrl}}"/>
|
||||
<a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a>
|
||||
<a href="#" ng:click="expandReplies(item)">Replies: {{item.links.replies[0].count}}</a>
|
||||
</h1>
|
||||
<div>
|
||||
{{item.object.content | html}}
|
||||
<div>
|
||||
<a href="{{attachment.links.enclosure[0].href}}" ng:repeat="attachment in item.object.attachments">
|
||||
<img ng:src="{{attachment.links.preview[0].href}}"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<my:expand expand="item.replies.show">
|
||||
<ul>
|
||||
<li ng:repeat="reply in item.replies.data.items">
|
||||
<img ng:src="{{reply.actor.thumbnailUrl}}"/>
|
||||
<a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>:
|
||||
{{reply.content | html}}
|
||||
</li>
|
||||
</ul>
|
||||
</my:expand>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
angular.module.ng('myApplication', function($resource){
|
||||
this.Activity = $resource(
|
||||
'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments',
|
||||
{alt:'json', callback:'JSON_CALLBACK'},
|
||||
{
|
||||
get: {method:'JSON', params:{visibility:'@self'}},
|
||||
replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}}
|
||||
});
|
||||
}, {inject:['$resource']});
|
||||
|
||||
function BuzzController() {
|
||||
this.$watch('$location.hashPath', this.userChange);
|
||||
}
|
||||
BuzzController.prototype = {
|
||||
userChange: function() {
|
||||
this.userId = this.$location.hashPath;
|
||||
this.activities = this.Activity.get({userId:this.userId});
|
||||
},
|
||||
|
||||
expandReplies: function(activity) {
|
||||
var self = this;
|
||||
if (activity.replies) {
|
||||
activity.replies.show = !activity.replies.show;
|
||||
} else {
|
||||
activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id}, function() {
|
||||
activity.replies.show = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
angular.widget('my:expand', function(element){
|
||||
element.css('display', 'block');
|
||||
this.descend(true);
|
||||
return function(element) {
|
||||
element.hide();
|
||||
var watch = element.attr('expand');
|
||||
this.$watch(watch, function(value){
|
||||
if (value) {
|
||||
element.delay(0).slideDown('slow');
|
||||
} else {
|
||||
element.slideUp('slow');
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li><a href="calculator-bootstrap.html">Calculator: Auto Init</a></li>
|
||||
<li><a href="calculator.html">Calculator: Manual Init</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,33 +0,0 @@
|
||||
<!doctype html>
|
||||
<html ng-app="personalLog">
|
||||
<head>
|
||||
<title>Personal Log</title>
|
||||
<script src="../../src/loader.js"></script>
|
||||
<script>
|
||||
setupModuleLoader(window);
|
||||
</script>
|
||||
<script src="personalLog.js"></script>
|
||||
<script src="../../src/angular-bootstrap.js"></script>
|
||||
<script src="../../src/ngCookies/cookies.js"></script>
|
||||
</head>
|
||||
|
||||
|
||||
<body ng-controller="LogCtrl">
|
||||
|
||||
<form action="" ng-submit="addLog(newMsg)">
|
||||
<input type="text" ng-model="newMsg">
|
||||
<input type="submit" value="add">
|
||||
<input type="button" value="remove all" ng-click="rmLogs()">
|
||||
</form>
|
||||
|
||||
<hr/>
|
||||
<h2>Logs:</h2>
|
||||
<ul>
|
||||
<li ng-repeat="log in logs | orderBy:'-at'">
|
||||
{{log.at | date:'yy-MM-dd HH:mm'}} {{log.msg}}
|
||||
[<a href="" ng-click="rmLog(log)">x</a>]
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* @fileOverview Very simple personal log demo application to demonstrate angular functionality,
|
||||
* especially:
|
||||
* - the MVC model
|
||||
* - testability of controllers
|
||||
* - dependency injection for controllers via $inject and constructor function
|
||||
* - $cookieStore for persistent cookie-backed storage
|
||||
* - simple templating constructs such as ng-repeat and {{}}
|
||||
* - date filter
|
||||
* - and binding onSubmit and onClick events to angular expressions
|
||||
* @author Igor Minar
|
||||
*/
|
||||
|
||||
//name space isolating closure
|
||||
(function() {
|
||||
|
||||
var app = angular.module('personalLog', ['ngCookies']);
|
||||
|
||||
var LOGS = 'logs';
|
||||
|
||||
/**
|
||||
* The controller for the personal log app.
|
||||
*/
|
||||
app.controller('LogCtrl', ['$cookieStore', '$scope', function LogCtrl($cookieStore, $scope) {
|
||||
|
||||
var logs = $scope.logs = $cookieStore.get(LOGS) || []; //main model
|
||||
|
||||
|
||||
/**
|
||||
* Adds newMsg to the logs array as a log, persists it and clears newMsg.
|
||||
* @param {string} msg Message to add (message is passed as parameter to make testing easier).
|
||||
*/
|
||||
$scope.addLog = function(msg) {
|
||||
var newMsg = msg || $scope.newMsg;
|
||||
if (!newMsg) return;
|
||||
var log = {
|
||||
at: new Date().getTime(),
|
||||
msg: newMsg
|
||||
};
|
||||
|
||||
logs.push(log);
|
||||
$cookieStore.put(LOGS, logs);
|
||||
$scope.newMsg = '';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Persistently removes a log from logs.
|
||||
* @param {object} log The log to remove.
|
||||
*/
|
||||
$scope.rmLog = function(log) {
|
||||
for ( var i = 0; i < logs.length; i++) {
|
||||
if (log === logs[i]) {
|
||||
logs.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$cookieStore.put(LOGS, logs);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Persistently removes all logs.
|
||||
*/
|
||||
$scope.rmLogs = function() {
|
||||
logs.splice(0, logs.length);
|
||||
$cookieStore.remove(LOGS);
|
||||
};
|
||||
}]);
|
||||
|
||||
})();
|
||||
@@ -1,98 +0,0 @@
|
||||
describe('personal log', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
browser().navigateTo('../personalLog.html');
|
||||
});
|
||||
|
||||
|
||||
afterEach(function() {
|
||||
clearCookies();
|
||||
});
|
||||
|
||||
|
||||
it('should create new logs and order them in reverse chronological order', function() {
|
||||
//create first msg
|
||||
input('newMsg').enter('my first message');
|
||||
element('form input[type="submit"]').click();
|
||||
|
||||
expect(repeater('ul li').count()).toEqual(1);
|
||||
expect(repeater('ul li').column('log.msg')).toEqual(['my first message']);
|
||||
|
||||
//create second msg
|
||||
input('newMsg').enter('my second message');
|
||||
element('form input[type="submit"]').click();
|
||||
|
||||
expect(repeater('ul li').count()).toEqual(2);
|
||||
expect(repeater('ul li').column('log.msg')).toEqual(['my second message', 'my first message']);
|
||||
});
|
||||
|
||||
|
||||
it('should delete a log when user clicks on the related X link', function() {
|
||||
//create first msg
|
||||
input('newMsg').enter('my first message');
|
||||
element('form input[type="submit"]').click();
|
||||
//create second msg
|
||||
input('newMsg').enter('my second message');
|
||||
element('form input[type="submit"]').click();
|
||||
expect(repeater('ul li').count()).toEqual(2);
|
||||
|
||||
element('ul li a:eq(1)').click();
|
||||
expect(repeater('ul li').count()).toEqual(1);
|
||||
expect(repeater('ul li').column('log.msg')).toEqual(['my second message']);
|
||||
|
||||
element('ul li a:eq(0)').click();
|
||||
expect(repeater('ul li').count()).toEqual(0);
|
||||
});
|
||||
|
||||
|
||||
it('should delete all cookies when user clicks on "remove all" button', function() {
|
||||
//create first msg
|
||||
input('newMsg').enter('my first message');
|
||||
element('form input[type="submit"]').click();
|
||||
//create second msg
|
||||
input('newMsg').enter('my second message');
|
||||
element('form input[type="submit"]').click();
|
||||
expect(repeater('ul li').count()).toEqual(2);
|
||||
|
||||
element('input[value="remove all"]').click();
|
||||
expect(repeater('ul li').count()).toEqual(0);
|
||||
});
|
||||
|
||||
|
||||
it('should preserve logs over page reloads', function() {
|
||||
input('newMsg').enter('my persistent message');
|
||||
element('form input[type="submit"]').click();
|
||||
expect(repeater('ul li').count()).toEqual(1);
|
||||
|
||||
browser().reload();
|
||||
|
||||
expect(repeater('ul li').column('log.msg')).toEqual(['my persistent message']);
|
||||
expect(repeater('ul li').count()).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* DSL for deleting all cookies.
|
||||
*/
|
||||
angular.scenario.dsl('clearCookies', function() {
|
||||
/**
|
||||
* Deletes cookies by interacting with the cookie service within the application under test.
|
||||
*/
|
||||
return function() {
|
||||
this.addFutureAction('clear all cookies', function($window, $document, done) {
|
||||
var element = $window.angular.element($document[0]),
|
||||
rootScope = element.scope(),
|
||||
$cookies = element.data('$injector')('$cookies'),
|
||||
cookieName;
|
||||
|
||||
rootScope.$apply(function() {
|
||||
for (cookieName in $cookies) {
|
||||
delete $cookies[cookieName];
|
||||
}
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
<!doctype html">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Personal Log Scenario Runner</title>
|
||||
<meta http-equiv="expires" content="0">
|
||||
<script type="text/javascript" src="../../../src/scenario/angular-bootstrap.js" ng:autotest></script>
|
||||
<script type="text/javascript" src="personalLogScenario.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,120 +0,0 @@
|
||||
describe('example.personalLog.LogCtrl', function() {
|
||||
var logScope;
|
||||
|
||||
|
||||
beforeEach(module('personalLog'));
|
||||
|
||||
beforeEach(inject(function($rootScope, $controller) {
|
||||
logScope = $rootScope.$new();
|
||||
$controller('LogCtrl', {$scope: logScope});
|
||||
}));
|
||||
|
||||
|
||||
it('should initialize notes with an empty array', function() {
|
||||
expect(logScope.logs).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
describe('addLog', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
expect(logScope.logs).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
it('should add newMsg to logs as a log entry', function() {
|
||||
logScope.newMsg = 'first log message';
|
||||
logScope.addLog();
|
||||
|
||||
expect(logScope.logs.length).toBe(1);
|
||||
expect(logScope.logs[0].msg).toBe('first log message');
|
||||
|
||||
//one more msg, this time passed in as param
|
||||
logScope.addLog('second log message');
|
||||
|
||||
expect(logScope.logs.length).toBe(2);
|
||||
expect(logScope.logs[0].msg).toBe('first log message');
|
||||
expect(logScope.logs[1].msg).toBe('second log message');
|
||||
});
|
||||
|
||||
|
||||
it('should clear newMsg when log entry is persisted', function() {
|
||||
logScope.addLog('first log message');
|
||||
expect(logScope.newMsg).toBe('');
|
||||
});
|
||||
|
||||
|
||||
it('should store logs in the logs cookie', inject(function($cookies) {
|
||||
expect($cookies.logs).not.toBeDefined();
|
||||
logScope.addLog('first log message');
|
||||
expect($cookies.logs).toBeTruthy();
|
||||
}));
|
||||
|
||||
|
||||
it('should do nothing if newMsg is empty', function() {
|
||||
logScope.addLog('');
|
||||
expect(logScope.logs.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('rmLog', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
logScope.addLog('message1');
|
||||
logScope.addLog('message2');
|
||||
logScope.addLog('message3');
|
||||
logScope.addLog('message4');
|
||||
expect(logScope.logs.length).toBe(4);
|
||||
});
|
||||
|
||||
|
||||
it('should delete a message identified by index', function() {
|
||||
logScope.rmLog(logScope.logs[1]);
|
||||
expect(logScope.logs.length).toBe(3);
|
||||
|
||||
logScope.rmLog(logScope.logs[2]);
|
||||
expect(logScope.logs.length).toBe(2);
|
||||
expect(logScope.logs[0].msg).toBe('message1');
|
||||
expect(logScope.logs[1].msg).toBe('message3');
|
||||
});
|
||||
|
||||
|
||||
it('should update cookies when a log is deleted', inject(function($cookies) {
|
||||
expect($cookies.logs).toMatch(/\[\{.*?\}(,\{.*?\}){3}\]/);
|
||||
|
||||
logScope.rmLog(logScope.logs[1]);
|
||||
expect($cookies.logs).toMatch(/\[\{.*?\}(,\{.*?\}){2}\]/);
|
||||
|
||||
logScope.rmLog(logScope.logs[0]);
|
||||
logScope.rmLog(logScope.logs[0]);
|
||||
logScope.rmLog(logScope.logs[0]);
|
||||
expect($cookies.logs).toMatch(/\[\]/);
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
describe('rmLogs', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
logScope.addLog('message1');
|
||||
logScope.addLog('message2');
|
||||
logScope.addLog('message3');
|
||||
logScope.addLog('message4');
|
||||
expect(logScope.logs.length).toBe(4);
|
||||
});
|
||||
|
||||
|
||||
it('should remove all logs', function() {
|
||||
logScope.rmLogs();
|
||||
expect(logScope.logs).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
it('should remove logs cookie', inject(function($cookies) {
|
||||
expect($cookies.logs).toBeTruthy();
|
||||
logScope.rmLogs();
|
||||
expect($cookies.logs).not.toBeDefined();
|
||||
}));
|
||||
});
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
<!doctype html>
|
||||
<html ng-app="example">
|
||||
<head>
|
||||
<title>angular dev sandbox</title>
|
||||
<script src="../src/loader.js"></script>
|
||||
<script>
|
||||
setupModuleLoader(window);
|
||||
angular.module('example', [], function($routeProvider) {
|
||||
$routeProvider.when('/view1', {controller: MyCtrl, templateUrl: 'view1.html'});
|
||||
$routeProvider.when('/view2', {controller: MyCtrl, templateUrl: 'view2.html'});
|
||||
|
||||
function MyCtrl($location, $scope) {
|
||||
$scope.url = function() {
|
||||
return $location.url();
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<script src="../src/angular-bootstrap.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<a href="#/view1">view1</a> | <a href="#/view2">view2</a> | <a href="#">blank</a>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<div ng-view></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,98 +0,0 @@
|
||||
.loading {display: none;}
|
||||
.fetching .loading {display: block;}
|
||||
|
||||
a {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
h1 {
|
||||
background-color: black;
|
||||
margin: 0;
|
||||
padding: .25em;
|
||||
color: white;
|
||||
border-bottom: 5px solid gray;
|
||||
}
|
||||
|
||||
.box {
|
||||
border: 2px solid gray;
|
||||
}
|
||||
|
||||
.tweeter {
|
||||
margin-right: 360px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: .25em;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
li img {
|
||||
float: left;
|
||||
margin: 2px;
|
||||
margin-right: .5em;
|
||||
max-height: 48px;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
li.even {
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
|
||||
.addressbook {
|
||||
float: right;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.addressbook li {
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
.clrleft {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
.notes {
|
||||
font-size: .8em;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.username, .nickname {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.editor {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
label {
|
||||
color: gray;
|
||||
display: inline-block;
|
||||
width: 75px;
|
||||
text-align: right;
|
||||
padding: 2px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.editor input[type=text],
|
||||
.editor textarea {
|
||||
width: 230px;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
.editor TEXTAREA {
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.debug{
|
||||
font-size: .7em;
|
||||
white-space: pre;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<link rel="stylesheet" type="text/css" href="../../css/angular.css">
|
||||
<script type="text/javascript" src="../../lib/underscore/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../lib/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../../src/angular-bootstrap.js"></script>
|
||||
<script type="text/javascript" src="tweeterclient.js"></script>
|
||||
</head>
|
||||
<body ng:class="status" ng:init="mute={}" ng:watch="$anchor.user: tweets = fetchTweets($anchor.user)">
|
||||
<div class="addressbook box">
|
||||
<h1>Address Book</h1>
|
||||
[ Filter: <input type="text" ng:model="userFilter"/>]
|
||||
<ul>
|
||||
<li ng:repeat="user in users.$filter(userFilter).$orderBy('screen_name')" ng:class-even="'even'" ng:class-odd="'odd'">
|
||||
<a href="" ng:click="$anchor.user=user.screen_name"><img src="{{user.profile_image_url}}"/></a>
|
||||
<a href="" ng:click="$anchor.user=user.screen_name">{{user.screen_name}}</a>
|
||||
as <span class="nickname">{{user.name}}</span>
|
||||
[ <a href="#" ng:click="$anchor.edituser=user.screen_name">edit</a>
|
||||
| <a href="#" ng:click="users.$remove(user)">X</a>
|
||||
| <a href="#" ng:click="mute[user.screen_name] = ! mute[user.screen_name]">mute</a>
|
||||
]
|
||||
<div class="notes">{{user.notes|linky}}</div>
|
||||
<div class="clrleft"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
<div ng:show="$anchor.edituser" ng:eval="user = users.$find({:$.screen_name == $anchor.edituser})">
|
||||
<div class="editor">
|
||||
<label>Username:</label>
|
||||
<input type="text" ng:model="user.screen_name" disabled="disabled"/>
|
||||
<label>Name:</label>
|
||||
<input type="text" ng:model="user.name"/>
|
||||
<label>Image:</label>
|
||||
<input type="text" ng:model="user.profile_image_url"/>
|
||||
<label>Notes:</label>
|
||||
<textarea type="text" ng:model="user.notes"></textarea>
|
||||
|
||||
<input type="button" ng:click="$anchor.edituser=undefined" value="Close"/>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="debug">
|
||||
mute={{mute|json}}
|
||||
|
||||
userFilter={{userFilter|json}}
|
||||
|
||||
tweetFilter={{tweetFilter|json}}
|
||||
|
||||
$anchor={{$anchor}}
|
||||
|
||||
users={{users}}
|
||||
|
||||
tweets={{tweets}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tweeter box">
|
||||
<h1>Tweets: {{$anchor.user}}</h1>
|
||||
[ Filter: <input type="text" ng:model="tweetFilter"/>
|
||||
<span ng:show="$anchor.user">| <a href="#user="><< All</a></span>
|
||||
]
|
||||
<div class="loading">Loading...</div>
|
||||
<ul>
|
||||
<li ng:repeat="tweet in tweets.$filter(tweetFilter).$filter({:!mute[$.user.screen_name]})"
|
||||
ng:class-even="'even'" ng:class-odd="'odd'"
|
||||
ng:eval="user = users.$find({: $.screen_name == tweet.user.screen_name}) || tweet.user">
|
||||
<img src="{{user.profile_image_url}}"/>
|
||||
[ <a href="" ng:click="$anchor.user=user.screen_name">{{user.nickname || user.name || user.screen_name }}</a>
|
||||
| <a href="" ng:click="users.$includeIf(user, true)">+</a>
|
||||
]:
|
||||
{{tweet.text | linky}}
|
||||
<span class="notes">{{tweet.created_at}}</span>
|
||||
<span class="notes">{{user.notes}}</span>
|
||||
<div class="clrleft"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<link rel="stylesheet" type="text/css" href="../../css/angular.css">
|
||||
<script type="text/javascript" src="../../lib/underscore/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../lib/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../../src/angular-bootstrap.js"></script>
|
||||
<script type="text/javascript" src="tweeterclient.js"></script>
|
||||
</head>
|
||||
<body ng:class="status" Xng:init="tweets = fetchTweets()">
|
||||
(TODO: I should fetch current tweets)
|
||||
<div class="tweeter box">
|
||||
<h1>Tweets: {{$anchor.user}}</h1>
|
||||
[ Filter: <input type="text" ng:model="tweetFilter"/> (TODO: this should act as search box)
|
||||
<span ng:show="$anchor.user">| <a href="#user="><< All</a></span>
|
||||
]
|
||||
<div class="loading">Loading...</div>
|
||||
<ul>
|
||||
<li Xng:repeat="tweet in tweets"
|
||||
ng:class-even="'even'" ng:class-odd="'odd'">
|
||||
<img src="{{tweet.user.profile_image_url}}"/>
|
||||
[ <a href="" Xng:click="$anchor.user=tweet.user.screen_name">{{tweet.user.nickname || tweet.user.name || tweet.user.screen_name }}</a>
|
||||
]:
|
||||
{{tweet.text}} (TODO: I want urls as links)
|
||||
<span class="notes">{{tweet.created_at}}</span>
|
||||
<span class="notes">{{tweet.user.notes}}</span>
|
||||
<div class="clrleft"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<pre>tweets=(TODO: display me!!!)</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,36 +0,0 @@
|
||||
function noop() {}
|
||||
$(document).ready(function() {
|
||||
function xhr(method, url, data, callback){
|
||||
jQuery.getJSON(url, function() {
|
||||
callback.apply(this, arguments);
|
||||
scope.updateView();
|
||||
});
|
||||
}
|
||||
|
||||
var resourceFactory = new ResourceFactory(xhr);
|
||||
|
||||
var Tweeter = resourceFactory.route("http://twitter.com/statuses/:service:username.json", {}, {
|
||||
home: {method:'GET', params: {service:'home_timeline'}, isArray:true },
|
||||
user: {method:'GET', params: {service:'user_timeline/'}, isArray:true }
|
||||
});
|
||||
|
||||
|
||||
var scope = window.scope = angular.compile(document, {
|
||||
location:angular.startUrlWatcher()
|
||||
});
|
||||
|
||||
function fetchTweets(username){
|
||||
return username ? Tweeter.user({username: username}) : Tweeter.home();
|
||||
}
|
||||
|
||||
scope.set('fetchTweets', fetchTweets);
|
||||
scope.set('users', [
|
||||
{screen_name:'mhevery', name:'Mi\u0161ko Hevery',
|
||||
notes:'Author of <angular/> http://www.getangular.com.',
|
||||
profile_image_url:'http://a3.twimg.com/profile_images/54360179/Me_-_Small_Banner_normal.jpg'},
|
||||
{screen_name:'abrons', name:'Adam Abrons',
|
||||
notes:'Author of <angular/> & Ruby guru see: http://www.angularjs.org.',
|
||||
profile_image_url:'http://media.linkedin.com/mpr/mpr/shrink_80_80/p/2/000/005/0a8/044278d.jpg'}
|
||||
]);
|
||||
scope.init();
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
view1<br>
|
||||
location: {{url()}}
|
||||
@@ -1,2 +0,0 @@
|
||||
view2<br/>
|
||||
location: {{url()}}<br/>
|
||||
Reference in New Issue
Block a user