add button to refresh random books

This commit is contained in:
2014-05-13 19:26:57 +08:00
parent 1de163303b
commit 90da9a313c
11 changed files with 36 additions and 19 deletions
+4 -3
View File
@@ -525,7 +525,7 @@
var actionList;
actionList = [];
actionList.push({
text: '随机找几本书看看'
text: '随便看看'
});
actionList.push({
text: "你可能喜欢的书"
@@ -571,7 +571,7 @@
url: this.Constant.baseUrl + ("/recommend/random?user_email=" + email + "&user_token=" + token),
method: 'GET',
timeout: 15000,
cache: true
cache: false
}).success(function(data, status, headers, config) {
return callback(data);
}).error(function(data) {
@@ -990,6 +990,7 @@
this.$location.path('/tab/settings');
return;
}
this.$scope.changeRecommend = this.changeRecommend;
}
showLoading = function($scope, $ionicLoading) {
@@ -1100,7 +1101,7 @@
LocationController.prototype.addLocation = function() {
if (this.$scope.locations.length >= 3) {
return this.IonicUtils.showLoading(this.$scope, '只能创建3个常用的地址,请先删除部分再添加');
} else if (localStorage.getItem('cur_address_detail') === null) {
} else if ((localStorage.getItem('cur_address_detail') === null) || (localStorage.getItem('cur_address_detail') === void 0)) {
return this.IonicUtils.showLoading(this.$scope, '定位成功后方可添加常用地址');
} else if (this.$scope.address === null || this.$scope.address === '') {
return this.IonicUtils.showLoading(this.$scope, '定位成功后方可添加常用地址');
@@ -22,6 +22,7 @@ class HomeController
else
@$location.path '/tab/settings'
return
@$scope.changeRecommend = @changeRecommend
showLoading = ($scope, $ionicLoading)->
$scope.loading = $ionicLoading.show {
@@ -30,7 +30,7 @@ class LocationController
addLocation: () =>
if @$scope.locations.length >= 3
@IonicUtils.showLoading(@$scope, '只能创建3个常用的地址,请先删除部分再添加')
else if localStorage.getItem('cur_address_detail') is null
else if (localStorage.getItem('cur_address_detail') is null) || (localStorage.getItem('cur_address_detail') is undefined)
@IonicUtils.showLoading(@$scope, '定位成功后方可添加常用地址')
else if (@$scope.address is null or @$scope.address is '')
@IonicUtils.showLoading(@$scope, '定位成功后方可添加常用地址')
@@ -7,7 +7,7 @@ class RecommendService
getActionSheetList: ()->
actionList = []
actionList.push {text: '机找几本书看看'}
actionList.push {text: '便看看'}
actionList.push {text: "你可能喜欢的书"}
@GeolocationService.getLocations (locations)=>
locationIds = []
@@ -40,7 +40,7 @@ class RecommendService
url: @Constant.baseUrl + "/recommend/random?user_email=#{email}&user_token=#{token}"
method: 'GET'
timeout: 15000
cache: true
cache: false
)
.success (data, status, headers, config)->
callback data
@@ -1,4 +1,8 @@
<ion-view title="{{title}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button class="button icon ion-shuffle" ng-click="showRecommendActionSheet()">
</button>
@@ -6,17 +6,20 @@
<div class="bar bar-loading bar-assertive" id="x-bar" ng-if="data.isLoading">
{{data.text}}
</div>
<ion-content class="padding has-header">
<ion-content class="padding has-header">
<form novalidate>
<h3 ng-if="doubanInputDisabled">已成功绑定豆瓣用户,你的豆瓣用户名为:{{doubanUsername}}</h3>
<h3 ng-if="doubanInputDisabled">已成功绑定豆瓣用户:{{doubanUsername}}</h3>
<label class="item item-input" ng-hide="doubanInputDisabled">
<span class="input-label">豆瓣用户名</span>
<input type="text" placeholder="请输入豆瓣用户名" ng-model="user" id="douban-username" ng-disabled="doubanInputDisabled"/>
<input type="text" placeholder="请输入豆瓣用户名" ng-model="user" id="douban-username"
ng-disabled="doubanInputDisabled"/>
</label>
<button ng-hide="doubanInputDisabled" class="button button-full button-royal" ng-click="searchDoubanUser(user)">
<button ng-hide="doubanInputDisabled" class="button button-full button-royal"
ng-click="searchDoubanUser(user)">
搜索用户
</button>
<button ng-if="submitAllowed" type="submit" class="button button-full button-energized" ng-click="submitDoubanUser()" >
<button ng-if="submitAllowed" type="submit" class="button button-full button-energized"
ng-click="submitDoubanUser()">
提交
</button>
</form>
@@ -22,6 +22,7 @@ class HomeController
else
@$location.path '/tab/settings'
return
@$scope.changeRecommend = @changeRecommend
showLoading = ($scope, $ionicLoading)->
$scope.loading = $ionicLoading.show {
@@ -30,7 +30,7 @@ class LocationController
addLocation: () =>
if @$scope.locations.length >= 3
@IonicUtils.showLoading(@$scope, '只能创建3个常用的地址,请先删除部分再添加')
else if localStorage.getItem('cur_address_detail') is null
else if (localStorage.getItem('cur_address_detail') is null) || (localStorage.getItem('cur_address_detail') is undefined)
@IonicUtils.showLoading(@$scope, '定位成功后方可添加常用地址')
else if (@$scope.address is null or @$scope.address is '')
@IonicUtils.showLoading(@$scope, '定位成功后方可添加常用地址')
+2 -2
View File
@@ -7,7 +7,7 @@ class RecommendService
getActionSheetList: ()->
actionList = []
actionList.push {text: '机找几本书看看'}
actionList.push {text: '便看看'}
actionList.push {text: "你可能喜欢的书"}
@GeolocationService.getLocations (locations)=>
locationIds = []
@@ -40,7 +40,7 @@ class RecommendService
url: @Constant.baseUrl + "/recommend/random?user_email=#{email}&user_token=#{token}"
method: 'GET'
timeout: 15000
cache: true
cache: false
)
.success (data, status, headers, config)->
callback data
+4
View File
@@ -1,4 +1,8 @@
<ion-view title="{{title}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button class="button icon ion-shuffle" ng-click="showRecommendActionSheet()">
</button>
+8 -5
View File
@@ -6,17 +6,20 @@
<div class="bar bar-loading bar-assertive" id="x-bar" ng-if="data.isLoading">
{{data.text}}
</div>
<ion-content class="padding has-header">
<ion-content class="padding has-header">
<form novalidate>
<h3 ng-if="doubanInputDisabled">已成功绑定豆瓣用户,你的豆瓣用户名为:{{doubanUsername}}</h3>
<h3 ng-if="doubanInputDisabled">已成功绑定豆瓣用户:{{doubanUsername}}</h3>
<label class="item item-input" ng-hide="doubanInputDisabled">
<span class="input-label">豆瓣用户名</span>
<input type="text" placeholder="请输入豆瓣用户名" ng-model="user" id="douban-username" ng-disabled="doubanInputDisabled"/>
<input type="text" placeholder="请输入豆瓣用户名" ng-model="user" id="douban-username"
ng-disabled="doubanInputDisabled"/>
</label>
<button ng-hide="doubanInputDisabled" class="button button-full button-royal" ng-click="searchDoubanUser(user)">
<button ng-hide="doubanInputDisabled" class="button button-full button-royal"
ng-click="searchDoubanUser(user)">
搜索用户
</button>
<button ng-if="submitAllowed" type="submit" class="button button-full button-energized" ng-click="submitDoubanUser()" >
<button ng-if="submitAllowed" type="submit" class="button button-full button-energized"
ng-click="submitDoubanUser()">
提交
</button>
</form>