timeline more; spinner; common update;
This commit is contained in:
1 parent
38fac9c033
commit
bed2cfad22
8 files changed
+90
-9
No files matched your search
@@ -168,3 +168,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timeline-end{
|
||||||
|
width: 50%;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
button.more{
|
||||||
|
position: relative;
|
||||||
|
top: -2px;
|
||||||
|
|
||||||
|
width: 100px;
|
||||||
|
height: 40px;
|
||||||
|
border: 2px solid black;
|
||||||
|
padding: 0 10px;
|
||||||
|
background: none;
|
||||||
|
|
||||||
|
font-size: 14pt;
|
||||||
|
|
||||||
|
&:hover{
|
||||||
|
background: gainsboro;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active{
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -25,6 +25,7 @@
|
|||||||
"angular-route": "~1.3.3",
|
"angular-route": "~1.3.3",
|
||||||
"angular-animate": "~1.3.3",
|
"angular-animate": "~1.3.3",
|
||||||
"angular": "~1.3.3",
|
"angular": "~1.3.3",
|
||||||
"angulartics": "~0.17.2"
|
"angulartics": "~0.17.2",
|
||||||
|
"angular-spinner": "~0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-2
@@ -2,12 +2,14 @@
|
|||||||
* Created by tmshv on 22/11/14.
|
* Created by tmshv on 22/11/14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var query = require("../../utils/net").query;
|
||||||
|
|
||||||
function APIFeed(http){
|
function APIFeed(http){
|
||||||
this.request = http;
|
this.request = http;
|
||||||
}
|
}
|
||||||
|
|
||||||
APIFeed.prototype.feed = function() {
|
APIFeed.prototype.feed = function(count, portion) {
|
||||||
return this.request.get("/news");
|
return this.request.get("/news?"+query([["count", count], ["portion", portion]]));
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = APIFeed;
|
module.exports = APIFeed;
|
||||||
+2
-1
@@ -6,7 +6,8 @@ var app = angular.module("hudozhka", [
|
|||||||
"hudozhka.data",
|
"hudozhka.data",
|
||||||
"ngRoute",
|
"ngRoute",
|
||||||
"angulartics",
|
"angulartics",
|
||||||
"angulartics.google.analytics"
|
"angulartics.google.analytics",
|
||||||
|
"angularSpinner"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
app.config(function ($locationProvider, $routeProvider) {
|
app.config(function ($locationProvider, $routeProvider) {
|
||||||
|
|||||||
+29
-4
@@ -38,13 +38,34 @@ module.exports = function(app) {
|
|||||||
return index % 2 === 1;
|
return index % 2 === 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
controller: function($scope, api){
|
controller: function($scope, $timeout, usSpinnerService, api){
|
||||||
|
var portion = 0;
|
||||||
|
var count = 10;
|
||||||
|
$scope.feed = [];
|
||||||
|
|
||||||
|
$scope.timelineUpdating = false;
|
||||||
|
usSpinnerService.stop("timelineMore");
|
||||||
|
//usSpinnerService.spin("timelineMore");
|
||||||
|
|
||||||
$scope.recordClass = function (i) {
|
$scope.recordClass = function (i) {
|
||||||
return i['type'];
|
return i['type'];
|
||||||
};
|
};
|
||||||
|
|
||||||
api.news.feed()
|
$scope.loadNext = function () {
|
||||||
|
$scope.timelineUpdating = true;
|
||||||
|
usSpinnerService.spin("timelineMore");
|
||||||
|
|
||||||
|
api.news.feed(count, portion)
|
||||||
|
.error(function(error) {
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
.success(function (list) {
|
.success(function (list) {
|
||||||
|
$scope.timelineUpdating = false;
|
||||||
|
usSpinnerService.stop("timelineMore");
|
||||||
|
//$timeout(function () {
|
||||||
|
//
|
||||||
|
//}, 5000);
|
||||||
|
|
||||||
var feed = list.map(function (post) {
|
var feed = list.map(function (post) {
|
||||||
if(post.type == "instagram"){
|
if(post.type == "instagram"){
|
||||||
var author_id = personByInstagram(team.team, post.data.author);
|
var author_id = personByInstagram(team.team, post.data.author);
|
||||||
@@ -64,8 +85,13 @@ module.exports = function(app) {
|
|||||||
return post;
|
return post;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.feed = feed;
|
|
||||||
|
portion++;
|
||||||
|
$scope.feed = $scope.feed.concat(feed);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.loadNext();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -81,7 +107,6 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function linkGram(scope, element, attrs) {
|
function linkGram(scope, element, attrs) {
|
||||||
scope.lal = "LAL";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
<script src="/bower_components/angular-animate/angular-animate.min.js"></script>
|
<script src="/bower_components/angular-animate/angular-animate.min.js"></script>
|
||||||
<script src="/bower_components/angulartics/dist/angulartics.min.js"></script>
|
<script src="/bower_components/angulartics/dist/angulartics.min.js"></script>
|
||||||
<script src="/bower_components/angulartics/dist/angulartics-ga.min.js"></script>
|
<script src="/bower_components/angulartics/dist/angulartics-ga.min.js"></script>
|
||||||
|
<script src="/bower_components/spin.js/spin.js"></script>
|
||||||
|
<script src="/bower_components/angular-spinner/angular-spinner.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/bower_components/fotorama/fotorama.css">
|
<link rel="stylesheet" href="/bower_components/fotorama/fotorama.css">
|
||||||
<script src="/bower_components/fotorama/fotorama.js"></script>
|
<script src="/bower_components/fotorama/fotorama.js"></script>
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
<div class="timeline">
|
<div class="timeline">
|
||||||
<timeline-record class="timeline-record {{recordClass(post)}}"
|
<timeline-record class="timeline-record {{recordClass(post)}}"
|
||||||
content="post"
|
content="post"
|
||||||
ng-repeat="post in feed"
|
ng-repeat="post in feed track by $index"
|
||||||
ng-class="{left: isEven($index), right: !isEven($index)}">
|
ng-class="{left: isEven($index), right: !isEven($index)}">
|
||||||
|
|
||||||
</timeline-record>
|
</timeline-record>
|
||||||
|
<div class="timeline-end">
|
||||||
|
<button class="more"
|
||||||
|
ng-click="loadNext()"
|
||||||
|
ng-disabled="timelineUpdating">
|
||||||
|
<span us-spinner="{radius:5, width:4, length: 4}" spinner-key="timelineMore"></span>
|
||||||
|
<span ng-hide="timelineUpdating">Ещё</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Created by tmshv on 08/03/15.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
query: function(list){
|
||||||
|
var params = list.reduce(function (query, param) {
|
||||||
|
var q = param[0] + "=" + param[1];
|
||||||
|
query.push(q);
|
||||||
|
return query;
|
||||||
|
}, [])
|
||||||
|
.join("&");
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in new issue
Block a user