<% if @state == 1 %> hideModal(); alert("您还未登录,请先登录"); <% elsif @state == 2 %> $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/apply_for_resource', :locals => {:attachment => @attachment, :state => @state}) %>'); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().css("top","30%").css("left","50%").css("position","fixed").css("border","3px solid #269ac9"); $("#resource_apply_status_<%= @attachment.id %>").html("等待回复"); <% elsif @state == 3 %> hideModal(); alert("您已申请过该资源"); <% end %>