Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Commit

Permalink
updating page titles on backbone views, #138
Browse files Browse the repository at this point in the history
  • Loading branch information
giggio committed Oct 27, 2013
1 parent 4fc2654 commit 59ec174
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions public/javascripts/areas/home/views/home.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ 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
@_showStoresView @stores
@_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
Expand All @@ -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
Expand All @@ -49,3 +52,4 @@ define [
$('#productSearchTerm').val searchTerm
@$('#storesPlaceHolder').empty()
@_showProductsSearchResultView products
document.title = "Ateliês - busca por produtos: #{searchTerm}"
1 change: 1 addition & 0 deletions public/javascripts/areas/store/views/cart.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions public/javascripts/areas/store/views/evaluations.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions public/javascripts/areas/store/views/product.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions public/javascripts/areas/store/views/store.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
2 changes: 1 addition & 1 deletion public/javascripts/areas/store/views/templates/store.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{#if hasEvaluations}}
<div id="evaluation">
<div id="ratingStars" data-average="{{evaluationAvgRating}}" data-id="1"></div>
<div id="ratingDescription">({{numberOfEvaluations}} avaliações, <a href="#evaluations">veja todas</a>)</div>
<div id="ratingDescription">({{numberOfEvaluations}} avaliações, <a href="evaluations">veja todas</a>)</div>
</div>
{{/if}}
{{#if userOwned}}
Expand Down

0 comments on commit 59ec174

Please sign in to comment.