发送资源到组织功能。同时个人资源库也要添加这个功能
This commit is contained in:
parent
6440434428
commit
abb19422ff
|
@ -281,4 +281,12 @@ class OrganizationsController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def org_resources_subfield
|
||||
@org = Organization.find(params[:id])
|
||||
@subfield = @org.org_subfields.where('field_type = "Resource" ')
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1613,6 +1613,77 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_org
|
||||
@flag = true
|
||||
if params[:send_id].present?
|
||||
send_id = params[:send_id]
|
||||
subfield_id = params[:subfield_id]
|
||||
if subfield_id.nil?
|
||||
@flag = false
|
||||
end
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
unless org_id.nil?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = OrgSubfield.find(subfield_id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
attach_copied_obj.save
|
||||
end
|
||||
elsif params[:send_ids].present?
|
||||
send_ids = params[:send_ids].split(" ")
|
||||
project_ids = params[:projects_ids]
|
||||
if project_ids.nil?
|
||||
@flag = false
|
||||
end
|
||||
send_ids.each do |send_id|
|
||||
|
||||
ori = Attachment.find_by_id(send_id)
|
||||
unless project_ids.nil?
|
||||
project_ids.each do |project_id|
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = Project.find(project_id)
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
attach_copied_obj.save
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@flag=true
|
||||
end
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
@user = User.current
|
||||
@is_remote = true
|
||||
@atta_count = @attachments.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@attachments = paginateHelper @attachments,25
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def change_org_subfield
|
||||
|
||||
end
|
||||
|
||||
# 资源预览
|
||||
def resource_preview
|
||||
preview_id = params[:resource_id]
|
||||
|
@ -1954,6 +2025,23 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def search_user_org
|
||||
@user = User.current
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@orgs = @user.organizations.where("name like ?", search)
|
||||
else
|
||||
@orgs = @user.organizations
|
||||
end
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
@send_ids = params[:checkbox1] || params[:send_ids]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_user
|
||||
|
|
|
@ -32,6 +32,7 @@ class Attachment < ActiveRecord::Base
|
|||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
include UserScoreHelper
|
||||
has_many :attachment_histories
|
||||
|
||||
validates :filename, presence: true, length: {maximum: 254}
|
||||
validates :author, presence: true
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class AttachmentHistory < ActiveRecord::Base
|
||||
belongs_to :attachment,foreign_key: 'attach_id'
|
||||
end
|
|
@ -34,36 +34,34 @@
|
|||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<li><%= link_to '更新版本','',:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if @course.is_public? %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||
</span>
|
||||
</li>
|
||||
<%else%>
|
||||
|
||||
</span>
|
||||
</li>
|
||||
<%end%>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
</li>
|
||||
|
||||
</li>
|
||||
<!--<%# if has_course?(User.current,file) %>-->
|
||||
<!--<li><%#= link_to("发 送",quote_resource_show_course_file_path(@course,file),:class => "postOptionLink",:remote => true) %></li>-->
|
||||
<!--<%#end %>-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -185,6 +185,20 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
function org_id_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
$(".orgDirection").text(orgDirection + sendText);
|
||||
}
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
|
||||
function course_attachmenttypes_change(id, type) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
|
@ -231,6 +245,89 @@
|
|||
});
|
||||
|
||||
}
|
||||
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
|
||||
$('#'+fieldId).each(function() {
|
||||
var $this = $(this);
|
||||
$this.addClass('autocomplete');
|
||||
$this.attr('data-value-was', $this.val());
|
||||
var check = function() {
|
||||
var val = $this.val();
|
||||
if ($this.attr('data-value-was') != val){
|
||||
$this.attr('data-value-was', val);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||||
complete: function(){ $this.removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
};
|
||||
var reset = function() {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
timer = setInterval(check, 300);
|
||||
}
|
||||
};
|
||||
var timer = setInterval(check, 300);
|
||||
$this.bind('keyup click mousemove', reset);
|
||||
});
|
||||
}
|
||||
|
||||
<% if User.current.logged? %>
|
||||
var sendType = '1';
|
||||
var lastSendType ;//初始为发送到我的课程
|
||||
function show_send(id){
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(lastSendType == '1'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if( lastSendType == '3'){//组织
|
||||
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//id 发送的id
|
||||
//发送的id数组
|
||||
function chooseSendType(res_id,res_ids){
|
||||
|
||||
sendType = $(".resourcesSendType").val();
|
||||
if (sendType === lastSendType) {
|
||||
return;
|
||||
} else if(lastSendType != null) { //不是第一次点击的时候
|
||||
if (sendType == '1') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
} else if(sendType == '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}else if(sendType == '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
lastSendType = sendType;
|
||||
}
|
||||
<% end %>
|
||||
<% if @course %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$(".columnContent").html('<%= escape_javascript( render :partial => 'users/org_resources_subfield',:locals => {:subfield=>@subfield})%>')
|
||||
$(".orgDirection").text('目标地址:'+'<%= @org.name.html_safe%>')
|
|
@ -0,0 +1,10 @@
|
|||
<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>
|
||||
<% unless subfield.nil? || subfield.empty? %>
|
||||
<% subfield.each do |field| %>
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="subfield" onclick="subfield_click();" value="<%= field.id %>" class="mt3 fl mr5" />
|
||||
<span><%= field.name %></span></label>
|
||||
</li>
|
||||
<%end %>
|
||||
<%end %>
|
|
@ -0,0 +1,56 @@
|
|||
<div class="mt10">
|
||||
<div class="relateText fl mb10 mr5">发送到</div>
|
||||
<div class="resourcesSendTo mr15">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2">项目</option>
|
||||
<option value="3" selected>组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<%= form_tag search_user_org_user_path(user),:method => 'get',
|
||||
:remote=>true,:id=>'search_user_org_form' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<input type="text" name="serach" id="search_org_input" value="<%=@search %>" placeholder="输入名称搜索" class="orgSendSearch mt15" />
|
||||
<script>
|
||||
observeSearchfieldOnInput('search_org_input','<%= search_user_org_user_path(user)%>','<%= send_id %>','<%= send_ids%>')
|
||||
</script>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
|
||||
<div class="sectionWrap fl mr15">
|
||||
<ul class="fontGrey3 sectionContent">
|
||||
<% unless @orgs.empty? %>
|
||||
<% @orgs.each do |org|%>
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id)%>')" class="mt3 fl mr5" />
|
||||
<span><%= org.name%></span></label>
|
||||
</li>
|
||||
<%end%>
|
||||
<%end%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columnWrap">
|
||||
<ul class="columnContent">
|
||||
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
|
||||
<!--<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>-->
|
||||
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
|
||||
<!--<li>-->
|
||||
<!--<label>-->
|
||||
<!--<input type="radio" name="sendColumn" class="mt3 fl mr5" />-->
|
||||
<!--<span>动态</span></label>-->
|
||||
<!--</li>-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="orgDirection mb10">目标地址:</div>
|
||||
<div class="courseSendSubmit mr15">
|
||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%end %>
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
<div class="boxContainer">
|
||||
<div>
|
||||
<div class="sendText fl">将资源发送至</div>
|
||||
<div class="sendText fl">将资源发送到</div>
|
||||
<div class="resourcesSendTo">
|
||||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2" selected>项目</option>
|
||||
<option value="3">组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -47,7 +48,7 @@
|
|||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="closePopUp();">取消</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>');">
|
||||
<option value="1">课程</option>
|
||||
<option value="2">项目</option>
|
||||
<option value="3">组织</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -47,7 +48,7 @@
|
|||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="closePopUp();">取消</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
|
|||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
closePopUp();
|
||||
hideModal();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
|
|||
$("#res_count").html(0);
|
||||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
closePopUp();
|
||||
hideModal();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -9,10 +9,10 @@
|
|||
//$("#upload_box").css('left','').css('top','');
|
||||
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
//$("#upload_box").css('display','block');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closePopUp();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("shareDP");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
var val = $("#search_org_input").val();
|
||||
$("#search_org_input").val("").focus().val(val);
|
|
@ -8,7 +8,7 @@
|
|||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closePopUp();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox")
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
|
|
|
@ -467,11 +467,17 @@
|
|||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id
|
||||
});
|
||||
} else {
|
||||
} else if(sendType === '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(sendType ==='3')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}else{//如果是多个发送
|
||||
if (sendType === '1'){
|
||||
|
@ -479,11 +485,16 @@
|
|||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize()
|
||||
});
|
||||
}else{
|
||||
}else if(sendType === '2'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize()
|
||||
});
|
||||
}else if(sendType === '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -521,5 +532,12 @@
|
|||
});
|
||||
}
|
||||
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'join_project_menu'
|
||||
post 'join_projects'
|
||||
post 'logout'
|
||||
get 'org_resources_subfield'
|
||||
end
|
||||
collection do
|
||||
get 'check_uniq'
|
||||
|
@ -500,6 +501,7 @@ RedmineApp::Application.routes.draw do
|
|||
get "search_user_course"
|
||||
post "add_exist_file_to_course"
|
||||
post "add_exist_file_to_project"
|
||||
post 'add_exist_file_to_org'
|
||||
get 'resource_preview'
|
||||
get 'rename_resource'
|
||||
get 'search_user_project'
|
||||
|
@ -510,6 +512,8 @@ RedmineApp::Application.routes.draw do
|
|||
get 'store_selected_resource'
|
||||
get 'user_organizations'
|
||||
get 'search_user_orgs'
|
||||
get 'search_user_org' #for send resource
|
||||
|
||||
# end
|
||||
end
|
||||
#resources :blogs
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
class CreateAttachmentHistories < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :attachment_histories do |t|
|
||||
t.integer :container_id
|
||||
t.string :container_type
|
||||
t.string :filename , :default => ""
|
||||
t.string :disk_filename, :default => ""
|
||||
t.integer :filesize, :default => 0
|
||||
t.string :content_type, :default => ""
|
||||
t.string :digest , :default => "",:limit=>40
|
||||
t.integer :downloads, :default => 0
|
||||
t.integer :author_id
|
||||
t.datetime :created_on
|
||||
t.string :description
|
||||
t.string :disk_directory
|
||||
t.integer :attachtype
|
||||
t.integer :is_public
|
||||
t.integer :copy_from
|
||||
t.integer :quotes
|
||||
t.integer :version
|
||||
t.integer :version_id
|
||||
end
|
||||
end
|
||||
end
|
67
db/schema.rb
67
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151218110033) do
|
||||
ActiveRecord::Schema.define(:version => 20151229045505) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -80,6 +80,27 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
|
|||
|
||||
add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id"
|
||||
|
||||
create_table "attachment_histories", :force => true do |t|
|
||||
t.integer "container_id"
|
||||
t.string "container_type"
|
||||
t.string "filename", :default => ""
|
||||
t.string "disk_filename", :default => ""
|
||||
t.integer "filesize", :default => 0
|
||||
t.string "content_type", :default => ""
|
||||
t.string "digest", :limit => 40, :default => ""
|
||||
t.integer "downloads", :default => 0
|
||||
t.integer "author_id"
|
||||
t.datetime "created_on"
|
||||
t.string "description"
|
||||
t.string "disk_directory"
|
||||
t.integer "attachtype"
|
||||
t.integer "is_public"
|
||||
t.integer "copy_from"
|
||||
t.integer "quotes"
|
||||
t.integer "version"
|
||||
t.integer "version_id"
|
||||
end
|
||||
|
||||
create_table "attachments", :force => true do |t|
|
||||
t.integer "container_id"
|
||||
t.string "container_type", :limit => 30
|
||||
|
@ -97,6 +118,7 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
|
|||
t.integer "is_public", :default => 1
|
||||
t.integer "copy_from"
|
||||
t.integer "quotes"
|
||||
t.integer "version", :default => 0
|
||||
end
|
||||
|
||||
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
|
||||
|
@ -558,26 +580,23 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
|
|||
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
||||
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||||
|
||||
create_table "dts", :primary_key => "Num", :force => true do |t|
|
||||
t.string "Defect", :limit => 50
|
||||
t.string "Category", :limit => 50
|
||||
t.string "File"
|
||||
t.string "Method"
|
||||
t.string "Module", :limit => 20
|
||||
t.string "Variable", :limit => 50
|
||||
t.integer "StartLine"
|
||||
t.integer "IPLine"
|
||||
t.string "IPLineCode", :limit => 200
|
||||
t.string "Judge", :limit => 15
|
||||
t.integer "Review", :limit => 1
|
||||
create_table "dts", :force => true do |t|
|
||||
t.string "IPLineCode"
|
||||
t.string "Description"
|
||||
t.text "PreConditions", :limit => 2147483647
|
||||
t.text "TraceInfo", :limit => 2147483647
|
||||
t.text "Code", :limit => 2147483647
|
||||
t.string "Num"
|
||||
t.string "Variable"
|
||||
t.string "TraceInfo"
|
||||
t.string "Method"
|
||||
t.string "File"
|
||||
t.string "IPLine"
|
||||
t.string "Review"
|
||||
t.string "Category"
|
||||
t.string "Defect"
|
||||
t.string "PreConditions"
|
||||
t.string "StartLine"
|
||||
t.integer "project_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "editor_of_documents", :force => true do |t|
|
||||
|
@ -926,6 +945,16 @@ ActiveRecord::Schema.define(:version => 20151218110033) do
|
|||
|
||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_details_copy", :force => true do |t|
|
||||
t.integer "journal_id", :default => 0, :null => false
|
||||
t.string "property", :limit => 30, :default => "", :null => false
|
||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||||
t.text "old_value"
|
||||
t.text "value"
|
||||
end
|
||||
|
||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_replies", :id => false, :force => true do |t|
|
||||
t.integer "journal_id"
|
||||
t.integer "user_id"
|
||||
|
|
|
@ -978,6 +978,15 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
|
||||
//点击发送资源弹出框中的组织,要更改选择栏目中的内容
|
||||
//@dom 选中的radio,值为org_id
|
||||
function change_org_subfield(url){
|
||||
$.ajax({
|
||||
type:'get',
|
||||
url:url
|
||||
})
|
||||
}
|
||||
|
||||
//点击图片即显示大图
|
||||
function showNormalImage(id) {
|
||||
var description_images=$('div#'+id).find("img");
|
||||
|
@ -1001,4 +1010,4 @@ $(function(){
|
|||
var userId = $(this).attr('data-user-id');
|
||||
$(window.location).attr('href', '/users/'+userId);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1392,3 +1392,19 @@ span.at {color:#269ac9;}
|
|||
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
|
||||
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;}
|
||||
|
||||
/*资源发送到org*/
|
||||
.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;}
|
||||
.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;}
|
||||
.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;}
|
||||
.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;}
|
||||
.columnWrap li {padding-left:10px; color:#585858; line-height:20px;}
|
||||
.columnWrap li:hover {background-color:#cccccc;}
|
||||
.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;}
|
||||
.sectionRow:hover {background-color:#cccccc; cursor:pointer;}
|
||||
.sectionContent {}
|
||||
.sectionContent li {padding-left:10px; line-height:20px;}
|
||||
.sectionContent li:hover {background-color:#cccccc;}
|
||||
.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;}
|
||||
.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
|
||||
.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
|
||||
|
||||
|
|
|
@ -408,23 +408,35 @@ a:hover.search_btn{ background: #0fa9bb;}
|
|||
|
||||
/*发送资源弹窗*/
|
||||
/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/
|
||||
.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
|
||||
.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:100px; display:inline-block; font-weight:bold;}
|
||||
/*发送资源弹窗*/
|
||||
/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/
|
||||
/*.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}*/
|
||||
.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
|
||||
.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
|
||||
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
||||
.boxContainer {height:33px; line-height:33px; position:relative}
|
||||
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
||||
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
|
||||
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
||||
.resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
|
||||
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
|
||||
.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
|
||||
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;}
|
||||
.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;}
|
||||
.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
|
||||
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
|
||||
.sendCourseName {font-size:12px; color:#5f6060;}
|
||||
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;}
|
||||
.sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
|
||||
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;}
|
||||
.courseSendSubmit:hover {background-color:#297fb8;}
|
||||
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
|
||||
.courseSendCancel:hover {background-color:#717171;}
|
||||
.courseReferContainer {float:left; max-height:120px; overflow:scroll; overflow-x:hidden; margin-right:16px; margin-bottom:10px;}
|
||||
a.sendSourceText {font-size:14px; color:#ffffff; display:block;}
|
||||
.courseSendCancel:hover {background-color: #717171;}
|
||||
a.sendSourceText {font-size:14px; color:#ffffff;}
|
||||
input.sendSourceText {font-size:14px;color:#ffffff;background-color:#269ac9;cursor: pointer; outline: none; border: none; width: 50px; height: 25px;}
|
||||
input.sendSourceText:hover {background-color:#297fb8;}
|
||||
/*input.sendSourceText:hover {font-size:14px; color:#ffffff;}*/
|
||||
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
||||
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
||||
.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;}
|
||||
.popbox{/* width:300px; *//* height:100px; */position:fixed !important;/* z-index:100; */left:50%;top:50%;margin:-100px 0 0 -150px; /* background:#fff; */ -moz-border-radius:5px; /* -webkit-border-radius:5px; */ /* border-radius:5px; */ /* box-shadow:0px 0px 8px #194a81; */ /* overflow:auto; */}
|
||||
|
||||
/*上传资源弹窗*/
|
||||
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
|
||||
|
@ -924,4 +936,19 @@ span.at {color:#269ac9;}
|
|||
.codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;}
|
||||
.othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;}
|
||||
.thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;}
|
||||
.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
|
||||
.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
|
||||
|
||||
.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;}
|
||||
.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;}
|
||||
.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;}
|
||||
.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;}
|
||||
.columnWrap li {padding-left:10px; color:#585858; line-height:20px;}
|
||||
.columnWrap li:hover {background-color:#cccccc;}
|
||||
.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;}
|
||||
.sectionRow:hover {background-color:#cccccc; cursor:pointer;}
|
||||
.sectionContent {}
|
||||
.sectionContent li {padding-left:10px; line-height:20px;}
|
||||
.sectionContent li:hover {background-color:#cccccc;}
|
||||
.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;}
|
||||
.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
|
||||
.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
|
|
@ -0,0 +1,6 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :attachment_history do
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AttachmentHistory, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue