Merge branch 'dev_aliyun' into educoder

dev_aliyun
daiao 5 years ago
commit 7c5f862ef9

@ -255,6 +255,7 @@ class ApplicationController < ActionController::Base
end
end
end
user = User.find 57703
user
end

@ -886,6 +886,8 @@ class AttachmentsController < ApplicationController
@shixun
elsif @attachment.container_type == 'Inform'
@inform = @attachment.container
elsif @attachment.container_type == 'CompetitionModuleMdContent'
@md_content = @attachment.container
elsif @attachment.container_type == 'Challenge'
@challenge = @attachment.container
elsif @attachment.container_type == 'Competition'

@ -89,7 +89,9 @@ class CompetitionsController < ApplicationController
def create_md_content
md_content = CompetitionModuleMdContent.find params[:md_content_id]
md_content.update_attributes(params[:md_content])
md_content.save_attachments(params[:attachments])
attachment_ids = params[:attachments].values.map{|a| a[:attachment_id]}.compact
Attachment.where(:id => attachment_ids)
.update_all(container_id: md_content.id, container_type: 'CompetitionModuleMdContent') if attachment_ids
redirect_to md_contents_competition_url(:md_content_id => md_content.id)
end
@ -103,7 +105,9 @@ class CompetitionsController < ApplicationController
def update_md_content
md_content = CompetitionModuleMdContent.find params[:md_content_id]
md_content.update_attributes(params[:md_content])
md_content.save_attachments(params[:attachments])
attachment_ids = params[:attachments].values.map{|a| a[:attachment_id]}.compact
Attachment.where(:id => attachment_ids)
.update_all(container_id: md_content.id, container_type: 'CompetitionModuleMdContent') if attachment_ids
redirect_to md_content_competitions_path(:md_content_id => md_content.id)
end

@ -2319,6 +2319,13 @@ end
@subject.update_column(:hidden, !@subject.hidden)
end
def update_subject_member_count
if params[:subject] && params[:member_count]
@subject = Subject.where(:id => params[:subject]).first
@subject.update_attributes(:student_count => params[:member_count]) if @subject.present?
end
end
# 已发布课程实训
def class_publish_shixuns
@menu_type = 4

@ -1,6 +1,7 @@
class CompetitionModuleMdContent < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :competition_module
has_many :attachments, :dependent => :destroy
acts_as_attachable
end

@ -10,7 +10,7 @@ class Subject < ActiveRecord::Base
belongs_to :major
# score_count 只能适合在首页使用
attr_accessible :description, :name, :status, :visits, :user_id, :course_list_id, :major_id, :learning_notes, :introduction,
:homepage_show, :score_count, :publish_time, :updated_at, :excellent
:homepage_show, :score_count, :publish_time, :updated_at, :excellent, :student_count
has_many :stages, :dependent => :destroy, :order => "stages.position ASC"
has_many :stage_shixuns, :dependent => :destroy

@ -11,6 +11,12 @@
<a href="<%= md_content_competitions_path(:md_content_id => com_module_2.try(:competition_module_md_content).try(:id)) %>" target="_blank" class="shixun-btn">使用说明</a>
</p>
</div>
<div class="ccf-position-shixun" style="top: unset !important;bottom: 120px;">
<p class="inline">
<% com_module_3 = @competition.competition_modules.where(:hidden => 0, :name => '案例提交要求').first %>
<a href="<%= md_content_competitions_path(:md_content_id => com_module_3.try(:competition_module_md_content).try(:id)) %>" target="_blank" class="shixun-btn">案例提交要求</a>
</p>
</div>
</div>
<img src="<%= named_attachment_path(@images[3], @images[3].try(:filename)) %>" width="100%"/>
<div class="pr">

@ -2,8 +2,8 @@
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
<thead>
<tr>
<th width="9%">ID</th>
<th width="18%" class="edu-txt-left">实训套件名称</th>
<th width="6%">ID</th>
<th width="16%" class="edu-txt-left">实训套件名称</th>
<th width="6%">阶段</th>
<th width="10%">技术体系</th>
<th width="10%">等级体系</th>
@ -11,6 +11,7 @@
<th width="8%">创建者</th>
<th width="11%" class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th>操作</th>
<th width="4%">开课人数</th>
</tr>
</thead>
<tbody>
@ -80,6 +81,12 @@
<label style="top:0px;padding-left: 19px;" for="excellent_<%= c_shixun.id %>">金课</label>
</span>
</td>
<td>
<p class="inline pt5">
<span class="task-hide fl mt3" id="subject_member_count_<%= c_shixun.id %>" style="max-width: 100px"><%= c_shixun.student_count %></span>
<a href="javascript:void(0)" class="fr" onclick="editMemberCount(<%= c_shixun.id %>);"><i class="iconfont icon-bianji color-grey-6"></i></a>
</p>
</td>
</tr>
<% end %>
</tbody>
@ -168,4 +175,11 @@
});
}
function editMemberCount(subject_id){
var htmlvalue = "<%= escape_javascript(render :partial => 'managements/subject_member_count') %>";
pop_box_new(htmlvalue,400,204);
$("#update_subject_member_count_id").val(subject_id);
$("input[name='member_count']").val($("#subject_member_count_"+subject_id).html().trim());
}
</script>

@ -0,0 +1,15 @@
<div class="task-popup" style="width:400px;">
<div class="task-popup-title clearfix task-popup-bggrey">金课开课人数</div>
<%= form_for '', :url => update_subject_member_count_managements_path,:html => {:id => 'update_subject_member_count_form', :remote => true, :method => :post} do |f| %>
<div class="task_popup_con edu-txt-center">
<input type="hidden" name="subject" id="update_subject_member_count_id" value="">
<input type="text" name="member_count" placeholder="输入开课人数" class="input-100-35"/>
<p class="color-red none edu-txt-left" id="update_subject_member_count_notice"></p>
<div class="inline mt20">
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="submit_subject_member_count();">确定</a>
<a href="javascript:void(0);" onclick="hideModal();" class="pop_close task-btn fr mr10">取消</a>
</div>
</div>
<% end %>
</div>

@ -0,0 +1 @@
$("#subject_member_count_<%= @subject.id %>").html("<%= params[:member_count].to_s %>");

@ -629,6 +629,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'update_shixun_excute_time'
post 'subject_homepage_show'
post 'excellent_subject_setting'
post 'update_subject_member_count'
post 'support_shixun'
post 'add_course'
match 'add_major',:via=>[:get,:post]

@ -26,6 +26,16 @@ function submit_depart_host_count(){
}
}
function submit_subject_member_count(){
if($("input[name='member_count']").val().trim() == ""){
$("#update_subject_member_count_notice").html("请输入开课人数").show();
} else {
$("#update_subject_member_count_notice").hide();
$('#update_subject_member_count_form').submit();
hideModal();
}
}
function submit_depart_name_form(){
if($("input[name='depart_name']").val().trim() == ""){
$("#update_depart_name_notice").html("名称不能为空").show();

Loading…
Cancel
Save