Skip to content

Commit 515e369

Browse files
committed
vojto je uplne super
0 parents  commit 515e369

11 files changed

+349
-0
lines changed

.meteor/.finished-upgraders

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file contains information which helps Meteor properly upgrade your
2+
# app when you run 'meteor update'. You should check it into version control
3+
# with your project.
4+
5+
notices-for-0.9.0
6+
notices-for-0.9.1
7+
0.9.4-platform-file
8+
notices-for-facebook-graph-api-2
9+
1.2.0-standard-minifiers-package
10+
1.2.0-meteor-platform-split
11+
1.2.0-cordova-changes
12+
1.2.0-breaking-changes

.meteor/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
local

.meteor/.id

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file contains a token that is unique to your project.
2+
# Check it into your repository along with the rest of this directory.
3+
# It can be used for purposes such as:
4+
# - ensuring you don't accidentally deploy one app on top of another
5+
# - providing package authors with aggregated statistics
6+
7+
14wcwqyf8mrpc1uhfok2

.meteor/packages

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Meteor packages used by this project, one per line.
2+
# Check this file (and the other files in this directory) into your repository.
3+
#
4+
# 'meteor add' and 'meteor remove' will edit this file for you,
5+
# but you can also edit it by hand.
6+
7+
meteor-base # Packages every Meteor app needs to have
8+
mobile-experience # Packages for a great mobile UX
9+
mongo # The database Meteor supports right now
10+
session # Client-side reactive dictionary for your app
11+
jquery # Helpful client-side library
12+
tracker # Meteor's client-side reactive programming library
13+
14+
standard-minifiers # JS/CSS minifiers run for production mode
15+
es5-shim # ECMAScript 5 compatibility for older browsers.
16+
17+
angular
18+
accounts-password
19+
dotansimha:accounts-ui-angular
20+
accounts-facebook
21+
angular:angular-material

.meteor/platforms

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
android
2+
browser
3+
server

.meteor/release

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
METEOR@1.2.1

.meteor/versions

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
accounts-base@1.2.2
2+
accounts-facebook@1.0.6
3+
accounts-oauth@1.1.8
4+
accounts-password@1.1.4
5+
accounts-ui@1.1.6
6+
accounts-ui-unstyled@1.1.8
7+
angular@1.3.5
8+
angular-meteor-data@0.1.0
9+
angular-templates@0.0.3
10+
angular:angular@1.4.8
11+
angular:angular-animate@1.4.8
12+
angular:angular-aria@1.4.8
13+
angular:angular-material@1.0.3
14+
autoupdate@1.2.4
15+
babel-compiler@5.8.24_1
16+
babel-runtime@0.1.4
17+
base64@1.0.4
18+
benjamine:jsondiffpatch@0.1.38_1
19+
binary-heap@1.0.4
20+
blaze@2.1.3
21+
blaze-html-templates@1.0.1
22+
blaze-tools@1.0.4
23+
boilerplate-generator@1.0.4
24+
caching-compiler@1.0.0
25+
caching-html-compiler@1.0.2
26+
callback-hook@1.0.4
27+
check@1.1.0
28+
dburles:mongo-collection-instances@0.3.4
29+
ddp@1.2.2
30+
ddp-client@1.2.1
31+
ddp-common@1.2.2
32+
ddp-rate-limiter@1.0.0
33+
ddp-server@1.2.2
34+
deps@1.0.9
35+
diff-sequence@1.0.1
36+
dotansimha:accounts-ui-angular@0.0.2
37+
ecmascript@0.1.6
38+
ecmascript-runtime@0.2.6
39+
ejson@1.0.7
40+
email@1.0.8
41+
es5-shim@4.1.14
42+
facebook@1.2.2
43+
fastclick@1.0.7
44+
geojson-utils@1.0.4
45+
hot-code-push@1.0.0
46+
html-tools@1.0.5
47+
htmljs@1.0.5
48+
http@1.1.1
49+
id-map@1.0.4
50+
jquery@1.11.4
51+
lai:collection-extensions@0.1.4
52+
launch-screen@1.0.4
53+
less@2.5.1
54+
livedata@1.0.15
55+
localstorage@1.0.5
56+
logging@1.0.8
57+
meteor@1.1.10
58+
meteor-base@1.0.1
59+
minifiers@1.1.7
60+
minimongo@1.0.10
61+
mobile-experience@1.0.1
62+
mobile-status-bar@1.0.6
63+
mongo@1.1.3
64+
mongo-id@1.0.1
65+
npm-bcrypt@0.7.8_2
66+
npm-mongo@1.4.39_1
67+
oauth@1.1.6
68+
oauth2@1.1.5
69+
observe-sequence@1.0.7
70+
ordered-dict@1.0.4
71+
pbastowski:angular-babel@1.0.9
72+
promise@0.5.1
73+
random@1.0.5
74+
rate-limit@1.0.0
75+
reactive-dict@1.1.3
76+
reactive-var@1.0.6
77+
reload@1.1.4
78+
retry@1.0.4
79+
routepolicy@1.0.6
80+
service-configuration@1.0.5
81+
session@1.1.1
82+
sha@1.0.4
83+
spacebars@1.0.7
84+
spacebars-compiler@1.0.7
85+
srp@1.0.4
86+
standard-minifiers@1.0.2
87+
templating@1.1.5
88+
templating-tools@1.0.0
89+
tracker@1.0.9
90+
ui@1.0.8
91+
underscore@1.0.4
92+
url@1.0.5
93+
webapp@1.2.3
94+
webapp-hashing@1.0.5

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
# Dev notes
3+
4+
meteor remove insecure
5+
meteor remove autopublish
6+
meteor remove blaze-html-templates
7+
meteor remove ecmascript
8+
9+
meteor remove twbs:bootstrap
10+
meteor add angular
11+
meteor add angularui:angular-ui-router
12+
meteor add angular:angular-material

simple-todos-angular.css

Whitespace-only changes.

simple-todos-angular.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<head>
2+
<title>Todo List</title>
3+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
4+
</head>
5+
6+
<body ng-controller="TodosListCtrl" layout="column">
7+
<md-toolbar>
8+
<div class="md-toolbar-tools">
9+
<h3>
10+
<span>Todo List ({{incompleteCount()}})</span>
11+
</h3>
12+
<span flex></span>
13+
<md-checkbox ng-model="hideCompleted" aria-label="Checkbox 1">
14+
Hide Completed Tasks
15+
</md-checkbox>
16+
<login-buttons></login-buttons>
17+
</div>
18+
</md-toolbar>
19+
<md-content>
20+
<form class="new-task"
21+
ng-submit="addTask(newTask); newTask='';"
22+
ng-show="$root.currentUser">
23+
<md-input-container class="md-block">
24+
<label>Task</label>
25+
<input ng-model="newTask" placeholder="Type to add new tasks" >
26+
</md-input-container>
27+
</form>
28+
29+
<md-list>
30+
<md-list-item ng-repeat="task in tasks">
31+
<md-checkbox ng-checked="task.checked" ng-click="setChecked(task)"></md-checkbox>
32+
<p>{{task.text}}</p>
33+
<md-switch
34+
ng-if="task.owner === $root.currentUser._id"
35+
ng-model="task.private"
36+
ng-click="setPrivate(task)"></md-switch>
37+
</md-list-item>
38+
</md-list>
39+
<!--<button class="delete" ng-click="deleteTask(task)">&times;</button>-->
40+
<form class="new-task"
41+
ng-submit="addMessage(newMessage); newMessage='';"
42+
ng-show="$root.currentUser">
43+
<input ng-model="newMessage" type="text"
44+
name="text" placeholder="Message ..." />
45+
</form>
46+
<table>
47+
<tr ng-repeat="msg in messages">
48+
<td>{{msg.username}}</td>
49+
<td>{{msg.body}}</td>
50+
</tr>
51+
</table>
52+
53+
</md-content>
54+
</body>

simple-todos-angular.js

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
Tasks = new Mongo.Collection('tasks');
2+
Messages = new Mongo.Collection('messages');
3+
4+
if (Meteor.isClient) {
5+
6+
Accounts.ui.config({
7+
passwordSignupFields: "USERNAME_ONLY"
8+
});
9+
10+
// This code only runs on the client
11+
var module = angular.module('simple-todos',['angular-meteor', 'accounts.ui', 'ngMaterial']);
12+
13+
function onReady() {
14+
angular.bootstrap(document, ['simple-todos']);
15+
}
16+
17+
if (Meteor.isCordova)
18+
angular.element(document).on('deviceready', onReady);
19+
else
20+
angular.element(document).ready(onReady);
21+
22+
module.controller('TodosListCtrl', function ($scope, $meteor) {
23+
$scope.$meteorSubscribe('tasks');
24+
$scope.$meteorSubscribe('messages');
25+
26+
$scope.helpers({
27+
tasks: () => {
28+
return Tasks.find($scope.getReactively('query'), {sort: {createdAt: -1}})
29+
},
30+
//incompleteCount: () => {
31+
// Tasks.find({ checked: {$ne: true} }).count()
32+
//}
33+
});
34+
35+
36+
$scope.incompleteCount = function () {
37+
return Tasks.find({ checked: {$ne: true} }).count();
38+
};
39+
40+
$scope.messages = $meteor.collection( function() {
41+
return Messages.find({}, {sort: {createdAt: -1}})
42+
});
43+
44+
$scope.addTask = function (newTask) {
45+
$meteor.call('addTask', newTask);
46+
};
47+
48+
$scope.addMessage = function (body) {
49+
$meteor.call('addMessage', body);
50+
};
51+
52+
$scope.deleteTask = function (task) {
53+
$meteor.call('deleteTask', task._id);
54+
};
55+
56+
$scope.setChecked = function (task) {
57+
$meteor.call('setChecked', task._id, !task.checked);
58+
};
59+
60+
$scope.setPrivate = function (task) {
61+
$meteor.call('setPrivate', task._id, !task.private);
62+
};
63+
64+
$scope.$watch('hideCompleted', function() {
65+
if ($scope.hideCompleted)
66+
$scope.query = {checked: {$ne: true}};
67+
else
68+
$scope.query = {};
69+
});
70+
71+
});
72+
}
73+
74+
Meteor.methods({
75+
addTask: function (text) {
76+
// Make sure the user is logged in before inserting a task
77+
if (! Meteor.userId()) {
78+
throw new Meteor.Error('not-authorized');
79+
}
80+
81+
Tasks.insert({
82+
text: text,
83+
createdAt: new Date(),
84+
owner: Meteor.userId(),
85+
username: Meteor.user().username
86+
});
87+
},
88+
addMessage: function (text) {
89+
// Make sure the user is logged in before inserting a task
90+
if (! Meteor.userId()) {
91+
throw new Meteor.Error('not-authorized');
92+
}
93+
94+
Messages.insert({
95+
body: text,
96+
createdAt: new Date(),
97+
owner: Meteor.userId(),
98+
username: Meteor.user().username
99+
});
100+
},
101+
deleteTask: function (taskId) {
102+
var task = Tasks.findOne(taskId);
103+
if (task.private && task.owner !== Meteor.userId()) {
104+
// If the task is private, make sure only the owner can delete it
105+
throw new Meteor.Error('not-authorized');
106+
}
107+
108+
Tasks.remove(taskId);
109+
},
110+
setChecked: function (taskId, setChecked) {
111+
var task = Tasks.findOne(taskId);
112+
if (task.private && task.owner !== Meteor.userId()) {
113+
// If the task is private, make sure only the owner can check it off
114+
throw new Meteor.Error('not-authorized');
115+
}
116+
117+
Tasks.update(taskId, { $set: { checked: setChecked} });
118+
},
119+
setPrivate: function (taskId, setToPrivate) {
120+
var task = Tasks.findOne(taskId);
121+
122+
// Make sure only the task owner can make a task private
123+
if (task.owner !== Meteor.userId()) {
124+
throw new Meteor.Error('not-authorized');
125+
}
126+
127+
Tasks.update(taskId, { $set: { private: setToPrivate } });
128+
}
129+
});
130+
131+
if (Meteor.isServer) {
132+
Meteor.publish('tasks', function () {
133+
return Tasks.find({
134+
$or: [
135+
{ private: {$ne: true} },
136+
{ owner: this.userId }
137+
]
138+
});
139+
});
140+
141+
Meteor.publish('messages', function () {
142+
return Messages.find({});
143+
});
144+
}

0 commit comments

Comments
 (0)