Permalink
Browse files

team card to refresh after update

  • Loading branch information...
game7 committed Mar 26, 2013
1 parent 6fccab9 commit 84b94fb7a5a878811c0804072f05e89676de5118
Showing with 6 additions and 18 deletions.
  1. +1 −1 app/views/teams/_team.html.haml
  2. +5 −17 app/views/teams/update.js.erb
@@ -3,7 +3,7 @@
.logo
= image_tag team.logo.small.url if team.logo?
= render :partial => "actions", :locals => { :team => team } if current_user_is_admin?
- %h1.name{ :style => "color: #{team.secondary_color}"}= team.name
+ %h3.name{ :style => "color: #{team.secondary_color}"}= team.name
.links
= link_to "Schedule", team_schedule_path(team.league_slug, team.season_slug, team.slug), { :style => "color: #{team.accent_color};" }
%span{ :style=> "color: #{team.secondary_color}"}= " | "
@@ -6,23 +6,11 @@
$("#dialog-modal").modal('hide');
$("#dialog-modal").html('');
var $team = $("#team-<%= @team.id %>");
+ var partial = $('<%= escape_javascript(render :partial => "team", :locals => { :team => @team, :class_name => "span6" }) %>').hide();
$team.slideUp('slow', function() {
- $team.find('.well').css('background-color', '<%= @team.primary_color %>');
- $team.find('.name').text('<%= @team.name %>')
- .css('color', '<%= @team.secondary_color %>');
- $team.find('.pages a').css('color', '<%= @team.accent_color %>');
- <% if @team.logo? %>
- $team.find('.info').removeClass('span12').addClass('span9');
- $team.find('.logo').show();
- <% else %>
- $team.find('.info').removeClass('span9').addClass('span12');
- $team.find('.logo').hide();
- <% end %>
- $team.find('.logo').html('<%= image_tag @team.logo.thumb.url if @team.logo? %>');
- $team.find('.actions').replaceWith('<%= escape_javascript(render :partial => "actions", :locals => { :team => @team }) %>');
- $team.slideDown();
+ $team.slideUp('slow', function() {
+ $team.replaceWith(partial);
+ partial.slideDown('slow');
+ });
});
-
-
-
<% end %>

0 comments on commit 84b94fb

Please sign in to comment.