Commit ef2e067c
Changed files (8)
app
assets
javascripts
backbone
controllers
controllers
models
views
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')
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
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)
app/views/my/dashboard/_comment.html.erb
@@ -1,9 +1,7 @@
<div>
- <i class="fa fa-comment fa-large"></i>
- <%= 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}") %>
- <small><%= time_ago_in_words(subject.created_at) %> ago.</small>
+ <i class="fa fa-comment fa-large"></i> <%= link_to subject.creation.name, my_root_path(anchor: "cakes/#{subject.creation.id}") %>
<blockquote>
<%= subject.text %>
+ - <%= avatar_for(subject.user, size: 24) %> <%= link_to subject.user.name, profile_path(subject.user) %>
</blockquote>
</div>
app/views/my/dashboard/_creation.html.erb
@@ -3,8 +3,7 @@
<img class="media-object" data-src="<%= item.primary_image.url_for(:thumb) %>" alt="64x64" style="width: 64px; height: 64px;" src="<%= item.primary_image.url_for(:thumb) %>">
<% end %>
<div class="media-body">
- <h4 class="media-heading"><%= item.name %></h4>
- <%= item.story %>
+ <h4 class="media-heading"><%= link_to item.name, my_root_path(anchor: "cakes/#{item.id}") %></h4>
<p>
<%= link_to my_root_path(anchor: "cakes/#{item.id}/edit") do %>
<i class="fa fa-pencil-square-o"></i> edit
app/views/my/dashboard/_favorite.html.erb
@@ -1,9 +1,8 @@
<div>
<p>
- <i class="fa fa-heart fa-large"></i>
+ <i class="fa fa-star fa-large"></i>
<%= 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
- <small><%= time_ago_in_words(subject.created_at) %> ago.</small>
+ <%= link_to subject.user.name, profile_path(subject.user) %> starred
+ <%= link_to subject.creation.name, my_root_path(anchor: "cakes/#{subject.creation.id}") %>
</p>
</div>
app/views/my/dashboard/_tutorial.html.erb
@@ -1,9 +1,5 @@
<div class="media">
- <%= link_to my_root_path(anchor: "tutorials/#{item.id}"), class: 'pull-left' do %>
- <img class="media-object" data-src="<%= item.image_url %>" alt="64x64" style="width: 64px; height: 64px;" src="<%= item.image_url %>">
- <% end %>
<div class="media-body">
- <h4 class="media-heading"><%= item.heading %></h4>
- <%= item.description %>
+ <h4 class="media-heading"><%= link_to item.heading, my_root_path(anchor: "tutorials/#{item.id}") %></h4>
</div>
</div>
app/views/my/dashboard/index.html.erb
@@ -25,24 +25,36 @@
<% end %>
<% end -%>
-<div class="row-fluid">
+<div class="row">
<div class="span2">
<%= render partial: "my/shared/my_nav" %>
</div>
<div id="backbone-content" class="span10">
- <div class="span5">
- <% @items.each do |item| %>
- <%= render item.class.to_s.downcase, item: item %>
- <% end %>
- </div>
- <div class="span5">
- <% if @activities.empty? %>
- <p>No new activity to report.</p>
- <% else %>
- <% @activities.each do |activity| %>
- <%= render activity.subject.class.to_s.downcase, subject: activity.subject %>
+ <div class="row">
+ <div class="span5">
+ <h5>My Cakes</h5>
+ <% @cakes.each do |item| %>
+ <%= render item.class.to_s.downcase, item: item %>
+ <% end %>
+ </div>
+ <div class="span5">
+ <div class="well">
+ <h5>My Notifications</h5>
+ <% if @activities.empty? %>
+ <p>No new activity to report.</p>
+ <% else %>
+ <% @activities.each do |activity| %>
+ <%= render activity.subject.class.to_s.downcase, subject: activity.subject %>
+ <% end %>
+ <% end %>
+ </div>
+ <% if @tutorials.any? %>
+ <h5>My Tutorials</h5>
+ <% @tutorials.each do |item| %>
+ <%= render item.class.to_s.downcase, item: item %>
+ <% end %>
<% end %>
- <% end %>
+ </div>
</div>
</div>
</div>