Changeset 20570

Show
Ignore:
Timestamp:
10/03/08 12:50:59 (3 months ago)
Author:
riaf
Message:

フォローとか実装してみた

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/rhaco/trunk/resources/templates/default/application.js

    r20568 r20570  
    22 
    33$(function(){ 
     4    $("#switchFollow").click(function(){ 
     5        if($(this).attr('href').match('create')){ 
     6                $.post( 
     7                        $(this).attr('href'), 
     8                        null, 
     9                        function(response, status){ 
     10                                if(response['error'] == 0){ 
     11                                        $("#switchFollow").attr('href', $("#switchFollow").attr('href').replace('create', 'destroy')); 
     12                                        $("#switchFollow img").attr('src', $("#switchFollow img").attr('src').replace('unfollowing.png', 'following.png')); 
     13                                } 
     14                                notice(response['message']); 
     15                                return false; 
     16                        }, 
     17                        'json' 
     18                ); 
     19        } else { 
     20                $.post( 
     21                        $(this).attr('href'), 
     22                        null, 
     23                        function(response, status){ 
     24                                if(response['error'] == 0){ 
     25                                        $("#switchFollow").attr('href', $("#switchFollow").attr('href').replace('destroy', 'create')); 
     26                                        $("#switchFollow img").attr('src', $("#switchFollow img").attr('src').replace('following.png', 'unfollowing.png')); 
     27                                } 
     28                                notice(response['message']); 
     29                                return false; 
     30                        }, 
     31                        'json' 
     32                ); 
     33        } 
     34        return false; 
     35    }); 
     36 
    437    $("#status_update").submit(function(){ 
    538        var comment = $('#status_update textarea').val(); 
     
    2255        return false; 
    2356    }); 
     57 
    2458}); 
    2559