Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
Tim 2016-10-15 13:41:45 +08:00
commit 0c481de79d
17 changed files with 83 additions and 45 deletions

View File

@ -348,6 +348,7 @@ class AttachmentsController < ApplicationController
@is_history_delete = true
@is_history_destroy = false
@attachment_histories = @attachment.attachment_histories
@attachment_histories_count = @attachment_histories.count
rescue Exception => e
puts e
end
@ -667,6 +668,7 @@ class AttachmentsController < ApplicationController
def attachment_versions_delete
@attachment = Attachment.find(params[:id])
@attachment_histories = @attachment.attachment_histories
@attachment_histories_count = @attachment_histories.count
respond_to do |format|
format.js
end

View File

@ -296,12 +296,12 @@ class ForumsController < ApplicationController
#检查forum的名字
def check_forum_name
forum_name_exist = false
# if params[:forum_id]
# forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
# else
forum_name_exist = true
if params[:forum_id]
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
else
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false
# end
end
render :text => forum_name_exist
end

View File

@ -1,6 +1,6 @@
<div class="muban_popup_top">
<h3 class="fl">删除资源</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal();"></a>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="attachment_fresh_for_destroy();"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con" >
@ -9,3 +9,10 @@
<%= render :partial => "files/attachment_history_popub_delete" %>
</div>
</div>
<script>
function attachment_fresh_for_destroy(){
hideModal();
$(".re_search").submit();
}
</script>

View File

@ -1,7 +1,7 @@
<% if @flag %>
hideModal();
alert('更新成功')
// $(".re_search").submit();
$(".re_search").submit(); // 为了刷新
<%else%>
$("#upload_file_count").html('(更新失败)')
<%end %>

View File

@ -14,7 +14,7 @@
<th><%= @attachment.downloads %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>
<th></th>
<!--<th></th>-->
</tr>
<% @attachment_histories.each do |history| %>
<tr>
@ -24,14 +24,14 @@
<th><%= history.downloads %></th>
<th><%= history.try(:quotes).to_i %></th>
<th><%= format_time(history.created_on) %></th>
<th>
<%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
:remote => true,
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => "postOptionLink",
<!--<th>-->
<%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
# :remote => true,
# :data => {:confirm => l(:text_are_you_sure)},
# :method => :delete,
# :class => "postOptionLink",
:class => "btn") if allow_to_delete_attachment(history) %>
</th>
<!--</th>-->
</tr>
<% end %>
</tbody>
@ -52,7 +52,15 @@
<div class="cl"></div>
<textarea style="resize:none" type="text" placeholder="请在此编辑资源描述" name="description" class="mr15 mb10 muban_textarea" ><%= @attachment.description %></textarea>
<div class="clear mb15">
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="btn fr" onclick="hideModal();">取消</a>
<%= submit_tag '确定', :onclick => 'upload_attachment_version(event);', :onfocus => 'this.blur()', :id => 'upload_files_submit_btn', :class => 'btn btn-blue fr mr5' %>
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="btn fr" onclick="attachment_fresh_for_destroy()">取消</a>
<%#= submit_tag '确定', :onclick => 'upload_attachment_version(event);', :onfocus => 'this.blur()', :id => 'upload_files_submit_btn', :class => 'btn btn-blue fr mr5' %>
<a href="javascript:void(0);" onclick = "upload_attachment_version(event);" onfocus = 'this.blur()' id = 'upload_files_submit_btn' class = 'btn btn-blue fr mr5' >确定</a>
</div>
<% end %>
<script>
function attachment_fresh_for_destroy(){
hideModal();
$(".re_search").submit();
}
</script>

View File

@ -39,11 +39,11 @@
</table>
<div>
<% if @attachment.container_type == "Project" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
<% elsif @attachment.container_type == "Course" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
<% elsif @attachment.container_type == "OrgSubfield" %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
<% end %>
</div>

View File

@ -79,8 +79,14 @@
</li>
<% end %>
<li>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => file.destroyable ? l(:text_are_you_sure) : l(:text_history_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
<% if file.destroyable %>
<%= link_to( '删除资源', attachment_path(file),
:data => {:confirm => file.destroyable ? l(:text_are_you_sure) : l(:text_history_are_you_sure)},
:method => :delete,
:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
<% else %>
<%= link_to '删除资源', attachment_versions_delete_path(file), :class => "postOptionLink", :remote => true %>
<% end %>
</li>
</ul>
<%else%>

View File

@ -3,7 +3,7 @@
<% course_board.children.reorder("position asc").each do |board| %>
<li>
<% count = board ? (board.topics.count + Message.where("board_id =? and parent_id is not ?", board.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course, :board_id =>board.id) %>"><font class="hidden w170 db"><%=board.name %></font><span><%=count %></span></a>
<a href="<%=course_boards_path(@course, :board_id =>board.id) %>"><font class="hidden dis" style="max-width: 120px;"><%=board.name %></font><span style="vertical-align: top;"><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :board_id =>board.id, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li>
<% end %>

View File

@ -43,11 +43,12 @@
$(this).prev().css("color","#808080");
$(this).css("z-index", "1");
});
//二级菜单滑动时箭头方向控制
$(".homepageLeftMenuMoreIcon").toggle(function(){
$(this).css("background","url(/images/homepage_icon.png) -74px -240px no-repeat");
},function(){
$(this).css("background","url(/images/homepage_icon.png) 100px -624px no-repeat");
},function(){
$(this).css("background","url(/images/homepage_icon.png) -74px -240px no-repeat");
});
})
</script>
@ -55,7 +56,7 @@
<% organization.org_subfields.order("priority").each do |field| %>
<% if is_default_field?(field) %>
<% case field.name %>
<% when 'activity' %>
<% when 'activity' %>
<div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0 ? 'block':'none' %>;" id="org_subfield_<%= field.id %>">
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
</div>
@ -102,15 +103,17 @@
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% else %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<!-- link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" -->
<a href = "javascript:void(0);" class = "homepageMenuText" onclick = "$('#PostDomain_<%= field.id %>').slideToggle();"><%= field.name %></a>
<% end %>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %>
<% end %>
</div>
<div class="<%= (field.sub_domains.count == 0) ? 'homepageLeftMenuCourses':'homepageLeftMenuCourses borderBottomNone' %>" id="PostDomain_<%= field.id %>" style="display:block;">
<div class="homepageLeftMenuCourses" id="PostDomain_<%= field.id %>" style="display:<%= field.sub_domains.count == 0 ? 'none' : '' %>">
<ul>
<%= render :partial => 'organizations/org_subdomain',:locals => {:subdomains => field.sub_domains.reorder('priority').uniq.limit(5), :org_subfield_id => field.id, :page=>1, :org_id => organization.id } %>
<%= render :partial => 'organizations/org_subdomain',:locals => {:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
</ul>
</div>
@ -136,7 +139,7 @@
</div>
<% elsif field.field_type == "Resource" %>
<div class="homepageLeftMenuBlock">
<% if !field.subfield_subdomain_dir.nil? %>
<% if !field.subfield_subdomain_dir.nil? %>
<% if !request.local? and Secdomain.where("sub_type=2 and pid=?", organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", organization.id).map(&:subname).include?(request.subdomain) %>
<%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden" %>
<% else %>

View File

@ -3,10 +3,10 @@
<%= link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %>
</li>
<% end %>
<% if subdomains.size == 5 %>
<li class="homepageLeftMenuMore" id="show_more_org_submains">
<input type="hidden" value="<%= page %>" id="org_submains_page_num">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_org_submain('<%= more_org_submains_organization_path(org_id, :org_subfield_id => org_subfield_id) %>');"></a>
</li>
<% end%>
<%# if subdomains.size == 5 %>
<!--<li class="homepageLeftMenuMore" id="show_more_org_project">-->
<!--<input type="hidden" value="<%#= page %>" id="org_project_page_num">-->
<!--<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_org_project('<%#= more_org_projects_organization_path(org_id) %>');"></a>-->
<!--</li>-->
<%# end%>

View File

@ -4,13 +4,13 @@
<h2 class="list-h2">讨论区列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<%= link_to "时间", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<%= link_to "人气", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'boards', :action => 'index', :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,9 @@
class ChangeDescriptionForAttachmentHistory < ActiveRecord::Migration
def up
change_column :attachment_histories, :description, :text
end
def down
change_column :attachment_histories, :description, :string
end
end

View File

@ -3,6 +3,7 @@
namespace :homework_publishtime do
desc "start publish homework and end homework"
task :publish => :environment do
puts "--------------------------------homework_publish start"
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
homework_commons.each do |homework|
homework_detail_manual = homework.homework_detail_manual
@ -18,7 +19,7 @@ namespace :homework_publishtime do
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{Time.now}', '#{Time.now}')"
end
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
@ -35,6 +36,7 @@ namespace :homework_publishtime do
Mailer.run.homework_added(homework)
end
end
puts "--------------------------------homework_publish end"
end
task :end => :environment do

View File

@ -3,9 +3,11 @@
namespace :resource_publish do
desc "start publish resource"
task :publish => :environment do
puts "--------------------------------resource_publish start"
attachments = Attachment.where("publish_time = '#{Date.today}'")
attachments.each do |attachment|
attachment.update_column('is_publish', 1)
end
puts "--------------------------------resource_publish end"
end
end

View File

@ -34,6 +34,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}
.hworkListBanner {width:720px; height:40px; background:#eaeaea; margin-bottom:10px;}
.hworkListContainer {float:left; clear:both; width:720px;}
.showHwork{ border:1px solid #eaeaea; width:696px; padding:10px; color:#666666; padding-bottom:0px; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); }
.showHworkP pre {white-space:normal;}
.showHworkP{ width:630px; float:left;}
.showHwork ul li {margin-bottom: 5px;}
.hworkPingText{ float:left; border:1px solid #e4e4e4; padding:5px; width:618px; height:35px;}

View File

@ -265,7 +265,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w557{ width:557px;}
.w570 {width:570px !important;}
.w576{ width:576px;}
.w590{ width:590px;}
.w590{ width:590px; !important;}
.w607 {width:607px;}
.w664{ width:664px;}
.w683{ width:683px;}
@ -660,4 +660,4 @@ a:hover.hw_btn_blue,a:active.hw_btn_blue{ background: #3b94d6; color:#fff;}
.error-icon {background:url("/images/icons_ziliao.png") 0 -56px no-repeat; padding-left:25px;}
/*禁用*/
.disabled {background-color:#f5f5f5;}
.disabled {background-color:#f5f5f5;}

View File

@ -565,8 +565,6 @@ a:hover.sy_class_ltitle{ color:#333;}
.hw_tab_hover a{ color:#60b25e !important; }
.hw_tab_nomal {border-bottom:none; }
.hw_tab_nomal a{ color:#333;}
.undis {display:none;}
.dis {display:block;}
.hw_more_box {position:absolute; width:24px; height:15px; right:15px; top:15px;}
.hw_more_box ul li:hover ul {display:block; }
.hw_more_icons {background:url(../images/hw/icons_hw.png) 0px -30px no-repeat; width:24px; height:15px; }