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

This commit is contained in:
Tim 2016-10-14 16:34:09 +08:00
commit 75a68e9844
44 changed files with 354 additions and 90 deletions

View File

@ -19,7 +19,7 @@ class BoardsController < ApplicationController
layout 'base_projects'#by young
default_search_scope :messages
before_filter :find_project_by_project_id, :find_board_if_available, :except => [:join_to_org_subfields]
before_filter :authorize, :except => [:new, :show, :create, :index, :join_to_org_subfields]
before_filter :authorize, :except => [:new, :show, :create, :index, :join_to_org_subfields, :update_position, :update_name]
accept_rss_auth :index, :show
@ -56,8 +56,12 @@ class BoardsController < ApplicationController
@boards = @course.boards.includes(:last_message => :author).all
end
end
unless @course.boards.empty?
@board = @course.boards.first
if params[:board_id]
@board = Board.find params[:board_id].to_i
else
unless @course.boards.where("parent_id is NULL").empty?
@board = @course.boards.where("parent_id is NULL").first
end
end
show and return
else
@ -192,18 +196,31 @@ class BoardsController < ApplicationController
end
end
def create
@board = @project.boards.build
@board.safe_attributes = params[:board]
if @board.save
flash[:notice] = l(:notice_successful_create)
#Modified by young
#redirect_to_settings_in_projects
redirect_to project_board_url(@project, @board)
#Ended by young
else
render :action => 'new'
def create
if @project
@board = @project.boards.build
@board.safe_attributes = params[:board]
if @board.save
flash[:notice] = l(:notice_successful_create)
#Modified by young
#redirect_to_settings_in_projects
redirect_to project_board_url(@project, @board)
#Ended by young
else
render :action => 'new'
end
elsif @course
parent = Board.find params[:board_id].to_i
board = @course.boards.build
board.name = params[:name]
board.description = board.name
board.project_id = -1
board.position = parent.children.count + 1
parent.children << board
respond_to do |format|
format.js
end
end
end
@ -224,8 +241,46 @@ class BoardsController < ApplicationController
end
def destroy
after_boards = @board.parent.children.where("position > #{@board.position}")
after_boards.update_all("position = position - 1")
@board.destroy
redirect_to_settings_in_projects
if @course
respond_to do |format|
format.js
end
elsif @project
redirect_to_settings_in_projects
end
end
def update_position
if @course
boards = @board.parent.children
if params[:opr] == 'up' && @board.position > 1
before_board = boards.where("position = #{@board.position - 1}").first
if before_board && @board.update_attribute('position', @board.position - 1)
before_board.update_attribute('position', before_board.position + 1)
end
elsif params[:opr] == 'down' && @board.position < boards.count
after_board = boards.where("position = #{@board.position + 1}").first
if after_board && @board.update_attribute('position', @board.position + 1)
after_board.update_attribute('position', after_board.position - 1)
end
end
respond_to do |format|
format.js
end
end
end
def update_name
if @course
@board.update_attribute("name", params[:name])
@board.update_attribute("description", params[:name])
respond_to do |format|
format.js
end
end
end
def join_to_org_subfields

View File

@ -122,7 +122,7 @@ class MessagesController < ApplicationController
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
redirect_to course_boards_path(@course, :board_id => @board.id)
end
else
redirect_to board_message_url(@board, @message)
@ -132,7 +132,7 @@ class MessagesController < ApplicationController
if @project
redirect_to project_boards_path(@project, :flag => true)
elsif @course
redirect_to course_boards_path(@course, :flag => true)
redirect_to course_boards_path(@course, :board_id => @board.id, :flag => true)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'

View File

@ -3562,7 +3562,7 @@ class UsersController < ApplicationController
@type = 'Issue'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'BlogComment'
#obj = BlogComment.where('id = ?', params[:id].to_i).first
obj = BlogComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]
@homepage = params[:homepage].to_i
@type = 'BlogComment'

View File

@ -332,7 +332,7 @@ class WordsController < ApplicationController
@homework_common = HomeworkCommon.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, options)
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, reply.root_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
@ -366,7 +366,7 @@ class WordsController < ApplicationController
@syllabus = Syllabus.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, reply.root_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')

View File

@ -35,7 +35,7 @@ class Board < ActiveRecord::Base
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args))
}
safe_attributes 'name', 'description', 'parent_id', 'move_to'
safe_attributes 'name', 'description', 'parent_id', 'move_to', 'position'
def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_messages, project)
@ -51,7 +51,11 @@ class Board < ActiveRecord::Base
end
def valid_parents
@valid_parents ||= project.boards - self_and_descendants
if project
@valid_parents ||= project.boards - self_and_descendants
elsif course
@valid_parents ||= course.boards - self_and_descendants
end
end
def reset_counters!

View File

@ -22,7 +22,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
班级讨论区
<%= @board.parent_id.nil? ? "班级讨论区" : "#{@board.name}" %>
</div>
</div>
<div nhname="topic_form">

View File

@ -0,0 +1,5 @@
<% if @course %>
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where("parent_id is NULL").first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");
<% end %>

View File

@ -0,0 +1,5 @@
<% if @course %>
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where("parent_id is NULL").first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");
<% end %>

View File

@ -0,0 +1,5 @@
<% if @course %>
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where("parent_id is NULL").first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");
<% end %>

View File

@ -0,0 +1,5 @@
<% if @course %>
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where("parent_id is NULL").first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");
<% end %>

View File

@ -1,10 +1,22 @@
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<% course_board = @course.boards.where("parent_id is NULL").first %>
<% if show_nav?(course_board ? course_board.topics.count : 0) %>
<li>
<a href="<%=course_boards_path(@course) %>">讨论区</a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li>
<% unless course_board.children.empty? %>
<ul class="sub-menu">
<% course_board.children.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) %>"><%=board.name %><span><%=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 %>
</ul>
<% end %>
<% end %>
<% if show_nav?(@course.homework_commons.count) %>
<li>

View File

@ -22,6 +22,9 @@
<li id="tb_3" class="hwork_normaltab" onclick="course_setting(3);">
组织
</li>
<li id="tb_4" class="hwork_normaltab" onclick="course_setting(4);">
讨论区设置
</li>
</ul>
</div>
<div class="hwork_dis" id="tbc_01" style="padding-top: 10px;">
@ -131,6 +134,10 @@
<div class="hwork_undis" id="tbc_03">
<%= render :partial => 'courses/settings/join_org' %>
</div>
<div class="hwork_undis" id="tbc_04">
<%= render :partial => 'courses/settings/boards_setting' %>
</div>
</div><!--talknew end-->
<div class="cl"></div>
<script type="text/javascript">

View File

@ -0,0 +1,115 @@
<% board = @course.boards.where("parent_id is NULL").first %>
<div class="w730 mt10" id="org_subfield_list">
<ul class="orgListRow borderBottomNone orgListBg">
<li class="w270 fb fl"><span class="ml15">名称</span></li>
<li class="w140 fb fl">状态</li>
<li class="w170 fb fl">类型</li>
<li class="w150 fb fl"><span class="mr15 fr">操作</span></li>
<div class="cl"></div>
</ul>
<ul class="orgListRow">
<li class="w270 fl"> <span class="ml15">班级讨论区</span> </li>
<li class="w140 fl">默认</li>
<li class="w170 fl">帖子</li>
<li class="w150 fl"> <a href="javascript:void(0)" class="link-blue fr mr15" id="addSubMenu">添加子栏目</a> </li>
<div class="cl"></div>
<% count = board.children.count %>
<% board.children.reorder("position asc").each_with_index do |board, i|%>
<ul class="orgSubList" style="border-top: 1px solid rgb(228, 228, 228);">
<li class="<%= i == count - 1 ? 'orgSubTree2' : 'orgSubTree' %>"></li>
<li class="w210 mr10 fl">
<div id="board_sub_show_<%= board.id %>" class="w210 hidden" title="<%=board.name %>"><%=board.name %></div>
<div id="board_sub_edit_<%= board.id %>" style="display:none;">
<input type="text" name="name" onblur="update_sub_board_name('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>','<%= board.id %>','<%= @course.id %>',$(this).val());" value="<%= board.name %>" style="width:140px;"/>
</div>
</li>
<li class="w140 fl">新增</li>
<li class="w170 fl">帖子</li>
<li class="w150 fl">
<a href="javascript:void(0);" class="linkGrey fr ml5 mr15" onclick="edit('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>');">编辑</a>
<%= link_to('删除', {:controller => 'boards', :action => 'destroy', :id => board.id, :course_id => @course.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "linkGrey fr ml5 mr5", :title => l(:button_delete)) %>
<% if i < count - 1 %>
<%= link_to('下移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'down'},:remote => true, :method => 'post', :class => "linkGrey fr ml5 mr5", :title => '下移') %>
<% end %>
<% unless i == 0 %>
<%= link_to('上移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'up'},:remote => true, :method => 'post', :class => "linkGrey fr ml5 mr5", :title => '上移') %>
<% end %>
</li>
<div class="cl"></div>
</ul>
<% end %>
</ul>
</div>
<!--新增二级栏目-->
<div class="mt10 fl orgListBg w730 undis" id="subMenuContent">
<%= form_tag url_for(:controller => 'boards', :action => 'create', :course_id => @course.id, :board_id => board.id), :id=> 'add_board_form_subboard',:remote => true do %>
<div class="ml15 mt10">
<span class="fontGrey3 mb5 mr10">新增子栏目名称 :</span>
<input id="subfield_name" name="name" placeholder="请输入子栏目名称" class="orgAddSearch mb10" type="text">
<span id="new_notice" class="undis ml10">名称不能为空</span>
</div>
<div class="mb10">
<span class="fontGrey3 ml50 mr15 fl">栏目类型 :</span>
<input class="mr5" id="orgMng" value="Post" name="field_type" checked="checked" type="radio">
<label for="orgMng">帖子</label>
</div>
<div class="mb10">
<a href="javascript:void(0);" class="grey_btn_cir fr c_white mr15 ml15" id="subMenuCancel">取消</a>
<a href="javascript:void(0);" class="blue_btn_cir fr c_white" id="subMenuSubmit">确定</a>
<div class="cl"></div>
</div>
</form>
<% end %>
</div>
<!--over-->
<script>
$(function(){
$("#subMenuSubmit").one('click', function(){
sub_board_submit();
});
});
function sub_board_submit(){
if ($("#subfield_name").val().trim() != ""){
$("#new_notice").hide();
$("#add_board_form_subboard").submit();
} else {
$("#new_notice").show();
$("#subMenuSubmit").one('click', function(){
sub_board_submit();
});
}
}
$("#addSubMenu").click(function(){
$("#subMenuContent").toggle();
});
$("#subMenuCancel").click(function(){
$("#subMenuContent").hide();
});
function update_sub_board_name(show_id, edit_id, field_id, domain_id, input_value) {
if (input_value.trim() != "" && $(show_id).html().trim() != input_value.trim()) {
if (confirm('确定修改为' + input_value + "?"))
$.ajax({
url: "/boards/" + field_id + "/update_name?course_id=" + domain_id + "&name=" + input_value,
type: 'put'
});
else{
$(edit_id).children("input").val($(show_id).html().trim());
}
}
$(show_id).show();
$(edit_id).hide();
}
function edit(show_id, edit_id) {
$(show_id).toggle();
$(edit_id).toggle();
$(edit_id).find('input').focus();
$(edit_id).find('input').on('keypress', function (e) {
if (e.keyCode == 13) {
this.blur();
}
})
}
</script>

View File

@ -0,0 +1,11 @@
<% unless course_board.children.empty? %>
<ul class="sub-menu">
<% 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) %>"><%=board.name %><span><%=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 %>
</ul>
<% end %>

View File

@ -64,12 +64,16 @@
<a href="<%=course_path(@course) %>" >动态<span><%=@course.course_activities.count %></span></a>
</li>
<% end %>
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<% course_board = @course.boards.where("parent_id is NULL").first %>
<% unless show_nav?(course_board ? course_board.topics.count : 0) %>
<li id="sy_02" class="sy_icons_boards">
<% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %>
<% count = course_board ? (course_board.topics.count + Message.where("board_id =? and parent_id is not ?", course_board.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_teacher %>
</li>
<div id="board_children_list">
<%= render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board} %>
</div>
<% end %>
<% unless show_nav?(@course.homework_commons.count) %>
<li id="sy_03" class="sy_icons_hwork">

View File

@ -4,11 +4,11 @@
<div class="talk_new ml15">
<p class="talk_top"><%= l(:label_message_new) %></p>
<ul>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= form_for @message, :url => {:action => 'new', :board_id => @board.id}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f,:is_new => true} %>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%#= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form' ,target='preview',{:class => 'blue_btn grey_btn fl c_white'} )%>
<%= link_to l(:button_cancel), course_boards_path(@course), :class => "grey_btn fl c_white ml10"%>
<%= link_to l(:button_cancel), course_boards_path(@course, :board_id => @board.id), :class => "grey_btn fl c_white ml10"%>
<% end %>
</ul>
</div>

View File

@ -3,7 +3,7 @@
<script type="text/javascript">
function resetQuestion<%=poll_question.id%>()
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
// $("#poll_questions_title_<%#=poll_question.id%>").val("<%#= poll_question.question_title%>")
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %> " +
"<% if poll_answer.answer_text != '' %>" +
@ -27,9 +27,9 @@
<div class="questionEditContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题题目" value="<%= poll_question.question_title%>"/>
<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题题目" onfocus="autoHeight('#poll_questions_title_<%=poll_question.id%>',30)"><%= poll_question.question_title%></textarea>
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label>
</div>

View File

@ -2,7 +2,7 @@
<script type="text/javascript">
function resetQuestion<%=poll_question.id%>()
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
// $("#poll_questions_title_<%#=poll_question.id%>").val("<%#= poll_question.question_title%>")
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<% if poll_answer.answer_text != '' %>" +
@ -25,9 +25,9 @@
</script>
<div class="questionEditContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题题目" value="<%= poll_question.question_title%>"/>
<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题题目" onfocus="autoHeight('#poll_questions_title_<%=poll_question.id%>',30)"><%= poll_question.question_title%></textarea>
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label>
</div>

View File

@ -3,9 +3,7 @@
<div>
<input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="testTitle mb10" placeholder="新建问卷,请先输入问卷标题"/>
</div>
<textarea name="polls_description" maxlength="300" id="polls_description" class="testDes" placeholder="请在此输入问卷描述">
<%= @poll.polls_description.html_safe if !@poll.polls_description.blank? %>
</textarea>
<textarea name="polls_description" id="polls_description" class="testDes" placeholder="请在此输入问卷描述"><%= @poll.polls_description.html_safe if !@poll.polls_description.blank? %></textarea>
<a data-button="cancel" onclick="pollsCancel();" class="grey_btn fr borderRadius">取消</a>
<a data-button="ok" onclick="pollsSubmit($(this));" class="blue_btn fr borderRadius mr5">保存</a>
<div class="cl"></div>

View File

@ -2,7 +2,7 @@
<script type="text/javascript">
function resetQuestion<%=poll_question.id%>()
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>");
// $("#poll_questions_title_<%#=poll_question.id%>").val("<%#= poll_question.question_title%>");
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item new_answer'>" +
@ -16,9 +16,9 @@
</script>
<div class="questionEditContainer"> <!--编辑多行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行主观题的问题描述" value="<%= poll_question.question_title%>"/>
<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行主观题的问题描述" onfocus="autoHeight('#poll_questions_title_<%=poll_question.id%>',30)"><%= poll_question.question_title%></textarea>
<label>
<input id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" type="checkbox" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
必答

View File

@ -2,16 +2,16 @@
<script type="text/javascript">
function resetQuestion<%=poll_question.id%>()
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
// $("#poll_questions_title_<%#=poll_question.id%>").val("<%#= poll_question.question_title%>")
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
}
</script>
<div class="questionEditContainer"> <!--编辑单行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" id="poll_questions_title_<%=poll_question.id%>" class="questionTitle w570" contenteditable="true" type="text"
name="poll_questions_title" placeholder="请输入单行主观题" value="<%= poll_question.question_title%>"/>
<textarea maxlength="250" id="poll_questions_title_<%=poll_question.id%>" class="questionTitle w570" contenteditable="true" type="text"
name="poll_questions_title" placeholder="请输入单行主观题" onfocus="autoHeight('#poll_questions_title_<%=poll_question.id%>',30)"><%= poll_question.question_title%></textarea>
<label>
<input name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%> type="checkbox">
必答</label>

View File

@ -3,9 +3,9 @@
<% insert_begin = insert_begin %>
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="1"/>
<input maxlength="250" class="questionTitle W600" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入单选题题目"/>
<textarea maxlength="250" class="questionTitle w590" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入单选题题目" oninput="autoHeight('#poll_questions_title_new',30)"></textarea>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>

View File

@ -1,9 +1,9 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%><!--新建多选start-->
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="2"/>
<input maxlength="250" class="questionTitle W600" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题题目"/>
<textarea maxlength="250" class="questionTitle w590" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题题目" oninput="autoHeight('#poll_questions_title_new',30)"></textarea>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>

View File

@ -1,9 +1,9 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<div class="questionContainer"> <!--编辑多行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="4"/>
<input maxlength="250" id="poll_questions_title_new" class="questionTitle W600" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"/>
<textarea maxlength="250" id="poll_questions_title_new" class="questionTitle w590" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述" oninput="autoHeight('#poll_questions_title_new',30)"></textarea>
<label>
<input name="is_necessary" value="true" checked type="checkbox">
必答

View File

@ -1,9 +1,9 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<div class="questionContainer"> <!--编辑单行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="3"/>
<input maxlength="250" id="poll_questions_title_new" class="questionTitle W600" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>
<textarea maxlength="250" id="poll_questions_title_new" class="questionTitle w590" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题" oninput="autoHeight('#poll_questions_title_new',30)"></textarea>
<label>
<input name="is_necessary" value="true" checked type="checkbox">
必答

View File

@ -72,11 +72,11 @@ function add_MC(){
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
' <div class="questionEditContainer"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题目"/>'+
'<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题目"></textarea>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
@ -128,6 +128,11 @@ function add_MC(){
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
$(".questionTitle").on("input",function(){
$(this).height(30);
var scrollVal = $(this)[0].scrollHeight;
$(this).height(scrollVal);
});
}
}
else {
@ -157,11 +162,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+
'<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题目"/>'+
'<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题目"></textarea>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
@ -213,6 +218,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
$(".questionTitle").on("input",function(){
$(this).height(30);
var scrollVal = $(this)[0].scrollHeight;
$(this).height(scrollVal);
});
}
}
else {
@ -242,11 +252,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>'+
'<textarea maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"></textarea>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
@ -266,6 +276,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
$(".questionTitle").on("input",function(){
$(this).height(30);
var scrollVal = $(this)[0].scrollHeight;
$(this).height(scrollVal);
});
}
}
else {
@ -294,11 +309,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<label for="ur_question_title" class="questionLabel mt8">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+
'<input maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"/>'+
'<textarea maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"></textarea>'+
'<label><input type="checkbox" name="is_necessary" value="true" checked/>'+
'必答</label>'+
'</div>'+
@ -339,6 +354,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){
$("#add_new_question").one('click', function(){
add_poll_question($(this));
});
$(".questionTitle").on("input",function(){
$(this).height(30);
var scrollVal = $(this)[0].scrollHeight;
$(this).height(scrollVal);
});
}
}
else {
@ -557,7 +577,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
<label for="">允许学生查看调查结果</label>
</div>
<div>
<a href="javascript:void(0);" onclick="poll_cancel();" class="grey_btn fr borderRadius">取消</a>
<!--<a href="javascript:void(0);" onclick="poll_cancel();" class="grey_btn fr borderRadius">取消</a>-->
<a href="javascript:void(0);" onclick="poll_save();" class="blue_btn fr borderRadius mr5">保存</a>
<a href="javascript:void(0);" onclick="poll_submit();" class="blue_btn fr borderRadius mr5" >发布</a>
</div>

View File

@ -1,9 +1,9 @@
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
<%if poll_question.is_necessary == 1%>
<span class="c_red ml5" title="必答">*</span>
<span class="c_red questionLabel ml5" title="必答">*</span>
<%end%>
</div>

View File

@ -1,9 +1,9 @@
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<span class="ur_required questionLabel ml5" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),

View File

@ -13,7 +13,7 @@
<% poll_question.poll_votes.where("user_id = #{User.current.id}").each do |answer|%>
<tr>
<td>
<p class="ml20">
<p class="ml20 break_word">
<%= answer.poll_answer.answer_text == "" ? (answer.vote_text.nil? ? "其他" : answer.vote_text) : answer.poll_answer.answer_text %>
</p>
</td>

View File

@ -13,7 +13,7 @@
<% poll_question.poll_votes.where("user_id = #{User.current.id}").each do |answer|%>
<tr>
<td>
<p class="ml20">
<p class="ml20 break_word">
<%= answer.poll_answer.answer_text == "" ? (answer.vote_text.nil? ? "其他" : answer.vote_text) : answer.poll_answer.answer_text %>
</p>
</td>

View File

@ -1,5 +1,5 @@
<div class="testStatus" ><!--头部显示 start-->
<a href="javascript:" class="testEdit" title="编辑" onclick="pollsEdit();"></a>
<div class="testStatus" onmouseover="$('#poll_head_edit_pen').show();" onmouseout="$('#poll_head_edit_pen').hide();"><!--头部显示 start-->
<a href="javascript:" class="testEdit undis" id="poll_head_edit_pen" title="编辑" onclick="pollsEdit();" style="top:0;"></a>
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
<h1 class="ur_page_title" id="polls_name_h"><%= poll.polls_name%></h1>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>

View File

@ -1,9 +1,9 @@
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<span class="ur_required questionLabel ml5" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),

View File

@ -10,7 +10,7 @@
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
<div class="ml40 mb10">
<p class="mb10"><%= i + 1 %>.<%= poll_answer.answer_text%></p>
<p class="ml20">
<p class="ml20 break_word">
<%= get_anwser_vote_text(poll_question.id,User.current.id,poll_answer.id).html_safe%>
</p>
</div>

View File

@ -1,9 +1,9 @@
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<span class="ur_required questionLabel ml5" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),

View File

@ -8,7 +8,7 @@
</div>
<div class="cl"></div>
<div class="ur_inputs">
<p class="ml20">
<p class="ml20 break_word">
<%= get_anwser_vote_text poll_question.id,User.current.id%>
</p>
</div>

View File

@ -233,7 +233,7 @@
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多行主观题</h3>
<% multi_question_list.each do |pq| %>
<div id="poll_questions_<%= pq.id%>">

View File

@ -2,12 +2,12 @@
<a href='<%= praise_tread_praise_plus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
<span class="likeText">赞</span>
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
<span class="likeNum"><%= num > 0 ? "#{num}" : "" %></span>
<span class="likeNum"><%= (num.nil? ? 0 : num) > 0 ? "#{(num.nil? ? 0 : num)}" : "" %></span>
</a>
<% else %>
<a href='<%= praise_tread_praise_minus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
<span class="likeText">已赞</span>
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
<span class="likeNum"><%= num > 0 ? "#{num}" : "" %></span>
<span class="likeNum"><%= (num.nil? ? 0 : num) > 0 ? "#{(num.nil? ? 0 : num)}" : "" %></span>
</a>
<% end %>

View File

@ -10,7 +10,7 @@
TO
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.course.name.to_s+" | 班级讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue mr5"%>
<%= link_to activity.course.name.to_s+" | #{activity.board.parent.nil? ? '班级讨论区' : activity.board.name}", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue mr5"%>
</div>
<div class="homepagePostTitle hidden m_w530 fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->

View File

@ -513,6 +513,8 @@ RedmineApp::Application.routes.draw do
# boards
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields'
match 'boards/:id/update_position', :to => 'boards#update_position', :via => :post
match 'boards/:id/update_name', :to => 'boards#update_name', :via => :put
get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit',:as=>'edit_board_message'

View File

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

View File

@ -2161,3 +2161,16 @@ function edit_img(){
$(document).ready(edit_img);
//自适应高度
function autoHeight(id, baseheight) {
var obj = $(id);
obj.height(baseheight);
var scrollVal = obj[0].scrollHeight;
obj.height(scrollVal);
obj.on('input',function(){
obj.height(baseheight);
var scrollVal = obj[0].scrollHeight;
obj.height(scrollVal);
});
};

View File

@ -6,7 +6,7 @@ function course_setting(id)
//$('#tbc_0'+id).removeClass().addClass("dis");
//$('#tb_'+(3-id)).removeClass().addClass("hwork_normaltab");
//$('#tbc_0'+(3-id)).removeClass().addClass("undis");
for (var i = 1; i < 4; i++) {
for (var i = 1; i < 5; i++) {
if (i == id) {
$("#tb_" + i).removeClass().addClass("hwork_hovertab");
$("#tbc_0" + i).removeClass().addClass("dis");

View File

@ -265,6 +265,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w557{ width:557px;}
.w570 {width:570px !important;}
.w576{ width:576px;}
.w590{ width:590px;}
.w607 {width:607px;}
.w664{ width:664px;}
.w683{ width:683px;}
@ -282,6 +283,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w712{width:712px; max-width:712px; min-width:712px;}
.w713{width: 713px;}
.w720{width:721px;}
.w730{width:730px;}
.w770{ width:770px;}
.h20{height: 20px;}
.h22{ height:22px;}
@ -470,7 +472,6 @@ a.green_btn{background:#28be6c;color:#fff; font-weight:normal; padding:2px 10px;
a:hover.green_btn{ background:#14ad5a;}
.blue_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;}
a.blue_btn{background:#3b94d6;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a:hover.blue_btn{ background:#329cbd;}
.red_btn{ background:red; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;}
a.red_btn{background:red; color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;}
a.orange_btn_homework{background:#d63502;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;}

View File

@ -481,12 +481,14 @@ a:hover.btn_submit{background:#297fb8;}
a:hover.btn_cancel{ color:#666;}
.testQuestion{ width:708px; height: auto; border:1px solid #cbcbcb; padding:10px 0 0 10px; margin-bottom:10px;}
.questionContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
.questionTitle{ width:644px; height:30px; border:1px solid #cbcbcb; padding-left:5px; background:#fff;}
.questionLabel {vertical-align:top; display:inline-block;}
.questionTitle{ width:644px; height:30px; line-height:30px; border:1px solid #cbcbcb; padding-left:5px; background:#fff;}
.formatContainer {white-space:pre-wrap; display:inline-block;}
.examTime {width:90px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }
.testStatus{width:698px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px; background:#ffffff; position:relative; color:#767676;}
.testEdit{ background:url(../images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; bottom:10px; right:10px; position:absolute;}
a:hover.testEdit{ background:url(../images/icons.png) -21px -272px no-repeat;}
.testDesEdit {width:670px; overflow:hidden;}
.testDesEdit {width:670px; overflow:hidden; white-space:pre-wrap;}
.testEditTitle{ padding:10px 0px ; float:left; width:564px; }
.questionEditContainer {border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px; margin-top:10px;}
.fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;}