Merge branch 'develop' into cxt_course

Conflicts:
	app/views/layouts/base_courses.html.erb
	app/views/organizations/_org_course_homework.html.erb
	app/views/users/_user_homework_detail.html.erb
This commit is contained in:
cxt 2016-01-18 17:12:56 +08:00
commit 7f7d0ac6f7
18 changed files with 193 additions and 79 deletions

View File

@ -27,7 +27,11 @@ class OrgSubfieldsController < ApplicationController
@sort = "" @sort = ""
@order = "" @order = ""
@is_remote = false @is_remote = false
@organization = Organization.find(params[:id]) if params[:id]
@organization = Organization.find(params[:id])
else
@organization = Organization.where("domain=?",request.subdomain).first
end
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+ @org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+ "subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first " org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first

View File

@ -136,6 +136,10 @@ class OrganizationsController < ApplicationController
end end
end end
def check_uniq_domain
@is_exist = (Organization.where("domain=?", params[:org_domain]).count > 0)
end
def find_organization def find_organization
@organization = Organization.find(params[:id]) @organization = Organization.find(params[:id])
end end

View File

@ -78,7 +78,7 @@
发帖时间:<%= format_time(activity.created_on) %> 发帖时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15"> <div class="homepagePostDate fl ml15">
更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %> 更新时间:<%= format_time(activity.updated_on) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">

View File

@ -2,19 +2,19 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if show_nav?(@course.homework_commons.count) %> <% if show_nav?(@course.homework_commons.count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02 ml10 fn"%> <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f12 c_blue02 ml10 fn"%>
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %> <%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(@course.news.count) %> <% if show_nav?(@course.news.count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02 ml10 fn" %> <%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f12 c_blue02 ml10 fn" %>
<%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %> <%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(course_file_num) %> <% if show_nav?(course_file_num) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02 ml10 fn" %> <%= link_to l(:label_course_file), course_files_path(@course), :class => "f12 c_blue02 ml10 fn" %>
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %> <% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')--> <!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
<a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a> <a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
@ -23,25 +23,25 @@
<% end %> <% end %>
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02 ml10 fn" %> <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f12 c_blue02 ml10 fn" %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %> <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(course_feedback_count) %> <% if show_nav?(course_feedback_count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02 ml10 fn" %> <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f12 c_blue02 ml10 fn" %>
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%> <%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
</div> </div>
<% end %> <% end %>
<% if show_nav?(course_poll_count) %> <% if show_nav?(course_poll_count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02 ml10 fn"%> <%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f12 c_blue02 ml10 fn"%>
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %> <%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
</div> </div>
<% end %> <% end %>
<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> <% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %>
<div class="subNav"> <div class="subNav">
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02 ml10 fn"%> <%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f12 c_blue02 ml10 fn"%>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %> <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
</div> </div>
<% end %> <% end %>

View File

@ -71,7 +71,7 @@
<a href="javascript:void(0)" class="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a> <a href="javascript:void(0)" class="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a>
</div><!--problem_search end--> </div><!--problem_search end-->
<%#= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %> <%#= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %>
<p class="problem_p fl" ><%= l(:label_issues_sum) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.visible.all.count %></a> <p class="problem_p fl" ><%= l(:label_issues_sum) %><a href="javascript:void(0)" class="c_red"><%= @project.project_score.issue_num %></a>
<%= l(:lable_issues_undo) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> </a> <%= l(:lable_issues_undo) %><a href="javascript:void(0)" class="c_red"><%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %> </a>
</p> </p>

View File

@ -102,9 +102,9 @@
</div> </div>
<div class="navHomepageNews"> <div class="navHomepageNews">
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon" %> <%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank" %>
<% if User.current.count_new_message >0 %> <% if User.current.count_new_message >0 %>
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive" %></div> <div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
<% end %> <% end %>
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %> <%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
</div> </div>

View File

@ -98,7 +98,7 @@
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.boards.first ? @course.boards.first.topics.count : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %> <%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %> <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
</div> </div>
<% end %> <% end %>
@ -126,6 +126,7 @@
<%# 工具栏展开 %> <%# 工具栏展开 %>
<% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 || <% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 ||
course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %> course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %>
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div> <div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent" id="navContentCourse"> <ul class="navContent" id="navContentCourse">
<%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %> <%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %>

View File

@ -350,4 +350,4 @@
$("#moreProject_<%=user_activity_id %>").show(); $("#moreProject_<%=user_activity_id %>").show();
}); });
$(description_show_hide(<%=user_activity_id %>)); $(description_show_hide(<%=user_activity_id %>));
</script> </script>

View File

@ -71,7 +71,11 @@
<div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>"> <div class="homepageLeftMenuBlock" style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.field_type == "Post" %> <% if field.field_type == "Post" %>
<% if !field.subfield_subdomain_dir.nil? %> <% if !field.subfield_subdomain_dir.nil? %>
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> <% if !request.local? and !organization.domain.nil? and Organization.where("domain is not null").map(&:domain).include?(request.subdomain) %>
<%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
<% else %>
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
<% end %>
<% else %> <% else %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
<% end %> <% end %>
@ -80,7 +84,11 @@
<% end %> <% end %>
<% else %> <% else %>
<% if !field.subfield_subdomain_dir.nil? %> <% if !field.subfield_subdomain_dir.nil? %>
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> <% if !request.local? and !organization.domain.nil? and Organization.where("domain is not null").map(&:domain).include?(request.subdomain) %>
<%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
<% else %>
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %>
<% end %>
<% else %> <% else %>
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
<% end %> <% end %>

View File

@ -0,0 +1,5 @@
<% if @is_exist %>
$is_exist = true;
<% else %>
$is_exist = false;
<% end %>

View File

@ -54,13 +54,13 @@
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div style="margin-left: 80px " id="check_desc_hint"></div> <div style="margin-left: 80px " id="check_desc_hint"></div>
<!--<div class="orgRow mb10"><span class="ml10">组织URL</span>--> <div class="orgRow mb10"><span class="ml10">组织URL</span>
<!--<div class="w607 fr">http//--> <div class="w607 fr">http//
<!--<input type="text" name="organization[domain]" id="domain" value="<%#= @organization.domain%>" class="orgUrlInput" />--> <input type="text" name="organization[domain]" id="domain" value="<%= @organization.domain%>" class="orgUrlInput" />
<!--.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%#= @organization.id %>,$('#domain').val());">申请</a>--> .trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<!--<p class="c_green f12" id="apply_hint" ></p></div>--> <p class="c_green f12" id="apply_hint" ></p></div>
<!--&lt;!&ndash;class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 &ndash;&gt;--> <!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
<!--</div>--> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span> <div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" /> <input type="checkbox" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
@ -115,15 +115,15 @@
<p class="fontBlue fb mb5">新增栏目</p> <p class="fontBlue fb mb5">新增栏目</p>
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %> <%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" /> <input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
<!--<div class="mb5">--> <div class="mb5">
<!--<p class="fontGrey3"><span class="fb">域名目录</span>用户自定义url可选</p>--> <p class="fontGrey3"><span class="fb">域名目录</span>用户自定义url可选</p>
<!--<%# if @organization.domain %>--> <% if @organization.domain %>
<!--<span class="fl"><%#= @organization.domain %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">--> <span class="fl"><%= @organization.domain %>.trustie.net/</span><input class="fl personalUrl ml3" type="text" name="sub_dir">
<!--<%# else %>--> <% else %>
<!--<span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>--> <span class="fl">您还没有子域名,请先在左侧信息栏申请子域名</span>
<!--<%# end %>--> <% end %>
<!--<div class="cl"></div>--> <div class="cl"></div>
<!--</div>--> </div>
<ul class="orgAddRole"> <ul class="orgAddRole">
<li class="fontGrey3 fb mb10">栏目类型</li> <li class="fontGrey3 fb mb10">栏目类型</li>
<li class="fl mr15"> <li class="fl mr15">
@ -149,18 +149,33 @@
if ($("#subfield_name").val().trim() != "") if ($("#subfield_name").val().trim() != "")
$("#add_subfield_form").submit(); $("#add_subfield_form").submit();
} }
var $is_exist = false;
function apply_subdomain(id, domain){ function apply_subdomain(id, domain){
var reg = new RegExp("^[a-zA-Z0-9_]{1,}$"); var reg = new RegExp("^[a-zA-Z0-9_]{1,}$");
if (reg.exec(domain)){ if (reg.exec(domain)){
$.ajax({ $.ajax({
url:"<%= apply_subdomain_organization_path %>", url: "<%= check_uniq_domain_organizations_path %>",
type:'post', type: 'get',
data:{ data:{
id:id, org_domain:domain
domain:domain
}, },
success:function(){ success:function(){
$("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); if(!$is_exist){
$.ajax({
url:"<%= apply_subdomain_organization_path %>",
type:'post',
data:{
id:id,
domain:domain
},
success:function(){
$("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果");
}
});
}
else{
$("#apply_hint").text("您申请的子域名已存在,请重新输入");
}
} }
}); });
} }

View File

@ -165,7 +165,7 @@
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<div class="cl"></div>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %> <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
<% projects = homework_common.student_work_projects.where("is_leader = 1") %> <% projects = homework_common.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %> <% unless projects.empty? %>
@ -213,42 +213,42 @@
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% if is_teacher%> <% if is_teacher%>
<% comment_status = homework_common.homework_detail_manual.comment_status%> <% comment_status = homework_common.homework_detail_manual.comment_status%>
<div class="homepagePostSetting"> <div class="homepagePostSetting">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li> <li>
<%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%> <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1), :class => "postOptionLink"%>
</li> </li>
<li> <li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course,:course_activity=>-1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li> </li>
<li> <li>
<%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %> <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true) %>
</li> </li>
<% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%> <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%>
<li> <li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%> <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common, :is_in_course => is_in_course,:course_activity=>-1),:class => "postOptionLink", :remote => true)%>
</li> </li>
<% end %> <% end %>
<% if homework_common.anonymous_comment == 0%> <% if homework_common.anonymous_comment == 0%>
<li> <li>
<%= homework_anonymous_comment(homework_common, is_in_course) %> <%= homework_anonymous_comment(homework_common, is_in_course) %>
</li> </li>
<% end %> <% end %>
<% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li> <li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%> <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
</li> </li>
<% end %> <% end %>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<% end%> <% end%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -0,0 +1,9 @@
class Subdomain
def matches?(request)
o = Organization.where(domain: request.subdomain).first
request.path_parameters[:id] = o.id if o
!o.nil?
end
end

View File

@ -66,6 +66,7 @@ RedmineApp::Application.routes.draw do
end end
collection do collection do
get 'check_uniq' get 'check_uniq'
get 'check_uniq_domain'
get 'autocomplete_search' get 'autocomplete_search'
post 'hide_org_subfield' post 'hide_org_subfield'
post 'show_org_subfield' post 'show_org_subfield'
@ -73,12 +74,9 @@ RedmineApp::Application.routes.draw do
end end
end end
get '/', to: 'organizations#show', constraints:lambda{|request|Organization.where("domain is not null").map(&:domain).include?(request.subdomain)}
Organization.where("domain is not null").each do |org| constraints(Subdomain.new) do
# org_domains = [] get '/', to: 'organizations#show'
# org_domains << org.domain
get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain}
#get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: lambda{ |request| org_domains.include?(request.remote_ip) }
end end
get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'} get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'}
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'} get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
@ -1127,6 +1125,8 @@ RedmineApp::Application.routes.draw do
resources :at resources :at
get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id'
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb") file = File.join(plugin_dir, "config/routes.rb")
if File.exists?(file) if File.exists?(file)

View File

@ -0,0 +1,32 @@
class UpdateBoardsAttach < ActiveRecord::Migration
def up
project_count = Project.all.count / 30 + 2
transaction do
for i in 1 ... project_count do i
Project.page(i).per(30).each do |project|
puts project.id
if ProjectScore.where("project_id=?", project.id).first.nil?
puts "create project ==>#{project.id}"
ProjectScore.create(:project_id => project.id, :score => false)
end
unless project.project_score.nil?
# update boards
unless project.boards.first.nil?
boards_count = project.boards.first.topics.count
project.project_score.update_attribute(:board_num, boards_count)
end
# update attach
unless project.attachments.nil?
attachments_count = project.attachments.count
project.project_score.update_attribute(:attach_num, attachments_count)
end
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,32 @@
class UpdateRepCommits < ActiveRecord::Migration
def up
project_count = Project.all.count / 30 + 2
transaction do
for i in 1 ... project_count do i
Project.page(i).per(30).each do |project|
puts project.id
if ProjectScore.where("project_id=?", project.id).first.nil?
puts "create project ==>#{project.id}"
ProjectScore.create(:project_id => project.id, :score => false)
end
unless project.project_score.nil?
# update boards
unless project.gpid.nil?
g = Gitlab.client
begin
puts project.id
count = g.project(project.gpid).commit_count
rescue
logger.error("The project's rep is not exit!")
end
project.project_score.update_attribute(:changeset_num, count)
end
end
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. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160114131753) do ActiveRecord::Schema.define(:version => 20160115125217) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false

View File

@ -1389,7 +1389,7 @@ $(function(){
var personalized_map = cookieget(personalized_expand_key); var personalized_map = cookieget(personalized_expand_key);
if(personalized_map!=false){ if(personalized_map!=false){
personalized_map = JSON.parse(personalized_map); personalized_map = JSON.parse(personalized_map);
$("*[nhtype='toggle4cookie']").each(function(){ $("*[nhtype='toggle4cookiecourse']").each(function(){
var personalized_id=$(this).data('id'); var personalized_id=$(this).data('id');
var val = personalized_map[personalized_id]; var val = personalized_map[personalized_id];
if(val!=undefined && val!=$(this).data('val')){ if(val!=undefined && val!=$(this).data('val')){
@ -1415,7 +1415,7 @@ $(function(){
cookiesave(personalized_expand_key,JSON.stringify(personalized_map)); cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
target.toggle(timeout); target.toggle(timeout);
} }
$("*[nhtype='toggle4cookie']").on('click',function(){ $("*[nhtype='toggle4cookiecourse']").on('click',function(){
personalized_click($(this),500); personalized_click($(this),500);
}); });
@ -1428,3 +1428,7 @@ function submit_course_feedback() {
var flag = true var flag = true
} }
} }
function show_more_tool(){
$('#navContentCourse').css('display', 'block');
}