<% if memberships.empty? %>
    <% if user != User.current %>
        <p class="font_description">
          <%= l(:label_project_course_un) %>
        </p>
    <% else %>
        <p class="font_description">
          <!--teacher could create the course directly-->
          <%= l(:label_project_course_unadd) %><%= link_to "#{l(:label_course_new)}", {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
        </p>
    <% end %>
<% else %>
    <%= render partial: 'users/course_list_have_entity_ex',:locals => {:user => user,:memberships_doing=>memberships_doing,:memberships_done=>memberships_done}  %>
<% end %>

<script type="text/javascript">
    $(document).ready(function() {
        var $menu = $('.user_course_list .menu');
        var $li_tags = $menu.find('[mode]');
        var $dyn_list = $('.dyn_list_wrapper');

        $menu.find('[mode]').each(function(index, el) {
            $(el).click(function() {
                mode = $(el).attr('mode');
                $menu.find('[mode]').removeClass( "on" );
                $( this ).addClass( "on" );
                var wrapper = $('[mode='+mode+']')
                $dyn_list.addClass( "hidden" );
                wrapper.removeClass('hidden')
            })
        });
    });
</script>