From 3ee2921ae444ce3525a86f9e146e9ce2b068b223 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 7 Jan 2013 19:57:04 -0500 Subject: [PATCH] updating user profile pages --- app/assets/javascripts/application.js | 2 +- app/controllers/users_controller.rb | 5 ++++- app/views/layouts/application.html.erb | 1 + app/views/maps/_map.html.erb | 24 ++++++++++++++++++++---- app/views/users/show.html.erb | 11 +++++++++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 42d3ef34..cd638588 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -56,7 +56,7 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, sliding1 = true; if (userid != null) { $('.footer .menu').animate({ - height: '252px' + height: '272px' }, 300, function() { sliding1 = false; }); diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c0adfec1..73a15553 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -24,8 +24,11 @@ class UsersController < ApplicationController # GET /user def show @user = User.find(params[:id]) + @topics = @user.topics.order("created_at").limit(3) + @synapses = @user.synapses.order("created_at").limit(3) + @maps = @user.maps.order("created_at").limit(3) - respond_with(@user) + respond_with(@user, @topics, @synapses, @maps) end # POST /user diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6ba778a6..a6f9dc2e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -46,6 +46,7 @@
  • <%= link_to "My Topics", user_topics_url(user) %>
  • <%= link_to "My Synapses", user_synapses_url(user) %>
  • <%= link_to "My Maps", user_maps_url(user) %>
  • +
  • <%= link_to "My Profile", user_url(user) %>
  • <%= link_to "Invite", invite_path %>
  • <%= link_to "Settings", edit_user_url(user) %>
  • <% unless Map.first(:conditions => [ "id = ?", 7]).nil? %> diff --git a/app/views/maps/_map.html.erb b/app/views/maps/_map.html.erb index 73b56a1b..e5c097cd 100644 --- a/app/views/maps/_map.html.erb +++ b/app/views/maps/_map.html.erb @@ -1,8 +1,24 @@ <%= div_for map do %> <% if map.user == user %><%= link_to 'Delete', map_path(map), :class => 'delete', :confirm => 'Delete this map (nodes and synapses will remain)?', :method => :delete, :remote => true %><% end %> -
    - <%= link_to map.name, map_path(map), :class => 'title' %> -

    <%= map.desc %>

    # of Topics: <%= map.topics.count %>

    # of Synapses: <%= map.synapses.count %>

    +

    Map

    + <%= image_tag 'map.png', :class => 'icon', :size => '50x50' %> + + <%=map.name %> + + + +
    +
    +
    + Added by: <%=map.user.name %> + +
    +
    +
    +

    <%= map.topics.count %> topics and <%= map.synapses.count %> synapses

    +

    <%= map.desc %>

    +
    - <% end %> \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 2d4e3525..8b37c0be 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -17,6 +17,17 @@
    --> +

    Recently Created Topics

    +<% @topics.each do |topic| %> + <%= render topic %> +<% end %> +
    + +

    Recently Created Maps

    +<% @maps.each do |map| %> + <%= render map %> +<% end %> +

    Viewing Mapper: <%= @user.name %>