summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/controllers/my/tutorials_controller.js.coffee
diff options
context:
space:
mode:
authormo <mokha@cisco.com>2017-09-02 15:53:55 -0600
committermo <mokha@cisco.com>2017-09-02 15:53:55 -0600
commit69a79609d7dacf25682ed3d899bbc4ea57502401 (patch)
tree6eab23b03c86554cc74821ca7a462d483c20795f /app/assets/javascripts/controllers/my/tutorials_controller.js.coffee
parent3512ca46969571a629602a26ed997ae837574ad8 (diff)
move bonebone code for my/* to my/* namespace.
Diffstat (limited to 'app/assets/javascripts/controllers/my/tutorials_controller.js.coffee')
-rw-r--r--app/assets/javascripts/controllers/my/tutorials_controller.js.coffee29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/assets/javascripts/controllers/my/tutorials_controller.js.coffee b/app/assets/javascripts/controllers/my/tutorials_controller.js.coffee
new file mode 100644
index 00000000..dcee92d5
--- /dev/null
+++ b/app/assets/javascripts/controllers/my/tutorials_controller.js.coffee
@@ -0,0 +1,29 @@
+class CakeSide.Controllers.My.TutorialsController extends Marionette.Controller
+ views: CakeSide.Views.My.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')