mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-25 22:14:29 -05:00
Built the BuyGemsModal stub.
This commit is contained in:
parent
f1947d7d9d
commit
ad35109878
5 changed files with 61 additions and 0 deletions
|
@ -64,6 +64,7 @@
|
||||||
next: "Next" # Go from choose hero to choose inventory before playing a level
|
next: "Next" # Go from choose hero to choose inventory before playing a level
|
||||||
change_hero: "Change Hero" # Go back from choose inventory to choose hero
|
change_hero: "Change Hero" # Go back from choose inventory to choose hero
|
||||||
choose_inventory: "Equip Items"
|
choose_inventory: "Equip Items"
|
||||||
|
buy_gems: "Buy Gems"
|
||||||
older_campaigns: "Older Campaigns"
|
older_campaigns: "Older Campaigns"
|
||||||
anonymous: "Anonymous Player"
|
anonymous: "Anonymous Player"
|
||||||
level_difficulty: "Difficulty: "
|
level_difficulty: "Difficulty: "
|
||||||
|
|
8
app/styles/play/modal/buy-gems-modal.sass
Normal file
8
app/styles/play/modal/buy-gems-modal.sass
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#buy-gems-modal
|
||||||
|
button
|
||||||
|
width: 100%
|
||||||
|
margin-bottom: 10px
|
||||||
|
|
||||||
|
.gem
|
||||||
|
width: 20px
|
||||||
|
height: 20px
|
14
app/templates/play/modal/buy-gems-modal.jade
Normal file
14
app/templates/play/modal/buy-gems-modal.jade
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
extends /templates/modal/modal_base
|
||||||
|
|
||||||
|
block modal-header-content
|
||||||
|
h3(data-i18n='play.buy_gems')
|
||||||
|
|
||||||
|
block modal-body-content
|
||||||
|
for product in products
|
||||||
|
button.product.btn.btn-lg(value=product.id)
|
||||||
|
img.gem(src="/images/common/gem.png")
|
||||||
|
span x#{product.gems): #{product.price}
|
||||||
|
|
||||||
|
block modal-footer
|
||||||
|
.modal-footer
|
||||||
|
button(data-dismiss="modal", data-i18n="common.cancel").btn Cancel
|
|
@ -40,6 +40,7 @@
|
||||||
button.btn.items(data-toggle='coco-modal', data-target='play/modal/PlayItemsModal', data-i18n="[title]play.items")
|
button.btn.items(data-toggle='coco-modal', data-target='play/modal/PlayItemsModal', data-i18n="[title]play.items")
|
||||||
button.btn.heroes(data-toggle='coco-modal', data-target='play/modal/PlayHeroesModal', data-i18n="[title]play.heroes")
|
button.btn.heroes(data-toggle='coco-modal', data-target='play/modal/PlayHeroesModal', data-i18n="[title]play.heroes")
|
||||||
if me.isAdmin()
|
if me.isAdmin()
|
||||||
|
button.btn.gems(data-toggle='coco-modal', data-target='play/modal/BuyGemsModal', data-i18n="[title]play.buy_gems")
|
||||||
button.btn.achievements(data-toggle='coco-modal', data-target='play/modal/PlayAchievementsModal', data-i18n="[title]play.achievements")
|
button.btn.achievements(data-toggle='coco-modal', data-target='play/modal/PlayAchievementsModal', data-i18n="[title]play.achievements")
|
||||||
button.btn.account(data-toggle='coco-modal', data-target='play/modal/PlayAccountModal', data-i18n="[title]play.account")
|
button.btn.account(data-toggle='coco-modal', data-target='play/modal/PlayAccountModal', data-i18n="[title]play.account")
|
||||||
button.btn.settings(data-toggle='coco-modal', data-target='play/modal/PlaySettingsModal', data-i18n="[title]play.settings")
|
button.btn.settings(data-toggle='coco-modal', data-target='play/modal/PlaySettingsModal', data-i18n="[title]play.settings")
|
||||||
|
|
37
app/views/play/modal/BuyGemsModal.coffee
Normal file
37
app/views/play/modal/BuyGemsModal.coffee
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
ModalView = require 'views/kinds/ModalView'
|
||||||
|
template = require 'templates/play/modal/buy-gems-modal'
|
||||||
|
|
||||||
|
module.exports = class BuyGemsModal extends ModalView
|
||||||
|
id: 'buy-gems-modal'
|
||||||
|
template: template
|
||||||
|
plain: true
|
||||||
|
|
||||||
|
events:
|
||||||
|
'click button.product': 'onClickProductButton'
|
||||||
|
|
||||||
|
getRenderData: ->
|
||||||
|
c = super()
|
||||||
|
c.products = @getProducts()
|
||||||
|
return c
|
||||||
|
|
||||||
|
getProducts: ->
|
||||||
|
if application.isIPadApp
|
||||||
|
# Inject IAP data here.
|
||||||
|
|
||||||
|
else
|
||||||
|
return [
|
||||||
|
{ price: '$4.99', gems: 5000, id: 'gems_5' }
|
||||||
|
{ price: '$9.99', gems: 11000, id: 'gems_10' }
|
||||||
|
{ price: '$19.99', gems: 25000, id: 'gems_20' }
|
||||||
|
]
|
||||||
|
|
||||||
|
onClickProductButton: (e) ->
|
||||||
|
productID = $(e.target).closest('button.product').val()
|
||||||
|
product = _.find @getProducts(), { id: productID }
|
||||||
|
console.log 'wanna purchase product', product
|
||||||
|
|
||||||
|
if application.isIPadApp
|
||||||
|
# Trigger IAP here.
|
||||||
|
|
||||||
|
else
|
||||||
|
@$el.find('.modal-body').append($('<div class="alert alert-danger">Not implemented</div>'))
|
Loading…
Reference in a new issue