git.fiddlerwoaroof.com
Browse code

making before work

fiddlerwoaroof authored on 31/03/2015 22:21:30
Showing 7 changed files
... ...
@@ -4,3 +4,5 @@ Flask-Limiter==0.7.6
4 4
 psycopg2==2.6
5 5
 uWSGI==2.0.9
6 6
 textblob==0.9.0
7
+lxml==3.4.2
8
+python-dateutil==2.4.1
... ...
@@ -7,6 +7,7 @@ from . import database
7 7
 import urlparse
8 8
 import json
9 9
 from marrow_config import config
10
+import dateutil.parser
10 11
 
11 12
 bone_blueprint = Blueprint('bone', __name__)
12 13
 
... ...
@@ -138,6 +139,7 @@ def subscriptions(before):
138 139
         with database.get_db().cursor() as cur:
139 140
             args = (username,50) # only 50 results
140 141
             if before is not None:
142
+                before = dateutil.parser.parse(before)
141 143
                 args = args + (before,)
142 144
             cur.callproc("get_bones", args)
143 145
             result['marrow'] = [
... ...
@@ -86,6 +86,7 @@ img {
86 86
   display: inline-block;
87 87
   vertical-align: middle;
88 88
 }
89
+
89 90
 .sub-ctrl {
90 91
   display: inline-block;
91 92
   vertical-align: middle;
... ...
@@ -104,8 +105,8 @@ ul.subscription-list::after {
104 105
 }
105 106
 
106 107
 li.sub-filter {
107
-  width: 12.5%;
108
-  margin: 5px;
108
+  width: 15.50%;
109
+  margin: 5px 0.58%;
109 110
   padding: 0px;
110 111
   display: block;
111 112
   float: left;
... ...
@@ -117,6 +118,7 @@ li.sub-filter label {
117 118
   text-overflow: ellipsis;
118 119
 
119 120
   border: black solid thin;
121
+  background: #eee;
120 122
   border-radius: 10px;
121 123
   height: 30px;
122 124
   line-height: 30px;
... ...
@@ -132,16 +134,18 @@ li.sub-filter input {
132 134
   display: none;
133 135
 }
134 136
 
137
+li.sub-filter label:hover,
135 138
 li.sub-filter input:checked + label {
136
-  border: thin solid white;
139
+  border: #eee thin solid;
137 140
   color: white;
138
-  background: linear-gradient(to bottom, #eee 0%, #bbb 75%, #888 100%);
141
+}
142
+
143
+li.sub-filter input:checked + label {
144
+  background: linear-gradient(to top, #eee 0%, #bbb 75%, #888 100%);
139 145
 }
140 146
 
141 147
 li.sub-filter label:hover {
142
-  border: thin solid white;
143
-  color: white;
144
-  background: #aaa;
148
+  background: linear-gradient(to bottom, #eee 0%, #bbb 75%, #888 100%);
145 149
 }
146 150
 
147 151
 /* @group State Definitions */
... ...
@@ -240,13 +244,13 @@ main form input[type="text"] {
240 244
   width: 315px;
241 245
 }
242 246
 .bone-list li {
243
-  padding-right: 1em;
247
+  /*padding-right: 1em;*/
244 248
   margin-bottom: 12px;
245 249
   width: 100%;
246 250
 }
247 251
 
248 252
 .bone-list .bone-details {
249
-  width: 80%;
253
+  width: 84%;
250 254
   overflow: hidden;
251 255
   white-space: nowrap;
252 256
   text-overflow: ellipsis;
... ...
@@ -405,6 +409,7 @@ a.user-settings:hover {
405 409
 
406 410
   main {
407 411
     padding-left: .5em;
412
+    padding-right: .5em;
408 413
   }
409 414
 
410 415
   #nav-main {
... ...
@@ -3,6 +3,13 @@
3 3
 <head>
4 4
   <title>Marrow</title>
5 5
   <base href="/" />
6
+  <meta charset="utf-8">
7
+  <meta name="msapplication-TileColor" content="#000000">
8
+  <meta name="msapplication-TileImage" content="/images/icons/mstile-144x144.png">
9
+  <meta name="msapplication-config" content="/images/icons/browserconfig.xml">
10
+  <meta name="theme-color" content="#000000">
11
+  <meta name="viewport" content="width=device-width, initial-scale=1">
12
+
6 13
   <!-- Favicons/App Icons -->
7 14
   <link rel="apple-touch-icon" sizes="57x57" href="/images/icons/apple-touch-icon-57x57.png">
8 15
   <link rel="apple-touch-icon" sizes="60x60" href="/images/icons/apple-touch-icon-60x60.png">
... ...
@@ -19,11 +26,6 @@
19 26
   <link rel="icon" type="image/png" href="/images/icons/favicon-16x16.png" sizes="16x16">
20 27
   <link rel="manifest" href="/images/icons/manifest.json">
21 28
   <link rel="shortcut icon" href="/images/icons/favicon.ico">
22
-  <meta charset="utf-8">
23
-  <meta name="msapplication-TileColor" content="#000000">
24
-  <meta name="msapplication-TileImage" content="/images/icons/mstile-144x144.png">
25
-  <meta name="msapplication-config" content="/images/icons/browserconfig.xml">
26
-  <meta name="theme-color" content="#000000">
27 29
   <!-- JS -->
28 30
   <script src="//crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/md5.js"></script>
29 31
   <script src="/lib/angular.min.js"></script>
... ...
@@ -36,9 +38,9 @@
36 38
   <script src="/js/new/services.js"></script>
37 39
   <script src="/js/new/controller.js"></script>
38 40
   <!-- CSS -->
39
-  <meta name="viewport" content="width=device-width, initial-scale=1">
40 41
   <link rel="stylesheet" href="/lib/formalize.css" media="screen" />
41 42
   <link rel="stylesheet" href="/css/main.css" media="screen" />
43
+
42 44
 </head>
43 45
 <body>
44 46
   <div id="page-container">
... ...
@@ -126,6 +126,14 @@ marrowApp.controller('SubscriptionCtrl', function ($controller,$scope,$http,$loc
126 126
   $scope.friend = Object.create(null);
127 127
   $scope.friend.all = true;
128 128
 
129
+  $scope.backAPage = function() {
130
+    var bone = $scope.bone.marrow;
131
+    var lastitem = bone[bone.length-1].posted;
132
+    console.log(lastitem);
133
+    $scope.bone = BoneService.subscriptions({before: lastitem});
134
+  };
135
+  $scope.bs = BoneService;
136
+
129 137
   $scope.emptyOrEquals = function(actual, expected) {
130 138
     console.log(actual, expected);
131 139
     var result = false;
... ...
@@ -10,12 +10,11 @@ serviceModule.factory('UserBone', ['$resource',
10 10
 
11 11
 serviceModule.factory('BoneService', ['$resource',
12 12
   function boneFactory($resource){
13
-    console.log('hi');
14 13
     return $resource('/api/bones', {}, {
15 14
       add: {'method': 'POST', 'url': '/api/bones/add'},
16 15
       user: {'method': 'GET', 'url': '/api/bones/u/:user', params: {user: '@user'}},
17 16
       random: {'method': 'GET', 'url': '/api/bones/random'},
18
-      subscriptions: {'method': 'GET', 'url': '/api/bones/subscriptions'},
17
+      subscriptions: {'method': 'GET', 'url': '/api/bones/subscriptions/:before', 'paramDefaults': {'before': null}, 'params': {before: '@before'}},
19 18
     });
20 19
 }]);
21 20
 
... ...
@@ -6,9 +6,9 @@
6 6
         <input id="sub-all" type="checkbox" ng-model="friend.all" ng-click="uncheckOthers(friend)"></input>
7 7
         <label for="sub-all">[All]</label>
8 8
       </li>
9
-      <li class="sub-filter" ng-repeat="name in friends.data">
9
+      <li class="sub-filter" ng-repeat="name in friends.data | orderBy:name">
10 10
         <input id="sub-{{$index+1}}" type="checkbox" ng-model="friend[name]" ng-click="friend.all = false"></input>
11
-        <label for="sub-{{$index+1}}" >
11
+        <label for="sub-{{$index+1}}" > <!-- TODO: figger out how to abstract this + combine with the other user badge -->
12 12
           <span class="narrow"><gravatar-image user-name="{{name}}"></gravatar-image></span>
13 13
           <span class="wide">{{name}}</span>
14 14
         </label>
... ...
@@ -25,7 +25,7 @@
25 25
         data-poster="{{marrow.poster}}">
26 26
       <div class="bone-details">
27 27
         <span ng-if="marrow.title">
28
-          <a href="{{marrow.url}}" class="list-item" >{{marrow.title}}</a>
28
+          <a href="{{marrow.url}}" class="list-item">{{marrow.title}}</a>
29 29
           <br />
30 30
         </span>
31 31
         <a href="{{marrow.url}}" ng-class="{'de-emphasize':marrow.title}" >{{marrow.url}}</a>
... ...
@@ -33,4 +33,5 @@
33 33
       <user-badge poster="{{marrow.poster}}"></user-badge>
34 34
     </li>
35 35
   </ul>
36
+  <a ng-click="backAPage()" style="display:block; margin-bottom: 2em" />&lt;&lt; Back</a>
36 37
 </section>