From c681a574c805c14d848df5b86cf4fae9d81b4b27 Mon Sep 17 00:00:00 2001 From: zhaojijizhao Date: Sat, 25 Apr 2015 03:04:32 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=BA=95?= =?UTF-8?q?=E9=83=A8=E4=B8=BB=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=9B=9B=E4=B8=AA?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=92=8C=E6=95=B4=E4=BD=93=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E5=8A=A0=E5=8F=B7=E6=8C=89=E9=92=AE=E5=92=8C=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E8=BF=98=E6=9C=AA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/client/views/tab_bar.html | 3 +- lib/common/client/views/tab_bar.import.styl | 22 ++++++++++-- modules/journey/both/lib/configs.coffee | 2 +- modules/note/both/lib/configs.coffee | 4 +-- modules/product/both/lib/configs.coffee | 4 +-- modules/say/both/lib/configs.coffee | 2 +- public/images/icondive-journey.svg | 32 ++++++++++++++++++ public/images/icondive-journeyon.svg | 32 ++++++++++++++++++ public/images/icondive-note.svg | 18 ++++++++++ public/images/icondive-noteon.svg | 20 +++++++++++ public/images/icondive-product.svg | 37 +++++++++++++++++++++ public/images/icondive-producton.svg | 37 +++++++++++++++++++++ public/images/icondive-say.svg | 22 ++++++++++++ public/images/icondive-sayon.svg | 22 ++++++++++++ 14 files changed, 248 insertions(+), 9 deletions(-) create mode 100755 public/images/icondive-journey.svg create mode 100755 public/images/icondive-journeyon.svg create mode 100755 public/images/icondive-note.svg create mode 100755 public/images/icondive-noteon.svg create mode 100755 public/images/icondive-product.svg create mode 100755 public/images/icondive-producton.svg create mode 100755 public/images/icondive-say.svg create mode 100755 public/images/icondive-sayon.svg diff --git a/lib/common/client/views/tab_bar.html b/lib/common/client/views/tab_bar.html index b94b340..e3fbd4d 100644 --- a/lib/common/client/views/tab_bar.html +++ b/lib/common/client/views/tab_bar.html @@ -8,7 +8,8 @@ {{#unless user}} {{/unless}} diff --git a/lib/common/client/views/tab_bar.import.styl b/lib/common/client/views/tab_bar.import.styl index 58f14d8..ccd2306 100644 --- a/lib/common/client/views/tab_bar.import.styl +++ b/lib/common/client/views/tab_bar.import.styl @@ -2,9 +2,27 @@ .tabs background #36618e .tab-item - color #aadeff - .tab-item.active + opacity 1 color white + font-family SimHei + .icon + filter brightness(0) invert(1) + .ion-dive-note + background url(/images/icondive-noteon.svg) no-repeat center + background-size 24px 24px + .ion-dive-journey + background url(/images/icondive-journeyon.svg) no-repeat center + background-size 24px 24px + .ion-dive-product + background url(/images/icondive-producton.svg) no-repeat center + background-size 24px 24px + .ion-dive-say + background url(/images/icondive-sayon.svg) no-repeat center + background-size 24px 24px + .tab-item.active + color #aadeff + .icon + filter none .add-button color #aadeff position absolute diff --git a/modules/journey/both/lib/configs.coffee b/modules/journey/both/lib/configs.coffee index fbd12e4..8316f5f 100644 --- a/modules/journey/both/lib/configs.coffee +++ b/modules/journey/both/lib/configs.coffee @@ -1,6 +1,6 @@ @journeyConfigs = label: '行程' - icon: "plane" + icon: "dive-journey" category2: official: 'official' user: 'user' diff --git a/modules/note/both/lib/configs.coffee b/modules/note/both/lib/configs.coffee index 01f3a3b..11fb4ca 100644 --- a/modules/note/both/lib/configs.coffee +++ b/modules/note/both/lib/configs.coffee @@ -1,4 +1,4 @@ @noteConfigs = - label: '游记' + label: '潜途' itemTemplate: 'imageItem' - icon: "android-car" \ No newline at end of file + icon: "dive-note" \ No newline at end of file diff --git a/modules/product/both/lib/configs.coffee b/modules/product/both/lib/configs.coffee index a7506e4..0703403 100644 --- a/modules/product/both/lib/configs.coffee +++ b/modules/product/both/lib/configs.coffee @@ -1,6 +1,6 @@ @productConfigs = - label: '商品' - icon: "android-cart" + label: '装备' + icon: "dive-product" category2: official: 'official' user: 'user' diff --git a/modules/say/both/lib/configs.coffee b/modules/say/both/lib/configs.coffee index 6c595f1..e12af1d 100644 --- a/modules/say/both/lib/configs.coffee +++ b/modules/say/both/lib/configs.coffee @@ -1,4 +1,4 @@ @sayConfigs = label: '说说' itemTemplate: 'imageItem' - icon: "chatbubble" \ No newline at end of file + icon: "dive-say" \ No newline at end of file diff --git a/public/images/icondive-journey.svg b/public/images/icondive-journey.svg new file mode 100755 index 0000000..cc9f1ae --- /dev/null +++ b/public/images/icondive-journey.svg @@ -0,0 +1,32 @@ + + + +]> + + + + + + + + diff --git a/public/images/icondive-journeyon.svg b/public/images/icondive-journeyon.svg new file mode 100755 index 0000000..daf5f66 --- /dev/null +++ b/public/images/icondive-journeyon.svg @@ -0,0 +1,32 @@ + + + +]> + + + + + + + + diff --git a/public/images/icondive-note.svg b/public/images/icondive-note.svg new file mode 100755 index 0000000..d6340f5 --- /dev/null +++ b/public/images/icondive-note.svg @@ -0,0 +1,18 @@ + + + +]> + + + + + diff --git a/public/images/icondive-noteon.svg b/public/images/icondive-noteon.svg new file mode 100755 index 0000000..5d42e84 --- /dev/null +++ b/public/images/icondive-noteon.svg @@ -0,0 +1,20 @@ + + + +]> + + + + + diff --git a/public/images/icondive-product.svg b/public/images/icondive-product.svg new file mode 100755 index 0000000..9050c64 --- /dev/null +++ b/public/images/icondive-product.svg @@ -0,0 +1,37 @@ + + + +]> + + + + + + + + + + + + diff --git a/public/images/icondive-producton.svg b/public/images/icondive-producton.svg new file mode 100755 index 0000000..447f18e --- /dev/null +++ b/public/images/icondive-producton.svg @@ -0,0 +1,37 @@ + + + +]> + + + + + + + + + + + + diff --git a/public/images/icondive-say.svg b/public/images/icondive-say.svg new file mode 100755 index 0000000..f7e72cd --- /dev/null +++ b/public/images/icondive-say.svg @@ -0,0 +1,22 @@ + + + +]> + + + + + + diff --git a/public/images/icondive-sayon.svg b/public/images/icondive-sayon.svg new file mode 100755 index 0000000..8dd9b40 --- /dev/null +++ b/public/images/icondive-sayon.svg @@ -0,0 +1,22 @@ + + + +]> + + + + + + From e3cdd617fdf6acac656d0707150a16bb1f58b26e Mon Sep 17 00:00:00 2001 From: lushisang Date: Tue, 28 Apr 2015 17:00:58 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BD=BF=E7=94=A8meteor-easy-search?= =?UTF-8?q?=E5=BA=93=E5=BC=80=E5=8F=91=E6=96=87=E7=AB=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9B=E6=94=B9=E8=BF=9B=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .meteor/packages | 4 +- .meteor/versions | 2 + lib/common/both/helpers.coffee | 2 +- lib/common/client/views/favorite_button.html | 4 +- .../client/views/favorite_button.import.styl | 4 -- lib/common/client/views/layout_content.html | 3 +- lib/post/both/collections.coffee | 8 +++- lib/post/both/configs.coffee | 2 +- lib/post/client/controllers.coffee | 5 +++ lib/post/client/router.coffee | 2 + lib/post/client/views/creator.coffee | 5 ++- lib/post/client/views/detail.html | 6 ++- lib/post/client/views/detail.import.styl | 5 +++ lib/post/client/views/list.coffee | 3 ++ lib/post/client/views/list.html | 3 ++ lib/post/client/views/list.import.styl | 7 +++- lib/post/client/views/main.import.styl | 1 + lib/post/client/views/search.coffee | 6 +++ lib/post/client/views/search.html | 37 +++++++++++++++++++ lib/post/client/views/search.import.styl | 7 ++++ main/client/views/main.html | 26 ------------- main/client/views/main.styl | 2 - modules/mongol/client/configs.coffee | 5 +++ modules/product/both/lib/configs.coffee | 3 +- modules/profile/client/controllers.coffee | 8 ++-- modules/user/client/controllers.coffee | 4 +- packages/favorites/lib/client/templates.html | 8 ++-- 27 files changed, 117 insertions(+), 55 deletions(-) delete mode 100644 lib/common/client/views/favorite_button.import.styl create mode 100644 lib/post/client/views/search.coffee create mode 100644 lib/post/client/views/search.html create mode 100644 lib/post/client/views/search.import.styl create mode 100644 modules/mongol/client/configs.coffee diff --git a/.meteor/packages b/.meteor/packages index 65cc0a4..a8a3820 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -63,4 +63,6 @@ meteorhacks:npm manuel:reactivearray http iron:url -less \ No newline at end of file +less +msavin:mongol +matteodem:easy-search diff --git a/.meteor/versions b/.meteor/versions index 1ae2b07..4b4eb20 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -75,6 +75,7 @@ localstorage@1.0.3 logging@1.0.7 manuel:reactivearray@1.0.5 matb33:collection-hooks@0.7.11 +matteodem:easy-search@1.5.6 mdg:geolocation@1.0.2 meteor@1.1.6 meteor-platform@1.2.2 @@ -93,6 +94,7 @@ mongo@1.1.0 mongo-livedata@1.0.8 mquandalle:bower@1.3.12_3 mquandalle:stylus@1.1.0 +msavin:mongol@0.3.5 multiply:iron-router-progress@1.0.1 npm-bcrypt@0.7.8_2 npm-container@1.0.0 diff --git a/lib/common/both/helpers.coffee b/lib/common/both/helpers.coffee index 61ef5ca..f7821ef 100644 --- a/lib/common/both/helpers.coffee +++ b/lib/common/both/helpers.coffee @@ -1,4 +1,4 @@ -@pq = (context)-> context.params.query +@paramsQuery = (context)-> context.params.query @gbl = -> Meteor.isClient and window or global diff --git a/lib/common/client/views/favorite_button.html b/lib/common/client/views/favorite_button.html index acbdede..17f426d 100644 --- a/lib/common/client/views/favorite_button.html +++ b/lib/common/client/views/favorite_button.html @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/lib/common/client/views/favorite_button.import.styl b/lib/common/client/views/favorite_button.import.styl deleted file mode 100644 index 3770949..0000000 --- a/lib/common/client/views/favorite_button.import.styl +++ /dev/null @@ -1,4 +0,0 @@ -.ionic-body - .nav-bar-block - .favorite-button - right 2.5em \ No newline at end of file diff --git a/lib/common/client/views/layout_content.html b/lib/common/client/views/layout_content.html index 8c0aec6..f7aadf8 100644 --- a/lib/common/client/views/layout_content.html +++ b/lib/common/client/views/layout_content.html @@ -8,7 +8,8 @@ {{> yield}} {{/ionNavView}} - {{>photoswipe}} + {{> yield 'popup'}} + {{/ionBody}} diff --git a/lib/post/both/collections.coffee b/lib/post/both/collections.coffee index d2a176d..8404436 100644 --- a/lib/post/both/collections.coffee +++ b/lib/post/both/collections.coffee @@ -1,5 +1,9 @@ @createPostCollection = (category, hasCategory2)-> - gbl()[pcap category] = new Meteor.Collection plural category + Posts = gbl()[pcap category] = new Meteor.Collection plural category + + Posts.initEasySearch ['title', '_id'], + 'limit': 20 + 'use': 'mongo-db' moreSchema = category: @@ -25,7 +29,7 @@ autoform: options: options - coln(category).attachSchema new SimpleSchema [PostSchema, moreSchema] + Posts.attachSchema new SimpleSchema [PostSchema, moreSchema] @PostSchema = new SimpleSchema diff --git a/lib/post/both/configs.coffee b/lib/post/both/configs.coffee index ccd8e18..d763565 100644 --- a/lib/post/both/configs.coffee +++ b/lib/post/both/configs.coffee @@ -1,2 +1,2 @@ @postConfigs = - autoFormOmitFields: ["category", "category2", "createdAt", "updatedAt", "user", "date", "images"] + autoFormOmitFields: ["category", "category2", "createdAt", "updatedAt", "user", "date", "images", "viewCount"] diff --git a/lib/post/client/controllers.coffee b/lib/post/client/controllers.coffee index 7309f57..ea46821 100644 --- a/lib/post/client/controllers.coffee +++ b/lib/post/client/controllers.coffee @@ -25,6 +25,11 @@ @PostUpdaterController = ContentController.extend data: -> noTransition coln(pq(@).category).findOne({_id: pq(@).id}) +@PostSearchController = ContentController.extend + data: -> noTransition pq(@) + +pq = (context)-> paramsQuery context + getListItemTemplate = (selector)-> cfg = getConfigs selector.category return cfg.itemTemplate[selector.category2] or cfg.itemTemplate diff --git a/lib/post/client/router.coffee b/lib/post/client/router.coffee index ac143ed..b333929 100644 --- a/lib/post/client/router.coffee +++ b/lib/post/client/router.coffee @@ -7,6 +7,8 @@ Router.route "/post/creator" Router.route "/post/updater" +Router.route "/post/search" + Router.plugin('ensureSignedIn', { only: ["post.creator", "post.updater"] }); \ No newline at end of file diff --git a/lib/post/client/views/creator.coffee b/lib/post/client/views/creator.coffee index 1e48c30..73ab9e8 100644 --- a/lib/post/client/views/creator.coffee +++ b/lib/post/client/views/creator.coffee @@ -12,7 +12,10 @@ Template.postCreator.helpers createAutoFormHooks = (data)-> hooks = onSuccess: (formType, result)-> - coln(data.category).update {_id: @docId}, {$set: {images: data.imagesToUpload.array()}} + coln(data.category).update {_id: @docId}, + $set: + category2: data.category2 + images: data.imagesToUpload.array() back() AutoForm.addHooks formId(data.category), hooks, true diff --git a/lib/post/client/views/detail.html b/lib/post/client/views/detail.html index efb8f0e..5672a35 100644 --- a/lib/post/client/views/detail.html +++ b/lib/post/client/views/detail.html @@ -6,7 +6,7 @@ {{#contentFor "headerButtonRight"}} {{#if currentUser}} - {{> favoriteButton _id=_id category=category}} + {{> favoriteButton _id=_id class='post-detail-favorite-button' category=category}} {{/if}} {{/contentFor}} @@ -15,6 +15,10 @@

{{title}}

{{/contentFor}} + {{#contentFor "popup"}} + {{>photoswipe}} + {{/contentFor}} + {{#ionView}} {{#ionContent}} diff --git a/lib/post/client/views/detail.import.styl b/lib/post/client/views/detail.import.styl index a40b846..5035cf5 100644 --- a/lib/post/client/views/detail.import.styl +++ b/lib/post/client/views/detail.import.styl @@ -19,3 +19,8 @@ opacity 0.6 @import '../../../lib/common/client/views/comment_box.import.styl' + +.ionic-body + .nav-bar-block + .favorite-button.post-detail-favorite-button + right 2.5em \ No newline at end of file diff --git a/lib/post/client/views/list.coffee b/lib/post/client/views/list.coffee index 09cf198..d98c91d 100644 --- a/lib/post/client/views/list.coffee +++ b/lib/post/client/views/list.coffee @@ -25,6 +25,9 @@ Template.ionNavBar.events else Router.go '/login?from=list' + 'click [data-action=search]': (event, template)-> + Router.go 'post.search', null, {query: currentLocation().query} + 'click [data-action=favoritesby]': (event, template)-> # setPostList 'favoritesby', myId() Router.go(currentPath() + "&favoritesby=#{myId()}") diff --git a/lib/post/client/views/list.html b/lib/post/client/views/list.html index b8088f5..6d04652 100644 --- a/lib/post/client/views/list.html +++ b/lib/post/client/views/list.html @@ -34,6 +34,9 @@

{{title}}

{{/if}} {{#contentFor "headerButtonRight"}} + diff --git a/lib/post/client/views/list.import.styl b/lib/post/client/views/list.import.styl index ff42a32..cc99038 100644 --- a/lib/post/client/views/list.import.styl +++ b/lib/post/client/views/list.import.styl @@ -15,4 +15,9 @@ color #FFF @import '../../../lib/common/client/views/tab_bar.import.styl' - @import '../../../lib/post/client/views/list_loader.import.styl' \ No newline at end of file + @import '../../../lib/post/client/views/list_loader.import.styl' + +.ionic-body + .nav-bar-block + [data-action="search"] + right 2.5em \ No newline at end of file diff --git a/lib/post/client/views/main.import.styl b/lib/post/client/views/main.import.styl index 3de001f..99bf7ff 100644 --- a/lib/post/client/views/main.import.styl +++ b/lib/post/client/views/main.import.styl @@ -2,3 +2,4 @@ @require '../../../lib/post/client/views/detail.import.styl' @require '../../../lib/post/client/views/creator.import.styl' @require '../../../lib/post/client/views/updater.import.styl' +@require '../../../lib/post/client/views/search.import.styl' diff --git a/lib/post/client/views/search.coffee b/lib/post/client/views/search.coffee new file mode 100644 index 0000000..815b9db --- /dev/null +++ b/lib/post/client/views/search.coffee @@ -0,0 +1,6 @@ +Template.postSearch.helpers + index: -> plural @category + +Template.postSearch.events + 'click .result-item': (event, template)-> + Router.go "/post/detail?category=#{template.data.category}&id=#{@id}" \ No newline at end of file diff --git a/lib/post/client/views/search.html b/lib/post/client/views/search.html new file mode 100644 index 0000000..7409202 --- /dev/null +++ b/lib/post/client/views/search.html @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/lib/post/client/views/search.import.styl b/lib/post/client/views/search.import.styl new file mode 100644 index 0000000..7c0258f --- /dev/null +++ b/lib/post/client/views/search.import.styl @@ -0,0 +1,7 @@ +.post-search + .query-input + padding 16px + height 4em + .result-loading + .no-results + text-align center \ No newline at end of file diff --git a/main/client/views/main.html b/main/client/views/main.html index 78dfb67..2154ba0 100644 --- a/main/client/views/main.html +++ b/main/client/views/main.html @@ -1,32 +1,6 @@ 潜水吧 - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/main/client/views/main.styl b/main/client/views/main.styl index b8644e8..7a54def 100644 --- a/main/client/views/main.styl +++ b/main/client/views/main.styl @@ -11,8 +11,6 @@ @require '../../../modules/journey/client/views/main.import.styl' @require '../../../modules/product/client/views/main.import.styl' -@require '../../../lib/common/client/views/favorite_button.import.styl' - a color inherit text-decoration none diff --git a/modules/mongol/client/configs.coffee b/modules/mongol/client/configs.coffee new file mode 100644 index 0000000..abff9e2 --- /dev/null +++ b/modules/mongol/client/configs.coffee @@ -0,0 +1,5 @@ +Session.set "Mongol", + 'collections': ['Notes', 'Journeys', 'Products', 'Says'] + 'display': false + 'opacity_normal': ".7" + 'opacity_expand': ".9" \ No newline at end of file diff --git a/modules/product/both/lib/configs.coffee b/modules/product/both/lib/configs.coffee index 0703403..d6f24c0 100644 --- a/modules/product/both/lib/configs.coffee +++ b/modules/product/both/lib/configs.coffee @@ -9,5 +9,4 @@ user: '二手' itemTemplate: official: 'imageItem' - user: 'productUserItem' - moreAutoFormOmitFields: ['viewCount'] \ No newline at end of file + user: 'productUserItem' \ No newline at end of file diff --git a/modules/profile/client/controllers.coffee b/modules/profile/client/controllers.coffee index 1e8a7e2..acee8b3 100644 --- a/modules/profile/client/controllers.coffee +++ b/modules/profile/client/controllers.coffee @@ -1,7 +1,7 @@ @ProfileController = ContentController.extend - action: -> @render "profile#{cap(pq(@).type or 'main')}" + action: -> @render "profile#{cap(paramsQuery(@).type or 'main')}" waitOn: -> - subManager.subscribe 'user', pq(@).user or myId() - subManager.subscribe 'profile', pq(@).user or myId() + subManager.subscribe 'user', paramsQuery(@).user or myId() + subManager.subscribe 'profile', paramsQuery(@).user or myId() subscribeMyFavorites() - data: -> noTransition Profiles.findOne({user: pq(@).user or myId()}) \ No newline at end of file + data: -> noTransition Profiles.findOne({user: paramsQuery(@).user or myId()}) \ No newline at end of file diff --git a/modules/user/client/controllers.coffee b/modules/user/client/controllers.coffee index cf1be8a..e8745b6 100644 --- a/modules/user/client/controllers.coffee +++ b/modules/user/client/controllers.coffee @@ -1,11 +1,11 @@ @UserListController = ContentController.extend onAfterAction: -> - selector = pq(@) + selector = paramsQuery(@) selector.category = 'user' subManager.subscribe "userList", selector, getListLimit(selector).get(), -> gbl()["loadingMore"].set false subscribeMyFavorites() data: -> - selector = pq(@) + selector = paramsQuery(@) data = _.clone selector selector.category = 'user' selector = selectFavorites(selector) diff --git a/packages/favorites/lib/client/templates.html b/packages/favorites/lib/client/templates.html index 4d37cfe..d4248fd 100755 --- a/packages/favorites/lib/client/templates.html +++ b/packages/favorites/lib/client/templates.html @@ -1,15 +1,15 @@ \ No newline at end of file From faad4aef7a8d94e6751bf2f3a5e2afbc5c33f50f Mon Sep 17 00:00:00 2001 From: lushisang Date: Tue, 28 Apr 2015 17:55:04 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=BB=A5=E9=80=82?= =?UTF-8?q?=E5=BA=94=E6=95=B4=E5=90=88=E5=9E=8B=E7=AE=A1=E7=90=86=E5=90=8E?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/post/both/collections.coffee | 2 +- modules/houston/server/houston.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/post/both/collections.coffee b/lib/post/both/collections.coffee index 8404436..757f6f9 100644 --- a/lib/post/both/collections.coffee +++ b/lib/post/both/collections.coffee @@ -1,7 +1,7 @@ @createPostCollection = (category, hasCategory2)-> Posts = gbl()[pcap category] = new Meteor.Collection plural category - Posts.initEasySearch ['title', '_id'], + Posts.initEasySearch and Posts.initEasySearch ['title', '_id'], 'limit': 20 'use': 'mongo-db' diff --git a/modules/houston/server/houston.coffee b/modules/houston/server/houston.coffee index ede0459..ca59b51 100644 --- a/modules/houston/server/houston.coffee +++ b/modules/houston/server/houston.coffee @@ -2,6 +2,6 @@ Meteor.startup -> Houston.add_collection Users Houston.add_collection Houston._admins - Houston.add_collection Favorites - Houston.add_collection Comments._collection + global['Favorites'] and Houston.add_collection Favorites + global['Comments'] and Houston.add_collection Comments._collection From 0024eee36119e4466dd16c84daa71b3515340b2f Mon Sep 17 00:00:00 2001 From: zhaojijizhao Date: Wed, 29 Apr 2015 01:13:07 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E6=BD=9C?= =?UTF-8?q?=E9=80=94list=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .meteor/versions | 2 +- lib/common/client/views/image_item.html | 8 ++-- .../client/views/image_item.import.styl | 45 +++++++++++++++---- lib/post/client/views/list_loader.import.styl | 1 + 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.meteor/versions b/.meteor/versions index 4b4eb20..0a6e34c 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -75,7 +75,7 @@ localstorage@1.0.3 logging@1.0.7 manuel:reactivearray@1.0.5 matb33:collection-hooks@0.7.11 -matteodem:easy-search@1.5.6 +matteodem:easy-search@1.5.4 mdg:geolocation@1.0.2 meteor@1.1.6 meteor-platform@1.2.2 diff --git a/lib/common/client/views/image_item.html b/lib/common/client/views/image_item.html index 07cc6c6..66180df 100644 --- a/lib/common/client/views/image_item.html +++ b/lib/common/client/views/image_item.html @@ -8,10 +8,12 @@ {{/if}}
-
diff --git a/lib/common/client/views/image_item.import.styl b/lib/common/client/views/image_item.import.styl index 90c9f7f..771de99 100644 --- a/lib/common/client/views/image_item.import.styl +++ b/lib/common/client/views/image_item.import.styl @@ -1,18 +1,47 @@ .image-item + margin-bottom 10px + position relative + width 100% + height 240px + background-color #fff + box-shadow 0 2px 2px rgba(0,0,0,0.1) + z-index 1 .image-container display flex + width 100% + height 205px + overflow hidden img margin auto + width 100% .title-container - padding-top 0.35em + position absolute + left 0 + bottom 0 size 100% 2em - background-color #a3ce5f + height 95px + background-color transparent label - color white position absolute .title - left 1em - .user - right 7em - .date - right 1em \ No newline at end of file + position relative + display block + padding 8px 5% + width 100% + height 60px + color #fff + font-size 20px + line-height 22px + background-color rgba(0,0,0,0.4) + .banner + height 35px + background-color #fff + color #CBCBCB + .user,.date + position relative + display block + padding 0 15% + height 35px + width 50% + float left + line-height 35px \ No newline at end of file diff --git a/lib/post/client/views/list_loader.import.styl b/lib/post/client/views/list_loader.import.styl index 873742f..35e8c5c 100644 --- a/lib/post/client/views/list_loader.import.styl +++ b/lib/post/client/views/list_loader.import.styl @@ -1,4 +1,5 @@ .item-list + background-color #f7f7f7 @import '../../../lib/common/client/views/image_item.import.styl' .loadmore-button margin 0 From 83cbdb09d1c7777b7c2d3460ee8c5628a302faa0 Mon Sep 17 00:00:00 2001 From: lushisang Date: Wed, 29 Apr 2015 16:21:41 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=EF=BC=8C=E6=95=B4=E5=90=88=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=92=8C=E7=94=A8=E6=88=B7=E6=90=9C=E7=B4=A2=E4=B8=BA=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .meteor/packages | 1 - .meteor/versions | 3 +- lib/post/both/collections.coffee | 4 -- lib/post/both/helpers.coffee | 3 ++ lib/post/client/controllers.coffee | 3 -- lib/post/client/helpers.coffee | 1 + lib/post/client/router.coffee | 2 - lib/post/client/views/list.coffee | 2 +- lib/post/client/views/main.import.styl | 1 - lib/post/client/views/search.coffee | 6 --- lib/post/client/views/search.html | 37 --------------- lib/post/client/views/search.import.styl | 7 --- main/client/helpers.coffee | 1 + main/client/views/main.styl | 2 + modules/search/both/main.coffee | 17 +++++++ modules/search/client/controllers.coffee | 2 + modules/search/client/router.coffee | 1 + modules/search/client/views/main.coffee | 11 +++++ modules/search/client/views/main.html | 50 ++++++++++++++++++++ modules/search/client/views/main.import.styl | 19 ++++++++ modules/user/client/controllers.coffee | 2 +- modules/user/client/router.coffee | 3 +- 22 files changed, 112 insertions(+), 66 deletions(-) create mode 100644 lib/post/client/helpers.coffee delete mode 100644 lib/post/client/views/search.coffee delete mode 100644 lib/post/client/views/search.html delete mode 100644 lib/post/client/views/search.import.styl create mode 100644 main/client/helpers.coffee create mode 100644 modules/search/both/main.coffee create mode 100644 modules/search/client/controllers.coffee create mode 100644 modules/search/client/router.coffee create mode 100644 modules/search/client/views/main.coffee create mode 100644 modules/search/client/views/main.html create mode 100644 modules/search/client/views/main.import.styl diff --git a/.meteor/packages b/.meteor/packages index a8a3820..a2eab26 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -64,5 +64,4 @@ manuel:reactivearray http iron:url less -msavin:mongol matteodem:easy-search diff --git a/.meteor/versions b/.meteor/versions index 0a6e34c..4ba7ef5 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -75,7 +75,7 @@ localstorage@1.0.3 logging@1.0.7 manuel:reactivearray@1.0.5 matb33:collection-hooks@0.7.11 -matteodem:easy-search@1.5.4 +matteodem:easy-search@1.5.6 mdg:geolocation@1.0.2 meteor@1.1.6 meteor-platform@1.2.2 @@ -94,7 +94,6 @@ mongo@1.1.0 mongo-livedata@1.0.8 mquandalle:bower@1.3.12_3 mquandalle:stylus@1.1.0 -msavin:mongol@0.3.5 multiply:iron-router-progress@1.0.1 npm-bcrypt@0.7.8_2 npm-container@1.0.0 diff --git a/lib/post/both/collections.coffee b/lib/post/both/collections.coffee index 757f6f9..f434ae5 100644 --- a/lib/post/both/collections.coffee +++ b/lib/post/both/collections.coffee @@ -1,10 +1,6 @@ @createPostCollection = (category, hasCategory2)-> Posts = gbl()[pcap category] = new Meteor.Collection plural category - Posts.initEasySearch and Posts.initEasySearch ['title', '_id'], - 'limit': 20 - 'use': 'mongo-db' - moreSchema = category: type: String diff --git a/lib/post/both/helpers.coffee b/lib/post/both/helpers.coffee index 152aa52..6489e26 100644 --- a/lib/post/both/helpers.coffee +++ b/lib/post/both/helpers.coffee @@ -1,3 +1,6 @@ + +@postCategoryLabel = (category)-> getConfigs(category).label + @autoFormOmitFields = (category)-> omitFields = getConfigs(category).autoFormOmitFields if omitFields diff --git a/lib/post/client/controllers.coffee b/lib/post/client/controllers.coffee index ea46821..f9a766a 100644 --- a/lib/post/client/controllers.coffee +++ b/lib/post/client/controllers.coffee @@ -25,9 +25,6 @@ @PostUpdaterController = ContentController.extend data: -> noTransition coln(pq(@).category).findOne({_id: pq(@).id}) -@PostSearchController = ContentController.extend - data: -> noTransition pq(@) - pq = (context)-> paramsQuery context getListItemTemplate = (selector)-> diff --git a/lib/post/client/helpers.coffee b/lib/post/client/helpers.coffee new file mode 100644 index 0000000..0272f40 --- /dev/null +++ b/lib/post/client/helpers.coffee @@ -0,0 +1 @@ +Template.registerHelper 'postCategoryLabel', (category)-> postCategoryLabel category \ No newline at end of file diff --git a/lib/post/client/router.coffee b/lib/post/client/router.coffee index b333929..ac143ed 100644 --- a/lib/post/client/router.coffee +++ b/lib/post/client/router.coffee @@ -7,8 +7,6 @@ Router.route "/post/creator" Router.route "/post/updater" -Router.route "/post/search" - Router.plugin('ensureSignedIn', { only: ["post.creator", "post.updater"] }); \ No newline at end of file diff --git a/lib/post/client/views/list.coffee b/lib/post/client/views/list.coffee index d98c91d..e7d7640 100644 --- a/lib/post/client/views/list.coffee +++ b/lib/post/client/views/list.coffee @@ -26,7 +26,7 @@ Template.ionNavBar.events Router.go '/login?from=list' 'click [data-action=search]': (event, template)-> - Router.go 'post.search', null, {query: currentLocation().query} + Router.go 'search' 'click [data-action=favoritesby]': (event, template)-> # setPostList 'favoritesby', myId() diff --git a/lib/post/client/views/main.import.styl b/lib/post/client/views/main.import.styl index 99bf7ff..3de001f 100644 --- a/lib/post/client/views/main.import.styl +++ b/lib/post/client/views/main.import.styl @@ -2,4 +2,3 @@ @require '../../../lib/post/client/views/detail.import.styl' @require '../../../lib/post/client/views/creator.import.styl' @require '../../../lib/post/client/views/updater.import.styl' -@require '../../../lib/post/client/views/search.import.styl' diff --git a/lib/post/client/views/search.coffee b/lib/post/client/views/search.coffee deleted file mode 100644 index 815b9db..0000000 --- a/lib/post/client/views/search.coffee +++ /dev/null @@ -1,6 +0,0 @@ -Template.postSearch.helpers - index: -> plural @category - -Template.postSearch.events - 'click .result-item': (event, template)-> - Router.go "/post/detail?category=#{template.data.category}&id=#{@id}" \ No newline at end of file diff --git a/lib/post/client/views/search.html b/lib/post/client/views/search.html deleted file mode 100644 index 7409202..0000000 --- a/lib/post/client/views/search.html +++ /dev/null @@ -1,37 +0,0 @@ - \ No newline at end of file diff --git a/lib/post/client/views/search.import.styl b/lib/post/client/views/search.import.styl deleted file mode 100644 index 7c0258f..0000000 --- a/lib/post/client/views/search.import.styl +++ /dev/null @@ -1,7 +0,0 @@ -.post-search - .query-input - padding 16px - height 4em - .result-loading - .no-results - text-align center \ No newline at end of file diff --git a/main/client/helpers.coffee b/main/client/helpers.coffee new file mode 100644 index 0000000..2c35529 --- /dev/null +++ b/main/client/helpers.coffee @@ -0,0 +1 @@ +Template.registerHelper 'postCategories', -> _.values PostCategory \ No newline at end of file diff --git a/main/client/views/main.styl b/main/client/views/main.styl index 7a54def..fd03104 100644 --- a/main/client/views/main.styl +++ b/main/client/views/main.styl @@ -11,6 +11,8 @@ @require '../../../modules/journey/client/views/main.import.styl' @require '../../../modules/product/client/views/main.import.styl' +@require '../../../modules/search/client/views/main.import.styl' + a color inherit text-decoration none diff --git a/modules/search/both/main.coffee b/modules/search/both/main.coffee new file mode 100644 index 0000000..8231246 --- /dev/null +++ b/modules/search/both/main.coffee @@ -0,0 +1,17 @@ +Meteor.startup -> + + _.each PostCategory, (category)-> + createPostSearchIndex category + + EasySearch.createSearchIndex 'profiles', + field: ['nickname', 'user'] + collection: Profiles + limit: 20 + use: 'mongo-db' + +createPostSearchIndex = (category)-> + EasySearch.createSearchIndex plural(category), + field: ['title', '_id', 'category'] + collection: coln(category) + limit: 20 + use: 'mongo-db' \ No newline at end of file diff --git a/modules/search/client/controllers.coffee b/modules/search/client/controllers.coffee new file mode 100644 index 0000000..9c185ae --- /dev/null +++ b/modules/search/client/controllers.coffee @@ -0,0 +1,2 @@ +SearchController = ContentController.extend + data: -> noTransition paramsQuery @ \ No newline at end of file diff --git a/modules/search/client/router.coffee b/modules/search/client/router.coffee new file mode 100644 index 0000000..a5c3b27 --- /dev/null +++ b/modules/search/client/router.coffee @@ -0,0 +1 @@ +Router.route "/search" \ No newline at end of file diff --git a/modules/search/client/views/main.coffee b/modules/search/client/views/main.coffee new file mode 100644 index 0000000..92e7125 --- /dev/null +++ b/modules/search/client/views/main.coffee @@ -0,0 +1,11 @@ +Template.search.helpers + indexes: -> ['notes', 'journeys', 'products', 'says', 'profiles'] + postIndex: -> plural @ + +Template.search.events + + 'click .result-item.post': (event, template)-> Router.go "/post/detail?category=#{@category}&id=#{@id}" + 'click .result-item.profile': (event, template)-> Router.go "/profile?type=main&user=#{@user}" + +# 'click .type-tab.type-user': -> Router.go "/user/search" + diff --git a/modules/search/client/views/main.html b/modules/search/client/views/main.html new file mode 100644 index 0000000..1a21e64 --- /dev/null +++ b/modules/search/client/views/main.html @@ -0,0 +1,50 @@ + \ No newline at end of file diff --git a/modules/search/client/views/main.import.styl b/modules/search/client/views/main.import.styl new file mode 100644 index 0000000..a1a8ff1 --- /dev/null +++ b/modules/search/client/views/main.import.styl @@ -0,0 +1,19 @@ +.search + .types-container + display flex + height 3em + .type-tab + flex 1 + text-align center + padding-top 0.9em + background #e0f1fd + color #2b9ad5 + .type-tab.selected + background #2b9ad5 + color #FFF + .query-input + padding 16px + height 4em + .result-loading + .no-results + text-align center \ No newline at end of file diff --git a/modules/user/client/controllers.coffee b/modules/user/client/controllers.coffee index e8745b6..e1a5205 100644 --- a/modules/user/client/controllers.coffee +++ b/modules/user/client/controllers.coffee @@ -12,4 +12,4 @@ selector = _.omit selector, 'category' data.list = Users.find selector data.itemTemplate = 'userListItem' - return noTransition data \ No newline at end of file + return noTransition data diff --git a/modules/user/client/router.coffee b/modules/user/client/router.coffee index 6468942..99d2c7c 100644 --- a/modules/user/client/router.coffee +++ b/modules/user/client/router.coffee @@ -1 +1,2 @@ -Router.route "/user/list" \ No newline at end of file +Router.route "/user/list" +Router.route "/user/search" \ No newline at end of file From 2d3339ae6729b4045c336b89648839c77ea11b77 Mon Sep 17 00:00:00 2001 From: lushisang Date: Wed, 29 Apr 2015 18:03:22 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/post/both/helpers.coffee | 2 +- lib/post/client/views/list.coffee | 4 ++-- modules/search/client/controllers.coffee | 2 +- modules/search/client/views/main.coffee | 11 +++++++++-- modules/search/client/views/main.html | 17 ++++++++++++----- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/lib/post/both/helpers.coffee b/lib/post/both/helpers.coffee index 6489e26..c7e43c8 100644 --- a/lib/post/both/helpers.coffee +++ b/lib/post/both/helpers.coffee @@ -1,5 +1,5 @@ -@postCategoryLabel = (category)-> getConfigs(category).label +@postCategoryLabel = (category)-> getConfigs(category).label or '' @autoFormOmitFields = (category)-> omitFields = getConfigs(category).autoFormOmitFields diff --git a/lib/post/client/views/list.coffee b/lib/post/client/views/list.coffee index e7d7640..bcaf3e7 100644 --- a/lib/post/client/views/list.coffee +++ b/lib/post/client/views/list.coffee @@ -26,11 +26,11 @@ Template.ionNavBar.events Router.go '/login?from=list' 'click [data-action=search]': (event, template)-> - Router.go 'search' + Router.go '/search?type=all' 'click [data-action=favoritesby]': (event, template)-> # setPostList 'favoritesby', myId() Router.go(currentPath() + "&favoritesby=#{myId()}") Template.postList.events - 'click .category2': -> Router.go "/post/list?category=#{Template.parentData().category}&category2=#{@}" + 'click .category2': -> Router.go "/post/list?category=#{Template.parentData().category}&category2=#{@}", {}, {replaceState: true} diff --git a/modules/search/client/controllers.coffee b/modules/search/client/controllers.coffee index 9c185ae..96853d8 100644 --- a/modules/search/client/controllers.coffee +++ b/modules/search/client/controllers.coffee @@ -1,2 +1,2 @@ -SearchController = ContentController.extend +@SearchController = ContentController.extend data: -> noTransition paramsQuery @ \ No newline at end of file diff --git a/modules/search/client/views/main.coffee b/modules/search/client/views/main.coffee index 92e7125..ca5d172 100644 --- a/modules/search/client/views/main.coffee +++ b/modules/search/client/views/main.coffee @@ -1,11 +1,18 @@ Template.search.helpers - indexes: -> ['notes', 'journeys', 'products', 'says', 'profiles'] + indexes: -> @type is 'all' and ['notes', 'journeys', 'products', 'says', 'profiles'] or plural(@type) postIndex: -> plural @ + isSelect: (type)-> s.contains(currentPath(), type) and 'selected' or '' + placeholder: -> + typeLabel = switch @type + when 'all' then '全部' + when 'profile' then '用户' + else postCategoryLabel @type + return "搜索#{typeLabel}..." Template.search.events 'click .result-item.post': (event, template)-> Router.go "/post/detail?category=#{@category}&id=#{@id}" 'click .result-item.profile': (event, template)-> Router.go "/profile?type=main&user=#{@user}" + 'click .type-tab': (event, template)-> Router.go "/search?type=#{@}", {}, {replaceState: true} # 'click .type-tab.type-user': -> Router.go "/user/search" - diff --git a/modules/search/client/views/main.html b/modules/search/client/views/main.html index 1a21e64..126bcbc 100644 --- a/modules/search/client/views/main.html +++ b/modules/search/client/views/main.html @@ -11,12 +11,19 @@

搜索

{{#ionView class='search'}} {{#ionContent}} - - - - +
+ {{#with 'all'}} + 全部 + {{/with}} + {{#each postCategories}} + {{postCategoryLabel this}} + {{/each}} + {{#with 'profile'}} + 用户 + {{/with}} +
- {{> esInput index=indexes placeholder="搜索文章、用户..." class='query-input' reactive='false' event='enter'}} + {{> esInput index=indexes placeholder=placeholder class='query-input' event='enter'}} {{#ionList}} {{#each postCategories}} From 5407d4fca2840086455072db5e2a63463c134367 Mon Sep 17 00:00:00 2001 From: zhaojijizhao Date: Thu, 30 Apr 2015 02:09:30 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=B0=E6=AD=A5tab?= =?UTF-8?q?=E6=A0=8F=E6=94=B9=E7=A7=B0=E6=9C=80=E6=96=B0=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/client/views/tab_bar.import.styl | 31 ++++++--- public/images/icondive-add.svg | 17 +++++ public/images/icondive-journey.svg | 26 ++------ public/images/icondive-note.svg | 25 ++++++-- public/images/icondive-product.svg | 71 +++++++++++++-------- public/images/icondive-say.svg | 51 +++++++++++---- 6 files changed, 146 insertions(+), 75 deletions(-) create mode 100644 public/images/icondive-add.svg mode change 100755 => 100644 public/images/icondive-journey.svg mode change 100755 => 100644 public/images/icondive-note.svg mode change 100755 => 100644 public/images/icondive-product.svg mode change 100755 => 100644 public/images/icondive-say.svg diff --git a/lib/common/client/views/tab_bar.import.styl b/lib/common/client/views/tab_bar.import.styl index ccd2306..d5b7cdb 100644 --- a/lib/common/client/views/tab_bar.import.styl +++ b/lib/common/client/views/tab_bar.import.styl @@ -5,26 +5,28 @@ opacity 1 color white font-family SimHei + line-height 12px .icon + height 34px filter brightness(0) invert(1) .ion-dive-note - background url(/images/icondive-noteon.svg) no-repeat center - background-size 24px 24px + background url(/images/icondive-note.svg) no-repeat center + background-size 30px 30px .ion-dive-journey - background url(/images/icondive-journeyon.svg) no-repeat center - background-size 24px 24px + background url(/images/icondive-journey.svg) no-repeat center + background-size 30px 30px .ion-dive-product - background url(/images/icondive-producton.svg) no-repeat center - background-size 24px 24px + background url(/images/icondive-product.svg) no-repeat center + background-size 30px 30px .ion-dive-say - background url(/images/icondive-sayon.svg) no-repeat center - background-size 24px 24px + background url(/images/icondive-say.svg) no-repeat center + background-size 30px 30px .tab-item.active - color #aadeff + color #2E5C8D + background-color #81BEFF .icon filter none .add-button - color #aadeff position absolute top 0 left 0 @@ -32,5 +34,14 @@ margin auto padding 0 width 50px + font-size 12px + line-height 12px + color #fff + .ion-dive-plus + display block + margin 0 auto + height 34px + background url(/images/icondive-add.svg) no-repeat center + background-size 32px 32px .icon:before font-size 50px \ No newline at end of file diff --git a/public/images/icondive-add.svg b/public/images/icondive-add.svg new file mode 100644 index 0000000..10ee2b2 --- /dev/null +++ b/public/images/icondive-add.svg @@ -0,0 +1,17 @@ + + + +]> + + + + + + + + + diff --git a/public/images/icondive-journey.svg b/public/images/icondive-journey.svg old mode 100755 new mode 100644 index cc9f1ae..dc80b97 --- a/public/images/icondive-journey.svg +++ b/public/images/icondive-journey.svg @@ -5,28 +5,12 @@ ]> - - - - + diff --git a/public/images/icondive-note.svg b/public/images/icondive-note.svg old mode 100755 new mode 100644 index d6340f5..9b231d8 --- a/public/images/icondive-note.svg +++ b/public/images/icondive-note.svg @@ -5,14 +5,25 @@ ]> - + diff --git a/public/images/icondive-product.svg b/public/images/icondive-product.svg old mode 100755 new mode 100644 index 9050c64..1dd9dac --- a/public/images/icondive-product.svg +++ b/public/images/icondive-product.svg @@ -5,33 +5,52 @@ ]> - - - - - - - - + + + + + + + + + + + diff --git a/public/images/icondive-say.svg b/public/images/icondive-say.svg old mode 100755 new mode 100644 index f7e72cd..08eaaaa --- a/public/images/icondive-say.svg +++ b/public/images/icondive-say.svg @@ -5,18 +5,47 @@ ]> - - + + + + + + From 4c03cefad789382df2807c3a8f2bd7e77044d42d Mon Sep 17 00:00:00 2001 From: lushisang Date: Thu, 30 Apr 2015 14:03:12 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/post/client/views/list.coffee | 2 +- modules/search/client/views/main.coffee | 38 ++++++++--- modules/search/client/views/main.html | 72 +++++++++++--------- modules/search/client/views/main.import.styl | 16 +++-- 4 files changed, 81 insertions(+), 47 deletions(-) diff --git a/lib/post/client/views/list.coffee b/lib/post/client/views/list.coffee index bcaf3e7..13a33ba 100644 --- a/lib/post/client/views/list.coffee +++ b/lib/post/client/views/list.coffee @@ -26,7 +26,7 @@ Template.ionNavBar.events Router.go '/login?from=list' 'click [data-action=search]': (event, template)-> - Router.go '/search?type=all' + Router.go "/search?type=#{@category}" 'click [data-action=favoritesby]': (event, template)-> # setPostList 'favoritesby', myId() diff --git a/modules/search/client/views/main.coffee b/modules/search/client/views/main.coffee index ca5d172..aa08624 100644 --- a/modules/search/client/views/main.coffee +++ b/modules/search/client/views/main.coffee @@ -1,18 +1,38 @@ +type = new ReactiveVar('') + +Template.search.onCreated -> type.set @data.type + Template.search.helpers - indexes: -> @type is 'all' and ['notes', 'journeys', 'products', 'says', 'profiles'] or plural(@type) + tabs: -> ['note', 'journey', 'product', 'say', 'profile'] + isHidden: -> (('' + @) != type.get()) and 'hidden' or '' + indexes: -> indexes ('' + @) postIndex: -> plural @ - isSelect: (type)-> s.contains(currentPath(), type) and 'selected' or '' - placeholder: -> - typeLabel = switch @type - when 'all' then '全部' - when 'profile' then '用户' - else postCategoryLabel @type - return "搜索#{typeLabel}..." + isSelect: (tabType)-> tabType is type.get() and 'selected' or '' + label: -> label ('' + @) + placeholder: -> "搜索#{label ('' + @)}..." + isPost: (type)-> ('' + type) in ['note', 'journey', 'product', 'say'] + isProfile: (type)-> ('' + type) is 'profile' Template.search.events 'click .result-item.post': (event, template)-> Router.go "/post/detail?category=#{@category}&id=#{@id}" 'click .result-item.profile': (event, template)-> Router.go "/profile?type=main&user=#{@user}" - 'click .type-tab': (event, template)-> Router.go "/search?type=#{@}", {}, {replaceState: true} + 'click .type-tab': (event, template)-> + type.set('' + @) + typeText = template.$('.' + type.get() + ' .query-input').val() + console.log type.get() + if not typeText + clearSearchIndex type.get() # 'click .type-tab.type-user': -> Router.go "/user/search" + +label = (type)-> + switch type + when 'profile' then '用户' + else postCategoryLabel type + +indexes = (type)-> plural(type) + +clearSearchIndex = (type)-> + instance = EasySearch.getComponentInstance {index: indexes(type)} + if instance then instance.clear() \ No newline at end of file diff --git a/modules/search/client/views/main.html b/modules/search/client/views/main.html index 126bcbc..d151c01 100644 --- a/modules/search/client/views/main.html +++ b/modules/search/client/views/main.html @@ -12,44 +12,54 @@

搜索

{{#ionContent}}
- {{#with 'all'}} - 全部 - {{/with}} - {{#each postCategories}} - {{postCategoryLabel this}} + {{#each tabs}} + {{label this}} {{/each}} - {{#with 'profile'}} - 用户 - {{/with}}
- {{> esInput index=indexes placeholder=placeholder class='query-input' event='enter'}} - - {{#ionList}} - {{#each postCategories}} - {{#esEach index=postIndex}} - {{#ionItem class='result-item post' id=_id category=category}} - {{postCategoryLabel category}}:{{title}} - {{/ionItem}} - {{/esEach}} - {{/each}} +
+ + {{#each tabs}} + +
+ + {{>esInput index=indexes placeholder=placeholder class='query-input' reactive='false' event='enter'}} + + {{#ionList}} + + {{#esEach index=indexes}} + + {{#if isPost ..}} + {{#ionItem class='result-item post' id=_id category=category}} + {{title}} + {{/ionItem}} + {{/if}} - {{#esEach index='profiles'}} - {{#ionItem class='result-item profile' user=user}} - 用户:{{nickname}} - {{/ionItem}} - {{/esEach}} - {{/ionList}} + {{#if isProfile ..}} + {{#ionItem class='result-item profile' user=user}} + {{nickname}} + {{/ionItem}} + {{/if}} - {{> esLoadMoreButton index=indexes}} + {{/esEach}} + {{/ionList}} - {{#ifEsHasNoResults index=indexes}} -
没有结果。
- {{/ifEsHasNoResults}} + {{>esLoadMoreButton index=indexes}} + + {{#ifEsHasNoResults index=indexes}} +
没有结果。
+ {{/ifEsHasNoResults}} + + {{#ifEsIsSearching index=indexes}} +
加载中...
+ {{/ifEsIsSearching}} + +
+ + {{/each}} + +
- {{#ifEsIsSearching index=indexes}} -
加载中...
- {{/ifEsIsSearching}} {{/ionContent}} {{/ionView}} diff --git a/modules/search/client/views/main.import.styl b/modules/search/client/views/main.import.styl index a1a8ff1..d44b0ab 100644 --- a/modules/search/client/views/main.import.styl +++ b/modules/search/client/views/main.import.styl @@ -11,9 +11,13 @@ .type-tab.selected background #2b9ad5 color #FFF - .query-input - padding 16px - height 4em - .result-loading - .no-results - text-align center \ No newline at end of file + .tab-view-container + .tab-view + .query-input + padding 16px + height 4em + .result-loading + .no-results + text-align center + .tab-view.hidden + display none \ No newline at end of file From fa31ed28675358f1ba23c76b9bc4a91aa9fd6e5f Mon Sep 17 00:00:00 2001 From: lushisang Date: Thu, 30 Apr 2015 15:55:21 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E5=B0=8F=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/search/client/views/main.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/search/client/views/main.coffee b/modules/search/client/views/main.coffee index aa08624..5013e85 100644 --- a/modules/search/client/views/main.coffee +++ b/modules/search/client/views/main.coffee @@ -20,7 +20,6 @@ Template.search.events 'click .type-tab': (event, template)-> type.set('' + @) typeText = template.$('.' + type.get() + ' .query-input').val() - console.log type.get() if not typeText clearSearchIndex type.get() From 5858ec6a694753f52fcca7cfee04d7a2c2bde1ee Mon Sep 17 00:00:00 2001 From: zhaojijizhao Date: Fri, 1 May 2015 13:07:42 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E8=AF=B4=E8=AF=B4=E7=9A=84imageitem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/views/Image_item_say.Import.styl | 47 +++++++++++++++++++ lib/common/client/views/Image_item_say.html | 20 ++++++++ lib/common/client/views/image_item_say.coffee | 8 ++++ lib/post/client/views/list_loader.html | 2 +- modules/say/both/lib/configs.coffee | 2 +- 5 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 lib/common/client/views/Image_item_say.Import.styl create mode 100644 lib/common/client/views/Image_item_say.html create mode 100644 lib/common/client/views/image_item_say.coffee diff --git a/lib/common/client/views/Image_item_say.Import.styl b/lib/common/client/views/Image_item_say.Import.styl new file mode 100644 index 0000000..771de99 --- /dev/null +++ b/lib/common/client/views/Image_item_say.Import.styl @@ -0,0 +1,47 @@ +.image-item + margin-bottom 10px + position relative + width 100% + height 240px + background-color #fff + box-shadow 0 2px 2px rgba(0,0,0,0.1) + z-index 1 + .image-container + display flex + width 100% + height 205px + overflow hidden + img + margin auto + width 100% + .title-container + position absolute + left 0 + bottom 0 + size 100% 2em + height 95px + background-color transparent + label + position absolute + .title + position relative + display block + padding 8px 5% + width 100% + height 60px + color #fff + font-size 20px + line-height 22px + background-color rgba(0,0,0,0.4) + .banner + height 35px + background-color #fff + color #CBCBCB + .user,.date + position relative + display block + padding 0 15% + height 35px + width 50% + float left + line-height 35px \ No newline at end of file diff --git a/lib/common/client/views/Image_item_say.html b/lib/common/client/views/Image_item_say.html new file mode 100644 index 0000000..862a1a1 --- /dev/null +++ b/lib/common/client/views/Image_item_say.html @@ -0,0 +1,20 @@ + diff --git a/lib/common/client/views/image_item_say.coffee b/lib/common/client/views/image_item_say.coffee new file mode 100644 index 0000000..8716062 --- /dev/null +++ b/lib/common/client/views/image_item_say.coffee @@ -0,0 +1,8 @@ +Template.imageItem.helpers + firstPicture: -> imageUrl @images?[0], {mode: 2, w: screen.width, h: screen.width * 0.8, q: 100} + +Template.imageItem.events + 'click .image-item': -> Router.go "/post/detail?category=#{@category}&id=#{@_id}" + 'click .image-item .user': (event)-> + event.stopImmediatePropagation() + Router.go userUrl(@user) \ No newline at end of file diff --git a/lib/post/client/views/list_loader.html b/lib/post/client/views/list_loader.html index e97dc8e..a00495f 100644 --- a/lib/post/client/views/list_loader.html +++ b/lib/post/client/views/list_loader.html @@ -4,7 +4,7 @@ {{#if ../itemTemplate}} {{>Template.dynamic template=../itemTemplate}} {{else}} - {{>imageItem}} + {{>imageItemSay}} {{/if}} {{/each}} diff --git a/modules/say/both/lib/configs.coffee b/modules/say/both/lib/configs.coffee index e12af1d..d59bd4a 100644 --- a/modules/say/both/lib/configs.coffee +++ b/modules/say/both/lib/configs.coffee @@ -1,4 +1,4 @@ @sayConfigs = - label: '说说' + label: '话题' itemTemplate: 'imageItem' icon: "dive-say" \ No newline at end of file From 572327d5ff9de3519b181903e6212c10c0daddfc Mon Sep 17 00:00:00 2001 From: zhaojijizhao Date: Fri, 1 May 2015 14:14:07 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E8=AF=B4=E8=AF=B4=E7=9A=84imageitemsay,=E7=84=B6=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E6=B8=85=E6=A5=9A=E6=80=8E=E4=B9=88=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=B0=E8=AF=B4=E8=AF=B4=E7=9A=84=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/client/views/image_item_say.coffee | 4 ++-- lib/post/client/views/list_loader.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/common/client/views/image_item_say.coffee b/lib/common/client/views/image_item_say.coffee index 8716062..b788ed7 100644 --- a/lib/common/client/views/image_item_say.coffee +++ b/lib/common/client/views/image_item_say.coffee @@ -1,7 +1,7 @@ -Template.imageItem.helpers +Template.imageItemSay.helpers firstPicture: -> imageUrl @images?[0], {mode: 2, w: screen.width, h: screen.width * 0.8, q: 100} -Template.imageItem.events +Template.imageItemSay.events 'click .image-item': -> Router.go "/post/detail?category=#{@category}&id=#{@_id}" 'click .image-item .user': (event)-> event.stopImmediatePropagation() diff --git a/lib/post/client/views/list_loader.html b/lib/post/client/views/list_loader.html index a00495f..7334361 100644 --- a/lib/post/client/views/list_loader.html +++ b/lib/post/client/views/list_loader.html @@ -1,11 +1,11 @@