This commit is contained in:
Glen De Cauwsemaecker 2014-04-11 00:43:15 +02:00
commit 0d2323fce6
10 changed files with 86 additions and 49 deletions

View file

@ -112,7 +112,7 @@ module.exports = class LevelBus extends Bus
@changedSessionProperties.teamSpells = true
@session.set({'teamSpells': @teamSpellMap})
@saveSession()
if spellTeam is me.team
if spellTeam is me.team or spellTeam is "common"
@onSpellChanged e # Save the new spell to the session, too.
onScriptStateChanged: (e) ->

View file

@ -102,7 +102,7 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi
spectate: "Наблюдать"
contact:
contact_us: "Связаться с CodeCombat"
contact_us: "Связаться с Нами"
welcome: "Мы рады вашему сообщению! Используйте эту форму, чтобы отправить нам email. "
contribute_prefix: "Если вы хотите внести свой вклад в проект, зайдите на нашу "
contribute_page: "страницу сотрудничества"
@ -604,21 +604,21 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi
so_ready: "Я полностью готов(а) для этого"
# loading_error:
# could_not_load: "Error loading from server"
# connection_failure: "Connection failed."
# could_not_load: "Ошибка соединения с сервером"
# connection_failure: "Соединение потеряно."
# unauthorized: "You need to be signed in. Do you have cookies disabled?"
# forbidden: "You do not have the permissions."
# not_found: "Not found."
# not_found: "Не наидено."
# not_allowed: "Method not allowed."
# timeout: "Server timeout."
# conflict: "Resource conflict."
# bad_input: "Bad input."
# server_error: "Server error."
# unknown: "Unknown error."
# server_error: "Ошибка сервера."
# unknown: "Неизвестная ошибка."
# resources:
# your_sessions: "Your Sessions"
# level: "Level"
# level: "Уровень"
# social_network_apis: "Social Network APIs"
# facebook_status: "Facebook Status"
# facebook_friends: "Facebook Friends"

View file

@ -5,7 +5,7 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
sending: "Gönderiliyor..."
cancel: "İptal"
save: "Kaydet"
# create: "Create"
create: "Oluştur"
delay_1_sec: "1 saniye"
delay_3_sec: "3 saniye"
delay_5_sec: "5 saniye"
@ -16,11 +16,11 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
units:
second: "saniye"
seconds: "saniyeler"
seconds: "saniye"
minute: "dakika"
minutes: "dakikalar"
minutes: "dakika"
hour: "saat"
hours: "saatler"
hours: "saat"
modal:
close: "Kapat"
@ -224,13 +224,13 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
tome_available_spells: "Kullanılabilir Büyüler"
hud_continue: "Devam (ÜstKarakter+Boşluk)"
spell_saved: "Büyü Kaydedildi"
# skip_tutorial: "Skip (esc)"
skip_tutorial: "Atla (esc)"
# editor_config: "Editor Config"
# editor_config_title: "Editor Configuration"
# editor_config_language_label: "Programming Language"
# editor_config_language_description: "Define the programming language you want to code in."
# editor_config_keybindings_label: "Key Bindings"
# editor_config_keybindings_default: "Default (Ace)"
editor_config_keybindings_default: "Varsayılan (Ace)"
# editor_config_keybindings_description: "Adds additional shortcuts known from the common editors."
# editor_config_invisibles_label: "Show Invisibles"
# editor_config_invisibles_description: "Displays invisibles such as spaces or tabs."
@ -238,7 +238,7 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
# editor_config_indentguides_description: "Displays vertical lines to see indentation better."
# editor_config_behaviors_label: "Smart Behaviors"
# editor_config_behaviors_description: "Autocompletes brackets, braces, and quotes."
# loading_ready: "Ready!"
loading_ready: "Hazır!"
# tip_insert_positions: "Shift+Click a point on the map to insert it into the spell editor."
# tip_toggle_play: "Toggle play/paused with Ctrl+P."
# tip_scrub_shortcut: "Ctrl+[ and Ctrl+] rewind and fast-forward."
@ -267,9 +267,9 @@ module.exports = nativeDescription: "Türkçe", englishDescription: "Turkish", t
# tip_impossible: "It always seems impossible until it's done. - Nelson Mandela"
# tip_talk_is_cheap: "Talk is cheap. Show me the code. - Linus Torvalds"
# tip_first_language: "The most disastrous thing that you can ever learn is your first programming language. - Alan Kay"
# time_current: "Now:"
# time_total: "Max:"
# time_goto: "Go to:"
time_current: "Şimdi:"
time_total: "Max:"
time_goto: "Git:"
admin:
av_title: "Yönetici Görünümleri"

View file

@ -22,7 +22,9 @@
position: absolute
z-index: 20
$UNVEIL_TIME: 1.2s
pointer-events: none
&.unveiled
pointer-events: none
.loading-details
position: absolute

View file

@ -55,16 +55,16 @@ class LiveEditingMarkup extends TreemaNode.nodeMap.ace
buildValueForDisplay: (valEl) ->
@editor?.destroy()
valEl.html(marked(@data))
class SoundFileTreema extends TreemaNode.nodeMap.string
valueClass: 'treema-sound-file'
editable: false
soundCollection: 'files'
onClick: (e) ->
return if $(e.target).closest('.btn').length
super(arguments...)
getFiles: ->
@settings[@soundCollection]?.models or []
@ -76,7 +76,7 @@ class SoundFileTreema extends TreemaNode.nodeMap.string
.click(@playFile)
stopButton = $('<a class="btn"><i class="icon-stop"></i></a>')
.click(@stopFile)
dropdown = $('<div class="btn-group dropdown"></div>')
dropdownButton = $('<a></a>')
@ -84,9 +84,9 @@ class SoundFileTreema extends TreemaNode.nodeMap.string
.attr('href', '#')
.append($('<span class="caret"></span>'))
.dropdown()
dropdown.append dropdownButton
menu = $('<div class="dropdown-menu"></div>')
files = @getFiles()
for file in files
@ -102,7 +102,7 @@ class SoundFileTreema extends TreemaNode.nodeMap.string
@data = $(e.target).data('fullPath') or @data
@reset()
dropdown.append(menu)
valEl.append(pickButton)
if @data
valEl.append(playButton)
@ -112,12 +112,12 @@ class SoundFileTreema extends TreemaNode.nodeMap.string
path = @data.split('/')
name = path[path.length-1]
valEl.append($('<span></span>').text(name))
reset: ->
@instance = null
@flushChanges()
@refreshDisplay()
playFile: =>
@src = "/file/#{@data}"
@ -129,27 +129,27 @@ class SoundFileTreema extends TreemaNode.nodeMap.string
registered = createjs.Sound.registerSound(@src)
if registered is true
@instance = createjs.Sound.play(@src)
else
f = (event) =>
@instance = createjs.Sound.play(event.src) if event.src is @src
createjs.Sound.removeEventListener('fileload', f)
createjs.Sound.addEventListener('fileload', f)
stopFile: => @instance?.stop()
onFileChosen: (InkBlob) =>
if not @settings.filePath
console.error('Need to specify a filePath for this treema', @getRoot())
throw Error('cannot upload file')
body =
url: InkBlob.url
filename: InkBlob.filename
mimetype: InkBlob.mimetype
path: @settings.filePath
force: true
@uploadingPath = [@settings.filePath, InkBlob.filename].join('/')
$.ajax('/file', { type: 'POST', data: body, success: @onFileUploaded })
@ -279,13 +279,13 @@ class LatestVersionReferenceNode extends TreemaNode
search: =>
term = @getValEl().find('input').val()
return if term is @lastTerm
# HACK while search is broken
if @collection
@lastTerm = term
@searchCallback()
return
@getSearchResultsEl().empty() if @lastTerm and not term
return unless term
@lastTerm = term
@ -295,9 +295,9 @@ class LatestVersionReferenceNode extends TreemaNode
# HACK while search is broken
# @collection.url = "#{@url}?term=#{term}&project=true"
@collection.url = "#{@url}?term=#{''}&project=true"
@collection.fetch()
@listenTo(@collection, 'sync', @searchCallback)
@collection.once 'sync', @searchCallback, @
searchCallback: ->
container = @getSearchResultsEl().detach().empty()
@ -306,10 +306,10 @@ class LatestVersionReferenceNode extends TreemaNode
row = $('<div></div>').addClass('treema-search-result-row')
text = @formatDocument(model)
continue unless text?
# HACK while search is broken
continue unless text.toLowerCase().indexOf(@lastTerm.toLowerCase()) >= 0
row.addClass('treema-search-selected') if first
first = false
row.text(text)

View file

@ -34,7 +34,7 @@ module.exports = class SystemsTabView extends View
do (url) -> ls.url = -> url
continue if @supermodel.getModelByURL ls.url
ls.fetch()
@listenTo(ls, 'sync', @onSystemLoaded)
@listenToOnce ls, 'sync', @onSystemLoaded
++@toLoad
@onDefaultSystemsLoaded() unless @toLoad
@ -63,7 +63,7 @@ module.exports = class SystemsTabView extends View
systemModelMap = {}
systemModelMap[sys.get('original')] = sys.get('name') for sys in systemModels
systems = _.sortBy systems, (sys) -> systemModelMap[sys.original]
treemaOptions =
# TODO: somehow get rid of the + button, or repurpose it to open the LevelSystemAddView instead
supermodel: @supermodel
@ -143,6 +143,8 @@ class LevelSystemNode extends TreemaObjectNode
@collection = @system?.attributes?.configSchema?.properties?
grabDBComponent: ->
unless _.isString @data.original
return alert('Press the "Add System" button at the bottom instead of the "+". Sorry.')
@system = @settings.supermodel.getModelByOriginalAndMajorVersion LevelSystem, @data.original, @data.majorVersion
#@system = _.find @settings.supermodel.getModels(LevelSystem), (m) =>
# m.get('original') is @data.original and m.get('version').major is @data.majorVersion

View file

@ -11,6 +11,7 @@ module.exports = class LadderPlayModal extends View
closeButton: true
startsLoading: true
@shownTutorialButton: false
tutorialLevelExists: null
events:
'click #skip-tutorial-button': 'hideTutorialButtons'
@ -21,7 +22,7 @@ module.exports = class LadderPlayModal extends View
@otherTeam = if team is 'ogres' then 'humans' else 'ogres'
@startLoadingChallengersMaybe()
@wizardType = ThangType.loadUniversalWizard()
# PART 1: Load challengers from the db unless some are in the matches
startLoadingChallengersMaybe: ->
@ -58,9 +59,11 @@ module.exports = class LadderPlayModal extends View
# PART 4: Render
finishRendering: ->
@startsLoading = false
@render()
@maybeShowTutorialButtons()
@checkTutorialLevelExists (exists) =>
@tutorialLevelExists = exists
@startsLoading = false
@render()
@maybeShowTutorialButtons()
getRenderData: ->
ctx = super()
@ -94,7 +97,7 @@ module.exports = class LadderPlayModal extends View
ctx
maybeShowTutorialButtons: ->
return if @session or LadderPlayModal.shownTutorialButton
return if @session or LadderPlayModal.shownTutorialButton or not @tutorialLevelExists
@$el.find('#normal-view').addClass('secret')
@$el.find('.modal-header').addClass('secret')
@$el.find('#noob-view').removeClass('secret')
@ -105,6 +108,17 @@ module.exports = class LadderPlayModal extends View
@$el.find('.modal-header').removeClass('secret')
@$el.find('#noob-view').addClass('secret')
checkTutorialLevelExists: (cb) ->
levelID = @level.get('slug') or @level.id
tutorialLevelID = "#{levelID}-tutorial"
success = => cb true
failure = => cb false
$.ajax
type: "GET"
url: "/db/level/#{tutorialLevelID}/exists"
success: success
error: failure
# Choosing challengers
getChallengers: ->

View file

@ -8,7 +8,7 @@ module.exports = class LevelLoadingView extends View
subscriptions:
'level-loader:progress-changed': 'onLevelLoaderProgressChanged'
afterRender: ->
@$el.find('.tip.rare').remove() if _.random(1, 10) < 9
tips = @$el.find('.tip').addClass('to-remove')
@ -34,6 +34,7 @@ module.exports = class LevelLoadingView extends View
reallyUnveil: =>
return if @destroyed
@$el.addClass 'unveiled'
loadingDetails = @$el.find('.loading-details')
duration = parseFloat loadingDetails.css 'transition-duration'
loadingDetails.css 'top', -loadingDetails.outerHeight(true)

View file

@ -90,6 +90,8 @@ module.exports = class Spell
problems:
jshint_W040: {level: "ignore"}
jshint_W030: {level: "ignore"} # aether_NoEffect instead
jshint_W038: {level: "ignore"} #eliminates hoisting problems
jshint_W091: {level: "ignore"} #eliminates more hoisting problems
aether_MissingThis: {level: (if thang.requiresThis then 'error' else 'warning')}
language: aceConfig.language ? 'javascript'
functionName: @name

View file

@ -37,7 +37,7 @@ LevelHandler = class LevelHandler extends Handler
return @getLeaderboardFacebookFriends(req, res, args[0]) if args[1] is 'leaderboard_facebook_friends'
return @getLeaderboardGPlusFriends(req, res, args[0]) if args[1] is 'leaderboard_gplus_friends'
return @getHistogramData(req, res, args[0]) if args[1] is 'histogram_data'
return @checkExistence(req, res, args[0]) if args[1] is 'exists'
return @sendNotFoundError(res)
fetchLevelByIDAndHandleErrors: (id, req, res, callback) ->
@ -130,7 +130,23 @@ LevelHandler = class LevelHandler extends Handler
if err? then return @sendDatabaseError res, err
valueArray = _.pluck data, "totalScore"
@sendSuccess res, valueArray
checkExistence: (req, res, slugOrID) ->
findParameters = {}
if Handler.isID slugOrID
findParameters["_id"] = slugOrID
else
findParameters["slug"] = slugOrID
selectString = 'original version.major permissions'
query = Level.findOne(findParameters)
.select(selectString)
.lean()
query.exec (err, level) =>
return @sendDatabaseError(res, err) if err
return @sendNotFoundError(res) unless level?
res.send({"exists":true})
res.end()
getLeaderboard: (req, res, id) ->
sessionsQueryParameters = @makeLeaderboardQueryParameters(req, id)