Skip to content

Commit 7f61e3e

Browse files
Update to default avatar
1 parent a09d3e3 commit 7f61e3e

File tree

6 files changed

+54
-46
lines changed

6 files changed

+54
-46
lines changed

SMS-Back-End/apigms/apigms_api.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from flask import Flask, jsonify, request, Response
3+
from flask import Flask, jsonify, request, Response, make_response
44
import json
55
from google.appengine.api import modules
66
import urllib2
@@ -66,15 +66,22 @@ def get_entities(kind, entity_id=None):
6666
req = urllib2.Request(url)
6767
f = urllib2.urlopen(req)
6868
response = f.read()
69+
70+
print type(response)
71+
response = json.dumps(response)
72+
print type(response)
73+
6974
f.close()
7075

71-
result = {
72-
'list': response,
73-
'total': len(response)
74-
}
76+
"""
77+
res = Response(json.dumps(response), mimetype='application/json')
78+
79+
rews = make_response(res)
7580
81+
rews.headers['Access-Control-Allow-Origin'] = "*"
82+
"""
7683

77-
return jsonify(result)
84+
return response
7885

7986
#return Response(json.dumps(list), mimetype='application/json')
8087
#return jsonify(r)

SMS-Front-End/app/css/style.css

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,13 @@ md-whiteframe {
1818
margin: 4px 16px;
1919
vertical-align: middle;
2020
width: 180px;
21-
}
21+
}
22+
23+
.img-profile {
24+
border-radius: 30px;
25+
border: 1px solid #ddd;
26+
display: inline-block;
27+
margin: 4px 16px;
28+
vertical-align: middle;
29+
width: 48px;
30+
}

SMS-Front-End/app/js/teaching/teachers/teachers.service.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
angular.module('teachers')
2-
.factory("Post",
2+
.factory("TeachersService",
33
function($resource) {
44

5-
return $resource('http://localhost:8002/entities/teacher/'+ ':id', {
5+
return $resource('http://localhost:8001/entities/teacher/'+ ':id', {
66
id: '@_id'
77
});
88

@@ -14,6 +14,17 @@ angular.module('teachers')
1414
'remove': {method:'DELETE'},
1515
'delete': {method:'DELETE'} };
1616
17+
Examples of use:
18+
var teacherList = Post.query({}, function(){
19+
console.log(teacherList)
20+
})
21+
22+
var singleTeacher = Post.get({id: 2}, function(){
23+
console.log(singleTeacher)
24+
})
25+
26+
27+
1728
*/
1829

1930
});

SMS-Front-End/app/js/teaching/teachers/teachersList.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11

22

33
angular.module('teachers')
4-
.controller('teachersListController',function($scope, Post){
4+
.controller('teachersListController',function($scope, TeachersService){
55

66
var vm = this;
77
vm.text='hi';
88

9+
vm.defaultAvatar = 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcThQiJ2fHMyU37Z0NCgLVwgv46BHfuTApr973sY7mao_C8Hx_CDPrq02g'
10+
911
activate();
1012

1113
///////////////////////////////////////////////////////////
1214
function activate() {
1315
console.log('Activating teachersListController controller.')
1416

15-
var teacherList = Post.query({}, function(){
16-
console.log(teacherList)
17-
})
18-
19-
var singleTeacher = Post.get({id: 2}, function(){
20-
console.log(singleTeacher)
17+
vm.teachersList = TeachersService.query({}, function(){
18+
console.log(vm.teachersList)
2119
})
2220

2321
}

SMS-Front-End/app/js/teaching/teachers/teachersProfile.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
angular.module('teachers')
2-
.controller('teachersProfileController',function($scope){
2+
.controller('teachersProfileController',function($scope, TeachersService){
33

44
var vm = this;
55
vm.text='hi';
66

77
vm.defaultAvatar = 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcThQiJ2fHMyU37Z0NCgLVwgv46BHfuTApr973sY7mao_C8Hx_CDPrq02g'
88

9+
10+
vm.teacher = TeachersService.get({id: 2}, function(){
11+
console.log(vm.teacher)
12+
})
13+
14+
15+
/*
916
vm.teacher = {
1017
"name": "El nombre",
1118
"surname": "Los apellidos",
@@ -22,7 +29,7 @@ angular.module('teachers')
2229
}
2330
]
2431
}
25-
}
32+
}*/
2633

2734
activate();
2835

SMS-Front-End/app/views/teachers/teachersList.html

+4-28
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
<h1 class="md-display-1">Profesores</h1>
77
<p class="md-body-1">Todos los profesores del sistema.</p>
88

9-
<!--this: {{vm.text}}-->
10-
{{ vm.teacherList }}
11-
129

1310
<!-- table wrapper -->
1411
<md-card style="background-color: #FFFFFF;>
@@ -39,11 +36,8 @@ <h1 class="md-display-1">Profesores</h1>
3936
<table md-table md-progress="vm.promise">
4037
<thead md-head md-order="vm.sortField" md-on-reorder="vm.onReorder">
4138
<tr md-row>
39+
<th md-column md-order-by="name"><span>Nombre</span></th>
4240
<th md-column></th>
43-
<th md-column md-order-by="name"><span>{{ _("User") }}</span></th>
44-
<th md-column></th> <!-- space to profile image -->
45-
<th md-column><span>{{ _("Last login") }}</span></th>
46-
<th md-column><span>{{ _("Log count") }}</span></th>
4741
<th md-column></th>
4842
</tr>
4943
</thead>
@@ -52,13 +46,6 @@ <h1 class="md-display-1">Profesores</h1>
5246
<tr md-row ng-repeat="item in vm.teachersList">
5347

5448

55-
<!-- Edit button -->
56-
<td md-cell>
57-
<md-button ng-click="go('/users/'+item._id)" class="md-fab md-mini md-primary">
58-
<md-icon md-font-icon="fa fa-pencil"></md-icon>
59-
</md-button>
60-
</td>
61-
6249
<!-- User identification -->
6350

6451
<td md-cell>
@@ -80,22 +67,11 @@ <h1 class="md-display-1">Profesores</h1>
8067
</div>
8168
</td>
8269

83-
<!-- User last login -->
84-
<td md-cell>
85-
<span>{{ item.last_login_at.substring(0,10) }}</span>
86-
</td>
87-
88-
<!-- User login count -->
89-
<td md-cell>
90-
<span>{{ item.login_count }}</span>
91-
</td>
9270

93-
<!-- User del button -->
71+
<!-- Edit button -->
9472
<td md-cell>
95-
<md-button ng-click="vm.showConfirm(0, item._id)"
96-
class="md-fab md-mini md-danger">
97-
<!--Using http://fontawesome.io/icons/ (fa) and the name of icon selected with "fa-" after-->
98-
<md-icon md-font-icon="fa fa-trash"></md-icon>
73+
<md-button ng-click="go('/users/'+item._id)" class="md-fab md-mini md-primary">
74+
<md-icon>forward</md-icon>
9975
</md-button>
10076
</td>
10177

0 commit comments

Comments
 (0)