|
|
|
@ -113,10 +113,10 @@
|
|
|
|
|
<%= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>
|
|
|
|
|
</div>
|
|
|
|
|
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="preview();" onfocus="this.blur()">预览</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="rename();" onfocus="this.blur()">重命名</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="show_send();" onfocus="this.blur()" >发送</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="delete_file();" onfocus="this.blur()">删除</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send();" onfocus="this.blur()" >发送</a></li>
|
|
|
|
|
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
@ -322,16 +322,21 @@ $(".resourcesList").click(function(e) {
|
|
|
|
|
document.oncontextmenu = function() {return true;}
|
|
|
|
|
line.children().css("background-color",'white');
|
|
|
|
|
id = line.children().last().html();
|
|
|
|
|
res_name = line.children().eq(1).children().attr('title');
|
|
|
|
|
res_link = line.children().eq(1).html();
|
|
|
|
|
line.children().eq(1).html('<%= form_tag(url_for(:controller => 'users',:action => 'rename_resource',:method => 'post',:remote=>true,:id=>@user.id),:id=>"res_name_form" ) do%>' +
|
|
|
|
|
'<input name="res_name" id="res_name" ' +
|
|
|
|
|
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" ' +
|
|
|
|
|
'value="'+res_name+
|
|
|
|
|
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>'+
|
|
|
|
|
'<% end %>');
|
|
|
|
|
$("#res_name").focus();
|
|
|
|
|
$("html,body").animate({scrollTop:$("#res_name").offset().top},1000)
|
|
|
|
|
user_id = line.children().eq(5).html();
|
|
|
|
|
if(user_id === '<%= User.current.id%>') {
|
|
|
|
|
res_name = line.children().eq(1).children().attr('title');
|
|
|
|
|
res_link = line.children().eq(1).html();
|
|
|
|
|
line.children().eq(1).html('<%= form_tag(url_for(:controller => 'users',:action => 'rename_resource',:method => 'post',:remote=>true,:id=>@user.id),:id=>"res_name_form" ) do%>' +
|
|
|
|
|
'<input name="res_name" id="res_name" ' +
|
|
|
|
|
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" ' +
|
|
|
|
|
'value="'+res_name+
|
|
|
|
|
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>'+
|
|
|
|
|
'<% end %>');
|
|
|
|
|
$("#res_name").focus();
|
|
|
|
|
$("html,body").animate({scrollTop:$("#res_name").offset().top},1000)
|
|
|
|
|
}else{
|
|
|
|
|
alert('您无法修改此资源!')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String.prototype.trim = function() {
|
|
|
|
|
var str = this,
|
|
|
|
@ -391,11 +396,16 @@ $(".resourcesList").click(function(e) {
|
|
|
|
|
}
|
|
|
|
|
line.children().css("background-color", 'white');
|
|
|
|
|
id = line.children().last().html();
|
|
|
|
|
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')){
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'post',
|
|
|
|
|
url: '<%= user_resource_delete_user_path(@user)%>' + '?resource_id=' + id+'&type='+$('#type').val()
|
|
|
|
|
});
|
|
|
|
|
user_id = line.children().eq(5).html();
|
|
|
|
|
if(user_id === '<%= User.current.id%>') {
|
|
|
|
|
if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'post',
|
|
|
|
|
url: '<%= user_resource_delete_user_path(@user)%>' + '?resource_id=' + id + '&type=' + $('#type').val()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
alert('您无法删除此资源!')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|