diff --git a/Gemfile b/Gemfile index a690b224b..cf6e9f773 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'https://ruby.taobao.org' #source 'http://ruby.sdutlinux.org/' unless RUBY_PLATFORM =~ /w32/ @@ -28,6 +28,7 @@ gem 'ruby-ole' gem 'rails_kindeditor',path:'lib/rails_kindeditor' #gem "rmagick", ">= 2.0.0" gem 'binding_of_caller' +gem 'chinese_pinyin' group :development do gem 'grape-swagger' diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 5666934b6..477a8e2b9 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -346,11 +346,16 @@ class AdminController < ApplicationController #学校列表 def schools @school_name = params[:school_name] - if @school_name + if @school_name && @school_name != '' @schools = School.where("name like '%#{@school_name}%'") - else - @schools = School.all + elsif @school_name.nil? + @schools = [] + else @school_name && @school_name == ' ' + @schools = School.where('1=1') end + @school_count = @schools.count + @school_pages = Paginator.new @school_count, per_page_option, params['page'] || 1 + @schools = paginateHelper @schools,100 respond_to do |format| format.html end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a6554075f..86c220bd2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -756,7 +756,7 @@ class ApplicationController < ActionController::Base # Returns a string that can be used as filename value in Content-Disposition header def filename_for_content_disposition(name) - request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name + request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident} ? ERB::Util.url_encode(name) : name end def api_request? diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 22881b8f2..2ec3cac0d 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -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}.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 - 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 diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 4f3f3ec0d..4f78d61f5 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -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] diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 9728ddf11..16d516f82 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -126,11 +126,13 @@ class MyController < ApplicationController end @se = @user.extensions - if params[:occupation].to_i.to_s == params[:occupation] - @se.school_id = params[:occupation] - else - @se.occupation = params[:occupation] - end + # if params[:occupation].to_i.to_s == params[:occupation] + # @se.school_id = params[:occupation] + # else + # @se.occupation = params[:occupation] + # end + @se.school_id = params[:occupation] + @se.gender = params[:gender] @se.location = params[:province] if params[:province] @se.location_city = params[:city] if params[:city] diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 3e0c280ac..062b0fa34 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -105,4 +105,42 @@ class SchoolController < ApplicationController render :text => options end + + #根据学校名字或者拼音来查询 + def on_search + condition = "#{params[:name].strip}".gsub(" ","") + #将条件截断为汉字和拼音(全汉字 或者 全拼音 或者 汉字和拼音), + #获取拼音的第一次出现的位置 + chinese = [] + pinyin = [] + condition.scan(/./).each_with_index do |char,index| + if char =~ /[a-zA-Z0-9]/ + pinyin << char + else + chinese << char + end + end + if(condition == '') + @school = School.all + else + @school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").all + end + + result = [] + # @school.each do |sc| + # result << {:value=>sc.name,:data=>sc.id} + # end + render :json => @school.to_json + end + + #添加学校 + def add_school + @school = School.new + @school.name = params[:name].strip + @school.pinyin = Pinyin.t(params[:name].strip, splitter: '') + @school.save + respond_to do |format| + format.js + end + end end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index abc642030..9393339a8 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -136,8 +136,9 @@ class StudentWorkController < ApplicationController format.js format.html format.xls { + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls" send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls") + :filename => filename_for_content_disposition(filename)) } end end @@ -389,8 +390,9 @@ class StudentWorkController < ApplicationController end respond_to do |format| format.xls { + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls" send_data(absence_penalty_list_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls") + :filename => filename_for_content_disposition(filename)) } end end @@ -399,8 +401,9 @@ class StudentWorkController < ApplicationController def evaluation_list respond_to do |format| format.xls { + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls" send_data(evaluation_list_xls(@homework.student_works), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls") + :filename => filename_for_content_disposition(filename)) } end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 797ad1bd4..ef3210719 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -881,8 +881,9 @@ class UsersController < ApplicationController @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" 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')" + course_types = "('Message','News','HomeworkCommon','Poll','Course')" + project_types = "('Message','Issue','ProjectCreateInfo')" + 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] diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index a59f507df..6304055ed 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b18d0c706..ce11bded8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2351,7 +2351,7 @@ module ApplicationHelper def user_for_homework_common homework,is_teacher 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" + 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? @@ -2366,6 +2366,8 @@ module ApplicationHelper end end end + else + link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index dde34abfd..faab129a6 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -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 diff --git a/app/models/principal_activity.rb b/app/models/principal_activity.rb new file mode 100644 index 000000000..bdd7cd60e --- /dev/null +++ b/app/models/principal_activity.rb @@ -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 diff --git a/app/models/school.rb b/app/models/school.rb index a180eefbe..6cafb0473 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -1,5 +1,5 @@ class School < ActiveRecord::Base - attr_accessible :name, :province + attr_accessible :name, :province,:pinyin has_many :courses def to_s diff --git a/app/models/user.rb b/app/models/user.rb index 0ed8aeda0..d66785460 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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? diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb index 0956981e8..d19e9b3b9 100644 --- a/app/views/admin/schools.html.erb +++ b/app/views/admin/schools.html.erb @@ -46,5 +46,8 @@ + <% html_title(l(:label_project_plural)) -%> diff --git a/app/views/attachments/_form_course.html.erb b/app/views/attachments/_form_course.html.erb index b0ab39b5a..b66632c7f 100644 --- a/app/views/attachments/_form_course.html.erb +++ b/app/views/attachments/_form_course.html.erb @@ -42,7 +42,9 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> -<%= 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}"%> +上传附件 <%= file_field_tag 'attachments[dummy][file]', :id => "file#{container.id}", :class => 'file_selector', @@ -63,7 +65,7 @@ <% if container.nil? %> <%= l(:label_no_file_uploaded)%> <% end %> -(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) + <% content_for :header_tags do %> diff --git a/app/views/boards/_course_message_edit.html.erb b/app/views/boards/_course_message_edit.html.erb new file mode 100644 index 000000000..16807afb0 --- /dev/null +++ b/app/views/boards/_course_message_edit.html.erb @@ -0,0 +1,16 @@ + +
+
+
+ 编辑帖子 +
+
+ <%= render :partial => 'boards/course_new', + :locals => {:f => f, :edit_mode => edit_mode, :topic => topic} %> +
\ No newline at end of file diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 61c774a95..61bbb85d2 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,12 +1,69 @@ -<%= 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' %> +
+
+
+
+ +

+
+ +
+ <%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %> + +
+
\ No newline at end of file diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index db174f30e..3fb97bd9d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,313 +1,101 @@ -
-
-

- <% if User.current.language == "zh"%> - <%= h @board.name %> - <% else %> - <%= l(:project_module_boards) %> - <% end %> - -

- <% if User.current.logged? %> - <%= l(:label_message_new) %> - <% end %> -
-
-
-
- -
-
- -
- -<% if !User.current.logged?%> -
- <%= l(:label_user_login_course_board) %> - <%= link_to l(:label_user_login_new), signin_path %> -
-
-<% end %> -

讨论区共有<%= @topic_count %>个帖子

-<% if @topics.any? %> - <% @topics.each do |topic| %> -
- <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
- <% author = topic.author.to_s %> -
- <%= 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;' %> -
-

  :

- -

  <%= h(topic.subject) %>

- <% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> - <% 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? %> - <%= l(:label_board_sticky)%> - <% end %> -
- - -
-
- <%= topic.content.html_safe %> - -
-
- - - - - <%= link_to_attachments_course topic, :author => false %> - - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> - -
- <%= l(:button_reply) %> - -
- - -
-
- <% reply = Message.new(:subject => "RE: #{topic.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - - <% 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 %> -
-
    - <% replies_all.each do |message| %> - <% replies_all_i=replies_all_i+1 %> -
  • - <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class => 'Msg_pic' %> -
    - <%= 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 ' %> -
    -
    - <%= textAreailizable message,:content,:attachments => message.attachments %> - -
    - -
    - <%= format_time(message.created_on) %> - <%= 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') %> -
    -
    - -
  • - <% end %> -
-
- <%if topic.replies_count>2 %> - - <% end %> - <% end %> -
-
-
- - <% end %> -<% else %> -

<%= l(:label_no_data) %>

-<% end %> - -<%# 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 %> -
-
+<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> + \ No newline at end of file + 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%> + + +
+
+
+ 课程讨论区 +
+
+ <% 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, :course => course} %> + <% end %> + <% end %> + + <% if topics%> + <% topics.each do |topic| %> + + <% if topic %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> + <% end %> + <% end %> + + <% if topics.count == 10 %> +
展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
+ <% end %> +<% end%> +
+ + diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 3cfd4ae72..5f6275e9d 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -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(); diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index a9c0e9101..4ca0857c1 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -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 %> <% if activity && activity.course_act%> diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 4cc8b9fbf..8e1e1c421 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -11,10 +11,10 @@ ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } - a:hover{ } + a:hover{} .alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } - #popbox{width:488px;height:308px;} + #popbox{width:488px;height:368px;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; } .C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; } .C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;} @@ -22,12 +22,15 @@ .C_form{ margin:20px 0 0 60px;} .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; } .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; } - .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:90px;} + .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;} .width190{ width:190px; height:26px; border-color:#e1e1e1;} .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;} .C_form a:hover{ text-decoration:underline;} - .C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;} - .C_form a.btn:hover{ background:#ff821d;} + .C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;} + .C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;} + .C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;} + .C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;} + .IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;} + +
+
+
+ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> +
+
+ <% if @topic.author.id == User.current.id%> + + <%end%> + +
-
-
- <%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %> +
+ <% 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 %> +
+
<%= format_time( @topic.created_on)%>
+
+
+ <%= @topic.content.html_safe%> +
+
+
+ <%= link_to_attachments_course @topic, :author => false %> +
+
+
-
-

- <%= @topic.subject %> -

-
-

- 由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %> - 添加于<%= format_time(@topic.created_on) %> -

-
- <%= 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) %>
-
<%= @topic.content.html_safe %>
-
<%= link_to_attachments_course @topic, :author => false %>
- -
- <% 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') %> -
-
-<% unless @replies.empty? %> - <% reply_count = 0 %> - <% @replies.each do |message| %> -
"> -
<%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %>
-
-
- <%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %> - <%= format_time(message.created_on) %> -
-

<%= textAreailizable message,:content,:attachments => message.attachments %>

- <%= link_to_attachments_course message, :author => false %> +
+ <% unless @replies.empty? %> +
+
回复(<%=@reply_count %>)
+
+ +
+
+ <% @replies.each_with_index do |reply,i| %> + +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
- <%= 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) %> +
+
+ <% 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 %> +
+
+ <%= reply.content.html_safe%> +
+
+ <%= format_time(reply.created_on) %> + +
+

-
-
- <% end %> -<% end %> -<% if !@topic.locked? && authorize_for_course('messages', 'reply') %> - -<% end %> -
-
    - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
-<% html_title @topic.subject %> + <% end %> +
+ <% 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 %> +
+
\ No newline at end of file diff --git a/app/views/messages/_course_show_old.html.erb b/app/views/messages/_course_show_old.html.erb new file mode 100644 index 000000000..de9205433 --- /dev/null +++ b/app/views/messages/_course_show_old.html.erb @@ -0,0 +1,117 @@ +
+

+ <%= l(:label_board) %> +

+
+ +
+

+ <%= l(:label_user_location) %> : + <%= link_to l(:label_borad_course), course_boards_path(@course) %> + > + <%= link_to @topic.subject, course_board_path(@course, @board) %> +

+
+
+ +
+
+ <%= link_to image_tag(url_to_avatar(@topic.author),:width => '46',:height => '46'), user_path(@topic.author) %> +
+
+

+ <%= @topic.subject %> +

+
+

+ 由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %> + 添加于<%= format_time(@topic.created_on) %> +

+
+ <%= 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) %> +
+
<%= @topic.content.html_safe %>
+
<%= link_to_attachments_course @topic, :author => false %>
+ +
+ <% 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') %> +
+
+<% unless @replies.empty? %> + <% reply_count = 0 %> + <% @replies.each do |message| %> +
"> +
<%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %>
+
+
+ <%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %> + <%= format_time(message.created_on) %> +
+

<%= textAreailizable message,:content,:attachments => message.attachments %>

+ <%= link_to_attachments_course message, :author => false %> +
+
+ <%= 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) %> +
+
+
+
+
+ <% end %> +<% end %> +<% if !@topic.locked? && authorize_for_course('messages', 'reply') %> + +<% end %> +
+
    + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
+<% html_title @topic.subject %> + diff --git a/app/views/messages/_form_course.html.erb b/app/views/messages/_form_course.html.erb index 7952e4820..86a6df836 100644 --- a/app/views/messages/_form_course.html.erb +++ b/app/views/messages/_form_course.html.erb @@ -28,16 +28,17 @@
  • -
  • -
  • - -
    - <%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %> -
    -
  • +<% unless replying %> +
  • + +
    + <%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %> +
    +
  • +<% end %>
  • diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb new file mode 100644 index 000000000..a859a088a --- /dev/null +++ b/app/views/messages/_reply_message.html.erb @@ -0,0 +1,31 @@ + + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    +
    +
    + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> + + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index d30aee45d..0817594ab 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -1,45 +1,38 @@ -
    -

    <%= l(:label_course_board) %>

    -
    +<% if @message.project %> +
    +

    <%= l(:label_course_board) %>

    +
    + - <% if @message.project %> <%#= board_breadcrumb(@message) %> - -
    -
      - <%= form_for @message, { :as => :message, - :url => {:action => 'edit'}, - :html => {:multipart => true, - :id => 'message-form', - :method => :post} - } do |f| %> + +
      +
        + <%= 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?} %> - <%= l(:button_submit)%> - <%= 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" %> -
      -
      - <% end %> + :locals => {:f => f, :replying => !@message.parent.nil?} %> + <%= l(:button_submit) %> + <%= 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" %> +
    +
    + <% end %> <% elsif @message.course %> - <%#= course_board_breadcrumb(@message) %> -
    -
      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?} %> - <%= l(:button_submit)%> - <%= 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 %> -
    -
    + <% end %> <% end %> -
    diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index e7ee0bca0..eee820c61 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -1,8 +1,18 @@ -$('#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(){ + $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); + $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); + init_activity_KindEditor_data(<%= @message.id%>,null,"85%"); + }); +}else if($("#reply_to_message_<%= @message.id%>").length >0) { + $("#reply_to_message_<%= @message.id%>").replaceWith("

    "); +} \ No newline at end of file diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 0e36d5fd9..4a2fe446d 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -18,8 +18,8 @@
  • 登录名 : *
  • 邮箱 : *
  • 身份 : 
  • -
  • 姓氏 : *
  • -
  • 名字 : *
  • +
  • 姓(First Name) : *
  • +
  • 名(Last Name) : *
  • 组织名 : *
  • 性别 : 
  • 工作单位 : 
  • @@ -72,21 +72,25 @@
  • <% if User.current.user_extensions.nil? %> - readonly> + - + + <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> - readonly> + - + + <% elsif User.current.user_extensions.school.nil? %> - readonly> + - + + <% else %> - + - + + <% end %>
  • @@ -140,7 +144,7 @@
  • <%= f.select :language, :Chinese => :zh, :English => :en %>
  • - 确认 + 确认
  • @@ -166,7 +170,7 @@
  • 确认 - +
  • @@ -180,7 +184,9 @@
    - +

    <%= l(:lable_school_list)%>

    @@ -202,6 +208,7 @@
    +
    <%= stylesheet_link_tag 'nyan' %> @@ -518,10 +525,132 @@ } } } - $(function(){ - //学校 - $("#province").attr("href", "#WOpenWindow") - $("#province").leanModal({top: 100, closeButton: ".modal_close"}); + function changeValue(value,data){ + //console.log(value+","+data) + $("input[name='province']").val(value); + $("input[name='occupation']").val(data); + $("#search_school_result_list").hide(); + $("#hint").hide(); + } + function add_school(name){ + $.ajax({ + url: '<%= url_for(:controller => 'school',:action => 'add_school') %>' + '?name=' + name, + type: 'post', + success: function (data) { + + } + }); + } + var lastSearchCondition = ''; + $(function() { +// $("input[name='province']").keydown(function(e){ +// if(e.keyCode == 13 && $("#search_school_result_list").css('display') == 'block'){ +// str = $("#search_school_result_list").children().eq(0).attr('onclick').match(/\(.*\)/)[0] +// +// str = str.replace(/\(/,'').replace(/\)/,''); +// arr = str.split(','); +// id = arr[1].replace(/\'/,'') +// name = arr.replace(/\'/,'') +// changeValue(name,id); +// return false; +// } +// }); + //查询学校 + $("input[name='province']").on('input', function (e) { + throttle(shcool_search_fn,window,e); + }); + + function throttle(method,context,e){ + clearTimeout(method.tId); + method.tId=setTimeout(function(){ + method.call(context,e); + },500); + } + + function shcool_search_fn(e){ + $("input[name='occupation']").val(''); //一旦有输入就清空id。 + if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){ + return; + } + lastSearchCondition = $(e.target).val().trim(); + $.ajax({ + url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, + type: 'post', + success: function (data) { + if(data.length != undefined && data.length != 0) { + var i = 0; + $("#search_school_result_list").html(''); + for (; i < data.length; i++) { + link = '' + data[i].school.name + '
    '; + $("#search_school_result_list").append(link); + } + $("#search_school_result_list").css('left', $(e.target).offset().left); + $("#search_school_result_list").css('top', $(e.target).offset().top + 28); + $("#search_school_result_list").css("position", "absolute"); + $("#search_school_result_list").show(); + if($(e.target).val().trim() != '') { + str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value; + $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校'); + $("#hint").show(); + }else{ + $("#hint").hide(); + } + }else{ + $("#search_school_result_list").html(''); + str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; + $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); + $("#hint").show(); + } + } + }); + } + $(document.body).click(function(e){ + if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province') + { + $("#search_school_result_list").hide(); + $("#hint").hide(); + } + }) + $("input[name='province']").on('focus', function (e) { + if($(e.target).val() == ''){ // + return; + } + if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在,不用去找了。 + return; + } + $.ajax({ + url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, + type: 'post', + success: function (data) { + if(data.length != undefined && data.length != 0) { + var i = 0; + $("#search_school_result_list").html(''); + for (; i < data.length; i++) { + link = '' + data[i].school.name + '
    '; + $("#search_school_result_list").append(link); + } + $("#search_school_result_list").css('left', $(e.target).offset().left); + $("#search_school_result_list").css('top', $(e.target).offset().top + 28); + $("#search_school_result_list").css("position", "absolute"); + $("#search_school_result_list").show(); + if ($(e.target).val().trim() != '') { + str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value; + $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校'); + $("#hint").show(); + } else { + $("#hint").hide(); + } + }else { + $("#search_school_result_list").html(''); + str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; + $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); + $("#hint").show(); + } + } + }); + }); + +// $("#province").leanModal({top: 100, closeButton: ".modal_close"}); //地区 var province = "<%= "#{province}" %>" @@ -543,7 +672,12 @@ <% if( !@act.nil? && @act == 'password') %> $("#users_tb_2").click(); <% end %> - $('#my_account_form_link').click(function(){ + $('#my_account_form_link').click(function(e){ + if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 + $("#hint").html('学校必须是从下拉列表中选择的,不能手动修改').show(); + e.stopImmediatePropagation(); + return; + } $('#my_account_form_btn').click(); }); $('#my_password_form_link').click(function(){ diff --git a/app/views/school/add_school.js.erb b/app/views/school/add_school.js.erb new file mode 100644 index 000000000..9ebecb682 --- /dev/null +++ b/app/views/school/add_school.js.erb @@ -0,0 +1,2 @@ +$("input[name='occupation']").val('<%= @school.id%>'); +$("#hint").html('创建成功').show(); \ No newline at end of file diff --git a/app/views/school/upload_logo.html.erb b/app/views/school/upload_logo.html.erb index 26da7e081..023069dd0 100644 --- a/app/views/school/upload_logo.html.erb +++ b/app/views/school/upload_logo.html.erb @@ -13,15 +13,21 @@ function showPreview(source) { <%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %> <%#= text_field_tag 'school'%> -
    +
    <%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%> - 上传图片 + 上传图片 <%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
    +
    学校名称:
    +
    学校省份: + +
    - <%= submit_tag('上传') %> - <%= submit_tag('取消') %> + + + <%#= submit_tag('提交',:class=>'mr5') %> + <%#= submit_tag('取消') %>
    <% end %> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 2aa14be71..cfc4129a8 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -45,7 +45,7 @@ 尚未提交附件 <% else%>
    - <%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %> + <%= render :partial => 'work_attachments_status', :locals => {:attachments => @work.attachments, :status => @homework.homework_detail_manual.comment_status} %>
    <% end%>
    diff --git a/app/views/student_work/_work_attachments_status.html.erb b/app/views/student_work/_work_attachments_status.html.erb new file mode 100644 index 000000000..e8d4f144b --- /dev/null +++ b/app/views/student_work/_work_attachments_status.html.erb @@ -0,0 +1,8 @@ +<% attachments.each_with_index do |attachment,i| %> +
    + <%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author && status != 2 %> + (<%= number_to_human_size attachment.filesize %>) +
    +
    +<% end -%> \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index d0f4f82b7..e28cdb1e2 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -35,11 +35,19 @@
    -
    +
    <% if activity.try(:author).try(:realname) == ' ' %> <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <% else %> diff --git a/app/views/users/_course_create.html.erb b/app/views/users/_course_create.html.erb index 699b20216..97213283e 100644 --- a/app/views/users/_course_create.html.erb +++ b/app/views/users/_course_create.html.erb @@ -4,7 +4,7 @@ <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_path(activity.tea_id), :alt => "用户头像" %>
    -
    +
    <% if activity.try(:teacher).try(:realname) == ' ' %> <%= link_to activity.try(:teacher), user_path(activity.tea_id), :class => "newsBlue mr15" %> <% else %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 703a52c32..2d3bc68de 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -5,7 +5,7 @@ <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
    -
    +
    <% if activity.try(:user).try(:realname) == ' ' %> <%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> <% else %> @@ -24,12 +24,10 @@ 匿评已结束 <% end%>
    - <% if User.current.member_of_course?(activity.course) %> -
    - <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> - <%= user_for_homework_common activity,is_teacher %> -
    - <% end %> +
    + <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> + <%= user_for_homework_common activity,is_teacher %> +
    <% if activity.homework_type == 2 && is_teacher%>
    diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index aab26c20b..28cb368d6 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -4,8 +4,8 @@ <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
    -
    - <% 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 @@
    -
    +
    回复(<%= count %>)
    - <%if count>2 %> + <%if count>3 %>
    展开更多 @@ -48,8 +48,13 @@
      <% course.journals_for_messages.where('m_parent_id IS NULL').reorder("created_on desc").each do |comment| %> + <% replies_all_i = replies_all_i + 1 %> -
    • +
    • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
      @@ -62,9 +67,14 @@ <% end %> <%= format_time(comment.created_on) %>
    -
    +
    <%= comment.notes.html_safe %>
    <% fetch_user_leaveWord_reply(comment).each do |reply| unless fetch_user_leaveWord_reply(comment).nil? %> +
    <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %> @@ -84,7 +94,7 @@ <% end %> <%= format_time reply.created_on %>
    -
    +
    <%= reply.notes.html_safe %>
    diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 8ec605567..d9574dc0b 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -4,7 +4,7 @@ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
    -
    +
    <% if activity.try(:author).try(:realname) == ' ' %> <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> <% else %> @@ -13,13 +13,20 @@ TO <%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
    -
    + + <% if activity.sticky == 1%> + 置顶 + <% end%> + <% if activity.locked%> +        + <% end%> +
    发帖时间:<%= format_time(activity.created_on) %>
    @@ -52,13 +59,13 @@ <% count=activity.children.count%> <% end %>
    -
    +
    回复( <%= count %> )
    <%#=format_date(activity.updated_on)%>
    - <%if count > 2 %> + <%if count > 3 %>
    -
    +
    <% if @ctivity.try(:author).try(:realname) == ' ' %> <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <% else %> @@ -32,7 +32,7 @@ 回复(<%= count %>)
    <%#= format_date(activity.updated_on) %>
    - <%if count>2 %> + <%if count>3 %>
    展开更多 @@ -46,13 +46,18 @@
      <% activity.comments.reorder("created_on desc").each do |comment| %> + <% replies_all_i = replies_all_i + 1 %> -
    • +
    • - <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
      -
      +
      <% if comment.try(:author).try(:realname) == ' ' %> <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <% else %> @@ -60,7 +65,7 @@ <% end %> <%= format_time(comment.created_on) %>
      -
      +
      <%= comment.comments.html_safe %>
      diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index 0b91a6ed3..8bbdadc1a 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -1,48 +1,48 @@ -<% has_commit = has_commit_poll?(activity.id ,User.current)%> -<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> -<% if ( activity.polls_status==2) %> -
      +<% has_commit = has_commit_poll?(activity.id ,User.current)%> +<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%> +<% if ( activity.polls_status==2) %> +
      +
      +
      + + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> +
      +
      +
      + <% 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" %> + <% end %> + TO + <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue ml15" %> + +
      +
      + <%#= link_to activity.polls_name.to_s/*+"(问卷名称)"*/, %> + <% if has_commit %> + <%= link_to poll_name, poll_result_poll_path(activity.id), :class => "postGrey"%> + <% else %> + <%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%> + <% end %> +
      +
      + 发布时间:<%= format_time(activity.published_at) %> +
      +
      <%=activity.polls_description.html_safe.to_s%>
      + +
      +
      +
      +
      <% end %> \ No newline at end of file diff --git a/app/views/users/_project_attachment.html.erb b/app/views/users/_project_attachment.html.erb index 5215e9ccc..b98356c7b 100644 --- a/app/views/users/_project_attachment.html.erb +++ b/app/views/users/_project_attachment.html.erb @@ -1,29 +1,29 @@ -
      -
      -
      - 用户头像
      -
      - - -
      - -
      截止时间:2015-08-20
      -
      -
      (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
      - -
      -
      -
      +
      +
      +
      + 用户头像
      +
      + + +
      + +
      截止时间:2015-08-20
      +
      +
      (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
      + +
      +
      +
      \ No newline at end of file diff --git a/app/views/users/_project_create.html.erb b/app/views/users/_project_create.html.erb index 862087e68..8e3b5a5dc 100644 --- a/app/views/users/_project_create.html.erb +++ b/app/views/users/_project_create.html.erb @@ -1,29 +1,38 @@ -
      -
      -
      - 用户头像
      -
      - - -
      - -
      截止时间:2015-08-20
      -
      -
      (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
      - -
      -
      -
      +<% project = Project.find(activity.act_id) %> +<% user = User.find(project.user_id)%> +
      +
      +
      + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> +
      +
      +
      + <% if user.try(:realname) == ' ' %> + <%= link_to user, user_path(user), :class => "newsBlue mr15" %> + <% else %> + <%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> +
      +
      + <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> +
      +
      + 创建时间:<%= format_time(project.created_on) %> +
      + +
      +
      +
      \ No newline at end of file diff --git a/app/views/users/_project_document.html.erb b/app/views/users/_project_document.html.erb index e6067e860..eb3ff2122 100644 --- a/app/views/users/_project_document.html.erb +++ b/app/views/users/_project_document.html.erb @@ -1,29 +1,29 @@ -
      -
      -
      - 用户头像
      -
      - - -
      - -
      截止时间:2015-08-20
      -
      -
      (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
      - -
      -
      -
      +
      +
      +
      + 用户头像
      +
      + + +
      + +
      截止时间:2015-08-20
      +
      +
      (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
      + +
      +
      +
      \ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 02d1940a6..5db13a350 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -4,7 +4,7 @@ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
      -
      +
      <% if activity.try(:author).try(:realname) == ' ' %> <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <% else %> @@ -69,7 +69,7 @@
      回复(<%= count %>)
      <%#= format_date(activity.updated_on) %>
      - <% if count > 2 %> + <% if count > 3 %>
      展开更多 @@ -83,13 +83,18 @@
        <% activity.journals.reorder("created_on desc").each do |reply| %> + <% replies_all_i=replies_all_i + 1 %> -
      • +
      • - <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
        -
        +
        <% if reply.try(:user).try(:realname) == ' ' %> <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> <% else %> @@ -97,7 +102,7 @@ <% end %> <%= format_time(reply.created_on) %>
        -
        +
        <% if reply.details.any? %> <% details_to_strings(reply.details).each do |string| %>

        <%= string %>

        diff --git a/app/views/users/_project_journal.html.erb b/app/views/users/_project_journal.html.erb index 692354f9f..7cf487211 100644 --- a/app/views/users/_project_journal.html.erb +++ b/app/views/users/_project_journal.html.erb @@ -1,29 +1,29 @@ -
        -
        -
        - 用户头像
        -
        - - -
        - -
        截止时间:2015-08-20
        -
        -
        (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
        - -
        -
        -
        +
        +
        +
        + 用户头像
        +
        + + +
        + +
        截止时间:2015-08-20
        +
        +
        (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
        + +
        +
        +
        \ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index ead43d7e4..4b83cb906 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -4,7 +4,7 @@ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
        -
        +
        <% if activity.try(:author).try(:realname) == ' ' %> <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <% else %> @@ -49,7 +49,7 @@ <%=count %> )
        <%#=format_date(activity.updated_on)%>
        - <%if count>2 %> + <%if count>3 %> <% end %>
        @@ -60,13 +60,18 @@
          <% activity.children.reorder("created_on desc").each do |reply| %> + <% replies_all_i=replies_all_i+1 %> -
        • +
        • - <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id), :alt => "用户头像" %> + <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
          -
          +
          <% if reply.try(:author).try(:realname) == ' ' %> <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <% else %> @@ -74,7 +79,7 @@ <% end %> <%= format_time(reply.created_on) %>
          -
          +
          <%= reply.content.html_safe %>
          diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index a347ffd3a..3ea1479c5 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -1,29 +1,29 @@ -
          -
          -
          - 用户头像
          -
          - - -
          - -
          截止时间:2015-08-20
          -
          -
          (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
          - -
          -
          -
          +
          +
          +
          + 用户头像
          +
          + + +
          + +
          截止时间:2015-08-20
          +
          +
          (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
          + +
          +
          +
          \ No newline at end of file diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 29752121f..cc8a6c0f2 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -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(); } } @@ -36,30 +37,12 @@ } $(function() { - init_activity_KindEditor_data(<%= user_activity.id%>,null,"87%"); - var description_images=$("div#activity_description_<%= user_activity.id %>").find("img"); - if (description_images.length>0) { - for (var i=0; i").attr("href",image.attr('src')); - image.wrap(element); - } - } - $('#activity_description_<%= user_activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); - - var reply_images=$("div#reply_content_<%= user_activity.id %>").find("img"); - if (reply_images.length>0) { - for (var i=0; i").attr("href",image.attr('src')); - image.wrap(element); - } - } - $('#reply_content_<%= user_activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); - + init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%"); + showNormalImage('activity_description_<%= user_activity.id %>'); }); - <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> + <% unless user_activity.act_type == "ProjectCreateInfo" %> + <% act= user_activity.act %> <% case user_activity.container_type.to_s %> <% when 'Course' %> <% if act %> @@ -72,6 +55,8 @@ <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> <% when 'Poll' %> <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% when 'Course'%> + <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %> <% end %> <% end %> <% when 'Project' %> @@ -81,8 +66,20 @@ <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> <% when 'Message' %> <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> + <% when 'ProjectCreateInfo'%> + <%= render :partial => 'project_create', :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 %> + <% else %> + <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %> <% end %> <% end %> <% end %> diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index 336a62d37..44f992bb4 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -6,7 +6,7 @@ <%=link_to image_tag(url_to_avatar(homework_common.user),width:"50px", height: "50px"), user_activities_path(homework_common.user.id)%>
          -
          +
          <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%> TO <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%> @@ -47,7 +47,7 @@
          <%= homework_common.description.html_safe %>
          -
          +
          <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
          diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb new file mode 100644 index 000000000..43ec2a0c2 --- /dev/null +++ b/app/views/users/_user_journalsformessage.html.erb @@ -0,0 +1,97 @@ +
          +
          +
          + <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> +
          +
          +
          + <%= 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 %> +
          +
          + <% 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 %> +
          +
          + 留言时间:<%= format_time(activity.created_on) %> +
          +
          +
          +
          + <% count=fetch_user_leaveWord_reply(activity).count %> +
          +
          +
          +
          + 回复(<%= count %>) +
          +
          + <%if count>3 %> + + <% end %> +
          + + <% replies_all_i = 0 %> + <% if count > 0 %> +
          +
            + <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> + <% replies_all_i = replies_all_i + 1 %> +
          • +
            + <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> +
            +
            +
            + <% 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) %> +
            +
            + <%= comment.notes.html_safe %> +
            + <% end %> +
            +
            +
          • +
          +
          + <% end %> + +
          +
          <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
          +
          +
          + <%= 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' %> + +
          + +
          +

          + <% end%> +
          +
          +
          +
          +
          +
          +
          \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index de166b4e7..fc87bd3a0 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -29,6 +29,7 @@
          • 更多
          • +
          • <%= link_to "留言动态", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
          • <%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%>
          • <%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
          diff --git a/app/views/users/user_system_messages.html.erb b/app/views/users/user_system_messages.html.erb index 64b0dff0c..2905e1e7d 100644 --- a/app/views/users/user_system_messages.html.erb +++ b/app/views/users/user_system_messages.html.erb @@ -4,10 +4,10 @@
          - <%= image_tag("/images/logo.png", :width => "42", :height => "42",class: "mt3") %> + <%= image_tag("/images/logo.png", :width => "50", :height => "50") %>
          -
          +
          Trustie平台 发布了系统消息: <%= system_message.subject.nil? ? "系统消息" : system_message.subject %>
          diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index d91ce08ce..db645f011 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -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' %> diff --git a/config/configuration.yml b/config/configuration.yml index ef39f6493..2ac986927 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -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. diff --git a/config/routes.rb b/config/routes.rb index 2e02cd3d2..810c22e7a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 @@ -879,6 +884,8 @@ RedmineApp::Application.routes.draw do post 'school/search_school/', :to => 'school#search_school' get 'school/search_school/', :to => 'school#search_school' + post 'school/on_search' + post 'school/add_school' ######added by nie match 'tags/show_projects_tags' ########### added by liuping diff --git a/db/migrate/20151013081912_create_principal_activities.rb b/db/migrate/20151013081912_create_principal_activities.rb new file mode 100644 index 000000000..f688ed807 --- /dev/null +++ b/db/migrate/20151013081912_create_principal_activities.rb @@ -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 diff --git a/db/migrate/20151013091057_update_principal_activity.rb b/db/migrate/20151013091057_update_principal_activity.rb new file mode 100644 index 000000000..bfcf9ccd9 --- /dev/null +++ b/db/migrate/20151013091057_update_principal_activity.rb @@ -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 diff --git a/db/migrate/20151013092356_update_principal_activity_time.rb b/db/migrate/20151013092356_update_principal_activity_time.rb new file mode 100644 index 000000000..8c1e5bd79 --- /dev/null +++ b/db/migrate/20151013092356_update_principal_activity_time.rb @@ -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 diff --git a/db/migrate/20151014012627_add_column_pinyin_to_schools.rb b/db/migrate/20151014012627_add_column_pinyin_to_schools.rb new file mode 100644 index 000000000..8da287d4a --- /dev/null +++ b/db/migrate/20151014012627_add_column_pinyin_to_schools.rb @@ -0,0 +1,5 @@ +class AddColumnPinyinToSchools < ActiveRecord::Migration + def change + add_column :schools, :pinyin, :string + end +end diff --git a/db/migrate/20151014013243_update_user_activity_updated_at.rb b/db/migrate/20151014013243_update_user_activity_updated_at.rb new file mode 100644 index 000000000..6678e07e1 --- /dev/null +++ b/db/migrate/20151014013243_update_user_activity_updated_at.rb @@ -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 diff --git a/db/migrate/20151014023806_transfer_name_column_value_to_pinyin_column_value.rb b/db/migrate/20151014023806_transfer_name_column_value_to_pinyin_column_value.rb new file mode 100644 index 000000000..a5aeba07a --- /dev/null +++ b/db/migrate/20151014023806_transfer_name_column_value_to_pinyin_column_value.rb @@ -0,0 +1,11 @@ +class TransferNameColumnValueToPinyinColumnValue < ActiveRecord::Migration + def up + School.all.each do |school| + school.pinyin = Pinyin.t(school.name, splitter: '') + school.save + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index abc7017e6..4a0d2312a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150917022239) do +ActiveRecord::Schema.define(:version => 20151014023806) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -575,6 +575,8 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.integer "viewed" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "secret_key" + t.integer "status" end create_table "forums", :force => true do |t| @@ -783,16 +785,6 @@ ActiveRecord::Schema.define(:version => 20150917022239) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" @@ -911,6 +903,7 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "updated_on", :null => false t.boolean "locked", :default => false t.integer "sticky", :default => 0 + t.integer "reply_id" end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" @@ -1093,6 +1086,15 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "updated_at", :null => false end + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1255,6 +1257,7 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.string "logo_link" + t.string "pinyin" end create_table "seems_rateable_cached_ratings", :force => true do |t| @@ -1376,6 +1379,7 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.text "description" + t.string "subject" end create_table "taggings", :force => true do |t| diff --git a/lib/grack/Gemfile b/lib/grack/Gemfile index b7113caa8..80932e7e4 100644 --- a/lib/grack/Gemfile +++ b/lib/grack/Gemfile @@ -1,4 +1,4 @@ -source "http://ruby.taobao.org" +source "https://ruby.taobao.org" gemspec diff --git a/lib/grack/Gemfile.lock b/lib/grack/Gemfile.lock index 52d60f85d..68fa71a2b 100644 --- a/lib/grack/Gemfile.lock +++ b/lib/grack/Gemfile.lock @@ -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) diff --git a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb index d7d5948d4..0e1177563 100644 --- a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb +++ b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb @@ -13,7 +13,7 @@ class Kindeditor::AssetsController < ApplicationController logger.warn '========= Warning: the owner_id is 0, "delete uploaded files automatically" will not work. =========' if defined?(logger) && @asset.owner_id == 0 @asset.asset_type = @dir if @asset.save - render :text => ({:error => 0, :url => "http://"+Setting.host_name + "/" + @asset.asset.url,:asset_id => @asset.id}.to_json) + render :text => ({:error => 0, :url => @asset.asset.url,:asset_id => @asset.id}.to_json) else show_error(@asset.errors.full_messages) end diff --git a/plugins/redmine_ckeditor/Gemfile b/plugins/redmine_ckeditor/Gemfile index ce2f3c583..07a2bac50 100644 --- a/plugins/redmine_ckeditor/Gemfile +++ b/plugins/redmine_ckeditor/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'https://ruby.taobao.org' gem 'rich', '1.4.6' gem 'kaminari' diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index da7434d9b..5f1063f0b 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -5127,8 +5127,10 @@ KEditor.prototype = { }; K(window).bind('resize', self._fullscreenResizeHandler); toolbar.select('fullscreen'); - statusbar.first().css('visibility', 'hidden'); - statusbar.last().css('visibility', 'hidden'); + if(statusbar.first() ){ + statusbar.first() .css('visibility', 'hidden'); + statusbar.last().css('visibility', 'hidden'); + } } else { if (_GECKO) { K(window).bind('scroll', function(e) { @@ -5145,7 +5147,9 @@ KEditor.prototype = { } }); } else { - statusbar.first().css('visibility', 'hidden'); + if(statusbar.first() ){ + statusbar.first().css('visibility', 'hidden'); + } } if (self.resizeType === 2) { _drag({ diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js index c413bbcb9..f08a768aa 100644 --- a/public/assets/kindeditor/pasteimg.js +++ b/public/assets/kindeditor/pasteimg.js @@ -277,7 +277,10 @@ https://github.com/layerssss/paste.js if (!img["_paste_marked_" + timespan]) { cb(img.src); } - _results.push($(img).remove()); + //firefox问题处理,因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴 + if ($(img).attr('src').startsWith('data:image/')) { + _results.push($(img).remove()); + }; } return _results; }; @@ -293,7 +296,6 @@ https://github.com/layerssss/paste.js function enablePasteImg(_editor) { var editor = _editor, name = 'paste'; - //òƶ༭Ͳͻ if(editor.edit == undefined || editor.edit.iframe == undefined){ return; } @@ -329,7 +331,6 @@ function enablePasteImg(_editor) { console.log("dataURL: " + data.dataURL); console.log("width: " + data.width); console.log("height: " + data.height); - console.log(data.blob); var blob = dataURItoBlob(data.dataURL); if (data.blob !== null) { var data = new FormData(); @@ -342,6 +343,7 @@ function enablePasteImg(_editor) { data: data, processData: false, success: function(data) { + console.log(data); editor.exec('insertimage', JSON.parse(data).url); } }); @@ -349,37 +351,4 @@ function enablePasteImg(_editor) { }); return; - contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) { - // use event.originalEvent.clipboard for newer chrome versions - var items = (event.clipboardData || event.originalEvent.clipboardData).items; - console.log(JSON.stringify(items)); // will give you the mime types - // find pasted image among pasted items - var blob = null; - for (var i = 0; i < items.length; i++) { - if (items[i].type.indexOf("image") === 0) { - blob = items[i].getAsFile(); - } - } - // load image if there is a pasted image - if (blob !== null) { - var reader = new FileReader(); - reader.onload = function(event) { - console.log(event.target.result); // data url! - var data = new FormData(); - data.append("imgFile", blob, "imageFilename.png"); - console.log(blob); - $.ajax({ - url: '/kindeditor/upload?dir=image', - contentType: false, - type: 'POST', - data: data, - processData: false, - success: function(data) { - editor.exec('insertimage', JSON.parse(data).url); - } - }); - }; - reader.readAsDataURL(blob); - } - } }; diff --git a/public/assets/kindeditor/plugins/paste/paste.js b/public/assets/kindeditor/plugins/paste/paste.js index 943c0bbe7..767cefb09 100644 --- a/public/assets/kindeditor/plugins/paste/paste.js +++ b/public/assets/kindeditor/plugins/paste/paste.js @@ -277,7 +277,10 @@ https://github.com/layerssss/paste.js if (!img["_paste_marked_" + timespan]) { cb(img.src); } - _results.push($(img).remove()); + //firefox问题处理,因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴 + if ($(img).attr('src').startsWith('data:image/')) { + _results.push($(img).remove()); + }; } return _results; }; @@ -293,7 +296,6 @@ https://github.com/layerssss/paste.js KindEditor.plugin('paste', function(K) { var editor = this, name = 'paste'; - //òƶ༭Ͳͻ if(editor.edit == undefined || editor.edit.iframe == undefined){ return; } @@ -303,7 +305,7 @@ KindEditor.plugin('paste', function(K) { var nodeBody = contentWindow.document.getElementsByTagName('body')[0]; console.log(nodeBody); $(nodeBody).pastableContenteditable(); - + dataURItoBlob = function(dataURI) { // convert base64/URLEncoded data component to raw binary data held in a string var byteString; @@ -329,7 +331,6 @@ KindEditor.plugin('paste', function(K) { console.log("dataURL: " + data.dataURL); console.log("width: " + data.width); console.log("height: " + data.height); - console.log(data.blob); var blob = dataURItoBlob(data.dataURL); if (data.blob !== null) { var data = new FormData(); @@ -342,6 +343,7 @@ KindEditor.plugin('paste', function(K) { data: data, processData: false, success: function(data) { + console.log(data); editor.exec('insertimage', JSON.parse(data).url); } }); @@ -349,37 +351,5 @@ KindEditor.plugin('paste', function(K) { }); return; - contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) { - // use event.originalEvent.clipboard for newer chrome versions - var items = (event.clipboardData || event.originalEvent.clipboardData).items; - console.log(JSON.stringify(items)); // will give you the mime types - // find pasted image among pasted items - var blob = null; - for (var i = 0; i < items.length; i++) { - if (items[i].type.indexOf("image") === 0) { - blob = items[i].getAsFile(); - } - } - // load image if there is a pasted image - if (blob !== null) { - var reader = new FileReader(); - reader.onload = function(event) { - console.log(event.target.result); // data url! - var data = new FormData(); - data.append("imgFile", blob, "imageFilename.png"); - console.log(blob); - $.ajax({ - url: '/kindeditor/upload?dir=image', - contentType: false, - type: 'POST', - data: data, - processData: false, - success: function(data) { - editor.exec('insertimage', JSON.parse(data).url); - } - }); - }; - reader.readAsDataURL(blob); - } - } + }); diff --git a/public/images/blue_line.png b/public/images/blue_line.png index 4ae87f343..b7654fb6a 100644 Binary files a/public/images/blue_line.png and b/public/images/blue_line.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8e5e38ee4..4ab267c1a 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -952,3 +952,16 @@ $(document).ready(function () { $("pre").addClass("break_word"); } }); + +//点击图片即显示大图 +function showNormalImage(id) { + var description_images=$('div#'+id).find("img"); + if (description_images.length>0) { + for (var i=0; i").attr("href",image.attr('src')); + image.wrap(element); + } + } + $('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); +} diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 3818d447d..3baa11970 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -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(){ + +} /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////课程讨论区 diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index decbbb341..977c62117 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -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,8 +25,8 @@ 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); - }else if(edit.html().val().trim() != ""){ + 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"); } \ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index a08c7760b..6c6227ed4 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -8,6 +8,14 @@ h3, .wiki h2 {font-size: 15px; padding-left: 5px} h4, .wiki h3 {font-size: 13px;} h4 {border-bottom: 1px dotted #bbb;} li{list-style-type:none;} + +/*Tim 151019*/ +.schoolName {border:1px solid #dddddd; outline: none; width: 180px; height: 22px;} +.provinceSelect {border: 1px solid #dddddd; outline: none; color: #888888;} +.submit_btn {background-color: #269ac9; color: #ffffff; padding: 2px 5px; border: none; border-radius: 3px; cursor: pointer;} +.submit_btn:hover {background-color:#297fb8;} +.cancel_btn {background-color: #c1c1c1; color: #ffffff; padding: 2px 5px; border: none; border-radius: 3px; cursor: pointer;} +.cancel_btn:hover {background-color:#656565; } /*huang*/ .hwork_input_news{ border:1px solid #64bdd9; height:22px; width:594px; background:#fff; margin-bottom:10px; padding:5px;} @@ -2805,7 +2813,7 @@ img,embed{max-width: 100%;} img.school_avatar { background: rgb(245, 245, 245); padding: 4px; - border: 1px solid #e5dfc7; + border: 1px solid #eaeaea; float: left; display: block; width: 100px; diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 73488ad18..2fb7ec9c9 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -83,7 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .mr95{margin-right: 95px;} .ml100{margin-left: 100px;} .mt16{margin-top: 16px;} - +.pr10{padding-right: 10px;} /*课程右侧动态 new_user.css*/ .resources {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd;float: right} .homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;} @@ -103,9 +103,9 @@ a.homepagePostTypeMine {background:url(../images/homepage_icon.png) -187px -277p a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -189px -308px no-repeat; padding-left:23px;} a.postTypeGrey {color:#888888;} a.postTypeGrey:hover {color:#269ac9;} -.homepagePostBrief {width:710px; margin:0px auto; position:relative;} -.homepagePostPortrait {float:left; width:42px;} -.homepagePostDes {float:left; width:645px; margin-left:15px;} +.homepagePostBrief {width:720px; margin:0px auto; position:relative;} +.homepagePostPortrait {float:left; width:50px;} +.homepagePostDes {float:left; width:655px; margin-left:15px;} .homepagePostTo {font-size:14px; color:#484848; margin-bottom:5px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:5px; font-weight:bold;} .homepagePostSubmitContainer {height:25px; margin-top: 8px; margin-bottom: 5px;} @@ -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;} @@ -141,7 +141,7 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} -a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;} +a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:632px; margin-left:15px;} @@ -171,6 +171,8 @@ 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;} +.locked_btn_cir{background: url("../images/locked.png") 0 0 no-repeat; cursor: default;} .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;} @@ -693,9 +695,9 @@ div#menu_r ul {float: left;} div#menu_r ul.menu_r { background: #269ac9; padding:0 10px; height:40px; } div#menu_r li {position: relative; z-index: 9; margin: 0; display: block; float: left; } div#menu_r li:hover>ul { left: -2px;} -div#menu_r a {position: relative;z-index: 10; height: 41px; display: block; float: left;line-height: 41px; text-decoration: none; font-size:14px; } -div#menu_r ul a.parent {background: url(../images/item.png) -20px -30px no-repeat; width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} -div#menu_r ul a.parent:hover {background: url(../images/item.png) -20px -60px no-repeat;} +div#menu_r a {position: relative;z-index: 10; height: 41px; display: block; float: left;line-height: 41px; text-decoration: none; font-size:14px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } +div#menu_r ul a.parent {background: url(../images/item.png) -30px -30px no-repeat; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +div#menu_r ul a.parent:hover {background: url(../images/item.png) -30px -60px no-repeat;} div#menu_r ul ul a.parent {background: url(../images/item.png) -20px 6px no-repeat;} div#menu_r ul ul a.parent:hover {background: url(../images/item.png) -20px -11px no-repeat;} /* menu::level1 */ @@ -704,12 +706,13 @@ div#menu_r a { padding: 5px 12px 0 10px;line-height: 30px; color: #fff;} div#menu_r li.last { background: none; } /* menu::level2 */ div#menu_r ul ul li { background: none; } -div#menu_r ul ul { position: absolute;top: 38px; left: -999em; width: 90px; padding: 5px 0 0 0; background:#fff; border:1px solid #269ac9; margin-top:1px;} +div#menu_r ul ul { position: absolute;top: 38px; left: -999em; min-width: 90px; max-width: 360px; padding: 5px 0 0 0; background:#fff;box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top:1px;} div#menu_r ul ul a {padding: 0 0 0 15px; height: auto; float: none;display: block; line-height: 24px; font-size:12px; font-weight:normal;color:#269ac9;} div#menu_r ul ul a:hover { background:#297fb8; color:#fff;} div#menu_r ul ul li.last { margin-left:15px; } div#menu_r ul ul li {width: 100%;} +.hidden{overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} /* 20150414*/ a.wzan_img{background:url(../images/new_project/public_icon.png) 0px -457px no-repeat; display:block; height:31px; width:30px; color:#fff; } a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px no-repeat;} @@ -886,12 +889,7 @@ a:hover.about_me{ color:#0781b4;} } #homework_work_test_show{margin-left: 35px;width: 94%;} - - - - /*20150820课程作业 LB*/ -.HomeWork {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd; float:right;} .RightBanner {width:708px; height:34px; border-bottom:1px solid #e9e9e9;} select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;} a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#ffffff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} @@ -904,6 +902,7 @@ a:hover.BlueCirBtn{ background:#269ac9; color:#fff;} .w720{width:721px;} .w709{width: 709px;} .w701{width: 701px;} +.w713{width: 713px;} 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;} @@ -914,7 +913,7 @@ a.DropBtn{background: url(../images/homepage_icon2.png) -125px -339px no-repeat; a:hover.DropBtn{background: url(../images/homepage_icon2.png) -125px -370px no-repeat;} .DropLine{border-top:1px solid #d9d9d9; float:left; width:623px; height:10px; margin-top:10px;} /*20150820课程作业 LB*/ -.HomeWork {width:708px; background-color:#ffffff; padding:20px; border:1px solid #dddddd;} +.HomeWork {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd; float: right;} .RightBanner {font-size:16px; width:733px; color:#4b4b4b; padding:10px 0 0 15px; margin-bottom:10px; background:#fff; border:1px solid #dddddd;height:34px;} select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;} a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#fff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} @@ -1037,6 +1036,39 @@ a:hover.c_grey{ color:#333;} .link_file_box{ width:360px;} /*a.postOptionLink{float: right;color: #64bdd9;display: block;padding: 1px 5px;border: 1px solid #64bdd9;width: initial;}*/ /*a:hover.postOptionLink {color: #fff;background: #64bdd9;}*/ -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;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index ee284683f..872d8df6d 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -296,6 +296,8 @@ 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;} +.locked_btn_cir{background: url("../images/locked.png") 0 0 no-repeat; cursor: default;} .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 +626,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;} @@ -635,9 +638,9 @@ a.homepageTypeUMessage {background:url(../images/homepage_icon.png) -4px -519px a.homepageTypeUApply {background:url(../images/homepage_icon.png) -91px -582px no-repeat; padding-left:23px;} a.postTypeGrey {color:#888888;} a.postTypeGrey:hover {color:#269ac9;} -.homepagePostBrief {width:710px; margin:0px auto; position:relative;} -.homepagePostPortrait {float:left; width:42px;} -.homepagePostDes {float:left; width:645px; margin-left:15px; overflow:hidden;} +.homepagePostBrief {width:720px; margin:0px auto; position:relative;} +.homepagePostPortrait {float:left; width:50px;} +.homepagePostDes {float:left; width:655px; margin-left:15px; overflow:hidden;} .homepagePostTo {font-size:14px; color:#484848; margin-bottom:5px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:5px; font-weight:bold;} .homepagePostSubmitContainer {height:25px; margin-top: 8px; margin-bottom: 5px;} @@ -646,15 +649,15 @@ a.postTypeGrey:hover {color:#269ac9;} .homepagePostIntro {font-size:14px; color:#484848;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; margin-top: 2px;} .homepagePostDate {font-size:12px; color:#888888;margin-bottom: 5px;} -.homepagePostReply {width:710px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} -.homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;} +.homepagePostReply {width:720px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} +.homepagePostReplyBanner {width:718px; 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;} 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;} +.homepagePostReplyBannerMore{width:315px; display:inline-block; text-align:right; float:right; padding-right:15px;} +.homepagePostReplyInputContainer {width:642px; float:left;} .homepagePostReplyInput {width:663px; height:45px; max-width:663px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:20px auto 10px auto;} .homepagePostReplyEmotion {background:url(../images/homepage_icon.png) -90px -88px no-repeat; width:50px; height:24px; float:left; padding-left:30px;} .homepagePostReplySubmit {float:right; width:45px; height:24px; text-align:center; line-height:24px; vertical-align:middle; font-size:12px; color:#ffffff; background-color:#269ac9;} @@ -666,7 +669,7 @@ a.postReplyCancel {color:#888888; display:block;} a.postReplyCancel:hover {color:#ffffff;} .homepagePostReplyInputContainer2 {width:595px; margin:0px auto;} .homepagePostReplyInput2 {width:588px; height:45px; max-width:588px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:0px auto 10px auto;} -.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:680px; margin:0px auto; margin-top:15px; min-height:60px;} +.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:690px; margin:0px auto; margin-top:15px; min-height:50px;} .homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} .homepagePostSetting ul li:hover ul {display:block;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} @@ -676,7 +679,7 @@ a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} -.homepagePostReplyDes {float:left; width:632px; margin-left:15px;} +.homepagePostReplyDes {float:left; width:642px; margin-left:15px;} .homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;} .homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;} .homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} @@ -999,7 +1002,6 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} .uppic_btn:hover {background-color: #329cbd;} /*20150820课程作业 LB*/ -.HomeWork {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd; float:right;} .RightBanner {width:708px; height:34px; border-bottom:1px solid #e9e9e9;} select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;} a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#ffffff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} @@ -1022,7 +1024,7 @@ a.DropBtn{background: url(../images/homepage_icon2.png) -125px -339px no-repeat; a:hover.DropBtn{background: url(../images/homepage_icon2.png) -125px -370px no-repeat;} .DropLine{border-top:1px solid #d9d9d9; float:left; width:623px; height:10px; margin-top:10px;} /*20150820课程作业 LB*/ -.HomeWork {width:708px; background-color:#ffffff; padding:20px; border:1px solid #dddddd;} +.HomeWork {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd; float:right;} .RightBanner {font-size:16px; width:733px; color:#4b4b4b; padding:10px 0 0 15px; margin-bottom:10px; background:#fff; border:1px solid #dddddd;height:34px;} select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;} a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#fff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index b64e60831..b476210b1 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -724,6 +724,10 @@ div.actions input[type="text"] { word-wrap: break-word; } +.memo-content li { + list-style-type: decimal; +} + .memo-timestamp { position: absolute; bottom: 0px; diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index c6ce61251..45580e95e 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -528,8 +528,8 @@ a.homepagePostTypeQuestion {background:url(../images/homepage_icon.png) -10px -2 a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -10px -360px no-repeat; padding-left:23px;} a.postTypeGrey {color:#888888;} a.postTypeGrey:hover {color:#269ac9;} -.homepagePostBrief {width:710px; margin:20px auto 0px auto; position:relative;} -.homepagePostPortrait {float:left; width:90px;} +.homepagePostBrief {width:720px; margin:20px auto 0px auto; position:relative;} +.homepagePostPortrait {float:left; width:50px;} .homepagePostDes {float:left; width:600px; margin-left:20px;} .homepagePostTo {font-size:14px; color:#484848; margin-bottom:8px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:10px; font-weight:bold;} @@ -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;} diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css index 849aa1c02..7db6e121d 100644 --- a/public/stylesheets/users.css +++ b/public/stylesheets/users.css @@ -81,7 +81,7 @@ a.select_btn_select{ background:#64bddb; color:#fff;} .users_dis{display:block; } .users_undis{display:none;} .users_ctt{ font-size:14px; color:#666; margin-top:10px;} -.setting_left{ width:85px; text-align:right; float:left;} +.setting_left{ width:115px; text-align:right; float:left;} .setting_left li{ height:28px;line-height:28px;} .setting_right{width:500px; text-align:left; float:left; margin-left:8px;} .setting_right li{ height:28px;line-height:28px;} diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 5a9ea3830..05c9ca244 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1874,9 +1874,9 @@ div.tableline{ font-size: 12px; color: #fff; padding: 3px 9px; - background: #15bccf; + background: #269ac9; border-radius: 4px; - border: 1px solid #15bccf; + border: 1px solid #269ac9; box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 0px 2px rgb(255, 255, 255) inset; text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2), 0px 1px 0px rgb(255, 255, 255); cursor: pointer; diff --git a/spec/factories/principal_activities.rb b/spec/factories/principal_activities.rb new file mode 100644 index 000000000..58e52fa17 --- /dev/null +++ b/spec/factories/principal_activities.rb @@ -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 diff --git a/spec/models/principal_activity_spec.rb b/spec/models/principal_activity_spec.rb new file mode 100644 index 000000000..3ae176e25 --- /dev/null +++ b/spec/models/principal_activity_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe PrincipalActivity, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end