Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-10-15 17:06:53 +08:00
commit bbd3999ab2
63 changed files with 2940 additions and 2448 deletions

View File

@ -1,4 +1,4 @@
source 'http://ruby.taobao.org'
source 'https://ruby.taobao.org'
#source 'http://ruby.sdutlinux.org/'
unless RUBY_PLATFORM =~ /w32/

View File

@ -90,65 +90,67 @@ class BoardsController < ApplicationController
end
end
end
sort_init 'updated_on', 'desc'
sort_update 'created_on' => "#{Message.table_name}.created_on",
'replies' => "#{Message.table_name}.replies_count",
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
@is_new = params[:is_new]
@topic_count = @board ? @board.topics.count : 0
if @project
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
#现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC,
@topics = @board.topics.
reorder("#{Message.table_name}.created_on desc").
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
preload(:author, {:last_reply => :author}).
all
elsif @course
#
# board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
# includes(:last_reply).
# # limit(@topic_pages.per_page).
# # offset(@topic_pages.offset).
#
# preload(:author, {:last_reply => :author}).
# all : []
# @topics = paginateHelper board_topics,10
if (@board)
limit = 10;
#pageno = params[:page];
#if(pageno == nil || pageno=='')
# dw_topic = nil;
# if( params[:parent_id]!=nil && params[:parent_id]!='' )
# dw_topic = @board.topics.where(id:params[:parent_id]).first();
# end
# if( dw_topic != nil )
# dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count();
# dw_count = dw_count+1;
# pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1)
# end
#end
#if(pageno == nil || pageno=='')
# pageno=1;
#end
@topic_count = @board.topics.count();
@topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc").
limit(limit).offset(@topic_pages).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
end
@message = Message.new(:board => @board)
#modify by nwb
respond_to do |format|
format.js
format.html {
sort_init 'updated_on', 'desc'
sort_update 'created_on' => "#{Message.table_name}.created_on",
'replies' => "#{Message.table_name}.replies_count",
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
@topic_count = @board ? @board.topics.count : 0
if @project
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
#现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC,
@topics = @board.topics.
reorder("#{Message.table_name}.created_on desc").
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
preload(:author, {:last_reply => :author}).
all
elsif @course
#
# board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
# includes(:last_reply).
# # limit(@topic_pages.per_page).
# # offset(@topic_pages.offset).
#
# preload(:author, {:last_reply => :author}).
# all : []
# @topics = paginateHelper board_topics,10
if( @board )
limit = 10;
pageno = params[:page];
if(pageno == nil || pageno=='')
dw_topic = nil;
if( params[:parent_id]!=nil && params[:parent_id]!='' )
dw_topic = @board.topics.where(id:params[:parent_id]).first();
end
if( dw_topic != nil )
dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count();
dw_count = dw_count+1;
pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1)
end
end
if(pageno == nil || pageno=='')
pageno=1;
end
@topic_count = @board.topics.count();
@topic_pages = Paginator.new @topic_count, limit, pageno
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
limit(limit).offset(@topic_pages.offset).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
end
@message = Message.new(:board => @board)
#modify by nwb
if @project
render :action => 'show', :layout => 'base_projects'
elsif @course
@ -158,10 +160,10 @@ class BoardsController < ApplicationController
}
format.atom {
@messages = @board.messages.
reorder('created_on DESC').
includes(:author, :board).
limit(Setting.feeds_limit.to_i).
all
reorder('created_on DESC').
includes(:author, :board).
limit(Setting.feeds_limit.to_i).
all
if @project
render_feed(@messages, :title => "#{@project}: #{@board}")
elsif @course

View File

@ -37,6 +37,7 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
=begin
if @course
topic_id = params[:r]?params[:r]:params[:id]
parent_id = params[:id]
@ -44,6 +45,7 @@ class MessagesController < ApplicationController
redirect_to url
return;
end
=end
@isReply = true
page = params[:page]

View File

@ -46,16 +46,21 @@ class RepositoriesController < ApplicationController
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
def new
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@repository.project = @project
@course_tag = params[:course]
if @course_tag == 1
render :layout => 'base_courses'
if @project.repositories.count == 0
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@repository.project = @project
@course_tag = params[:course]
if @course_tag == 1
render :layout => 'base_courses'
else
render :layout => 'base_projects'
end
else
render :layout => 'base_projects'
render_403
end
end

View File

@ -883,6 +883,7 @@ class UsersController < ApplicationController
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll')"
project_types = "('Message','Issue')"
principal_types = "JournalsForMessage"
if params[:type].present?
case params[:type]
when "course_homework"
@ -897,13 +898,15 @@ class UsersController < ApplicationController
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10)
when "project_message"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
when "user_journals"
@user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10)
when "current_user"
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc').limit(10).offset(@page * 10)
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
end
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc').limit(10).offset(@page * 10)
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
end
# @user_activities = paginateHelper @user_activities,500
@type = params[:type]

View File

@ -76,7 +76,8 @@ class WordsController < ApplicationController
# render 'test/index'
# }
format.js {
@user_activity_id = params[:user_activity_id] if
@reply_type = params[:reply_type]
@user_activity_id = params[:user_activity_id]
@activity = JournalsForMessage.find(parent_id)
}
end

View File

@ -2349,22 +2349,25 @@ module ApplicationHelper
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher
if is_teacher #老师显示作品数量
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品已交", "javascript:void(0)", :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
end
end
end
end
end
def student_anonymous_comment homework

View File

@ -56,6 +56,7 @@ class JournalsForMessage < ActiveRecord::Base
acts_as_attachable
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :principal_acts, :class_name => 'PrincipalActivity',:as =>:principal_act ,:dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# 消息关联
@ -63,7 +64,7 @@ class JournalsForMessage < ActiveRecord::Base
has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy
validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message, :act_as_principal_activity
after_create :reset_counters!
after_destroy :reset_counters!
after_save :be_user_score
@ -133,6 +134,15 @@ class JournalsForMessage < ActiveRecord::Base
end
end
#用户动态公共表记录
def act_as_principal_activity
if self.jour_type == 'Principal'
unless self.user_id == self.jour.id && self.user_id != self.reply_id && self.reply_id != 0
self.principal_acts << PrincipalActivity.new(:user_id => self.user_id, :principal_id => self.jour_id)
end
end
end
def reset_counters!
self.class.reset_counters!(self)
end

View File

@ -0,0 +1,34 @@
class PrincipalActivity < ActiveRecord::Base
attr_accessible :principal_act_id, :principal_act_type, :principal_id, :user_id
#虚拟关联
belongs_to :principal_act ,:polymorphic => true
belongs_to :user
validates :user_id,presence: true
validates :principal_id,presence: true
validates :principal_act_id,presence: true
validates :principal_act_type, presence: true
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
after_save :add_user_activity
before_destroy :destroy_user_activity
#在个人动态里面增加当前动态
def add_user_activity
user_activity = UserActivity.where("act_type = '#{self.principal_act_type.to_s}' and act_id = '#{self.principal_act_id}'").first
if user_activity
user_activity.save
else
user_activity = UserActivity.new
user_activity.act_id = self.principal_act_id
user_activity.act_type = self.principal_act_type
user_activity.container_type = "Principal"
user_activity.container_id = self.principal_id
user_activity.user_id = self.user_id
user_activity.save
end
end
def destroy_user_activity
user_activity = UserActivity.where("act_type = '#{self.principal_act_type.to_s}' and act_id = '#{self.principal_act_id}'")
user_activity.destroy_all
end
end

View File

@ -91,8 +91,10 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
# 动态级联删除
has_many :forge_activities, :class_name => 'ForgeActivity', :dependent => :destroy
# 关联虚拟表
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
belongs_to :organization

View File

@ -114,6 +114,7 @@ class User < Principal
has_many :students_for_courses
#has_many :courses, :through => :students_for_courses, :source => :project
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :principal_acts, :class_name => 'PrincipalActivity',:as =>:principal_act ,:dependent => :destroy
has_many :file_commit, :class_name => 'Attachment', :foreign_key => 'author_id', :conditions => "container_type = 'Project' or container_type = 'Version'"
####
# added by bai
@ -211,7 +212,7 @@ class User < Principal
before_save :update_hashed_password
before_destroy :remove_references_before_destroy
# added by fq
after_create :act_as_activity, :add_onclick_time
after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity
# end
# 更新邮箱用户或用户名的同事,同步更新邀请信息
after_update :update_invite_list
@ -1006,6 +1007,11 @@ class User < Principal
self.acts << Activity.new(:user_id => self.id)
end
#用户动态公共表记录
def act_as_principal_activity
self.principal_acts << PrincipalActivity.new(:user_id => self.id,:principal_id => self.id)
end
# 注册用户的时候消息默认点击时间为用户创建时间
def add_onclick_time
if OnclickTime.where("user_id =?" , self.id).first.nil?

View File

@ -42,7 +42,9 @@
<span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%#= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<% id ="file#{container.id}"%>
<a href="javascript:void(0);" class="AnnexBtn fl" style= "<%= ie8? ? 'display:none' : ''%>" onclick="$('#'+'<%= id %>').click();">上传附件</a>
<%= file_field_tag 'attachments[dummy][file]',
:id => "file#{container.id}",
:class => 'file_selector',
@ -63,7 +65,7 @@
<% if container.nil? %>
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
<% end %>
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
<!--(<%#= l(:label_max_size) %>: <%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)-->
</span>
<% content_for :header_tags do %>

View File

@ -0,0 +1,16 @@
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
$("#message_subject").focus();
});
</script>
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
编辑帖子
</div>
</div>
<%= render :partial => 'boards/course_new',
:locals => {:f => f, :edit_mode => edit_mode, :topic => topic} %>
</div>

View File

@ -1,12 +1,67 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= error_messages_for 'message' %>
<div class="resources mt10">
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w704" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<div class="mt10">
<%= f.check_box :sticky, :value => topic.sticky%>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked%>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<div class="cl"></div>
</div>
<div class="mt10">
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
<li>
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
:owner_id => topic.nil? ? 0: topic.id,
:owner_type => OwnerTypeHelper::MESSAGE,
:width => '100%',
:height => 300,
:minHeight=>300,
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
<div class="cl"></div>
<p id="message_content_span"></p>
</div>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="topic_attachments">
<%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<%if !edit_mode %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>
<%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %>
<!--<li>
<div class="ml55 fl" nhname="toolbar_container"></div>
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%#= l(:button_cancel) %></a>
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
<%= l(:button_submit)%>
<%#= l(:button_submit)%>
</a>
<div class="cl"></div>
</li>
<% end %>
</li>-->
</div>
</div>

View File

@ -1,313 +1,110 @@
<div nhname="container_board">
<div class="project_r_h">
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<% if User.current.logged? %>
<a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" nhname="about_talk" id="about_newtalk" style="display:none;" >
<ul>
<%= render :partial => 'course_new' %>
</ul>
</div><!--talknew end-->
</div>
</div>
<!-- 发布新帖部分 -->
<div class=" talklist_box" >
<% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_course_board) %>
<%= link_to l(:label_user_login_new), signin_path %>
<hr/>
</div>
<% end %>
<p class="c_dark mb5 f14">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5 f12">
<% author = topic.author.to_s %>
<div style="max-width:120px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
<%= link_to User.current.member_of_course?(@board.course) ? "#{topic.author.show_name}(#{topic.author.login})" : "#{topic.author}" , user_path(topic.author),
:class =>"talkmain_name fl f14",:title=>author,
:style=>'max-width:120px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
</div>
<p style="float:left;color:#ff5722;">&nbsp;&nbsp;:</p>
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:360px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" nhname="showbtn" class="linkBlue" style="float: right;
margin-right: 10px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<div class="cl"></div>
<script>
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug
$(function(){
function nh_show_btn(){
if($("#project_show_<%= topic.id%>").is(':hidden')){
if($("#contentmessage<%=topic.id %>").height()>182){
$("#project_show_<%= topic.id%>").show();
}
}
}
var div = $("#contentmessage<%=topic.id %>");
var imgs = $('img',div);
var lens = imgs.length;
function nh_load_img_end(){
nh_show_btn();
// lens--;
// if(lens <= 0){
// nh_show_btn();
// }
}
if(lens > 0){
$('img',div).load(function(){
nh_load_img_end();
});
}
nh_show_btn();
// if(lens <= 0){
// nh_show_btn();
// }else{
// $('img',div).load(function(){
// nh_load_img_end();
// });
// }
});
</script>
<div class="project_board_content break_word f14 list_style" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content.html_safe %>
<!-- -->
</div>
</div>
<p style="display: none" id="project_show_<%= topic.id%>">
<a id="expend_more_information<%= topic.id%>" href="javascript:void(0)" style="color: #0781b4;" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<a href="javascript:void(0)" nhname="showbtn_reply" class="linkBlue fr f12" style="margin-right:10px;"><%= l(:button_reply) %></a>
<div class="cl"></div>
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none;border-top: 1px dashed #d9d9d9;padding-top:5px;margin-left:0px;padding-left:15px;">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="cl"></div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<input name="parent_topic" type="hidden" value=""/>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<div style="padding-top:5px;" class="fr">
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
</div>
<% end %>
<div class="cl"></div>
</div>
</div>
<% end %>
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").all %>
<% unless replies_all.empty? %>
<% replies_all_i = 0 %>
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
<ul>
<% replies_all.each do |message| %>
<% replies_all_i=replies_all_i+1 %>
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>" id="topic<%=message.id%>">
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class => 'Msg_pic' %>
<div class="Msg_txt">
<%= link_to User.current.member_of_course?(@board.course) ? "#{message.author.show_name}(#{message.author.login})" : "#{message.author}", user_path(message.author),:class => 'fl c_orange f14 ' %>
<br/>
<div class="fl break_word f14 list_style">
<%= textAreailizable message,:content,:attachments => message.attachments %>
<!-- -->
</div>
<input nhname="nh_content_val" value="<%= message.content %>" type="hidden"/>
<br/><div class="cl"></div>
<span class=" c_grey fl f12"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' linkBlue fr f12'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_reply),
'javascript:;',
:nhname =>'showbtn_child_reply',
:class => ' linkBlue fr f12',
:style => 'margin-right: 10px;',
'data-topic-id' =>message.id,
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<%if topic.replies_count>2 %>
<div class="talkWrapMsg"><a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" class=" ml258" href="javascript:void(0)" id="showgithelp<%= topic.id%>" value="show_help" class="c_dblue lh23" style="color: #0781b4;" >展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist">
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %>
<% html_title @board.name %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %>
<% end %>
</div>
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<script type="text/javascript">
$(function(){
$(".talkmain_box").each(function(){
var target = $("li[nhname='reply_rec']",$(this));
var btn = $("a[nhname='reply_ex_btn']",$(this));
var jumpobj = $("div[nhname='nh_reply_div']",$(this));
btn.click(function(){
if($(this).data('init')=='0'){
$(this).data('init',1);
$(this).html('收起回复('+$(this).data('count')+')');
target.show();
}else{
$(this).data('init',0);
$(this).html('展开回复('+$(this).data('count')+')');
target.hide();
target.eq(0).show();
target.eq(1).show();
$("#nhjump").attr('href','#'+jumpobj.attr('id'));
$("#nhjump")[0].click();
}
});
});
KindEditor.ready(function(K){
$("div[nhname='container_board']").each(function(){
var container = $(this);
var about_talk = $("div[nhname='about_talk']",container);
var params = ({
kindutil:K,
showbtn:$("a[nhname='showbtn']",container),
about_talk:about_talk,
inputsubject:$("input[nhname='inputsubject']",about_talk),
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
textarea:$("textarea[nhname='textarea']",about_talk),
contentmsg:$("p[nhname='contentmsg']",about_talk),
submitbtn:$("a[nhname='submitbtn']",about_talk),
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
form:$("form[nhname='form']",about_talk),
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
init_content_val:$("input[nhname='init_content_val']",about_talk)
});
nh_init_board(params);
});
$("div[mhname='container_board_reply']").each(function(){
var container = $(this);
var about_talk = $("div[nhname='about_talk_reply']",container);
var params = {
type:'reply',
kindutil:K,
showbtn:$("a[nhname='showbtn_reply']",container),
showbtn_child:$("a[nhname='showbtn_child_reply']",container),
about_talk:about_talk,
inputsubject:$("input[nhname='inputsubject']",about_talk),
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
textarea:$("textarea[nhname='textarea']",about_talk),
contentmsg:$("p[nhname='contentmsg']",about_talk),
submitbtn:$("a[nhname='submitbtn']",about_talk),
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
form:$("form[nhname='form']",about_talk),
quote_show:$("div[nhname='quote_show']",about_talk),
quote_input:$("textarea[nhname='quote_input']",about_talk),
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
jumphref:$("#nhjump")
};
params.get_ref_str_call=function(btn){
var div = btn.parent('div');
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'<div class="cl"></div></blockquote>';
return str;
}
nh_init_board(params);
});
<% if( @params[:topic_id]!=nil && @params[:topic_id]!='' && @params[:page]==nil ) %>
var nh_dw_html = $("#topic<%=@params[:topic_id]%>");
if(nh_dw_html!=undefined && nh_dw_html.length!=0){
if(nh_dw_html.is(':hidden')){
$("a[nhname='reply_ex_btn']",nh_dw_html.parent('ul').parent('div').parent('div')).click();
}
$("#nhjump").attr('href','#'+nh_dw_html.attr('id'));
$("#nhjump")[0].click();
}
<% end %>
<% if(!@flag.nil? && @flag=='true') %>
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
<% end %>
});
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
function reset_topic(){
$("#message_subject").val("");
$("#subjectmsg").text("");
document.getElementById("message_sticky").checked=false;
document.getElementById("message_locked").checked=false;
$("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => Message.new, :isReply => @isReply})%>");
message_content_editor.html("");
$("#topic_editor").toggle();
}
<% if @is_new%>
$(function(){
$("#message_subject").focus();
});
<%end%>
</script>
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
课程讨论区
</div>
</div>
<% if User.current.logged? %>
<%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false} %>
<% end %>
<% end %>
<% if topics%>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
var description_images=$("div#activity_description_<%= topic.id %>").find("img");
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
var reply_images=$("div#reply_content_<%= topic.id %>").find("img");
if (reply_images.length>0) {
for (var i=0; i<reply_images.length; i++){
var image=$(reply_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#reply_content_<%= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>
<% end %>
<% end%>
</div>
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>

View File

@ -51,9 +51,9 @@
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
<%# if topic.sticky? %>
<!--<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%#= l(:label_board_sticky)%></a>-->
<%# end %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<script>
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug
@ -209,11 +209,11 @@
btn.click(function(){
if($(this).data('init')=='0'){
$(this).data('init',1);
$(this).html('收起回复('+$(this).data('count')+')');
$(this).html('收起回复');
target.show();
}else{
$(this).data('init',0);
$(this).html('展开回复('+$(this).data('count')+')');
$(this).html('展开回复'+$(this).data('count')+')');
target.hide();
target.eq(0).show();
target.eq(1).show();

View File

@ -30,11 +30,13 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<% if @project %>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %>
<%= render :partial => 'course_show', locals: {course: @course} %>
<% end %>
<% elsif @course %>
<%= render :partial => 'course_show', :locals => {:topics => @topics, :page => 0, :course => @course} %>
<% end %>
<script type="text/javascript">//侧导航

View File

@ -0,0 +1 @@
$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show',:locals => {:topics => @topics, :page => @page} )%>");

View File

@ -56,14 +56,15 @@
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复(' + btn.data('count') + ')');
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多(' + btn.data('count') + ')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}

View File

@ -1,4 +1,4 @@
<script type="text/javascript">
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_end_time").val("");

View File

@ -47,7 +47,7 @@
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %>
<div class="problem_search" >
<input class="problem_search_input fl" id="v_subject" type="text" name="subject" value="<%= @subject ? @subject : ""%>" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<input class="problem_search_input fl" id="v_subject" type="text" name="subject" placeholder="请输入问题名称" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
<a href="javascript:void(0)" class="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a>
</div><!--problem_search end-->

View File

@ -108,7 +108,7 @@
<div class="subNav">
<%= 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( "+#{l(:label_message_new)}",course_boards_path(@course, :flag => true),:class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
<%= link_to( "+#{l(:label_message_new)}",course_boards_path(@course, :flag => true, :is_new => 1),:class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
</div>
<div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>

View File

@ -17,14 +17,15 @@
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多('+btn.data('count')+')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {

View File

@ -1,117 +1,157 @@
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_board) %>
</h2>
</div>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
<div class="topbar_info02 fl">
<p class="hiddent">
<%= l(:label_user_location) %> :
<%= link_to l(:label_borad_course), course_boards_path(@course) %>
>
<%= link_to @topic.subject, course_board_path(@course, @board) %>
</p>
</div>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%");
});
</script>
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
</div>
<div class="postThemeWrap">
<% if @topic.author.id == User.current.id%>
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'postOptionLink'
) if @message.course_editable_by?(User.current) %>
</li>
<li>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if @message.course_destroyable_by?(User.current) %>
</li>
</ul>
</li>
</ul>
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
</div>
<div class="cl"></div>
<div class="problem_main">
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %>
<div class="postDetailCreater">
<% if @topic.try(:author).try(:realname) == ' ' %>
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_date( @topic.created_on)%></div>
<div class="cl"></div>
<div class="memo-content upload_img break_word" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @topic.content.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%= link_to_attachments_course @topic, :author => false %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="talk_txt fl">
<p class="problem_tit fl fb c_dblue break_word" >
<%= @topic.subject %>
</p>
<br/>
<p>
由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %>
添加于<%= format_time(@topic.created_on) %>
</p>
</div>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr'
) if @message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'talk_edit fr'
) if @message.course_editable_by?(User.current) %>
<div class="cl"></div>
<div class="talk_info mb10 upload_img break_word"><%= @topic.content.html_safe %></div>
<div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div>
<!-- <a href="#" class=" link_file ml60">附件爱覅俄方if.zip(27.5kB)</a>-->
<div class="cl"></div>
<% if User.current.logged? %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_subject',:class => 'talk_edit fr' %>
<% else %>
<%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %>
<% end %>
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @topic},
:remote => true,
:method => 'get',
:class => 'talk_edit fr',
:remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% unless @replies.empty? %>
<% reply_count = 0 %>
<% @replies.each do |message| %>
<div class="ping_C mb10 ml50" id="<%= "message-#{message.id}" %>">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %></div>
<div class="ping_discon">
<div class="ping_distop upload_img break_word">
<%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %>
<span class="c_grey fr"><%= format_time(message.created_on) %></span>
<div class="cl"></div>
<p><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<%= link_to_attachments_course message, :author => false %>
<div class="homepagePostReply">
<% unless @replies.empty? %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %></div>
<div class="homepagePostReplyBannerTime"></div>
<!-- <div class="homepagePostReplyBannerMore">
<%# if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
<%# end %>
</div>-->
</div>
<div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="ping_disfoot">
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
l(:button_delete),
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.course_destroyable_by?(User.current) %>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% end %>
</div>
<div class="homepagePostReplyContent"><%= reply.content.html_safe%></div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_date(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:class => 'fr newsBlue',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div><!---留言内容-->
<% end %>
<% end %>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div id="reply" style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fl c_white" %>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% html_title @topic.subject %>
<% end %>
<div class="cl"></div>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %>
<%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fr c_white mt10" ,:style=>"margin-left: 50px;"%>
<% end %>
<% end %>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,117 @@
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_board) %>
</h2>
</div>
<div class="topbar_info02 fl">
<p class="hiddent">
<%= l(:label_user_location) %> :
<%= link_to l(:label_borad_course), course_boards_path(@course) %>
>
<%= link_to @topic.subject, course_board_path(@course, @board) %>
</p>
</div>
<div class="cl"></div>
<div class="problem_main">
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %>
</div>
<div class="talk_txt fl">
<p class="problem_tit fl fb c_dblue break_word" >
<%= @topic.subject %>
</p>
<br/>
<p>
由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %>
添加于<%= format_time(@topic.created_on) %>
</p>
</div>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr'
) if @message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'talk_edit fr'
) if @message.course_editable_by?(User.current) %>
<div class="cl"></div>
<div class="talk_info mb10 upload_img break_word"><%= @topic.content.html_safe %></div>
<div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div>
<!-- <a href="#" class=" link_file ml60">附件爱覅俄方if.zip(27.5kB)</a>-->
<div class="cl"></div>
<% if User.current.logged? %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_subject',:class => 'talk_edit fr' %>
<% else %>
<%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %>
<% end %>
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @topic},
:remote => true,
:method => 'get',
:class => 'talk_edit fr',
:remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% unless @replies.empty? %>
<% reply_count = 0 %>
<% @replies.each do |message| %>
<div class="ping_C mb10 ml50" id="<%= "message-#{message.id}" %>">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %></div>
<div class="ping_discon">
<div class="ping_distop upload_img break_word">
<%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %>
<span class="c_grey fr"><%= format_time(message.created_on) %></span>
<div class="cl"></div>
<p><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<%= link_to_attachments_course message, :author => false %>
</div>
<div class="ping_disfoot">
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
l(:button_delete),
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div><!---留言内容-->
<% end %>
<% end %>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div id="reply" style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fl c_white" %>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% html_title @topic.subject %>

View File

@ -28,16 +28,17 @@
</li>
<li>
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<label class="fl" >
<!--<label class="fl" >
<span class="c_red">*</span>&nbsp;
<%= l(:field_description) %>&nbsp;&nbsp;
</label>
<%#= l(:field_description) %>&nbsp;&nbsp;
</label>-->
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<% if replying %>
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
:width => '89%',
:height => 300,
:width => '99%',
:height => 100,
:minHeight=>100,
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
@ -47,21 +48,24 @@
:owner_type => OwnerTypeHelper::MESSAGE,
:width => '90%',
:height => 300,
:minHeight=>300,
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
<% end %>
<div class="cl"></div>
<p id="message_content_span" class="ml55"></p>
<p id="message_content_span"></p>
</li>
<div class="cl"></div>
<li>
<label class="fl mt10">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<div class="fl mt10">
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
</div>
</li>
<% unless replying %>
<li>
<label class="fl mt10">&nbsp;&nbsp;<%= l(:label_attachment_plural) %>&nbsp;&nbsp;</label>
<div class="fl mt10">
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
</div>
</li>
<% end %>
<li >
<div class="cl"></div>
</li>

View File

@ -0,0 +1,31 @@
<style type="text/css">
/*回复框*/
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-outline{border:none;}
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
.ReplyToMessageInputContainer .ke-container{float:left;}
</style>
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10">
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" value="<%= temp.content %>">
<input type="hidden" name="reply[subject]" value="<%= subject %>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>

View File

@ -1,45 +1,38 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_board) %></h2>
</div>
<% if @message.project %>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_course_board) %></h2>
</div>
<% if @message.project %>
<%#= board_breadcrumb(@message) %>
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
<div class="ml15">
<ul>
<%= form_for @message, { :as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
<div class="ml15">
<ul>
<%= form_for @message, {:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'form_project',
:locals => {:f => f, :replying => !@message.parent.nil?} %>
<a href="#" onclick="submitProjectsBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul>
</div>
<% end %>
:locals => {:f => f, :replying => !@message.parent.nil?} %>
<a href="#" onclick="submitProjectsBoard();" class="blue_btn fl c_white"><%= l(:button_submit) %></a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul>
</div>
<% end %>
<% elsif @message.course %>
<%#= course_board_breadcrumb(@message) %>
<div class="talk_new ml15">
<ul>0
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'form_course',
:locals => {:f => f, :replying => !@message.parent.nil?} %>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'boards/course_message_edit',
:locals => {:f => f, :edit_mode => true, :topic => @message} %>
<% end %>
</ul>
</div>
<% end %>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -1,8 +1,16 @@
$('#message_subject').val("<%= raw escape_javascript(@subject) %>");
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
/*$('#message_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#message_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
$('#quote_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
$('#quote_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;
$("img").removeAttr("align");
$("img").removeAttr("align");*/
if($("#reply_message_<%= @message.id%>").length > 0) {
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>");
$(function(){
init_activity_KindEditor_data(<%= @message.id%>,null,"85%");
});
}else if($("#reply_to_message_<%= @message.id%>").length >0) {
$("#reply_to_message_<%= @message.id%>").replaceWith("<p id='reply_message_<%= @message.id%>'></p>");
}

View File

@ -8,93 +8,98 @@
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
<% if @project.repositories.any? %>
<table class="pro_table">
<tbody>
<tr class="pro_table_tit">
<td class=" w150"><%= l(:field_identifier) %></td>
<td class="w150"> <%= l(:field_repository_is_default) %></td>
<td class="w150"><%= l(:label_scm) %> </td>
<td class="w150" ><%= l(:label_repository_path) %> </td>
<td class="w150"> </td>
<td class="w150"> </td>
</tr>
<% @project.repositories.sort.each do |repository| %>
<tr class="<%= cycle 'pro_table_on', '' %>">
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
<td> <%= checked_image repository.is_default? %></td>
<td><%=h repository.scm_name %></td>
<%if repository.scm_name=="Git"%>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
<table class="pro_table">
<tbody>
<tr class="pro_table_tit">
<td class=" w150"><%= l(:field_identifier) %></td>
<td class="w150"> <%= l(:field_repository_is_default) %></td>
<td class="w150"><%= l(:label_scm) %> </td>
<td class="w150" ><%= l(:label_repository_path) %> </td>
<td class="w150"> </td>
<td class="w150"> </td>
</tr>
<% @project.repositories.sort.each do |repository| %>
<tr class="<%= cycle 'pro_table_on', '' %>">
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
<td> <%= checked_image repository.is_default? %></td>
<td><%=h repository.scm_name %></td>
<%if repository.scm_name=="Git"%>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
<%=h repository.url.slice(project_path_cut, repository.url.length) %>"> <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>20)%></td><!--Modified by tanxianbo-->
<%else %>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
<% end %>
<td><a href="javascript:viod(0)" class="c_blue" >
<% if repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to(l(:label_user_plural), committers_repository_path(repository)) %>
<% end %>
<% end %>
</a></td>
<td>
<% if repository.login.to_s==User.current.login.to_s %>
<%= delete_new_link repository_path(repository) %>
<% end %></td>
</tr>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</tbody>
</table>
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
<% course_tag = @project.project_type %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<!--newrepo_project_repository_path(@project, :course => course_tag) -->
<%= link_to l(:label_repository_new_repos),"#" , :onclick=>"pro_st_show_ku();", :class => 'c_blue fl' %></p>
<% end %>
</a>
<div class="cl"></div>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
<label class="label02"><%=l(:label_scm)%></label>
<%= select_tag('repository_scm',
options_for_select(["Git"],@repository.class.name.demodulize),
:data => {:remote => true, :method => 'get'})%>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%></label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
<%else %>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
<% end %>
<td><a href="javascript:viod(0)" class="c_blue" >
<% if repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to(l(:label_user_plural), committers_repository_path(repository)) %>
<% end %>
<% end %>
</a></td>
<td>
<% if repository.login.to_s==User.current.login.to_s %>
<%= delete_new_link repository_path(repository) %>
<% end %></td>
</tr>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110"><%=l(:button_save)%></a>
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl ml10"><%=l(:button_cancel)%></a>
</div><!--pro_st_edit_issues end-->
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_repository_no_data) %></p>
<% end %>
<%# 新建版本库 %>
<% if @project.repositories.count == 0 %>
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
<% course_tag = @project.project_type %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<!--newrepo_project_repository_path(@project, :course => course_tag) -->
<%= link_to l(:label_repository_new_repos),"#" , :onclick=>"pro_st_show_ku();", :class => 'c_blue fl' %></p>
<% end %>
</a>
<div class="cl"></div>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
<label class="label02"><%=l(:label_scm)%></label>
<%= select_tag('repository_scm',
options_for_select(["Git"],@repository.class.name.demodulize),
:data => {:remote => true, :method => 'get'})%>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%></label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110"><%=l(:button_save)%></a>
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl ml10"><%=l(:button_cancel)%></a>
</div><!--pro_st_edit_issues end-->
<% end %>
<% end %>

View File

@ -16,7 +16,7 @@
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
</div>
<%end%>
<a href="javascript:void(0);" class="blue_n_btn fr evaluation_submit" onclick="$(this).parent().parent().submit();">提交</a>
<a href="javascript:void(0);" class="blue_n_btn fr evaluation_submit" onclick="$(this).parent().parent().submit();$('#about_hwork_<%= @work.id%>').html('');">提交</a>
<div class="cl"></div>
</li>
<% end%>

View File

@ -3,7 +3,7 @@
<li class="hworkList340 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<ul>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(User.current.id))%>
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
</li>
<div onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>">

View File

@ -13,7 +13,7 @@
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
</div>
</li>
<li>
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
@ -32,7 +32,7 @@
<%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
</div>
</li>
<li>
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
匿名
@ -46,7 +46,7 @@
</ul>
</li>
<li class="hworkList130 c_grey">
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>

View File

@ -6,17 +6,17 @@
});
// 匿评弹框提示
<% if @is_evaluation && !@stundet_works.empty?%>
$(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/praise_alert') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
});
<% end%>
<%# if @is_evaluation && !@stundet_works.empty?%>
// $(function(){
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/praise_alert') %>');
// showModal('ajax-modal', '500px');
// $('#ajax-modal').siblings().remove();
// $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
// "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
// $('#ajax-modal').parent().css("top","").css("left","");
// $('#ajax-modal').parent().addClass("anonymos");
// });
<%# end%>
//设置评分规则
function set_score_rule(){

View File

@ -24,10 +24,12 @@
<span class="grey_btn_cir ml10">匿评已结束</span>
<% end%>
<div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% if User.current.member_of_course?(activity.course) %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">

View File

@ -5,7 +5,7 @@
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<% if @ctivity.try(:user).try(:realname) == ' ' %>
<% if activity.try(:user).try(:realname) == ' ' %>
<%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
@ -30,11 +30,11 @@
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">
<div class="homepagePostReplyBannerCount">
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -49,7 +49,7 @@
<ul>
<% course.journals_for_messages.where('m_parent_id IS NULL').reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
@ -84,7 +84,7 @@
<% end %>
<%= format_time reply.created_on %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>">
<div class="homepagePostReplyContent break_word list_style upload_img" style="max-width: 580px;" id="reply_content_<%= user_activity_id %>">
<%= reply.notes.html_safe %></div>
<div class="cl"></div>
</div>

View File

@ -13,13 +13,17 @@
TO
<%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
</div>
<div class="homepagePostTitle break_word">
<div class="homepagePostTitle hidden m_w530 fl">
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id,:host=> Setting.host_course), :class=> "postGrey" %>
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id,:host=> Setting.host_course), :class=> "postGrey"%>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
<% end %>
</div>
<% if activity.sticky == 1%>
<span class="sticky_btn_cir ml10">置顶</span>
<% end%>
<div class="cl"></div>
<div class="homepagePostDate">
发帖时间:<%= format_time(activity.created_on) %>
</div>
@ -58,7 +62,7 @@
<%= count %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count > 2 %>
<%if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -74,7 +78,7 @@
<ul>
<% activity.children.reorder("created_on desc").each do |reply|%>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
</div>

View File

@ -32,7 +32,7 @@
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -47,7 +47,7 @@
<ul>
<% activity.comments.reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.author_id), :alt => "用户头像" %>
</div>

View File

@ -69,7 +69,7 @@
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(<%= count %></div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<% if count > 2 %>
<% if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
展开更多
@ -84,7 +84,7 @@
<ul>
<% activity.journals.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %>
</div>

View File

@ -49,7 +49,7 @@
<%=count %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
<% end %>
</div>
@ -61,7 +61,7 @@
<ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id), :alt => "用户头像" %>
</div>

View File

@ -20,14 +20,15 @@
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多('+btn.data('count')+')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
@ -83,6 +84,13 @@
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% end %>
<% end %>
<% when 'Principal' %>
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'JournalsForMessage' %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>

View File

@ -0,0 +1,97 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
TO
<% if activity.jour %>
<%= link_to activity.jour.show_name+""+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的留言", feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
<% end %>
</div>
<div class="homepagePostTitle break_word list_style upload_img">
<% if activity.parent %>
<%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
<% else %>
<%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
<% end %>
</div>
<div class="homepagePostDate">
留言时间:<%= format_time(activity.created_on) %>
</div>
</div>
<div class="cl"></div>
</div>
<% count=fetch_user_leaveWord_reply(activity).count %>
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
</div>
<% end %>
</div>
<% replies_all_i = 0 %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if comment.try(:user).try(:realname) == ' ' %>
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= user_activity_id %>">
<%= comment.notes.html_safe %>
</div>
<% end %>
</div>
<div class="cl"></div>
</li>
</ul>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'reply_type',params[:reply_type],:value =>'user' %>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -144,9 +144,13 @@
</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p>
<p>
截止日期<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span>
匿评截止:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span>
</p>
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
<p>请您尽早完成匿评!如果您在规定时间内未完成匿评,一次将被扣<%= ma.course_message.homework_detail_manual.absence_penalty %>分。</p>
<% end%>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -193,12 +197,15 @@
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败
失败原因提交作品的人数低于2人
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败
<p> 失败原因提交作品的人数低于2人</p>
</p>
<p>作业详情如下:</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>
提交截止:<span style="color:Red;"><%= ma.course_message.end_time%>&nbsp;&nbsp;24点</span>
</p>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -281,9 +288,22 @@
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style" >
<%= ma.content.html_safe %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%=ma.course_message.student_work.homework_common.name %></span></p>
<% content = ma.content.gsub("作业评分:","").split("&nbsp;&nbsp;&nbsp; 评语:")%>
<p>
作品评分:<%= content[0] %>
</p>
<% if content.size > 1 %>
<div class="fl">作品评语:</div>
<div class="ml60"><%= content[1] %></div>
<% end %>
<p>
本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点结束匿评到时您将可以看到所有其他同学的作品啦大家可以进一步互相学习。
</p>
<p>
期待你取得更大的进步!
</p>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -29,6 +29,7 @@
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "留言动态", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
<li class="mt-4"><%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>

View File

@ -1,6 +1,10 @@
<% if @save_succ %>
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% if @reply_type == 'user' %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% end %>
init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%");
<% else %>
<% if !@jfm.nil? && @jfm.jour_type == 'Principal' %>

View File

@ -83,12 +83,12 @@ default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.163.com
port: 25
domain: smtp.163.com
authentication: :plain
user_name: "huang.jingquan@163.com"
password: 'xinhu1ji2qu366'
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"
# Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance.

View File

@ -199,7 +199,8 @@ zh:
label_descripition_blank: 描述不能为空
label_subject_empty: 主题不能为空
label_no_data: 没有任何数据可供显示
label_no_data: 没有任何数据可供显示
label_repository_no_data: 您还没有创建版本库,每个项目只允许创建一个版本库!
# 项目、课程、用户公用
label_settings: 配置
label_information_plural: 信息

View File

@ -318,6 +318,7 @@ RedmineApp::Application.routes.draw do
post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities"
post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity'
get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic'
#added by young
resources :users do
@ -802,7 +803,11 @@ RedmineApp::Application.routes.draw do
end
end
resources :news, :except => [:show, :edit, :update, :destroy]
resources :boards
# resources :boards do
# member do
# match 'boards_topic', :to => 'boards#boards_topic', :via => :get, :as => "boards_topic"
# end
# end
match '/homework', :to => 'courses#homework', :as => 'homework', :via => :get
resources :activity_notifys do
collection do

View File

@ -0,0 +1,12 @@
class CreatePrincipalActivities < ActiveRecord::Migration
def change
create_table :principal_activities do |t|
t.integer :user_id
t.integer :principal_id
t.integer :principal_act_id
t.string :principal_act_type
t.timestamps
end
end
end

View File

@ -0,0 +1,15 @@
class UpdatePrincipalActivity < ActiveRecord::Migration
def up
User.all.each do |user|
transaction do
user.principal_acts << PrincipalActivity.new(:user_id => user.id,:principal_id => user.id)
user.journals_for_messages.each do |jour|
jour.principal_acts << PrincipalActivity.new(:user_id => jour.user_id,:principal_id => user.id)
end
end
end
end
def down
end
end

View File

@ -0,0 +1,43 @@
class UpdatePrincipalActivityTime < ActiveRecord::Migration
def up
count = PrincipalActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
PrincipalActivity.page(i).per(30).each do |activity|
if activity.principal_act
if activity.principal_act.respond_to?("created_on")
activity.created_at = activity.principal_act.created_on
activity.updated_at = activity.principal_act.created_on
elsif activity.principal_act.respond_to?("created_at")
activity.created_at = activity.principal_act.created_at
activity.updated_at = activity.principal_act.created_at
end
activity.save
user_activity = UserActivity.where("act_type = '#{activity.principal_act_type.to_s}' and act_id = '#{activity.principal_act_id}'").first
user_activity.created_at = activity.created_at
user_activity.updated_at = activity.created_at
if user_activity.act_type == 'JournalsForMessage'
if user_activity.act
unless user_activity.act.m_parent_id.nil?
parent_act = UserActivity.where("act_id = #{user_activity.act.m_parent_id} and act_type='JournalsForMessage' and container_type='Principal'").first
if parent_act
parent_act.created_at = user_activity.act.parent.children.maximum("created_on")
parent_act.save
user_activity.destroy
end
end
else
user_activity.destroy
end
end
user_activity.save
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,16 @@
class UpdateUserActivityUpdatedAt < ActiveRecord::Migration
def up
count = UserActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
UserActivity.page(i).per(30).each do |activity|
activity.updated_at = activity.created_at
activity.save
end
end
end
end
def down
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
source "http://ruby.taobao.org"
source "https://ruby.taobao.org"
gemspec

View File

@ -5,7 +5,7 @@ PATH
rack (~> 1.5.1)
GEM
remote: http://ruby.taobao.org/
remote: https://ruby.taobao.org/
specs:
byebug (4.0.5)
columnize (= 0.9.0)

View File

@ -1,4 +1,4 @@
source 'http://ruby.taobao.org'
source 'https://ruby.taobao.org'
gem 'rich', '1.4.6'
gem 'kaminari'

View File

@ -148,6 +148,65 @@ function submit_edit_course(id)
$("#edit_course_"+id).submit();
}
}
//课程讨论区
function regexTopicSubject() {
var name = $("#message_subject").val();
if(name.length ==0)
{
$("#subjectmsg").text("标题不能为空");
$("#subjectmsg").css('color','#ff0000');
$("#message_subject").focus();
return false;
}
else if(name.length <= 255)
{
$("#subjectmsg").text("填写正确");
$("#subjectmsg").css('color','#008000');
return true;
}
else
{
$("#subjectmsg").text("标题超过255个字符");
$("#subjectmsg").css('color','#ff0000');
$("#message_subject").focus();
return false;
}
}
function regexTopicDescription()
{
var name = message_content_editor.html();
if(name.length ==0)
{
$("#message_content_span").text("描述不能为空");
$("#message_content_span").css('color','#ff0000');
return false;
}
else if(name.length >=6000){
$("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)");
$("#message_content_span").css('color','#ff0000');
return false;
}
else
{
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color','#008000');
return true;
}
}
function submit_topic()
{
if(regexTopicSubject() && regexTopicDescription())
{
message_content_editor.sync();
$("#message-form").submit();
}
}
function reset_topic(){
}
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////课程讨论区

View File

@ -5,7 +5,7 @@ function init_editor(params){
var paramsWidth = params.width == undefined ? "100%" : params.width;
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"95%",
resizeType : 1,minWidth:"1px",width:"94%",
height:"33px",// == undefined ? "30px":paramsHeight+"px",
minHeight:"33px",// == undefined ? "30px":paramsHeight+"px",
items:['emoticons'],
@ -25,7 +25,7 @@ function init_editor(params){
$('#reply_image_' + id).addClass('imageFuzzy');
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){
params.submit_btn.hide();
this.resize("95%", null);
this.resize("94%", null);
}else if(this.edit.html().trim() != ""){
params.submit_btn.show();
}
@ -157,5 +157,6 @@ function init_activity_KindEditor_data(id){
});
});
$(".ke-edit").css("height","33px");
div_form = $("div[nhname='new_message_" + id + "']");
$(".ke-edit", div_form).css("height","33px");
}

View File

@ -119,7 +119,7 @@ a.postTypeGrey:hover {color:#269ac9;}
.borderBottomNone {border-bottom:none !important;}
.topBorder {border-top: 1px solid #e4e4e4;}
div.minHeight48{min-height: 48px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:15px;}
.homepagePostReplyBannerTime{width:85px; display:inline-block;}
.homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;}
.homepagePostReplyInputContainer {width:630px; float:left;}
@ -171,6 +171,7 @@ a.f_grey:hover {color:#000000;}
.grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
.orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;}
a.homepageWhite {color:#ffffff;}
@ -904,6 +905,7 @@ a:hover.BlueCirBtn{ background:#269ac9; color:#fff;}
.w720{width:721px;}
.w709{width: 709px;}
.w701{width: 701px;}
.w704{width: 704px;}
a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;}
a.FilesBtn{ background: url(../images/homepage_icon2.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
@ -1040,3 +1042,38 @@ a:hover.c_grey{ color:#333;}
a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;}
a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;}
/*讨论区内部样式*/
.postDetailContainer {padding:15px; border:1px solid #dddddd; background-color:#ffffff;}
.postlabel {background-color:#edf1f2; color:#888888; padding:2px 5px; float:left; margin-bottom:5px;}
.postRightContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff; float:left; margin-bottom:10px;}
.postDetailBanner {height:30px; width:720px; border-bottom:1px solid #efefef;}
.postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;}
.postDetailPortrait {width:50px; height:50px; float:left; margin-right:15px;}
.postDetailWrap {width:580px; float:left;}
.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;}
.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;}
.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;}
.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;}
.postDetailDate {color:#888888; font-size:12px; float:left;}
.postDetailReply { margin-top:28px; color:#888888; float:right;}
a.postReplyIcon {background:url(images/post_image_list.png) -40px 2px no-repeat; width:18px; height:18px; float:left;}
a.postReplyIcon:hover {background:url(images/post_image_list.png) -40px -29px no-repeat;}
.postDetailInput {width:713px; height:28px; border:1px solid #d9d9d9; outline:none !important;}
.postAttIcon {background:url(images/post_image_list.png) 0px -91px no-repeat; width:16px; height:16px; padding-left:20px;}
.postAttIcon:hover {background:url(images/post_image_list.png) 0px -113px no-repeat;}
.postThemeContainer {width:720px;}
.postThemeWrap {width:655px; float:left;position: relative}
.postLikeIcon {background:url(images/post_image_list.png) 0px -42px no-repeat ;float:right; padding-left:18px; margin-top:3px;}
.postLikeIcon:hover {background:url(images/post_image_list.png) 0px -64px no-repeat ;}
a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;}
.postEdit {background:url(images/post_image_list.png) 0px -94px no-repeat; width:18px; height:18px; display:block; float:left;}
.postDelete {background:url(images/post_image_list.png) -42px -93px no-repeat; width:18px; height:18px; display:block; float:right;}
.pageBanner {width:968px; margin:0px auto; border:1px solid #dddddd; background-color: #FFF; padding: 10px 15px; float:left;}
.homepagePostReplyInput {width:543px; height:33px; max-width:543px; max-height:33px; border:1px solid #d9d9d9; outline:none;}
.postRouteContainer {padding:10px 15px; background-color:#ffffff; border:1px solid #dddddd; margin-top:10px; font-size:14px;}
a.postRouteLink {font-weight:bold; color:#484848;}
a.postRouteLink:hover {text-decoration:underline;}
.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;}
.ReplyToMessageInputContainer {width:582px; float:left;}

View File

@ -296,6 +296,7 @@ a:hover.bgreen_n_btn{background:#08a384;}
.grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
.orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
/* commonpic */
.pic_date{ display:block; background:url(../images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; }
@ -624,6 +625,7 @@ a.homepagePostTypeQuiz {background:url(../images/homepage_icon.png) -90px -124px
a.homepagePostTypeQuestion {background:url(../images/homepage_icon.png) -10px -273px no-repeat; padding-left:23px;}
a.homepagePostTypeMine {background:url(../images/homepage_icon.png) -187px -277px no-repeat; padding-left:23px;}
a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -185px -308px no-repeat; padding-left:23px;}
a.homepagePostTypeMessage {background:url(images/homepage_icon.png) -3px -518px no-repeat; padding-left:23px;}
.homepagePostTypeMore {width:180px; border-top:1px dashed #dddddd; margin-top:5px;}
.w100 {width:100px;}
a.homepageTypeUnread {background:url(../images/homepage_icon.png) -6px -579px no-repeat; padding-left:23px;}
@ -651,7 +653,7 @@ a.postTypeGrey:hover {color:#269ac9;}
.borderBottomNone {border-bottom:none !important;}
.topBorder {border-top: 1px solid #e4e4e4;}
div.minHeight48{min-height: 48px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:15px;}
.homepagePostReplyBannerTime{width:85px; display:inline-block;}
.homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;}
.homepagePostReplyInputContainer {width:630px; float:left;}

View File

@ -542,7 +542,7 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;}
.borderBottomNone {border-bottom:none !important;}
.topBorder {border-top: 1px solid #e4e4e4;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:15px;}
.homepagePostReplyBannerTime{width:85px; display:inline-block;}
.homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;}
.homepagePostReplyInputContainer {width:690px; margin:0px auto;}

View File

@ -0,0 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :principal_activity do
user_id 1
principal_id 1
principal_act_id 1
principal_act_type "MyString"
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe PrincipalActivity, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end