From 691dabbc39ad6f260bd3597a89c7626a32e2f558 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 31 Oct 2014 21:40:37 -0600 Subject: add just the cake edit view to make uploading photo button more prominent. --- .../backbone/templates/cakes/cake.jst.ejs | 24 ++++++++-------------- .../backbone/templates/cakes/edit.jst.ejs | 7 ++++++- .../backbone/templates/photos/new-modal.jst.ejs | 4 ++-- 3 files changed, 17 insertions(+), 18 deletions(-) (limited to 'app/assets/javascripts/backbone') diff --git a/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs b/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs index c20138b5..af2da9a5 100644 --- a/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs +++ b/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs @@ -4,18 +4,12 @@ 64x64 <% } %> -
-

<%= name %>

- <%= story %> -

- - edit - - - fanclub - - - - -

-
+
+

<%= name %>

+ <%= story %> +

+ edit + fanclub + +

+
diff --git a/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs b/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs index d462642f..e589075f 100644 --- a/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs +++ b/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs @@ -1,10 +1,15 @@
-

Add Photo...

Edit <%= cake.name %>


+
+ + +
diff --git a/app/assets/javascripts/backbone/templates/photos/new-modal.jst.ejs b/app/assets/javascripts/backbone/templates/photos/new-modal.jst.ejs index 66bbe946..7f7a7dfb 100644 --- a/app/assets/javascripts/backbone/templates/photos/new-modal.jst.ejs +++ b/app/assets/javascripts/backbone/templates/photos/new-modal.jst.ejs @@ -3,14 +3,14 @@

Upload Photo

+
+ +
+ <% if (typeof(cake.tools) === "string") { %> + <% tools = _.map(cake.tools.split(','), function(x){ return x; }) %> + <% } else { %> + <% tools = _.map(cake.tools, function(x){ return x.name; }) %> + <% } %> + +
+
Cancel diff --git a/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee b/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee index c568ca95..945d7917 100644 --- a/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee +++ b/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee @@ -10,6 +10,7 @@ class CakeSide.Views.Cakes.EditView extends Marionette.CompositeView description: "#cake_story" category: "#cake_category_id" tags: "#cake_tags" + tools: "#cake_tools" save_button: '#save-button' modelEvents: @@ -37,6 +38,7 @@ class CakeSide.Views.Cakes.EditView extends Marionette.CompositeView onRender: -> @$("#cake_category_id").val(@model.category_id()) @ui.tags.tagit({ availableTags: ALL_TAGS }) + @ui.tools.tagit({ availableTags: ALL_TOOLS }) @disableSaveButton() savedSuccessfully: (cake) => @@ -55,6 +57,7 @@ class CakeSide.Views.Cakes.EditView extends Marionette.CompositeView @model.set('story', @ui.description.val()) @model.set('category_id', @ui.category.val()) @model.set('tags', @ui.tags.val()) + @model.set('tools', @ui.tools.val()) @model.isValid() displayError: (model, error) -> diff --git a/app/controllers/api/v1/cakes_controller.rb b/app/controllers/api/v1/cakes_controller.rb index 7dc46473..862ef071 100644 --- a/app/controllers/api/v1/cakes_controller.rb +++ b/app/controllers/api/v1/cakes_controller.rb @@ -24,15 +24,14 @@ module Api end def update - UpdateCakeCommand.new(self).run(params[:id], params[:cake][:tags], cake_params) - end - - def update_cake_succeeded(cake) - respond_with(@cake = cake) - end - - def update_cake_failed(cake) - respond_with(@cake = cake) + @cake = current_user.creations.find(params[:id]) + current_user.tag(@cake, with: params[:cake][:tags], on: :tags) + current_user.tag(@cake, with: params[:cake][:tools], on: :tools) + if @cake.update(cake_params.reject { |key, value| key == "tags" || key == "tools" }) + respond_with @cake + else + respond_with @cake + end end def destroy diff --git a/app/services/application/update_cake_command.rb b/app/services/application/update_cake_command.rb deleted file mode 100644 index 829a87dc..00000000 --- a/app/services/application/update_cake_command.rb +++ /dev/null @@ -1,18 +0,0 @@ -class UpdateCakeCommand - def initialize(context) - @context = context - end - - def run(id, tags, creation_params) - current_user = @context.current_user - - cake = current_user.creations.find(id) - current_user.tag(cake, with: tags, on: :tags) - - if cake.update(creation_params.reject { |key, value| key == "tags" }) - @context.update_cake_succeeded(cake) - else - @context.update_cake_failed(cake) - end - end -end -- cgit v1.2.3 From ef2e067cfb015795bd1e4a07f3c06e23769555b5 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 1 Nov 2014 23:10:59 -0600 Subject: re-arrange my-dashboard. --- .../controllers/tutorials_controller.js.coffee | 4 +-- app/controllers/my/dashboard_controller.rb | 3 +- app/models/user.rb | 2 +- app/views/my/dashboard/_comment.html.erb | 6 ++-- app/views/my/dashboard/_creation.html.erb | 3 +- app/views/my/dashboard/_favorite.html.erb | 7 ++-- app/views/my/dashboard/_tutorial.html.erb | 6 +--- app/views/my/dashboard/index.html.erb | 38 ++++++++++++++-------- 8 files changed, 37 insertions(+), 32 deletions(-) (limited to 'app/assets/javascripts/backbone') diff --git a/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee b/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee index ae1a626f..791c4406 100644 --- a/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee +++ b/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee @@ -21,8 +21,8 @@ class CakeSide.Controllers.TutorialsController extends Marionette.Controller @content_region.show(new @views.ShowView(model: tutorial)) @comment_view.render identifier: "t-#{tutorial.id}" - title: tutorial.get('name') - url: tutorial.public_url() + title: tutorial.get('heading') + url: tutorial.get('url') selectTab: -> $('.nav-list').children().removeClass('active') diff --git a/app/controllers/my/dashboard_controller.rb b/app/controllers/my/dashboard_controller.rb index 006a55a7..158dc91c 100644 --- a/app/controllers/my/dashboard_controller.rb +++ b/app/controllers/my/dashboard_controller.rb @@ -1,7 +1,8 @@ module My class DashboardController < BaseController def index - @items = (current_user.creations.includes(:photos) + current_user.tutorials).sort_by! { |x| x.created_at }.reverse + @cakes = current_user.creations.includes(:photos) + @tutorials = current_user.tutorials.limit(10) @activities = current_user.recent_activities end end diff --git a/app/models/user.rb b/app/models/user.rb index edaf11c2..6bb6b95b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,7 +50,7 @@ class User < ActiveRecord::Base end def recent_activities(limit = 20) - activities.includes(:subject).order(created_at: :desc).limit(limit) + activities.includes(subject: [{user: :avatar}, :creation]).order(created_at: :desc).limit(limit) end def comment_on(creation, text, disqus_id) diff --git a/app/views/my/dashboard/_comment.html.erb b/app/views/my/dashboard/_comment.html.erb index 7b15845a..88c21462 100644 --- a/app/views/my/dashboard/_comment.html.erb +++ b/app/views/my/dashboard/_comment.html.erb @@ -1,9 +1,7 @@
- - <%= avatar_for(subject.user, size: 24) %> - <%= link_to subject.user.name, profile_path(subject.user) %> commented on <%= link_to subject.creation.name, my_root_path(anchor: "cakes/#{subject.creation.id}") %> - <%= time_ago_in_words(subject.created_at) %> ago. + <%= link_to subject.creation.name, my_root_path(anchor: "cakes/#{subject.creation.id}") %>
<%= subject.text %> + - <%= avatar_for(subject.user, size: 24) %> <%= link_to subject.user.name, profile_path(subject.user) %>
diff --git a/app/views/my/dashboard/_creation.html.erb b/app/views/my/dashboard/_creation.html.erb index 72d1663e..d8a72b00 100644 --- a/app/views/my/dashboard/_creation.html.erb +++ b/app/views/my/dashboard/_creation.html.erb @@ -3,8 +3,7 @@ 64x64 <% end %>
-

<%= item.name %>

- <%= item.story %> +

<%= link_to item.name, my_root_path(anchor: "cakes/#{item.id}") %>

<%= link_to my_root_path(anchor: "cakes/#{item.id}/edit") do %> edit diff --git a/app/views/my/dashboard/_favorite.html.erb b/app/views/my/dashboard/_favorite.html.erb index 1b48e7fa..70e499f6 100644 --- a/app/views/my/dashboard/_favorite.html.erb +++ b/app/views/my/dashboard/_favorite.html.erb @@ -1,9 +1,8 @@

- + <%= avatar_for(subject.user, size: 24) %> - <%= link_to subject.user.name, profile_path(subject.user) %> added - <%= link_to subject.creation.name, my_root_path(anchor: "cakes/#{subject.creation.id}") %> to their favorites - <%= time_ago_in_words(subject.created_at) %> ago. + <%= link_to subject.user.name, profile_path(subject.user) %> starred + <%= link_to subject.creation.name, my_root_path(anchor: "cakes/#{subject.creation.id}") %>

diff --git a/app/views/my/dashboard/_tutorial.html.erb b/app/views/my/dashboard/_tutorial.html.erb index 19802278..0cd22be1 100644 --- a/app/views/my/dashboard/_tutorial.html.erb +++ b/app/views/my/dashboard/_tutorial.html.erb @@ -1,9 +1,5 @@
- <%= link_to my_root_path(anchor: "tutorials/#{item.id}"), class: 'pull-left' do %> - 64x64 - <% end %>
-

<%= item.heading %>

- <%= item.description %> +

<%= link_to item.heading, my_root_path(anchor: "tutorials/#{item.id}") %>

diff --git a/app/views/my/dashboard/index.html.erb b/app/views/my/dashboard/index.html.erb index 21a3a5e3..989ee905 100644 --- a/app/views/my/dashboard/index.html.erb +++ b/app/views/my/dashboard/index.html.erb @@ -25,24 +25,36 @@ <% end %> <% end -%> -
+
<%= render partial: "my/shared/my_nav" %>
-
- <% @items.each do |item| %> - <%= render item.class.to_s.downcase, item: item %> - <% end %> -
-
- <% if @activities.empty? %> -

No new activity to report.

- <% else %> - <% @activities.each do |activity| %> - <%= render activity.subject.class.to_s.downcase, subject: activity.subject %> +
+
+
My Cakes
+ <% @cakes.each do |item| %> + <%= render item.class.to_s.downcase, item: item %> + <% end %> +
+
+
+
My Notifications
+ <% if @activities.empty? %> +

No new activity to report.

+ <% else %> + <% @activities.each do |activity| %> + <%= render activity.subject.class.to_s.downcase, subject: activity.subject %> + <% end %> + <% end %> +
+ <% if @tutorials.any? %> +
My Tutorials
+ <% @tutorials.each do |item| %> + <%= render item.class.to_s.downcase, item: item %> + <% end %> <% end %> - <% end %> +
-- cgit v1.2.3 From 3809550dc864d6b26c91cb38bbf6b784e597abef Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 2 Nov 2014 09:02:53 -0700 Subject: try to improve the backbone stuff. --- Gemfile | 1 + Gemfile.lock | 4 +++ app/assets/javascripts/application.js | 1 + app/assets/javascripts/backbone/cakeside.js.coffee | 8 +++--- .../controllers/cakes_controller.js.coffee | 8 +++--- .../controllers/dashboard_controller.js.coffee | 4 +-- .../controllers/profile_controller.js.coffee | 4 +-- .../controllers/tutorials_controller.js.coffee | 14 +++++----- .../backbone/templates/cakes/cake.jst.ejs | 4 +-- .../backbone/templates/cakes/edit.jst.ejs | 11 -------- .../backbone/views/cakes/edit_view.js.coffee | 3 --- app/controllers/my/kitchens_controller.rb | 7 +++++ app/helpers/my/dashboard_helper.rb | 7 ----- app/models/creation.rb | 1 - app/models/tag.rb | 12 --------- app/views/layouts/_header.html.erb | 4 +-- app/views/my/dashboard/index.html.erb | 30 +--------------------- app/views/my/kitchens/show.html.erb | 25 ++++++++++++++++++ app/views/my/shared/_my_nav.html.erb | 2 +- config/routes.rb | 3 ++- 20 files changed, 64 insertions(+), 89 deletions(-) create mode 100644 app/controllers/my/kitchens_controller.rb create mode 100644 app/views/my/kitchens/show.html.erb (limited to 'app/assets/javascripts/backbone') diff --git a/Gemfile b/Gemfile index 910eafbd..92c77563 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ end gem 'acts-as-taggable-on' gem 'jquery-ui-rails', '~> 4.0.0' +gem 'jquery-turbolinks' gem 'mini_magick' gem "kaminari" gem 'bootstrap-sass', '~> 2.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 958f377f..77be763f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -197,6 +197,9 @@ GEM jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jquery-turbolinks (2.1.0) + railties (>= 3.1.0) + turbolinks jquery-ui-rails (4.0.5) railties (>= 3.1.0) js-routes (0.9.9) @@ -402,6 +405,7 @@ DEPENDENCIES groupdate jbuilder jquery-rails + jquery-turbolinks jquery-ui-rails (~> 4.0.0) js-routes kaminari diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fc002f2d..d973d0cc 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,6 +11,7 @@ // about supported directives. // //= require jquery +//= require jquery.turbolinks //= require jquery-migrate //= require jquery_ujs //= require turbolinks diff --git a/app/assets/javascripts/backbone/cakeside.js.coffee b/app/assets/javascripts/backbone/cakeside.js.coffee index e55bb348..f3aa6aee 100644 --- a/app/assets/javascripts/backbone/cakeside.js.coffee +++ b/app/assets/javascripts/backbone/cakeside.js.coffee @@ -41,10 +41,10 @@ window.CakeSide = @tutorials = new CakeSide.Collections.TutorialsCollection() @tutorials.fetch(reset: true) - @disqus_view = new CakeSide.Views.DisqusView - disqus_shortname: data.disqus_shortname - CakeSide.Application.reqres.setHandler 'CommentView', => - @disqus_view + #@disqus_view = new CakeSide.Views.DisqusView + #disqus_shortname: data.disqus_shortname + #CakeSide.Application.reqres.setHandler 'CommentView', => + #@disqus_view CakeSide.Application.reqres.setHandler 'CakesRepository', => @cakes CakeSide.Application.reqres.setHandler 'CategoriesRepository', => diff --git a/app/assets/javascripts/backbone/controllers/cakes_controller.js.coffee b/app/assets/javascripts/backbone/controllers/cakes_controller.js.coffee index c9fe5579..70d99253 100644 --- a/app/assets/javascripts/backbone/controllers/cakes_controller.js.coffee +++ b/app/assets/javascripts/backbone/controllers/cakes_controller.js.coffee @@ -3,11 +3,11 @@ class CakeSide.Controllers.CakesController extends Marionette.Controller initialize: (options) -> @content_region = CakeSide.Application.content_region @cakes = CakeSide.Application.request('CakesRepository') - @comment_view = CakeSide.Application.request('CommentView') + #@comment_view = CakeSide.Application.request('CommentView') index: -> @selectTab() - @comment_view.hide() + #@comment_view.hide() @content_region.show(new @views.IndexView(collection: @cakes)) show: (id, photo_id) -> @@ -21,13 +21,13 @@ class CakeSide.Controllers.CakesController extends Marionette.Controller newCake: -> @selectTab() - @comment_view.hide() + #@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() + #@comment_view.hide() selectTab: -> $('.nav-list').children().removeClass('active') diff --git a/app/assets/javascripts/backbone/controllers/dashboard_controller.js.coffee b/app/assets/javascripts/backbone/controllers/dashboard_controller.js.coffee index 45e7196c..23169914 100644 --- a/app/assets/javascripts/backbone/controllers/dashboard_controller.js.coffee +++ b/app/assets/javascripts/backbone/controllers/dashboard_controller.js.coffee @@ -1,6 +1,6 @@ class CakeSide.Controllers.DashboardController extends Marionette.Controller initialize: (options) -> - @comment_view = CakeSide.Application.request('CommentView') + #@comment_view = CakeSide.Application.request('CommentView') index: -> - @comment_view.hide() + #@comment_view.hide() diff --git a/app/assets/javascripts/backbone/controllers/profile_controller.js.coffee b/app/assets/javascripts/backbone/controllers/profile_controller.js.coffee index e0306805..984cf4d7 100644 --- a/app/assets/javascripts/backbone/controllers/profile_controller.js.coffee +++ b/app/assets/javascripts/backbone/controllers/profile_controller.js.coffee @@ -2,11 +2,11 @@ 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') + #@comment_view = CakeSide.Application.request('CommentView') show: (id) -> @selectTab() - @comment_view.hide() + #@comment_view.hide() profile = new CakeSide.Models.Profile id: id profile.fetch diff --git a/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee b/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee index 791c4406..5f1997c4 100644 --- a/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee +++ b/app/assets/javascripts/backbone/controllers/tutorials_controller.js.coffee @@ -3,26 +3,26 @@ class CakeSide.Controllers.TutorialsController extends Marionette.Controller initialize: (options) -> @content_region = CakeSide.Application.content_region @tutorials = CakeSide.Application.request('TutorialsRepository') - @comment_view = CakeSide.Application.request('CommentView') + #@comment_view = CakeSide.Application.request('CommentView') index: -> @selectTab() - @comment_view.hide() + #@comment_view.hide() @content_region.show(new @views.IndexView(collection: @tutorials)) new: -> @selectTab() - @comment_view.hide() + #@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') + #@comment_view.render + #identifier: "t-#{tutorial.id}" + #title: tutorial.get('heading') + #url: tutorial.get('url') selectTab: -> $('.nav-list').children().removeClass('active') diff --git a/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs b/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs index af2da9a5..e9800ad5 100644 --- a/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs +++ b/app/assets/javascripts/backbone/templates/cakes/cake.jst.ejs @@ -5,11 +5,9 @@ <% } %>
-

<%= name %>

- <%= story %> +

<%= name %>

edit fanclub -

diff --git a/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs b/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs index 0e964ec9..e589075f 100644 --- a/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs +++ b/app/assets/javascripts/backbone/templates/cakes/edit.jst.ejs @@ -43,17 +43,6 @@
-
- -
- <% if (typeof(cake.tools) === "string") { %> - <% tools = _.map(cake.tools.split(','), function(x){ return x; }) %> - <% } else { %> - <% tools = _.map(cake.tools, function(x){ return x.name; }) %> - <% } %> - -
-
Cancel diff --git a/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee b/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee index 945d7917..c568ca95 100644 --- a/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee +++ b/app/assets/javascripts/backbone/views/cakes/edit_view.js.coffee @@ -10,7 +10,6 @@ class CakeSide.Views.Cakes.EditView extends Marionette.CompositeView description: "#cake_story" category: "#cake_category_id" tags: "#cake_tags" - tools: "#cake_tools" save_button: '#save-button' modelEvents: @@ -38,7 +37,6 @@ class CakeSide.Views.Cakes.EditView extends Marionette.CompositeView onRender: -> @$("#cake_category_id").val(@model.category_id()) @ui.tags.tagit({ availableTags: ALL_TAGS }) - @ui.tools.tagit({ availableTags: ALL_TOOLS }) @disableSaveButton() savedSuccessfully: (cake) => @@ -57,7 +55,6 @@ class CakeSide.Views.Cakes.EditView extends Marionette.CompositeView @model.set('story', @ui.description.val()) @model.set('category_id', @ui.category.val()) @model.set('tags', @ui.tags.val()) - @model.set('tools', @ui.tools.val()) @model.isValid() displayError: (model, error) -> diff --git a/app/controllers/my/kitchens_controller.rb b/app/controllers/my/kitchens_controller.rb new file mode 100644 index 00000000..33b14e2e --- /dev/null +++ b/app/controllers/my/kitchens_controller.rb @@ -0,0 +1,7 @@ +module My + class KitchensController < BaseController + def show + @tags = Tag.unique_tags + end + end +end diff --git a/app/helpers/my/dashboard_helper.rb b/app/helpers/my/dashboard_helper.rb index e3ab6089..9331cd8e 100644 --- a/app/helpers/my/dashboard_helper.rb +++ b/app/helpers/my/dashboard_helper.rb @@ -1,11 +1,4 @@ module My module DashboardHelper - def unique_tags - Tag.unique_tags - end - - def unique_tools - Tag.unique_tools - end end end diff --git a/app/models/creation.rb b/app/models/creation.rb index 2de0ccd6..901e2db1 100644 --- a/app/models/creation.rb +++ b/app/models/creation.rb @@ -7,7 +7,6 @@ class Creation < ActiveRecord::Base has_many :favorites, :dependent => :destroy has_many :comments, dependent: :destroy acts_as_taggable_on :tags - acts_as_taggable_on :tools alias_method :author, :user default_scope -> { order(created_at: :desc) } diff --git a/app/models/tag.rb b/app/models/tag.rb index ac8b1121..1f8309e5 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -4,18 +4,6 @@ class Tag .joins(:taggings) .where(taggings: { context: 'tags' }) .order(:name) - .pluck(:name) .uniq end - - def self.unique_tools - #ActsAsTaggableOn::Tag - #.joins(:taggings) - #.where(taggings: { context: 'tools' }) - #.where(taggings: { taggable_type: Creation.name }) - #.order(:name) - #.pluck(:name) - #.uniq - Tool.all - end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 704d38e0..ee19e5f5 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -21,7 +21,7 @@ <% if user_signed_in? %>
  • - <%= link_to my_root_path do %> + <%= link_to my_dashboard_path do %> <% end %>
  • diff --git a/app/views/my/dashboard/index.html.erb b/app/views/my/dashboard/index.html.erb index 989ee905..38997056 100644 --- a/app/views/my/dashboard/index.html.erb +++ b/app/views/my/dashboard/index.html.erb @@ -1,35 +1,9 @@ <% provide(:title, "Dashboard") -%> -<%= content_for :javascript do -%> - <%= javascript_tag do %> - var ALL_TAGS = <%= raw unique_tags %>; - var ALL_TOOLS = <%= raw unique_tools %>; - var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>'; - var disqus_identifier = 'u-<%= current_user.id %>'; - var disqus_config = function(){ - this.page.remote_auth_s3 = '<%= disqus_auth %>'; - this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>'; - }; - $(document).ready(function(){ - CakeSide.initialize({ - access_token: '<%= current_user.authentication_token %>', - disqus_shortname: disqus_shortname, - }); - }); - $(document).on('page:load', function(){ - Backbone.history.stop(); - CakeSide.initialize({ - access_token: '<%= current_user.authentication_token %>', - disqus_shortname: disqus_shortname, - }); - }); - <% end %> -<% end -%> -
    <%= render partial: "my/shared/my_nav" %>
    -
    +
    My Cakes
    @@ -58,5 +32,3 @@
    -
    - diff --git a/app/views/my/kitchens/show.html.erb b/app/views/my/kitchens/show.html.erb new file mode 100644 index 00000000..3c076d89 --- /dev/null +++ b/app/views/my/kitchens/show.html.erb @@ -0,0 +1,25 @@ +<% provide(:title, "Kitchen") -%> +<%= content_for :javascript do -%> + <%= javascript_tag do %> + var ALL_TAGS = <%= raw @tags.pluck(:name) %>; + var disqus_shortname = '<%= ENV['DISQUS_SHORTNAME'] %>'; + var disqus_identifier = 'u-<%= current_user.id %>'; + var disqus_config = function(){ + this.page.remote_auth_s3 = '<%= disqus_auth %>'; + this.page.api_key = '<%= ENV['DISQUS_API_KEY'] %>'; + }; + CakeSide.initialize({ + access_token: '<%= current_user.authentication_token %>', + disqus_shortname: disqus_shortname + }); + <% end %> +<% end %> + +
    +
    + <%= render partial: "my/shared/my_nav" %> +
    +
    +
    +
    + diff --git a/app/views/my/shared/_my_nav.html.erb b/app/views/my/shared/_my_nav.html.erb index b0febcbf..4837bb1c 100644 --- a/app/views/my/shared/_my_nav.html.erb +++ b/app/views/my/shared/_my_nav.html.erb @@ -4,7 +4,7 @@ <% end %>