summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/controllers
diff options
context:
space:
mode:
authormo <mokha@cisco.com>2017-09-02 14:48:43 -0600
committermo <mokha@cisco.com>2017-09-02 14:48:43 -0600
commitb8dfe131c6c5fe9d0e5b4ee2d271feeb5d411502 (patch)
tree05b475a8b6442e2a43d9529c42362a3460df7d13 /app/assets/javascripts/controllers
parentbba21d02643d632fee5fa4bdbc876d44832ccf4b (diff)
promote backbone subdirectory up to root.
Diffstat (limited to 'app/assets/javascripts/controllers')
-rw-r--r--app/assets/javascripts/controllers/cakes_controller.js.coffee34
-rw-r--r--app/assets/javascripts/controllers/dashboard_controller.js.coffee6
-rw-r--r--app/assets/javascripts/controllers/profile_controller.js.coffee18
-rw-r--r--app/assets/javascripts/controllers/tutorials_controller.js.coffee29
4 files changed, 87 insertions, 0 deletions
diff --git a/app/assets/javascripts/controllers/cakes_controller.js.coffee b/app/assets/javascripts/controllers/cakes_controller.js.coffee
new file mode 100644
index 00000000..3167248b
--- /dev/null
+++ b/app/assets/javascripts/controllers/cakes_controller.js.coffee
@@ -0,0 +1,34 @@
+class CakeSide.Controllers.CakesController extends Marionette.Controller
+ views: CakeSide.Views.Cakes
+ initialize: (options) ->
+ @content_region = CakeSide.Application.content_region
+ @cakes = CakeSide.Application.request('CakesRepository')
+ #@comment_view = CakeSide.Application.request('CommentView')
+
+ 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')
+ $('a[href="/my#cakes/new"]').addClass('active')
diff --git a/app/assets/javascripts/controllers/dashboard_controller.js.coffee b/app/assets/javascripts/controllers/dashboard_controller.js.coffee
new file mode 100644
index 00000000..23169914
--- /dev/null
+++ b/app/assets/javascripts/controllers/dashboard_controller.js.coffee
@@ -0,0 +1,6 @@
+class CakeSide.Controllers.DashboardController extends Marionette.Controller
+ initialize: (options) ->
+ #@comment_view = CakeSide.Application.request('CommentView')
+
+ index: ->
+ #@comment_view.hide()
diff --git a/app/assets/javascripts/controllers/profile_controller.js.coffee b/app/assets/javascripts/controllers/profile_controller.js.coffee
new file mode 100644
index 00000000..c8577e2a
--- /dev/null
+++ b/app/assets/javascripts/controllers/profile_controller.js.coffee
@@ -0,0 +1,18 @@
+class CakeSide.Controllers.ProfileController extends Marionette.Controller
+ views: CakeSide.Views.Profiles
+ initialize: (options) ->
+ @content_region = CakeSide.Application.content_region
+ #@comment_view = CakeSide.Application.request('CommentView')
+
+ show: (id) ->
+ @selectTab()
+ #@comment_view.hide()
+ profile = new CakeSide.Models.Profile
+ id: id
+ profile.fetch
+ success: =>
+ @content_region.show(new @views.ShowView(model: profile))
+
+ selectTab: ->
+ $('.nav-link').removeClass('active')
+ $('a[href="/my#profile/me"]').addClass('active')
diff --git a/app/assets/javascripts/controllers/tutorials_controller.js.coffee b/app/assets/javascripts/controllers/tutorials_controller.js.coffee
new file mode 100644
index 00000000..732bea3e
--- /dev/null
+++ b/app/assets/javascripts/controllers/tutorials_controller.js.coffee
@@ -0,0 +1,29 @@
+class CakeSide.Controllers.TutorialsController extends Marionette.Controller
+ views: CakeSide.Views.Tutorials
+ initialize: (options) ->
+ @content_region = CakeSide.Application.content_region
+ @tutorials = CakeSide.Application.request('TutorialsRepository')
+ #@comment_view = CakeSide.Application.request('CommentView')
+
+ 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')
+ $('a[href="/my#tutorials/new"]').addClass('active')