temp fix scope.title issue in home controller

This commit is contained in:
2014-05-21 16:20:04 +08:00
parent 62a1dd2f4b
commit db8a8e569b
25 changed files with 114 additions and 2695 deletions
@@ -1,5 +1,5 @@
#Last build type
#Sun, 11 May 2014 16:43:16 +0800
#Wed, 21 May 2014 14:13:08 +0800
build.last.target=debug
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -20
View File
@@ -494,31 +494,12 @@
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/css \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/fonts \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/css/all.min.css \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/fonts/ionicons.eot \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/fonts/ionicons.svg \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/fonts/ionicons.ttf \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/fonts/ionicons.woff \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js/all.min.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/authication-service.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/book-service.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/books-controller.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/comments-service.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/constant.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/controllers.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/douban-service.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/error-handler.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/geolocation.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/home-controller.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/ionic-utils.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/localstorage-utils.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/location-controller.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/login-controller.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/main-controller.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/recommend-service.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/scan-service.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/dist/js-app/settings-controller.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/fonts/ionicons.eot \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/fonts/ionicons.svg \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/fonts/ionicons.ttf \
@@ -526,10 +507,12 @@
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/default.jpg \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/douban_24.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/douban_32.png \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/img/social.umeng \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/imgcache.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/libr.js \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/umeng \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/controllers \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/handler \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/services \
@@ -548,7 +531,6 @@
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/services/douban-service.coffee \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/services/geolocation.coffee \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/services/recommend-service.coffee \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/services/rest \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/services/scan-service.coffee \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/utils/ionic-utils.coffee \
/Users/twer/gitrepo/libr-mobile/platforms/android/assets/www/js/app/utils/localstorage-utils.coffee \
+1 -1
View File
@@ -1,5 +1,5 @@
#Last build type
#Sun, 11 May 2014 16:43:39 +0800
#Wed, 21 May 2014 14:13:14 +0800
build.last.target=debug
File diff suppressed because it is too large Load Diff
@@ -1,9 +1,8 @@
libr = angular.module('libr.controllers', ['ionic'])
class BookDetailController
@$inject: ['$scope', '$stateParams', 'Books', '$window', '$ionicModal', 'Comments']
constructor: (@$scope, @$stateParams, @Books, @$window, @$ionicModal, @Comments) ->
@$inject: ['$scope', '$stateParams', 'Books', '$window', '$ionicModal', 'Comments', 'DoubanService']
constructor: (@$scope, @$stateParams, @Books, @$window, @$ionicModal, @Comments, @DoubanService) ->
@$scope.openDialog = @openCommentDialog
@$scope.closeDialog = @closeCommentDialog
@$scope.doComment = @doComment
@@ -15,15 +14,19 @@ class BookDetailController
scope: @$scope,
animation: 'slide-in-up'
}
console.log '===='
@Books.get {book_id: @$stateParams.isbn},
(result) =>
@$scope.book = result
@$scope.usersAccount = result.users.length
@$scope.bookName = @$scope.book.name
@Comments.query {book_id: result.id}, (data)=>
console.log data,'!!!!!'
console.log data, '!!!!!'
@$scope.comments = data
@DoubanService.bookDetail result.isbn, (data)=>
console.log data
@$scope.bookDetail = data
, (error)->
console.log 'error', error
@$scope.$on '$destroy', ()=>
@$scope.modal.remove()
@@ -54,5 +57,4 @@ class BookDetailController
@$window.history.back()
libr.controller 'BookDetailController', BookDetailController
@@ -4,24 +4,26 @@ class HomeController
@$inject: ['$scope', '$location', 'ScanService', '$ionicLoading', '$ionicActionSheet',
'RecommendService', 'ErrorHandler', 'LocalStorageUtils']
constructor: (@$scope, @$location, ScanService, @$ionicLoading, @$ionicActionSheet, @RecommendService, @ErrorHandler, @LocalStorageUtils)->
console.log @$scope, '!!!!!!!'
@$scope.showRecommendActionSheet = @showRecommendActionSheet
if @LocalStorageUtils.isUserLogedIn()
showLoading(@$scope, @$ionicLoading)
@$scope.title = '随便看看吧'
@$scope.title = {'name': 'Libr-随便看看吧'}
if localStorage.getItem('home.books') is null
@RecommendService.randomBooks (result)=>
@$scope.books = result
localStorage.setItem 'home.books', JSON.stringify(result)
@$scope.loading.hide()
@$ionicLoading.hide()
, (error)=>
@ErrorHandler.loadingHandler @$scope, null
else
@$scope.books = JSON.parse(localStorage.getItem('home.books'))
@$scope.loading.hide()
@$ionicLoading.hide()
else
@$location.path '/tab/settings'
return
@$scope.changeRecommend = @changeRecommend
showLoading = ($scope, $ionicLoading)->
$scope.loading = $ionicLoading.show {
@@ -54,7 +56,9 @@ class HomeController
@$scope.books = result
localStorage.setItem 'home.books', JSON.stringify(result)
listArray = JSON.parse(localStorage.getItem 'recommend_action_sheet_full_arr')
@$scope.title = listArray[index].text
@$scope.title.name = listArray[index].text
console.log @$scope, '========'
, (error)=>
@ErrorHandler.whenError null
libr.controller 'HomeCtrl', HomeController
@@ -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, '定位成功后方可添加常用地址')
@@ -22,6 +22,21 @@ class DoubanService
.error (data)->
error data
bookDetail: (isbn, callback, error)->
@$http(
url: "https://api.douban.com/v2/book/isbn/#{isbn}"
method: 'GET'
timeout: 10000
cache: true
)
.success (data, status, headers, config)->
if status is 200
callback data
else
error data
.error (data)->
error data
submitUser: (user, callback, error)=>
email = localStorage.getItem 'email'
token = localStorage.getItem 'token'
@@ -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
@@ -28,6 +28,11 @@
评论
</a>
</div>
<!--book Summary-->
<div class="item item-divider"> 图书简介:</div>
<div class="item item-body">
{{bookDetail.summary}}
</div>
<!-- comments -->
<div class="item item-divider"> 评论:</div>
<a class="item item-avatar comment-item" ng-repeat="comment in comments | orderBy: 'id' :false">
@@ -1,4 +1,9 @@
<ion-view title="{{title}}">
<ion-view title="{{title.name}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)"
ng-show="(title.name=='随便看看吧')|| (title.name=='Libr-随便看看吧')">
</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>
@@ -12,20 +12,10 @@
<i class="icon ion-log-out"></i>
注销登录
</a>
<a class="item item-icon-left">
<i class="icon ion-email"></i>
系统消息
<span class="badge badge-assertive">0</span>
</a>
<a class="item item-icon-left" href="#" ng-click="feedback()">
<i class="icon ion-heart"></i>
请给我们提供反馈吧
</a>
<a class="item item-icon-left" ng-click="showMe()">
<i class="icon ion-information-circled"></i>
关于
</a>
</div>
</ion-content>
</ion-view>
+3 -3
View File
@@ -26,6 +26,9 @@
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification" />
</feature>
<name>Libr</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
@@ -52,7 +55,4 @@
<param name="onload" value="true" />
<param name="ios-package" onload="true" value="IonicKeyboard" />
</feature>
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification" />
</feature>
</widget>
@@ -5,6 +5,7 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1407A44D22484B4395C72B89 /* scannerOverlay.xib in Resources */ = {isa = PBXBuildFile; fileRef = E12B99CB376A490BA963436B /* scannerOverlay.xib */; };
1A60A167A53E41DC9AB3A5B5 /* CDVReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = CB86B589F04E43CD95185886 /* CDVReachability.m */; };
+1 -1
View File
@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+18 -1328
View File
File diff suppressed because it is too large Load Diff
@@ -4,10 +4,11 @@ class HomeController
@$inject: ['$scope', '$location', 'ScanService', '$ionicLoading', '$ionicActionSheet',
'RecommendService', 'ErrorHandler', 'LocalStorageUtils']
constructor: (@$scope, @$location, ScanService, @$ionicLoading, @$ionicActionSheet, @RecommendService, @ErrorHandler, @LocalStorageUtils)->
console.log @$scope, '!!!!!!!'
@$scope.showRecommendActionSheet = @showRecommendActionSheet
if @LocalStorageUtils.isUserLogedIn()
showLoading(@$scope, @$ionicLoading)
@$scope.title = '随便看看吧'
@$scope.title = {'name': 'Libr-随便看看吧'}
if localStorage.getItem('home.books') is null
@RecommendService.randomBooks (result)=>
@$scope.books = result
@@ -55,7 +56,9 @@ class HomeController
@$scope.books = result
localStorage.setItem 'home.books', JSON.stringify(result)
listArray = JSON.parse(localStorage.getItem 'recommend_action_sheet_full_arr')
@$scope.title = listArray[index].text
@$scope.title.name = listArray[index].text
console.log @$scope, '========'
, (error)=>
@ErrorHandler.whenError null
libr.controller 'HomeCtrl', HomeController
+3 -2
View File
@@ -1,6 +1,7 @@
<ion-view title="{{title}}">
<ion-view title="{{title.name}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)"
ng-show="(title.name=='随便看看吧')|| (title.name=='Libr-随便看看吧')">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
@@ -4,10 +4,11 @@ class HomeController
@$inject: ['$scope', '$location', 'ScanService', '$ionicLoading', '$ionicActionSheet',
'RecommendService', 'ErrorHandler', 'LocalStorageUtils']
constructor: (@$scope, @$location, ScanService, @$ionicLoading, @$ionicActionSheet, @RecommendService, @ErrorHandler, @LocalStorageUtils)->
console.log @$scope, '!!!!!!!'
@$scope.showRecommendActionSheet = @showRecommendActionSheet
if @LocalStorageUtils.isUserLogedIn()
showLoading(@$scope, @$ionicLoading)
@$scope.title = '随便看看吧'
@$scope.title = {'name': 'Libr-随便看看吧'}
if localStorage.getItem('home.books') is null
@RecommendService.randomBooks (result)=>
@$scope.books = result
@@ -55,7 +56,9 @@ class HomeController
@$scope.books = result
localStorage.setItem 'home.books', JSON.stringify(result)
listArray = JSON.parse(localStorage.getItem 'recommend_action_sheet_full_arr')
@$scope.title = listArray[index].text
@$scope.title.name = listArray[index].text
console.log @$scope, '========'
, (error)=>
@ErrorHandler.whenError null
libr.controller 'HomeCtrl', HomeController
+3 -2
View File
@@ -1,6 +1,7 @@
<ion-view title="{{title}}">
<ion-view title="{{title.name}}">
<ion-nav-buttons side="left">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)" ng-show="title=='随便看看吧'">
<button class="button icon ion-ios7-refresh-empty" ng-click="changeRecommend(0)"
ng-show="(title.name=='随便看看吧')|| (title.name=='Libr-随便看看吧')">
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">