Merge branch 'master' into feature/defaults
This commit is contained in:
commit
2dde77f8b0
27 changed files with 77 additions and 85 deletions
app
lib
services
surface
locale
models
schemas/subscriptions
styles
templates
views
editor
kinds
modal
play
server/commons
|
@ -17,7 +17,7 @@ module.exports = initializeFacebook = ->
|
||||||
if response.status is 'connected'
|
if response.status is 'connected'
|
||||||
|
|
||||||
# They have logged in to the app.
|
# They have logged in to the app.
|
||||||
Backbone.Mediator.publish 'facebook-logged-in', response: response
|
Backbone.Mediator.publish 'auth:logged-in-with-facebook', response: response
|
||||||
|
|
||||||
else if response.status is 'not_authorized'
|
else if response.status is 'not_authorized'
|
||||||
#
|
#
|
||||||
|
|
|
@ -53,6 +53,7 @@ module.exports = class CoordinateDisplay extends createjs.Container
|
||||||
wop = @camera.screenToWorld x: e.x, y: e.y
|
wop = @camera.screenToWorld x: e.x, y: e.y
|
||||||
wop.x = Math.round wop.x
|
wop.x = Math.round wop.x
|
||||||
wop.y = Math.round wop.y
|
wop.y = Math.round wop.y
|
||||||
|
Backbone.Mediator.publish 'tome:focus-editor', {}
|
||||||
Backbone.Mediator.publish 'surface:coordinate-selected', wop
|
Backbone.Mediator.publish 'surface:coordinate-selected', wop
|
||||||
|
|
||||||
onZoomUpdated: (e) ->
|
onZoomUpdated: (e) ->
|
||||||
|
|
|
@ -26,7 +26,6 @@ module.exports = class Dimmer extends CocoClass
|
||||||
build: ->
|
build: ->
|
||||||
@dimLayer = new createjs.Container()
|
@dimLayer = new createjs.Container()
|
||||||
@dimLayer.mouseEnabled = @dimLayer.mouseChildren = false
|
@dimLayer.mouseEnabled = @dimLayer.mouseChildren = false
|
||||||
@dimLayer.layerIndex = -10
|
|
||||||
@dimLayer.addChild @dimScreen = new createjs.Shape()
|
@dimLayer.addChild @dimScreen = new createjs.Shape()
|
||||||
@dimLayer.addChild @dimMask = new createjs.Shape()
|
@dimLayer.addChild @dimMask = new createjs.Shape()
|
||||||
@dimScreen.graphics.beginFill('rgba(0,0,0,0.5)').rect 0, 0, @camera.canvasWidth, @camera.canvasHeight
|
@dimScreen.graphics.beginFill('rgba(0,0,0,0.5)').rect 0, 0, @camera.canvasWidth, @camera.canvasHeight
|
||||||
|
|
|
@ -45,6 +45,13 @@ module.exports = class Mark extends CocoClass
|
||||||
@mark.visible = true
|
@mark.visible = true
|
||||||
@
|
@
|
||||||
|
|
||||||
|
setLayer: (layer) ->
|
||||||
|
return if layer is @layer
|
||||||
|
wasOn = @on
|
||||||
|
@toggle false
|
||||||
|
@layer = layer
|
||||||
|
@toggle true if wasOn
|
||||||
|
|
||||||
setSprite: (sprite) ->
|
setSprite: (sprite) ->
|
||||||
return if sprite is @sprite
|
return if sprite is @sprite
|
||||||
@sprite = sprite
|
@sprite = sprite
|
||||||
|
@ -131,7 +138,6 @@ module.exports = class Mark extends CocoClass
|
||||||
@mark.graphics.endFill()
|
@mark.graphics.endFill()
|
||||||
@mark.regX = width / 2
|
@mark.regX = width / 2
|
||||||
@mark.regY = height / 2
|
@mark.regY = height / 2
|
||||||
@mark.layerIndex = 10
|
|
||||||
@mark.cache -1, -1, width + 2, height + 2 # not actually faster than simple ellipse draw
|
@mark.cache -1, -1, width + 2, height + 2 # not actually faster than simple ellipse draw
|
||||||
|
|
||||||
buildRadius: (range) ->
|
buildRadius: (range) ->
|
||||||
|
|
|
@ -15,7 +15,6 @@ module.exports = class PlaybackOverScreen extends CocoClass
|
||||||
build: ->
|
build: ->
|
||||||
@dimLayer = new createjs.Container()
|
@dimLayer = new createjs.Container()
|
||||||
@dimLayer.mouseEnabled = @dimLayer.mouseChildren = false
|
@dimLayer.mouseEnabled = @dimLayer.mouseChildren = false
|
||||||
@dimLayer.layerIndex = -12
|
|
||||||
@dimLayer.addChild @dimScreen = new createjs.Shape()
|
@dimLayer.addChild @dimScreen = new createjs.Shape()
|
||||||
@dimScreen.graphics.beginFill('rgba(0,0,0,0.4)').rect 0, 0, @camera.canvasWidth, @camera.canvasHeight
|
@dimScreen.graphics.beginFill('rgba(0,0,0,0.4)').rect 0, 0, @camera.canvasWidth, @camera.canvasHeight
|
||||||
@dimLayer.cache 0, 0, @camera.canvasWidth, @camera.canvasHeight
|
@dimLayer.cache 0, 0, @camera.canvasWidth, @camera.canvasHeight
|
||||||
|
|
|
@ -21,7 +21,6 @@ module.exports = class PointChooser extends CocoClass
|
||||||
@shape.mouseEnabled = false
|
@shape.mouseEnabled = false
|
||||||
@shape.graphics.setStrokeStyle(1, 'round').beginStroke('#000000').beginFill('#fedcba')
|
@shape.graphics.setStrokeStyle(1, 'round').beginStroke('#000000').beginFill('#fedcba')
|
||||||
@shape.graphics.drawCircle(0, 0, 4).endFill()
|
@shape.graphics.drawCircle(0, 0, 4).endFill()
|
||||||
@shape.layerIndex = 100
|
|
||||||
|
|
||||||
onMouseDown: (e) =>
|
onMouseDown: (e) =>
|
||||||
return unless key.shift
|
return unless key.shift
|
||||||
|
|
|
@ -373,6 +373,11 @@ module.exports = class SpriteBoss extends CocoClass
|
||||||
@updateTarget()
|
@updateTarget()
|
||||||
return unless @selectionMark
|
return unless @selectionMark
|
||||||
@selectedSprite = null if @selectedSprite and (@selectedSprite.destroyed or not @selectedSprite.thang)
|
@selectedSprite = null if @selectedSprite and (@selectedSprite.destroyed or not @selectedSprite.thang)
|
||||||
|
# The selection mark should be on the ground layer, unless we're not a normal sprite (like a wall), in which case we'll place it higher so we can see it.
|
||||||
|
if @selectedSprite and @selectedSprite.imageObject.parent isnt @spriteLayers.Default
|
||||||
|
@selectionMark.setLayer @spriteLayers.Default
|
||||||
|
else if @selectedSprite
|
||||||
|
@selectionMark.setLayer @spriteLayers.Ground
|
||||||
@selectionMark.toggle @selectedSprite?
|
@selectionMark.toggle @selectedSprite?
|
||||||
@selectionMark.setSprite @selectedSprite
|
@selectionMark.setSprite @selectedSprite
|
||||||
@selectionMark.update()
|
@selectionMark.update()
|
||||||
|
|
|
@ -424,7 +424,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
oldHeight = parseInt @canvas.attr('height'), 10
|
oldHeight = parseInt @canvas.attr('height'), 10
|
||||||
aspectRatio = oldWidth / oldHeight
|
aspectRatio = oldWidth / oldHeight
|
||||||
pageWidth = $('#page-container').width() - 17 # 17px nano scroll bar
|
pageWidth = $('#page-container').width() - 17 # 17px nano scroll bar
|
||||||
if @realTime
|
if @realTime or @options.spectateGame
|
||||||
pageHeight = $('#page-container').height() - $('#control-bar-view').outerHeight() - $('#playback-view').outerHeight()
|
pageHeight = $('#page-container').height() - $('#control-bar-view').outerHeight() - $('#playback-view').outerHeight()
|
||||||
newWidth = Math.min pageWidth, pageHeight * aspectRatio
|
newWidth = Math.min pageWidth, pageHeight * aspectRatio
|
||||||
newHeight = newWidth / aspectRatio
|
newHeight = newWidth / aspectRatio
|
||||||
|
@ -483,11 +483,13 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY
|
worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY
|
||||||
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos
|
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos
|
||||||
Backbone.Mediator.publish 'surface:stage-mouse-down', event
|
Backbone.Mediator.publish 'surface:stage-mouse-down', event
|
||||||
|
Backbone.Mediator.publish 'tome:focus-editor', {}
|
||||||
|
|
||||||
onMouseUp: (e) =>
|
onMouseUp: (e) =>
|
||||||
return if @disabled
|
return if @disabled
|
||||||
onBackground = not @stage.hitTest e.stageX, e.stageY
|
onBackground = not @stage.hitTest e.stageX, e.stageY
|
||||||
Backbone.Mediator.publish 'surface:stage-mouse-up', onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e
|
Backbone.Mediator.publish 'surface:stage-mouse-up', onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e
|
||||||
|
Backbone.Mediator.publish 'tome:focus-editor', {}
|
||||||
|
|
||||||
onMouseWheel: (e) =>
|
onMouseWheel: (e) =>
|
||||||
# https://github.com/brandonaaron/jquery-mousewheel
|
# https://github.com/brandonaaron/jquery-mousewheel
|
||||||
|
|
|
@ -126,8 +126,8 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
||||||
level_difficulty: "Dificuldade: "
|
level_difficulty: "Dificuldade: "
|
||||||
play_as: "Jogar Como"
|
play_as: "Jogar Como"
|
||||||
spectate: "Espectar"
|
spectate: "Espectar"
|
||||||
# players: "players"
|
players: "jogadores"
|
||||||
# hours_played: "hours played"
|
hours_played: "horas jogadas"
|
||||||
|
|
||||||
contact:
|
contact:
|
||||||
contact_us: "Contacte o CodeCombat"
|
contact_us: "Contacte o CodeCombat"
|
||||||
|
@ -513,7 +513,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
||||||
toggle_grid: "Ativar/desativar a sobreposição da grelha."
|
toggle_grid: "Ativar/desativar a sobreposição da grelha."
|
||||||
toggle_pathfinding: "Ativar/desativar a sobreposição do encontrador de caminho."
|
toggle_pathfinding: "Ativar/desativar a sobreposição do encontrador de caminho."
|
||||||
beautify: "Embelezar o código ao estandardizar a formatação."
|
beautify: "Embelezar o código ao estandardizar a formatação."
|
||||||
# maximize_editor: "Maximize/minimize code editor."
|
maximize_editor: "Maximizar/minimizar o editor de código."
|
||||||
move_wizard: "Mover o seu Feiticeiro pelo nível."
|
move_wizard: "Mover o seu Feiticeiro pelo nível."
|
||||||
|
|
||||||
admin:
|
admin:
|
||||||
|
@ -910,7 +910,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
||||||
unknown: "Erro desconhecido."
|
unknown: "Erro desconhecido."
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
# sessions: "Sessions"
|
sessions: "Sessões"
|
||||||
your_sessions: "As Suas Sessões"
|
your_sessions: "As Suas Sessões"
|
||||||
level: "Nível"
|
level: "Nível"
|
||||||
social_network_apis: "APIs das Redes Sociais"
|
social_network_apis: "APIs das Redes Sociais"
|
||||||
|
@ -926,7 +926,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
||||||
patched_model: "Documento Fonte"
|
patched_model: "Documento Fonte"
|
||||||
model: "Modelo"
|
model: "Modelo"
|
||||||
system: "Sistema"
|
system: "Sistema"
|
||||||
# systems: "Systems"
|
systems: "Sistemas"
|
||||||
component: "Componente"
|
component: "Componente"
|
||||||
components: "Componentes"
|
components: "Componentes"
|
||||||
thang: "Thang"
|
thang: "Thang"
|
||||||
|
@ -941,16 +941,16 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
||||||
source_document: "Documento Fonte"
|
source_document: "Documento Fonte"
|
||||||
document: "Documento"
|
document: "Documento"
|
||||||
sprite_sheet: "Folha de Sprite"
|
sprite_sheet: "Folha de Sprite"
|
||||||
# employers: "Employers"
|
employers: "Empregadores"
|
||||||
# candidates: "Candidates"
|
candidates: "Candidatos"
|
||||||
candidate_sessions: "Sessões de Candidatos"
|
candidate_sessions: "Sessões de Candidatos"
|
||||||
user_remark: "Observação do Utilizador"
|
user_remark: "Observação do Utilizador"
|
||||||
# user_remarks: "User Remarks"
|
user_remarks: "Observações de Utilizador"
|
||||||
versions: "Versões"
|
versions: "Versões"
|
||||||
items: "Itens"
|
items: "Itens"
|
||||||
# wizard: "Wizard"
|
wizard: "Feiticeiro"
|
||||||
# achievement: "Achievement"
|
achievement: "Conquista"
|
||||||
# clas: "CLAs"
|
clas: "CLAs"
|
||||||
# play_counts: "Play Counts"
|
# play_counts: "Play Counts"
|
||||||
|
|
||||||
delta:
|
delta:
|
||||||
|
|
|
@ -210,6 +210,11 @@ class CocoModel extends Backbone.Model
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
getOwner: ->
|
||||||
|
return null unless permissions = @get 'permissions'
|
||||||
|
ownerPermission = _.find permissions, access: 'owner'
|
||||||
|
ownerPermission?.target
|
||||||
|
|
||||||
getDelta: ->
|
getDelta: ->
|
||||||
differ = deltasLib.makeJSONDiffer()
|
differ = deltasLib.makeJSONDiffer()
|
||||||
differ.diff @_revertAttributes, @attributes
|
differ.diff @_revertAttributes, @attributes
|
||||||
|
|
|
@ -23,5 +23,5 @@ module.exports =
|
||||||
bus: {$ref: 'bus'}
|
bus: {$ref: 'bus'}
|
||||||
|
|
||||||
'bus:player-states-changed': c.object {title: 'Player state changes', description: 'State of the players has changed'},
|
'bus:player-states-changed': c.object {title: 'Player state changes', description: 'State of the players has changed'},
|
||||||
states: c.array {}, {type: 'object'}
|
states: {type: 'object', additionalProperties: {type: 'object'}}
|
||||||
bus: {$ref: 'bus'}
|
bus: {$ref: 'bus'}
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports =
|
||||||
'router:navigate': c.object {required: ['route']},
|
'router:navigate': c.object {required: ['route']},
|
||||||
route: {type: 'string'}
|
route: {type: 'string'}
|
||||||
view: {type: 'object'}
|
view: {type: 'object'}
|
||||||
viewClass: {type: 'object'}
|
viewClass: {type: 'function'}
|
||||||
viewArgs: {type: 'array'}
|
viewArgs: {type: 'array'}
|
||||||
|
|
||||||
'achievements:new': c.object {required: 'earnedAchievements'},
|
'achievements:new': c.object {required: 'earnedAchievements'},
|
||||||
|
|
|
@ -66,6 +66,7 @@ module.exports = # /app/lib/surface
|
||||||
'surface:coordinate-selected': c.object {required: ['x', 'y']},
|
'surface:coordinate-selected': c.object {required: ['x', 'y']},
|
||||||
x: {type: 'number'}
|
x: {type: 'number'}
|
||||||
y: {type: 'number'}
|
y: {type: 'number'}
|
||||||
|
z: {type: 'number'}
|
||||||
|
|
||||||
'surface:coordinates-shown': c.object {}
|
'surface:coordinates-shown': c.object {}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
text-overflow: ellipsis
|
text-overflow: ellipsis
|
||||||
|
|
||||||
|
tr.mine
|
||||||
|
background-color: #f8ecaa
|
||||||
|
|
||||||
.loading
|
.loading
|
||||||
text-align: center
|
text-align: center
|
||||||
|
|
||||||
|
|
|
@ -38,17 +38,12 @@
|
||||||
margin: 0px auto
|
margin: 0px auto
|
||||||
|
|
||||||
#canvas-wrapper
|
#canvas-wrapper
|
||||||
height: 100%
|
width: 100%
|
||||||
position: relative
|
position: relative
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
|
|
||||||
canvas#surface
|
canvas#surface
|
||||||
background-color: #333
|
background-color: #333
|
||||||
max-height: 93%
|
|
||||||
max-height: -webkit-calc(100% - 60px)
|
|
||||||
max-height: calc(100% - 60px)
|
|
||||||
height: auto
|
|
||||||
max-width: 100%
|
|
||||||
display: block
|
display: block
|
||||||
z-index: 1
|
z-index: 1
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
table.table
|
extends /templates/kinds/table
|
||||||
tr
|
|
||||||
th(colspan=3)
|
|
||||||
span(data-i18n="general.results")
|
|
||||||
| Results
|
|
||||||
span
|
|
||||||
|: #{documents.length}
|
|
||||||
|
|
||||||
tr
|
|
||||||
th(data-i18n="general.name") Name
|
|
||||||
th(data-i18n="general.description") Description
|
|
||||||
th(data-i18n="general.version") Version
|
|
||||||
|
|
||||||
for data in documents
|
|
||||||
- data = data.attributes;
|
|
||||||
tr
|
|
||||||
td
|
|
||||||
a(href="/editor/article/#{data.slug || data._id}")
|
|
||||||
| #{data.name}
|
|
||||||
td.body-row #{data.description}
|
|
||||||
td #{data.version.major}.#{data.version.minor}
|
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
table.table
|
extends /templates/kinds/table
|
||||||
tr
|
|
||||||
th(colspan=3)
|
|
||||||
span(data-i18n="general.results")
|
|
||||||
| Results
|
|
||||||
span
|
|
||||||
|: #{documents.length}
|
|
||||||
|
|
||||||
tr
|
|
||||||
th(data-i18n="general.name") Name
|
|
||||||
th(data-i18n="general.description") Description
|
|
||||||
th(data-i18n="general.version") Version
|
|
||||||
|
|
||||||
for data in documents
|
|
||||||
- data = data.attributes;
|
|
||||||
tr
|
|
||||||
td
|
|
||||||
a(href="/editor/level/#{data.slug || data._id}")
|
|
||||||
| #{data.name}
|
|
||||||
td.body-row #{data.description}
|
|
||||||
td #{data.version.major}.#{data.version.minor}
|
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
table.table
|
extends /templates/kinds/table
|
||||||
|
|
||||||
|
block tableResultsHeader
|
||||||
tr
|
tr
|
||||||
th(colspan=3)
|
th(colspan=4)
|
||||||
span(data-i18n="general.results")
|
span(data-i18n="general.results")
|
||||||
| Results
|
| Results
|
||||||
span
|
span
|
||||||
|: #{documents.length}
|
|: #{documents.length}
|
||||||
|
|
||||||
|
block tableHeader
|
||||||
tr
|
tr
|
||||||
th#portrait-col
|
th#portrait-col
|
||||||
th(data-i18n="general.name") Name
|
th(data-i18n="general.name") Name
|
||||||
th(data-i18n="general.description") Description
|
th(data-i18n="general.description") Description
|
||||||
th(data-i18n="general.version") Version
|
th(data-i18n="general.version") Version
|
||||||
|
|
||||||
|
block tableBody
|
||||||
for thang in documents
|
for thang in documents
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
table.table
|
table.table
|
||||||
tr
|
block tableResultsHeader
|
||||||
th(colspan=3)
|
tr
|
||||||
span(data-i18n="general.results")
|
th(colspan=3)
|
||||||
| Results
|
span(data-i18n="general.results")
|
||||||
span
|
| Results
|
||||||
|: #{documents.length}
|
span
|
||||||
|
|: #{documents.length}
|
||||||
|
|
||||||
block tableHeader
|
block tableHeader
|
||||||
tr
|
tr
|
||||||
|
@ -13,9 +14,9 @@ table.table
|
||||||
th(data-i18n="general.version") Version
|
th(data-i18n="general.version") Version
|
||||||
|
|
||||||
block tableBody
|
block tableBody
|
||||||
for data in documents
|
for document in documents
|
||||||
- data = data.attributes;
|
- var data = document.attributes;
|
||||||
tr
|
tr(class=document.getOwner() == me.id ? 'mine' : '')
|
||||||
td
|
td
|
||||||
a(href="/editor/#{page}/#{data.slug || data._id}")
|
a(href="/editor/#{page}/#{data.slug || data._id}")
|
||||||
| #{data.name}
|
| #{data.name}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
.level-content
|
.level-content
|
||||||
#control-bar-view
|
#control-bar-view
|
||||||
#canvas-wrapper
|
#canvas-wrapper
|
||||||
canvas(width=1848, height=1178)#surface
|
canvas(width=924, height=589)#surface
|
||||||
#canvas-left-gradient.gradient
|
#canvas-left-gradient.gradient
|
||||||
#canvas-top-gradient.gradient
|
#canvas-top-gradient.gradient
|
||||||
#gold-view.secret.expanded
|
#gold-view.secret.expanded
|
||||||
|
|
|
@ -6,6 +6,7 @@ module.exports = class ArticleSearchView extends SearchView
|
||||||
model: require 'models/Article'
|
model: require 'models/Article'
|
||||||
modelURL: '/db/article'
|
modelURL: '/db/article'
|
||||||
tableTemplate: require 'templates/editor/article/table'
|
tableTemplate: require 'templates/editor/article/table'
|
||||||
|
page: 'article'
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
context = super()
|
context = super()
|
||||||
|
|
|
@ -6,6 +6,7 @@ module.exports = class LevelSearchView extends SearchView
|
||||||
model: require 'models/Level'
|
model: require 'models/Level'
|
||||||
modelURL: '/db/level'
|
modelURL: '/db/level'
|
||||||
tableTemplate: require 'templates/editor/level/table'
|
tableTemplate: require 'templates/editor/level/table'
|
||||||
|
page: 'level'
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
context = super()
|
context = super()
|
||||||
|
|
|
@ -7,6 +7,7 @@ module.exports = class ThangTypeSearchView extends SearchView
|
||||||
modelURL: '/db/thang.type'
|
modelURL: '/db/thang.type'
|
||||||
tableTemplate: require 'templates/editor/thang/table'
|
tableTemplate: require 'templates/editor/thang/table'
|
||||||
projection: ['original', 'name', 'version', 'description', 'slug', 'kind', 'rasterIcon']
|
projection: ['original', 'name', 'version', 'description', 'slug', 'kind', 'rasterIcon']
|
||||||
|
page: 'thang'
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
context = super()
|
context = super()
|
||||||
|
|
|
@ -7,11 +7,19 @@ class SearchCollection extends Backbone.Collection
|
||||||
initialize: (modelURL, @model, @term, @projection) ->
|
initialize: (modelURL, @model, @term, @projection) ->
|
||||||
@url = "#{modelURL}?project="
|
@url = "#{modelURL}?project="
|
||||||
if @projection? and not (@projection == [])
|
if @projection? and not (@projection == [])
|
||||||
@url += projection[0]
|
@url += 'created,permissions'
|
||||||
@url += ',' + projected for projected in projection[1..]
|
@url += ',' + projected for projected in projection
|
||||||
else @url += 'true'
|
else @url += 'true'
|
||||||
@url += "&term=#{term}" if @term
|
@url += "&term=#{term}" if @term
|
||||||
|
|
||||||
|
comparator: (a, b) ->
|
||||||
|
score = 0
|
||||||
|
score -= 9001900190019001 if a.getOwner() is me.id
|
||||||
|
score += 9001900190019001 if b.getOwner() is me.id
|
||||||
|
score -= new Date(a.get 'created')
|
||||||
|
score -= -(new Date(b.get 'created'))
|
||||||
|
if score < 0 then -1 else (if score > 0 then 1 else 0)
|
||||||
|
|
||||||
module.exports = class SearchView extends RootView
|
module.exports = class SearchView extends RootView
|
||||||
template: template
|
template: template
|
||||||
className: 'search-view'
|
className: 'search-view'
|
||||||
|
@ -67,8 +75,9 @@ module.exports = class SearchView extends RootView
|
||||||
|
|
||||||
onSearchChange: ->
|
onSearchChange: ->
|
||||||
@hideLoading()
|
@hideLoading()
|
||||||
|
@collection.sort()
|
||||||
documents = @collection.models
|
documents = @collection.models
|
||||||
table = $(@tableTemplate(documents:documents))
|
table = $(@tableTemplate(documents: documents, me: me, page: @page))
|
||||||
@$el.find('table').replaceWith(table)
|
@$el.find('table').replaceWith(table)
|
||||||
@$el.find('table').i18n()
|
@$el.find('table').i18n()
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,11 @@ module.exports = class WizardSettingsModal extends ModalView
|
||||||
res.error =>
|
res.error =>
|
||||||
errors = JSON.parse(res.responseText)
|
errors = JSON.parse(res.responseText)
|
||||||
console.warn 'Got errors saving user:', errors
|
console.warn 'Got errors saving user:', errors
|
||||||
|
return if @destroyed
|
||||||
forms.applyErrorsToForm(@$el, errors)
|
forms.applyErrorsToForm(@$el, errors)
|
||||||
@disableModalInProgress(@$el)
|
@disableModalInProgress(@$el)
|
||||||
|
|
||||||
res.success (model, response, options) =>
|
res.success (model, response, options) =>
|
||||||
@hide()
|
@hide() unless @destroyed
|
||||||
|
|
||||||
@enableModalInProgress(@$el)
|
@enableModalInProgress(@$el)
|
||||||
|
|
|
@ -221,7 +221,6 @@ module.exports = class SpectateLevelView extends RootView
|
||||||
else
|
else
|
||||||
console.log 'World scripts don\'t exist!'
|
console.log 'World scripts don\'t exist!'
|
||||||
nonVictoryPlaybackScripts = []
|
nonVictoryPlaybackScripts = []
|
||||||
console.log nonVictoryPlaybackScripts
|
|
||||||
@scriptManager = new ScriptManager({scripts: nonVictoryPlaybackScripts, view:@, session: @session})
|
@scriptManager = new ScriptManager({scripts: nonVictoryPlaybackScripts, view:@, session: @session})
|
||||||
@scriptManager.loadFromSession()
|
@scriptManager.loadFromSession()
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Patch = require '../patches/Patch'
|
||||||
User = require '../users/User'
|
User = require '../users/User'
|
||||||
sendwithus = require '../sendwithus'
|
sendwithus = require '../sendwithus'
|
||||||
|
|
||||||
PROJECT = {original: 1, name: 1, version: 1, description: 1, slug: 1, kind: 1}
|
PROJECT = {original: 1, name: 1, version: 1, description: 1, slug: 1, kind: 1, created: 1, permissions: 1}
|
||||||
FETCH_LIMIT = 300
|
FETCH_LIMIT = 300
|
||||||
|
|
||||||
module.exports = class Handler
|
module.exports = class Handler
|
||||||
|
|
Reference in a new issue