diff options
| author | mo <mo.khan@gmail.com> | 2017-09-02 22:46:07 +0000 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2017-09-02 22:46:07 +0000 |
| commit | 4d6fd17c8f1d7ee0ecb46e8323b61e4006bf39a4 (patch) | |
| tree | e9d098503da331c6b50c339166d1dd8f4a7c3c5f /app/assets/javascripts/controllers | |
| parent | 85b4e006052f51dfb7fb02ee1fe7d6914cb6b17c (diff) | |
| parent | 6a6daa8c8d9223d6f3b29897bc23df386f28428b (diff) | |
Merge branch 'bootstrap' into 'master'
Bootstrap
Closes #10
See merge request !2
Diffstat (limited to 'app/assets/javascripts/controllers')
4 files changed, 87 insertions, 0 deletions
diff --git a/app/assets/javascripts/controllers/my/cakes_controller.js.coffee b/app/assets/javascripts/controllers/my/cakes_controller.js.coffee new file mode 100644 index 00000000..6a56d6bc --- /dev/null +++ b/app/assets/javascripts/controllers/my/cakes_controller.js.coffee @@ -0,0 +1,34 @@ +class CakeSide.Controllers.My.CakesController extends Marionette.Controller + views: CakeSide.Views.My.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/my/dashboard_controller.js.coffee b/app/assets/javascripts/controllers/my/dashboard_controller.js.coffee new file mode 100644 index 00000000..734aedc9 --- /dev/null +++ b/app/assets/javascripts/controllers/my/dashboard_controller.js.coffee @@ -0,0 +1,6 @@ +class CakeSide.Controllers.My.DashboardController extends Marionette.Controller + initialize: (options) -> + #@comment_view = CakeSide.Application.request('CommentView') + + index: -> + #@comment_view.hide() diff --git a/app/assets/javascripts/controllers/my/profile_controller.js.coffee b/app/assets/javascripts/controllers/my/profile_controller.js.coffee new file mode 100644 index 00000000..c429c035 --- /dev/null +++ b/app/assets/javascripts/controllers/my/profile_controller.js.coffee @@ -0,0 +1,18 @@ +class CakeSide.Controllers.My.ProfileController extends Marionette.Controller + views: CakeSide.Views.My.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/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') |
