Commit e273780d
Changed files (52)
app
assets
javascripts
controllers
lib
models
routers
service
views
my
cakes
passwords
photos
profiles
spec
javascripts
initializers
views
app/assets/javascripts/controllers/my/cakes_controller.js.coffee
@@ -1,33 +1,25 @@
-class CakeSide.Controllers.My.CakesController extends Marionette.Controller
- views: CakeSide.Views.My.Cakes
+class csx.Controllers.My.CakesController extends Marionette.Controller
+ views: csx.Views.My.Cakes
initialize: (options) ->
- @content_region = CakeSide.Application.content_region
- @cakes = CakeSide.Application.request('CakesRepository')
- #@comment_view = CakeSide.Application.request('CommentView')
+ @content_region = csx.Application.content_region
+ @cakes = csx.Application.request('CakesRepository')
index: ->
@selectTab()
- #@comment_view.hide()
@content_region.show(new @views.IndexView(collection: @cakes))
show: (id, photo_id) ->
@selectTab()
cake = @cakes.get(id)
@content_region.show(new @views.ShowView(model: cake, photo_id: photo_id))
- #@comment_view.render
- #identifier: "c-#{cake.id}"
- #title: cake.get('name')
- #url: cake.public_url()
newCake: ->
@selectTab()
- #@comment_view.hide()
@content_region.show(new @views.NewView(collection: @cakes))
edit: (id) ->
@selectTab()
@content_region.show(new @views.EditView(model: @cakes.get(id)))
- #@comment_view.hide()
selectTab: ->
$('.nav-link').removeClass('active')
app/assets/javascripts/controllers/my/dashboard_controller.js.coffee
@@ -1,6 +1,1 @@
-class CakeSide.Controllers.My.DashboardController extends Marionette.Controller
- initialize: (options) ->
- #@comment_view = CakeSide.Application.request('CommentView')
-
- index: ->
- #@comment_view.hide()
+class csx.Controllers.My.DashboardController extends Marionette.Controller
app/assets/javascripts/controllers/my/profile_controller.js.coffee
@@ -1,13 +1,11 @@
-class CakeSide.Controllers.My.ProfileController extends Marionette.Controller
- views: CakeSide.Views.My.Profiles
+class csx.Controllers.My.ProfileController extends Marionette.Controller
+ views: csx.Views.My.Profiles
initialize: (options) ->
- @content_region = CakeSide.Application.content_region
- #@comment_view = CakeSide.Application.request('CommentView')
+ @content_region = csx.Application.content_region
show: (id) ->
@selectTab()
- #@comment_view.hide()
- profile = new CakeSide.Models.Profile
+ profile = new csx.Models.Profile
id: id
profile.fetch
success: =>
app/assets/javascripts/controllers/my/tutorials_controller.js.coffee
@@ -1,28 +1,21 @@
-class CakeSide.Controllers.My.TutorialsController extends Marionette.Controller
- views: CakeSide.Views.My.Tutorials
+class csx.Controllers.My.TutorialsController extends Marionette.Controller
+ views: csx.Views.My.Tutorials
initialize: (options) ->
- @content_region = CakeSide.Application.content_region
- @tutorials = CakeSide.Application.request('TutorialsRepository')
- #@comment_view = CakeSide.Application.request('CommentView')
+ @content_region = csx.Application.content_region
+ @tutorials = csx.Application.request('TutorialsRepository')
index: ->
@selectTab()
- #@comment_view.hide()
@content_region.show(new @views.IndexView(collection: @tutorials))
new: ->
@selectTab()
- #@comment_view.hide()
@content_region.show(new @views.NewView(collection: @tutorials))
show: (id) ->
@selectTab()
tutorial = @tutorials.get(id)
@content_region.show(new @views.ShowView(model: tutorial))
- #@comment_view.render
- #identifier: "t-#{tutorial.id}"
- #title: tutorial.get('heading')
- #url: tutorial.get('url')
selectTab: ->
$('.nav-link').removeClass('active')
app/assets/javascripts/initializers/auto_view_setup.js.coffee
@@ -1,6 +1,6 @@
#= require ./behaviour
-class CakeSide.AutoViewSetup extends CakeSide.Behaviour
+class csx.AutoViewSetup extends csx.Behaviour
@on "ready"
@on "ajaxComplete"
@@ -12,8 +12,8 @@ class CakeSide.AutoViewSetup extends CakeSide.Behaviour
install: (element) ->
viewName = element.data('autoview')
if viewName.indexOf("-") > 0
- CakeSide.AutoView.install(element)
+ csx.AutoView.install(element)
else
- constructor = CakeSide.Proxy.create(CakeSide.Views, viewName)
- CakeSide.AutoView.create(viewName, element, constructor)
+ constructor = csx.Proxy.create(csx.Views, viewName)
+ csx.AutoView.create(viewName, element, constructor)
element.data('autoview-setup-complete', true)
app/assets/javascripts/initializers/behaviour.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Behaviour
+class csx.Behaviour
@on: (event) ->
behaviour = new this()
$(document).on event, () =>
app/assets/javascripts/initializers/infinite_scroll.js.coffee
@@ -1,6 +1,6 @@
#= require ./behaviour
-class CakeSide.InfiniteScroll extends CakeSide.Behaviour
+class csx.InfiniteScroll extends csx.Behaviour
PERCENTAGE=0.8
@on "scroll"
app/assets/javascripts/lib/proxy.js.coffee
@@ -1,7 +1,7 @@
-class CakeSide.Proxy
+class csx.Proxy
@create: do ->
parse = (object, path) ->
- return unless CakeSide.Proxy.typeOf(object) == 'object' and path?
+ return unless csx.Proxy.typeOf(object) == 'object' and path?
return [object, path] if path.indexOf('.') == -1
path = path.split('.')
tail = path.pop()
@@ -23,7 +23,7 @@ class CakeSide.Proxy
(object, path, value) ->
return read(object, path) if arguments.length == 2
return write(object, path, value) if arguments.length == 3
- console.error '[CakeSide.Proxy.create] incorrect number of arguments'
+ console.error '[csx.Proxy.create] incorrect number of arguments'
@typeOf: (object) ->
return 'array' if _.isArray(object)
app/assets/javascripts/models/cake.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Models.Cake extends Backbone.Model
+class csx.Models.Cake extends Backbone.Model
paramRoot: 'cake'
defaults:
@@ -14,7 +14,7 @@ class CakeSide.Models.Cake extends Backbone.Model
return "Category can't be blank" unless attributes.category_id
photos: ->
- CakeSide.Application.request('PhotosRepository', @id)
+ csx.Application.request('PhotosRepository', @id)
public_url: ->
"#{window.location.origin}/creations/#{@get('slug')}"
@@ -22,6 +22,6 @@ class CakeSide.Models.Cake extends Backbone.Model
category_id: ->
@get('category_id') || @get('category').id
-class CakeSide.Collections.CakesCollection extends Backbone.Collection
- model: CakeSide.Models.Cake
+class csx.Collections.CakesCollection extends Backbone.Collection
+ model: csx.Models.Cake
url: '/api/v1/cakes'
app/assets/javascripts/models/category.js.coffee
@@ -1,10 +1,10 @@
-class CakeSide.Models.Category extends Backbone.Model
+class csx.Models.Category extends Backbone.Model
paramRoot: 'category'
defaults:
name: null
slug: null
-class CakeSide.Collections.CategoriesCollection extends Backbone.Collection
- model: CakeSide.Models.Category
+class csx.Collections.CategoriesCollection extends Backbone.Collection
+ model: csx.Models.Category
url: '/api/v1/categories'
app/assets/javascripts/models/email.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Models.Email
+class csx.Models.Email
EMAIL_REGEX=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/
constructor: (email) ->
app/assets/javascripts/models/photo.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Models.Photo extends Backbone.Model
+class csx.Models.Photo extends Backbone.Model
paramRoot: 'photo'
fileAttribute: 'image'
@@ -22,8 +22,8 @@ class CakeSide.Models.Photo extends Backbone.Model
super(options)
-class CakeSide.Collections.PhotosCollection extends Backbone.Collection
- model: CakeSide.Models.Photo
+class csx.Collections.PhotosCollection extends Backbone.Collection
+ model: csx.Models.Photo
initialize: (options) ->
@set('cake_id', options.cake_id)
app/assets/javascripts/models/profile.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Models.Profile extends Backbone.Model
+class csx.Models.Profile extends Backbone.Model
paramRoot: 'profile'
urlRoot: '/api/v1/profiles'
modelEvents:
@@ -33,6 +33,6 @@ class CakeSide.Models.Profile extends Backbone.Model
regex = /^@?(\w){1,15}$/
regex.test(twitter)
-class CakeSide.Collections.ProfilesCollection extends Backbone.Collection
- model: CakeSide.Models.Profile
+class csx.Collections.ProfilesCollection extends Backbone.Collection
+ model: csx.Models.Profile
url: '/api/v1/profiles'
app/assets/javascripts/models/registration.js.coffee
@@ -1,7 +1,7 @@
#= require ./translation
-class CakeSide.Models.Registration extends Backbone.Model
- translation: new CakeSide.Translation('user')
+class csx.Models.Registration extends Backbone.Model
+ translation: new csx.Translation('user')
defaults:
name: null
email: null
@@ -12,7 +12,7 @@ class CakeSide.Models.Registration extends Backbone.Model
validate: (attributes, options) ->
errors = {}
- unless new CakeSide.Models.Email(attributes.email).isValid()
+ unless new csx.Models.Email(attributes.email).isValid()
errors['email'] = @translation.errorFor('email', 'invalid')
_.each @requiredFields, (field) =>
app/assets/javascripts/models/session.js.coffee
@@ -1,8 +1,8 @@
#= require ./translation
-class CakeSide.Models.Session extends Backbone.Model
+class csx.Models.Session extends Backbone.Model
modelKey: 'session'
- translation: new CakeSide.Translation('session')
+ translation: new csx.Translation('session')
defaults:
email: null
password: null
@@ -12,7 +12,7 @@ class CakeSide.Models.Session extends Backbone.Model
validate: (attributes, options) ->
errors = {}
- unless new CakeSide.Models.Email(attributes.email).isValid()
+ unless new csx.Models.Email(attributes.email).isValid()
errors['email'] = @translation.errorFor('email', 'invalid')
_.each @requiredFields, (field) =>
app/assets/javascripts/models/translation.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Translation
+class csx.Translation
constructor: (modelKey) ->
@modelKey = modelKey
app/assets/javascripts/models/tutorials.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Models.Tutorial extends Backbone.Model
+class csx.Models.Tutorial extends Backbone.Model
paramRoot: 'tutorial'
defaults:
@@ -19,6 +19,6 @@ class CakeSide.Models.Tutorial extends Backbone.Model
hasImage: (image_url) ->
image_url
-class CakeSide.Collections.TutorialsCollection extends Backbone.Collection
- model: CakeSide.Models.Tutorial
+class csx.Collections.TutorialsCollection extends Backbone.Collection
+ model: csx.Models.Tutorial
url: '/api/v1/tutorials'
app/assets/javascripts/routers/cakes_router.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Routers.CakesRouter extends Marionette.AppRouter
+class csx.Routers.CakesRouter extends Marionette.AppRouter
appRoutes:
"cakes/new": "newCake"
"cakes/:id/edit": "edit"
app/assets/javascripts/routers/dashboard_router.js.coffee
@@ -1,3 +1,3 @@
-class CakeSide.Routers.DashboardRouter extends Marionette.AppRouter
+class csx.Routers.DashboardRouter extends Marionette.AppRouter
appRoutes:
"": "index"
app/assets/javascripts/routers/profile_router.js.coffee
@@ -1,3 +1,3 @@
-class CakeSide.Routers.ProfileRouter extends Marionette.AppRouter
+class csx.Routers.ProfileRouter extends Marionette.AppRouter
appRoutes:
"profile/:id": "show"
app/assets/javascripts/routers/tutorials_router.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Routers.TutorialsRouter extends Marionette.AppRouter
+class csx.Routers.TutorialsRouter extends Marionette.AppRouter
appRoutes:
"tutorials": "index"
"tutorials/new": "new"
app/assets/javascripts/service/embedly_service.js.coffee
@@ -1,3 +1,3 @@
-class CakeSide.EmbedlyService
+class csx.EmbedlyService
retrieve_info_on: (url, callback) ->
$.embedly.extract(url, {}).progress(callback)
app/assets/javascripts/views/cakes/card.js.coffee
@@ -1,4 +1,4 @@
#= require views/auto_view
-class CakeSide.Views.Cakes.Card extends CakeSide.AutoView
+class csx.Views.Cakes.Card extends csx.AutoView
@viewName 'cake-card'
app/assets/javascripts/views/cakes/show_page.js.coffee
@@ -1,6 +1,6 @@
#= require views/auto_view
-class CakeSide.Views.Cakes.ShowPage extends CakeSide.AutoView
+class csx.Views.Cakes.ShowPage extends csx.AutoView
@viewName "cakes#show"
render: ->
app/assets/javascripts/views/my/cakes/cake_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Cakes.CakeView extends Marionette.ItemView
+class csx.Views.My.Cakes.CakeView extends Marionette.ItemView
template: JST["templates/my/cakes/cake"]
tagName: 'div'
className: 'media'
app/assets/javascripts/views/my/cakes/delete_cake_modal_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Cakes.DeleteCakeModalView extends Marionette.ItemView
+class csx.Views.My.Cakes.DeleteCakeModalView extends Marionette.ItemView
template: JST["templates/my/cakes/delete_modal"]
ui:
remove_button: "#remove-button"
app/assets/javascripts/views/my/cakes/edit_view.js.coffee
@@ -1,8 +1,8 @@
#= require views/my/cakes/thumbnail_view
-class CakeSide.Views.My.Cakes.EditView extends Marionette.CompositeView
+class csx.Views.My.Cakes.EditView extends Marionette.CompositeView
template : JST["templates/my/cakes/edit"]
- childView: CakeSide.Views.My.Cakes.ThumbnailView
+ childView: csx.Views.My.Cakes.ThumbnailView
childViewContainer: '.card-columns'
ui:
name: "#cake_name"
@@ -43,7 +43,7 @@ class CakeSide.Views.My.Cakes.EditView extends Marionette.CompositeView
couldNotSave: (cake, xhr) =>
@enableSaveButton()
- error = new CakeSide.Views.ErrorView
+ error = new csx.Views.ErrorView
el: @$('form#edit-cake'),
attributesWithErrors: $.parseJSON(xhr.responseText)
error.render()
@@ -68,11 +68,11 @@ class CakeSide.Views.My.Cakes.EditView extends Marionette.CompositeView
serializeData: ->
{
cake: @model.toJSON(),
- categories: CakeSide.Application.request('CategoriesRepository').toJSON(),
+ categories: csx.Application.request('CategoriesRepository').toJSON(),
}
launchAddPhoto: ->
- @displayModal(new CakeSide.Views.Photos.NewModalView(cake: @model))
+ @displayModal(new csx.Views.Photos.NewModalView(cake: @model))
displayModal: (view) ->
$("#modal").html(view.render().el)
app/assets/javascripts/views/my/cakes/index_view.js.coffee
@@ -1,7 +1,7 @@
#= require views/my/cakes/no_cakes_view
-class CakeSide.Views.My.Cakes.IndexView extends Marionette.CollectionView
- childView: CakeSide.Views.My.Cakes.CakeView
- emptyView: CakeSide.Views.My.Cakes.NoCakesView
+class csx.Views.My.Cakes.IndexView extends Marionette.CollectionView
+ childView: csx.Views.My.Cakes.CakeView
+ emptyView: csx.Views.My.Cakes.NoCakesView
className: ''
tagName: 'div'
app/assets/javascripts/views/my/cakes/new_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Cakes.NewView extends Marionette.ItemView
+class csx.Views.My.Cakes.NewView extends Marionette.ItemView
template: JST["templates/my/cakes/new"]
ui:
name: "#cake_name"
@@ -34,7 +34,7 @@ class CakeSide.Views.My.Cakes.NewView extends Marionette.ItemView
couldNotSave: (cake, xhr) =>
@enableSaveButton()
- error = new CakeSide.Views.ErrorView
+ error = new csx.Views.ErrorView
el: @$('form#new-cake'),
attributesWithErrors: $.parseJSON(xhr.responseText)
error.render()
@@ -57,5 +57,5 @@ class CakeSide.Views.My.Cakes.NewView extends Marionette.ItemView
serializeData: ->
{
cake: @model.toJSON(),
- categories: CakeSide.Application.request('CategoriesRepository').toJSON(),
+ categories: csx.Application.request('CategoriesRepository').toJSON(),
}
app/assets/javascripts/views/my/cakes/no_cakes_view.js.coffee
@@ -1,3 +1,3 @@
-class CakeSide.Views.My.Cakes.NoCakesView extends Marionette.ItemView
+class csx.Views.My.Cakes.NoCakesView extends Marionette.ItemView
template: JST["templates/my/cakes/no_cakes"]
tagName: 'li'
app/assets/javascripts/views/my/cakes/show_view.js.coffee
@@ -1,8 +1,8 @@
#= require views/my/cakes/thumbnail_view
-class CakeSide.Views.My.Cakes.ShowView extends Marionette.CompositeView
+class csx.Views.My.Cakes.ShowView extends Marionette.CompositeView
template: JST["templates/my/cakes/show"]
- childView: CakeSide.Views.My.Cakes.ThumbnailView
+ childView: csx.Views.My.Cakes.ThumbnailView
childViewContainer: '.card-columns'
events:
@@ -26,10 +26,10 @@ class CakeSide.Views.My.Cakes.ShowView extends Marionette.CompositeView
@model.set('primary_photo_id', options.photo_id) if options.photo_id
launchAddPhoto: ->
- @displayModal(new CakeSide.Views.Photos.NewModalView(cake: @model))
+ @displayModal(new csx.Views.Photos.NewModalView(cake: @model))
removeCake: ->
- @displayModal(new CakeSide.Views.Cakes.DeleteCakeModalView(model: @model))
+ @displayModal(new csx.Views.Cakes.DeleteCakeModalView(model: @model))
displayModal: (view) ->
$("#modal").html(view.render().el)
app/assets/javascripts/views/my/cakes/thumbnail_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Cakes.ThumbnailView extends Marionette.ItemView
+class csx.Views.My.Cakes.ThumbnailView extends Marionette.ItemView
template: JST['templates/my/cakes/thumbnail']
tagName: 'div'
className: 'card'
app/assets/javascripts/views/my/passwords/change_password.js.coffee
@@ -1,6 +1,6 @@
#= require views/auto_view
-class CakeSide.Views.My.ChangePassword extends CakeSide.AutoView
+class csx.Views.My.ChangePassword extends csx.AutoView
@viewName 'change-password'
render: () ->
app/assets/javascripts/views/my/photos/new_modal_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Photos.NewModalView extends Marionette.ItemView
+class csx.Views.My.Photos.NewModalView extends Marionette.ItemView
template: JST["templates/my/photos/new-modal"]
ui:
watermark: '#watermark'
@@ -11,7 +11,7 @@ class CakeSide.Views.My.Photos.NewModalView extends Marionette.ItemView
constructor: (options) ->
super(options)
- @collection = CakeSide.Application.request('PhotosRepository', options.cake.id)
+ @collection = csx.Application.request('PhotosRepository', options.cake.id)
@cake = options.cake
@model = new @collection.model(cake_id: @cake.id)
app/assets/javascripts/views/my/profiles/show_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Profiles.ShowView extends Marionette.ItemView
+class csx.Views.My.Profiles.ShowView extends Marionette.ItemView
template: JST["templates/my/profiles/show"]
ui:
name: '#user_name'
app/assets/javascripts/views/my/tutorials/index_view.js.coffee
@@ -1,8 +1,8 @@
#= require views/my/tutorials/no_tutorials_view
#= require views/my/tutorials/tutorial_view
-class CakeSide.Views.My.Tutorials.IndexView extends Marionette.CollectionView
- childView: CakeSide.Views.My.Tutorials.TutorialView
- emptyView: CakeSide.Views.My.Tutorials.NoTutorialsView
+class csx.Views.My.Tutorials.IndexView extends Marionette.CollectionView
+ childView: csx.Views.My.Tutorials.TutorialView
+ emptyView: csx.Views.My.Tutorials.NoTutorialsView
className: ''
tagName: 'div'
app/assets/javascripts/views/my/tutorials/new_view.js.coffee
@@ -1,6 +1,6 @@
#= require service/embedly_service
-class CakeSide.Views.My.Tutorials.NewView extends Marionette.ItemView
+class csx.Views.My.Tutorials.NewView extends Marionette.ItemView
template: JST['templates/my/tutorials/new']
ui:
url: '#tutorial_url'
@@ -19,7 +19,7 @@ class CakeSide.Views.My.Tutorials.NewView extends Marionette.ItemView
initialize: ->
@model = new @collection.model()
- @service = new CakeSide.EmbedlyService()
+ @service = new csx.EmbedlyService()
loadUrl: ->
if @model.isValidUrl(@ui.url.val())
@@ -63,7 +63,7 @@ class CakeSide.Views.My.Tutorials.NewView extends Marionette.ItemView
couldNotSave: (cake, xhr) =>
@ui.save_button.removeAttr('disabled')
- error = new CakeSide.Views.ErrorView
+ error = new csx.Views.ErrorView
el: @$('form#new-tutorial'),
attributesWithErrors: $.parseJSON(xhr.responseText)
error.render()
app/assets/javascripts/views/my/tutorials/no_tutorials_view.js.coffee
@@ -1,3 +1,3 @@
-class CakeSide.Views.My.Tutorials.NoTutorialsView extends Marionette.ItemView
+class csx.Views.My.Tutorials.NoTutorialsView extends Marionette.ItemView
template: JST['templates/my/tutorials/no_tutorials']
tagName: 'li'
app/assets/javascripts/views/my/tutorials/show_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Tutorials.ShowView extends Marionette.ItemView
+class csx.Views.My.Tutorials.ShowView extends Marionette.ItemView
template: JST["templates/my/tutorials/show"]
templateHelpers:
displayDate: (date) ->
app/assets/javascripts/views/my/tutorials/tutorial_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.My.Tutorials.TutorialView extends Marionette.ItemView
+class csx.Views.My.Tutorials.TutorialView extends Marionette.ItemView
template: JST['templates/my/tutorials/tutorial']
tagName: 'div'
className: 'media'
app/assets/javascripts/views/sessions/login_form.js.coffee
@@ -1,6 +1,6 @@
#= require views/auto_view
-class CakeSide.Views.LoginForm extends CakeSide.AutoView
+class csx.Views.LoginForm extends csx.AutoView
@viewName 'login-form'
modelKey: "session"
events:
@@ -9,7 +9,7 @@ class CakeSide.Views.LoginForm extends CakeSide.AutoView
'submit form': 'onSubmit'
initialize: () ->
- @model = new CakeSide.Models.Session()
+ @model = new csx.Models.Session()
render: ->
@renderErrors(@model.validationError)
app/assets/javascripts/views/sessions/registration-form.js.coffee
@@ -1,6 +1,6 @@
#= require views/auto_view
-class CakeSide.Views.RegistrationForm extends CakeSide.AutoView
+class csx.Views.RegistrationForm extends csx.AutoView
@viewName 'registration-form'
modelKey: "user"
events:
@@ -11,7 +11,7 @@ class CakeSide.Views.RegistrationForm extends CakeSide.AutoView
'submit form': 'onSubmit'
initialize: () ->
- @model = new CakeSide.Models.Registration()
+ @model = new csx.Models.Registration()
render: ->
@renderErrors(@model.validationError)
app/assets/javascripts/views/auto_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.AutoView extends Backbone.View
+class csx.AutoView extends Backbone.View
@views: {}
@constructors: {}
app/assets/javascripts/views/error_view.js.coffee
@@ -1,4 +1,4 @@
-class CakeSide.Views.ErrorView extends Backbone.View
+class csx.Views.ErrorView extends Backbone.View
initialize: (options) ->
@attributesWithErrors = options.attributesWithErrors
_.bindAll(@, "clearOldErrors", "renderErrors", "renderError", "fieldFor")
app/assets/javascripts/views/index.js.coffee
@@ -1,9 +1,9 @@
#= require_self
#= require_tree .
-CakeSide.Views.Cakes ||= {}
-CakeSide.Views.My ||= {}
-CakeSide.Views.My.Cakes ||= {}
-CakeSide.Views.My.Photos ||= {}
-CakeSide.Views.My.Profiles ||= {}
-CakeSide.Views.My.Tutorials ||= {}
+csx.Views.Cakes ||= {}
+csx.Views.My ||= {}
+csx.Views.My.Cakes ||= {}
+csx.Views.My.Photos ||= {}
+csx.Views.My.Profiles ||= {}
+csx.Views.My.Tutorials ||= {}
app/assets/javascripts/cakeside.js.coffee
@@ -8,7 +8,7 @@
#= require_tree ./routers
#= require_tree ./service
-window.CakeSide =
+window.csx =
Models: {}
Collections: {}
Routers: {}
@@ -19,47 +19,47 @@ window.CakeSide =
if data.access_token
xhr.setRequestHeader "Authorization", "Token token=#{data.access_token}"
- CakeSide.Application = new Marionette.Application()
- CakeSide.Application.addRegions
+ csx.Application = new Marionette.Application()
+ csx.Application.addRegions
content_region: '#backbone-content'
- CakeSide.Application.addInitializer (options) ->
- new CakeSide.Routers.CakesRouter
- controller: new CakeSide.Controllers.My.CakesController()
- new CakeSide.Routers.TutorialsRouter
- controller: new CakeSide.Controllers.My.TutorialsController()
- new CakeSide.Routers.DashboardRouter
- controller: new CakeSide.Controllers.My.DashboardController()
- new CakeSide.Routers.ProfileRouter
- controller: new CakeSide.Controllers.My.ProfileController()
+ csx.Application.addInitializer (options) ->
+ new csx.Routers.CakesRouter
+ controller: new csx.Controllers.My.CakesController()
+ new csx.Routers.TutorialsRouter
+ controller: new csx.Controllers.My.TutorialsController()
+ new csx.Routers.DashboardRouter
+ controller: new csx.Controllers.My.DashboardController()
+ new csx.Routers.ProfileRouter
+ controller: new csx.Controllers.My.ProfileController()
- CakeSide.Application.on 'start', ->
+ csx.Application.on 'start', ->
if Backbone.history
Backbone.history.start()
- @cakes = new CakeSide.Collections.CakesCollection()
- @categories = new CakeSide.Collections.CategoriesCollection()
- @tutorials = new CakeSide.Collections.TutorialsCollection()
+ @cakes = new csx.Collections.CakesCollection()
+ @categories = new csx.Collections.CategoriesCollection()
+ @tutorials = new csx.Collections.TutorialsCollection()
- CakeSide.Application.reqres.setHandler 'CakesRepository', =>
+ csx.Application.reqres.setHandler 'CakesRepository', =>
@cakes
- CakeSide.Application.reqres.setHandler 'CategoriesRepository', =>
+ csx.Application.reqres.setHandler 'CategoriesRepository', =>
@categories
@photos_cache = {}
- CakeSide.Application.reqres.setHandler 'PhotosRepository', (cake_id) =>
+ csx.Application.reqres.setHandler 'PhotosRepository', (cake_id) =>
if @photos_cache[cake_id]
@photos_cache[cake_id]
else
- photos = new CakeSide.Collections.PhotosCollection(cake_id: cake_id)
+ photos = new csx.Collections.PhotosCollection(cake_id: cake_id)
@photos_cache[cake_id] = photos
photos.fetch(reset: true)
photos
- CakeSide.Application.reqres.setHandler 'TutorialsRepository', =>
+ csx.Application.reqres.setHandler 'TutorialsRepository', =>
@tutorials
- CakeSide.Application.reqres.setHandler 'ProfilesRepository', =>
- @profiles ||= new CakeSide.Collections.ProfilesCollection()
+ csx.Application.reqres.setHandler 'ProfilesRepository', =>
+ @profiles ||= new csx.Collections.ProfilesCollection()
@categories.fetch(reset: true)
@tutorials.fetch(reset: true)
@cakes.fetch(reset: true).done ->
- CakeSide.Application.start()
+ csx.Application.start()
spec/javascripts/initializers/auto_view_setup_spec.js.coffee
@@ -1,25 +1,25 @@
-describe "CakeSide.AutoViewSetup", ->
+describe "csx.AutoViewSetup", ->
subject = null
logger = null
beforeEach ->
spyOn(console, 'error')
- subject = new CakeSide.AutoViewSetup()
+ subject = new csx.AutoViewSetup()
describe "#execute", ->
beforeEach ->
- CakeSide.AutoView.views = {}
+ csx.AutoView.views = {}
it 'attaches the autoview to the DOM element', ->
fixture.set '<div id="item" data-autoview="My.ChangePassword"></div>'
subject.execute()
- result = CakeSide.AutoView.views['My-ChangePassword'][0]
- expect(result instanceof CakeSide.Views.My.ChangePassword).toEqual(true)
+ result = csx.AutoView.views['My-ChangePassword'][0]
+ expect(result instanceof csx.Views.My.ChangePassword).toEqual(true)
expect($('#item').data('autoview-setup-complete')).toEqual(true)
it "returns nil if the autoview cannot be discovered", ->
fixture.set '<div data-autoview="Unknown"></div>'
subject.execute()
- expect(_.isEmpty(CakeSide.AutoView.views)).toEqual(true)
+ expect(_.isEmpty(csx.AutoView.views)).toEqual(true)
expect(console.error).toHaveBeenCalled()
spec/javascripts/lib/proxy_spec.js.coffee
@@ -1,9 +1,9 @@
-describe "CakeSide.Proxy", ->
+describe "csx.Proxy", ->
subject = null
describe "#create", ->
object = null
- subject = CakeSide.Proxy
+ subject = csx.Proxy
beforeEach ->
object =
spec/javascripts/models/cake_spec.js.coffee
@@ -1,6 +1,6 @@
-describe "CakeSide.Models.Cake", ->
+describe "csx.Models.Cake", ->
subject = (attributes) ->
- new CakeSide.Models.Cake(attributes)
+ new csx.Models.Cake(attributes)
describe "#validate", ->
it "returns an error when the name is null", ->
spec/javascripts/models/session_spec.js.coffee
@@ -1,8 +1,8 @@
-describe "CakeSide.Models.Session", ->
+describe "csx.Models.Session", ->
subject = null
beforeEach ->
- subject = new CakeSide.Models.Session()
+ subject = new csx.Models.Session()
it "is invalid, when the email is missing", ->
expectedError = "Email can't be blank"
spec/javascripts/views/sessions/login_form_spec.js.coffee
@@ -1,4 +1,4 @@
-describe "CakeSide.Views.LoginForm", ->
+describe "csx.Views.LoginForm", ->
subject = null
beforeEach ->
@@ -21,7 +21,7 @@ describe "CakeSide.Views.LoginForm", ->
</div>
'''
- subject = new CakeSide.Views.LoginForm
+ subject = new csx.Views.LoginForm
el: $('[data-autoview=login-form]')
it "disables the submit button when the email is missing", ->
spec/javascripts/views/cake_view_spec.js.coffee
@@ -1,8 +1,8 @@
-describe "CakeSide.Views.My.Cakes.CakeView", ->
- cake = new CakeSide.Models.Cake
+describe "csx.Views.My.Cakes.CakeView", ->
+ cake = new csx.Models.Cake
id: '1'
name: 'chocolate'
- subject = new CakeSide.Views.My.Cakes.CakeView
+ subject = new csx.Views.My.Cakes.CakeView
model: cake
describe "when there are no photos", ->