From 59ec1740ad342f2f90f8cc572afa51eb49a760c1 Mon Sep 17 00:00:00 2001 From: Giovanni Bassi Date: Sat, 26 Oct 2013 22:47:43 -0200 Subject: [PATCH] updating page titles on backbone views, #138 --- public/javascripts/areas/home/views/home.coffee | 4 ++++ public/javascripts/areas/store/views/cart.coffee | 1 + public/javascripts/areas/store/views/evaluations.coffee | 1 + public/javascripts/areas/store/views/product.coffee | 1 + public/javascripts/areas/store/views/store.coffee | 2 ++ public/javascripts/areas/store/views/templates/store.html | 2 +- 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/public/javascripts/areas/home/views/home.coffee b/public/javascripts/areas/home/views/home.coffee index 88d6096..7bc2e5e 100644 --- a/public/javascripts/areas/home/views/home.coffee +++ b/public/javascripts/areas/home/views/home.coffee @@ -17,6 +17,7 @@ define [ @products = opt.products @stores = opt.stores @showProductsAndStores() + document.title = "Ateliês - Shopping virtual de artes e afins" showProductsAndStores: -> context = Handlebars.compile @template @$el.html context @@ -24,6 +25,7 @@ define [ @_showProductsView @products searchStores: -> @$('#searchStores').attr('style', 'display:block !important;').show() + document.title = "Ateliês - busca por lojas" closeSearchStore: -> @$('#searchStores').hide('fade') Backbone.history.navigate "", true @@ -36,6 +38,7 @@ define [ @$('#storeSearchTerm').val searchTerm @$('#productsPlaceHolder').empty() @_showStoresView stores + document.title = "Ateliês - busca por lojas: #{searchTerm}" _showStoresView: (stores) -> @storesView = new StoresView stores:stores @$('#storesPlaceHolder').html @storesView.el @@ -49,3 +52,4 @@ define [ $('#productSearchTerm').val searchTerm @$('#storesPlaceHolder').empty() @_showProductsSearchResultView products + document.title = "Ateliês - busca por produtos: #{searchTerm}" diff --git a/public/javascripts/areas/store/views/cart.coffee b/public/javascripts/areas/store/views/cart.coffee index 583f3de..2e16169 100644 --- a/public/javascripts/areas/store/views/cart.coffee +++ b/public/javascripts/areas/store/views/cart.coffee @@ -22,6 +22,7 @@ define [ cartItems = Cart.get(@store.slug).items() @$el.html context cartItems: cartItems, store: @store, hasItems: cartItems.length isnt 0 @renderCartItems() + document.title = "#{@store.name} - Carrinho" super renderCartItems: => items = @cart.items() diff --git a/public/javascripts/areas/store/views/evaluations.coffee b/public/javascripts/areas/store/views/evaluations.coffee index f7c01ee..f240d50 100644 --- a/public/javascripts/areas/store/views/evaluations.coffee +++ b/public/javascripts/areas/store/views/evaluations.coffee @@ -24,6 +24,7 @@ define [ smallStarsPath : "#{staticPath}/images/jrating/small.png" rateMax: 5 isDisabled: on + document.title = "#{@store.name} - Avaliações" createNiceDate: (date) -> date = new Date(date) if typeof date is 'string' date = date.getTime() unless typeof date is 'number' diff --git a/public/javascripts/areas/store/views/product.coffee b/public/javascripts/areas/store/views/product.coffee index 851e0c8..48dbacf 100644 --- a/public/javascripts/areas/store/views/product.coffee +++ b/public/javascripts/areas/store/views/product.coffee @@ -80,6 +80,7 @@ define [ height: '-=50' , 500, -> $('.name,.price', @).hide() + document.title = "#{@store.name} - #{@product.get('name')}" super createNiceDate: (date) -> date = new Date(date) if typeof date is 'string' diff --git a/public/javascripts/areas/store/views/store.coffee b/public/javascripts/areas/store/views/store.coffee index d297926..89fb430 100644 --- a/public/javascripts/areas/store/views/store.coffee +++ b/public/javascripts/areas/store/views/store.coffee @@ -33,8 +33,10 @@ define [ isDisabled: on @productsView = new ProductsView products:@products @$('#productsPlaceHolder').html @productsView.el + document.title = @store.name super showProductsSearchResults: (searchTerm, products) -> $('#productSearchTerm').val searchTerm productsSearchResultsView = new ProductsSearchResultsView products:products @$('#productsPlaceHolder').html productsSearchResultsView.el + document.title = "#{@store.name} - busca por: #{searchTerm}" diff --git a/public/javascripts/areas/store/views/templates/store.html b/public/javascripts/areas/store/views/templates/store.html index 34f50ee..92c4a34 100644 --- a/public/javascripts/areas/store/views/templates/store.html +++ b/public/javascripts/areas/store/views/templates/store.html @@ -6,7 +6,7 @@ {{#if hasEvaluations}}
-
({{numberOfEvaluations}} avaliações, veja todas)
+
({{numberOfEvaluations}} avaliações, veja todas)
{{/if}} {{#if userOwned}}