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

This commit is contained in:
cxt 2016-10-15 15:16:39 +08:00
commit a709f5c720
10 changed files with 60 additions and 27 deletions

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

@ -10,7 +10,7 @@
</thead>
<tbody>
<tr>
<th ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></th>
<th ><p class="popup_ziyuan_title fl"><%= @attachment.filename %></p><span class="muban_icons_blue ml5">当前版本</span></th>
<th><%= @attachment.downloads %></th>
<th><%= @attachment.try(:quotes).to_i %></th>
<th><%= format_time(@attachment.created_on) %></th>

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

@ -0,0 +1,20 @@
class UpdateHomeworkCommentStatus < ActiveRecord::Migration
def up
homeworks = HomeworkCommon.joins(:homework_detail_manual).where("publish_time is not NULL and publish_time <= '#{Date.today}' and homework_detail_manuals.comment_status = 0")
homeworks.each do |homework|
hw_dm = homework.homework_detail_manual
if hw_dm && hw_dm.comment_status == 0
if hw_dm.evaluation_end < Date.today && homework.anonymous_comment == 0
hw_dm.update_column("comment_status", 3)
elsif homework.anonymous_comment == 0 && hw_dm.evaluation_end >= Date.today && hw_dm.evaluation_start <= Date.today
hw_dm.update_column("comment_status", 2)
else
hw_dm.update_column("comment_status", 1)
end
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161011012114) do
ActiveRecord::Schema.define(:version => 20161015054820) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -142,7 +142,7 @@ ActiveRecord::Schema.define(:version => 20161011012114) do
t.integer "downloads", :default => 0
t.integer "author_id"
t.datetime "created_on"
t.string "description"
t.text "description"
t.string "disk_directory"
t.integer "attachtype"
t.integer "is_public"
@ -313,14 +313,16 @@ ActiveRecord::Schema.define(:version => 20161011012114) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.string "committer"
t.datetime "committed_on", :null => false
t.datetime "committed_on", :null => false
t.text "comments"
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -971,6 +973,10 @@ ActiveRecord::Schema.define(:version => 20161011012114) do
t.datetime "updated_at", :null => false
end
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"

View File

@ -4,6 +4,7 @@ namespace :homework_publishtime do
desc "start publish homework and end homework"
task :publish => :environment do
puts "--------------------------------homework_publish start"
Rails.logger.info("log--------------------------------homework_publish start")
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
homework_commons.each do |homework|
homework_detail_manual = homework.homework_detail_manual
@ -36,6 +37,7 @@ namespace :homework_publishtime do
Mailer.run.homework_added(homework)
end
end
Rails.logger.info("log--------------------------------homework_publish end")
puts "--------------------------------homework_publish end"
end

View File

@ -4,10 +4,12 @@ namespace :resource_publish do
desc "start publish resource"
task :publish => :environment do
puts "--------------------------------resource_publish start"
Rails.logger.info("log--------------------------------resource_publish start")
attachments = Attachment.where("publish_time = '#{Date.today}'")
attachments.each do |attachment|
attachment.update_column('is_publish', 1)
end
Rails.logger.info("log--------------------------------resource_publish end")
puts "--------------------------------resource_publish end"
end
end

View File

@ -660,6 +660,3 @@ a:hover.sy_btn_pink{ background: #e64c4c;}
}
.sy_class_titbox{margin-bottom:5px; padding-top:10px; }
/*项目历史版本删除功能*/
.popup_ziyuan_title{ display: block; margin-left: 10px; text-align: left;width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}

View File

@ -1512,3 +1512,6 @@ a.syllabusbox_a_blue{
/*20160912问卷调查*/
.dash-block {border:1px dashed #ddd;}
/*历史版本删除功能*/
.popup_ziyuan_title{ display: block; margin-left: 10px; text-align: left;width:360px; overflow:hidden;white-space: nowrap; text-overflow:ellipsis;}