Merge branch 'develop' into szzh

This commit is contained in:
alan 2015-06-01 10:43:43 +08:00
commit ac637d8bf0
52 changed files with 2986 additions and 2676 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@
*.swp *.swp
/config/database.yml /config/database.yml
/config/configuration.yml /config/configuration.yml
/config/additional_environment.rb
/files/* /files/*
/log/* /log/*
/public/tmp/* /public/tmp/*

174
Gemfile
View File

@ -1,87 +1,87 @@
source 'http://ruby.taobao.org' source 'http://ruby.taobao.org'
#source 'http://ruby.sdutlinux.org/' #source 'http://ruby.sdutlinux.org/'
unless RUBY_PLATFORM =~ /w32/ unless RUBY_PLATFORM =~ /w32/
# unix-like only # unix-like only
gem 'iconv' gem 'iconv'
end end
source 'http://rubygems.oneapm.com' do source 'http://rubygems.oneapm.com' do
gem 'oneapm_rpm' gem 'oneapm_rpm'
end end
gem "mysql2", "= 0.3.18" gem "mysql2", "= 0.3.18"
gem 'redis-rails' gem 'redis-rails'
gem 'rubyzip' gem 'rubyzip'
gem 'delayed_job_active_record'#, :group => :production gem 'delayed_job_active_record'#, :group => :production
gem 'daemons' gem 'daemons'
gem 'grape', '~> 0.9.0' gem 'grape', '~> 0.9.0'
gem 'grape-entity' gem 'grape-entity'
gem 'seems_rateable', '~> 1.0.13' gem 'seems_rateable', '~> 1.0.13'
gem "rails", "3.2.13" gem "rails", "3.2.13"
gem "jquery-rails", "~> 2.0.2" gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0" gem "i18n", "~> 0.6.0"
gem 'coderay', '~> 1.1.0' gem 'coderay', '~> 1.1.0'
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0" gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1' gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet' gem 'spreadsheet'
gem 'ruby-ole' gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor' gem 'rails_kindeditor',path:'lib/rails_kindeditor'
#gem "rmagick", ">= 2.0.0" #gem "rmagick", ">= 2.0.0"
group :development do group :development do
gem 'grape-swagger' gem 'grape-swagger'
gem 'better_errors', '~> 1.1.0' gem 'better_errors', '~> 1.1.0'
gem 'rack-mini-profiler', '~> 0.9.3' gem 'rack-mini-profiler', '~> 0.9.3'
end end
group :development, :test do group :development, :test do
unless RUBY_PLATFORM =~ /w32/ unless RUBY_PLATFORM =~ /w32/
gem 'pry-rails' gem 'pry-rails'
if RUBY_VERSION >= '2.0.0' if RUBY_VERSION >= '2.0.0'
gem 'pry-byebug' gem 'pry-byebug'
end end
gem 'pry-stack_explorer' gem 'pry-stack_explorer'
end end
gem 'rspec-rails', '~> 3.0' gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails' gem 'factory_girl_rails'
end end
# Gems used only for assets and not required # Gems used only for assets and not required
# in production environments by default. # in production environments by default.
group :assets do group :assets do
gem 'sass-rails', '~> 3.2.3' gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1' gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes # See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3' gem 'uglifier', '>= 1.0.3'
end end
# Optional gem for LDAP authentication # Optional gem for LDAP authentication
group :ldap do group :ldap do
gem "net-ldap", "~> 0.3.1" gem "net-ldap", "~> 0.3.1"
end end
# Optional gem for OpenID authentication # Optional gem for OpenID authentication
group :openid do group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid" gem "ruby-openid", "~> 2.1.4", :require => "openid"
gem "rack-openid" gem "rack-openid"
end end
database_file = File.join(File.dirname(__FILE__), "config/database.yml") database_file = File.join(File.dirname(__FILE__), "config/database.yml")
if File.exist?(database_file) if File.exist?(database_file)
else else
warn("Please configure your config/database.yml first") warn("Please configure your config/database.yml first")
end end
# Load plugins' Gemfiles # Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file| Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file) instance_eval File.read(file)
end end

View File

@ -91,6 +91,7 @@ module Mobile
desc '课程留言列表' desc '课程留言列表'
params do params do
optional :token, type: String optional :token, type: String
optional :page,type:Integer,desc:'页数'
end end
get ':id/course_message' do get ':id/course_message' do
cs = CommentService.new cs = CommentService.new

View File

@ -336,9 +336,11 @@ class AccountController < ApplicationController
:expires => 1.month.from_now, :expires => 1.month.from_now,
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
:domain => Redmine::Configuration['cookie_domain'],
:httponly => true :httponly => true
} }
if Redmine::Configuration['cookie_domain'].present?
cookie_options = cookie_options.merge(domain: Redmine::Configuration['cookie_domain'])
end
cookies[autologin_cookie_name] = cookie_options cookies[autologin_cookie_name] = cookie_options
end end

View File

@ -199,7 +199,11 @@ class ApplicationController < ActionController::Base
# Logs out current user # Logs out current user
def logout_user def logout_user
if User.current.logged? if User.current.logged?
cookies.delete(autologin_cookie_name, domain: :all) if Redmine::Configuration['cookie_domain'].present?
cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain'])
else
cookies.delete autologin_cookie_name
end
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil self.logged_user = nil
end end

View File

@ -80,19 +80,19 @@ class BoardsController < ApplicationController
if @project if @project
@topic_pages = Paginator.new @topic_count, per_page_option, params['page'] @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@topics = @board.topics. @topics = @board.topics.
reorder("#{Message.table_name}.sticky DESC"). reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
includes(:last_reply). includes(:last_reply).
limit(@topic_pages.per_page). limit(@topic_pages.per_page).
offset(@topic_pages.offset). offset(@topic_pages.offset).
order("last_replies_messages.created_on desc").
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all all
elsif @course elsif @course
board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC"). board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
includes(:last_reply). includes(:last_reply).
# limit(@topic_pages.per_page). # limit(@topic_pages.per_page).
# offset(@topic_pages.offset). # offset(@topic_pages.offset).
order("last_replies_messages.created_on desc").
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all : [] all : []
@topics = paginateHelper board_topics,10 @topics = paginateHelper board_topics,10

View File

@ -193,7 +193,7 @@ class MessagesController < ApplicationController
else else
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
end end
elsif request.get? elsif request.get? || request.post?
if params[:is_board] if params[:is_board]
if @project if @project
redirect_to project_boards_path(@project) redirect_to project_boards_path(@project)

View File

@ -243,14 +243,7 @@ class ProjectsController < ApplicationController
# Author lizanle # Author lizanle
# Description 项目动态展示方法,删除了不必要的代码 # Description 项目动态展示方法,删除了不必要的代码
def show def show
# params[:login]为邮箱邀请用户加入,主要功能:
# 1、自动注册
# 2、加入项目、创建角色
# 3、用户得分
if params[:mail]
Member.create(:role_ids => [4], :user_id => params[:user],:project_id => params[:id])
UserGrade.create(:user_id =>params[:user], :project_id => params[:id])
end
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return
end end
@ -399,6 +392,26 @@ class ProjectsController < ApplicationController
# by young # by young
# include CoursesHelper # include CoursesHelper
def member def member
# params[:login]为邮箱邀请用户加入,主要功能:
# 1、自动注册
# 2、加入项目、创建角色
# 3、用户得分
if params[:mail]
user = User.find(params[:user_id])
user.activate!
Member.create(:role_ids => [4], :user_id => params[:user_id],:project_id => params[:id])
UserGrade.create(:user_id => params[:user_id], :project_id => params[:id])
token = Token.get_token_from_user(user, 'autologin')
#user = User.try_to_autologin(token.value)
if user
start_user_session(user)
user.save
redirect_to project_member_path(params[:id])
return
# account_ project_member_path(params[:id])
flash[:notice] = l(:label_mail_invite_success)
end
end
## 有角色参数的才是课程,没有的就是项目 ## 有角色参数的才是课程,没有的就是项目
@render_file = 'project_member_list' @render_file = 'project_member_list'
# 判断是否课程 # 判断是否课程

View File

@ -16,74 +16,77 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController class WelcomeController < ApplicationController
# layout "base_welcome"
include ApplicationHelper include ApplicationHelper
include WelcomeHelper include WelcomeHelper
helper :project_score helper :project_score
caches_action :robots caches_action :robots, :course, :contest, expires_in: 2.hours, layout: false
#before_filter :find_first_page, :only => [:index] #before_filter :find_first_page, :only => [:index]
# before_filter :fake, :only => [:index, :course] # before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index] before_filter :entry_select, :only => [:index]
def index def index
# 企业版定制: params[:project]为传过来的参数 # 企业版定制: params[:project]为传过来的参数
unless params[:organization].nil?
@organization = Organization.find params[:organization] unless params[:organization].nil?
# @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all @organization = Organization.find params[:organization]
@organization_projects = @organization.projects.visible.joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").order("project_scores.score DESC").limit(10).all # @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all
@part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : [] @organization_projects = @organization.projects.visible.joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").order("project_scores.score DESC").limit(10).all
# @cur_projects = Project.find(params[:organization]) @part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : []
# @organization = @cur_projects.enterprise_name # @cur_projects = Project.find(params[:organization])
# @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) # @organization = @cur_projects.enterprise_name
# @e_count = @organization_projects.count # @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization)
# @part_projects = [] # @e_count = @organization_projects.count
# # 取十个 # @part_projects = []
# @organization_projects.each do |obj| # # 取十个
# break if(@organization_projects[10] == obj) # @organization_projects.each do |obj|
# @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil? # break if(@organization_projects[10] == obj)
# end # @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil?
# # 不够十个的用最火项目替代 # end
# @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects # # 不够十个的用最火项目替代
# # 配置文件首页定制 # @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects
@enterprise_page = FirstPage.find_by_page_type('enterprise') # # 配置文件首页定制
if @enterprise_page.nil? @enterprise_page = FirstPage.find_by_page_type('enterprise')
@enterprise_page = FirstPage.new if @enterprise_page.nil?
@enterprise_page.page_type = 'enterprise' @enterprise_page = FirstPage.new
@enterprise_page.page_type = 'enterprise'
end
# 主页配置部分结束
end end
# 主页配置部分结束 # end 企业版定制结束
end
# end 企业版定制结束
if @first_page.nil? || @first_page.sort_type.nil? if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"score desc") @projects = find_miracle_project(10, 3,"score desc")
else else
case @first_page.sort_type case @first_page.sort_type
when 0 when 0
@my_projects = find_my_projects @my_projects = find_my_projects
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
@projects = find_miracle_project(10, 3,"created_on desc") @projects = find_miracle_project(10, 3,"created_on desc")
#@projects = @projects_all.order("created_on desc") #@projects = @projects_all.order("created_on desc")
when 1 when 1
@my_projects = find_my_projects @my_projects = find_my_projects
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
@projects = find_miracle_project(10, 3,"score desc") @projects = find_miracle_project(10, 3,"score desc")
#@projects = @projects_all.order("grade desc") #@projects = @projects_all.order("grade desc")
when 2 when 2
@my_projects = find_my_projects @my_projects = find_my_projects
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : [] @other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
@projects = find_miracle_project(10, 3,"watchers_count desc") @projects = find_miracle_project(10, 3,"watchers_count desc")
#@projects = @projects_all.order("watchers_count desc") #@projects = @projects_all.order("watchers_count desc")
#gcm #gcm
#when '3' #when '3'
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array) #@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
# @projects=handle_project @projects_all,@project_activity_count # @projects=handle_project @projects_all,@project_activity_count
# @s_type = 3 # @s_type = 3
# @projects = @projects[@project_pages.offset, @project_pages.per_page] # @projects = @projects[@project_pages.offset, @project_pages.per_page]
else else
@projects = @projects_all.order("score desc") @projects = @projects_all.order("score desc")
end
end end
end
rescue Exception => e rescue Exception => e
render_404 render_404
end end

View File

@ -0,0 +1,5 @@
class InviteList < ActiveRecord::Base
attr_accessible :project_id, :user_id
# belongs_to :user
# belongs_to :project
end

View File

@ -60,8 +60,8 @@ class Mailer < ActionMailer::Base
user = us.register_auto(login, @email, @password) user = us.register_auto(login, @email, @password)
User.current = user unless User.current.nil? User.current = user unless User.current.nil?
@user = user @user = user
@token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end
@ -72,8 +72,9 @@ class Mailer < ActionMailer::Base
@invitor_name = "#{invitor.name}" @invitor_name = "#{invitor.name}"
@project_name = "#{project.name}" @project_name = "#{project.name}"
@user = user @user = user
@project = project
@token = Token.get_token_from_user(user, 'autologin') @token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id, :user => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end

View File

@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
has_many :student, :through => :students_for_courses, :source => :user has_many :student, :through => :students_for_courses, :source => :user
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects has_many :applied_projects
# has_many :invite_lists
# end # end
#ADDED BY NIE #ADDED BY NIE

View File

@ -125,6 +125,10 @@ class User < Principal
has_many :documents # 项目中关联的文档再次与人关联 has_many :documents # 项目中关联的文档再次与人关联
# end # end
# 邮件邀请状态
# has_many :invite_lists
# end
######added by nie ######added by nie
has_many :project_infos, :dependent => :destroy has_many :project_infos, :dependent => :destroy
has_one :user_status, :dependent => :destroy has_one :user_status, :dependent => :destroy

View File

@ -94,7 +94,7 @@ class CommentService
def course_messages params,current_user def course_messages params,current_user
@course = ::Course.find(params[:id]) @course = ::Course.find(params[:id])
if (current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course))) if (current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course)))
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC').page(params[:page] ||= 1).per(10)
else else
raise '403' raise '403'
end end

View File

@ -62,7 +62,7 @@ class UsersService
else else
@user.password = "" @user.password = ""
end end
@user = automatically_register(@user) @user = automatically_register_lock(@user)
if @user.id != nil if @user.id != nil
ue = @user.user_extensions ||= UserExtensions.new ue = @user.user_extensions ||= UserExtensions.new
ue.user_id = @user.id ue.user_id = @user.id
@ -292,6 +292,7 @@ class UsersService
jours jours
end end
# 所有的与我相关
def reply_my_messages params,current_user def reply_my_messages params,current_user
jours = my_personal_messages params,current_user jours = my_personal_messages params,current_user
jours1 = my_course_messages params,current_user jours1 = my_course_messages params,current_user

View File

@ -1,9 +1,12 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= 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 => 'form_course', :locals => {:f => f, :topic => @message} %> <%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
<li> <li>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a> <div class="ml55 fl" nhname="toolbar_container"></div>
<a href="#" onclick="submitProjectsBoard('<%= @message.id %>')" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a> <a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
<%= l(:button_submit)%>
</a>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>

View File

@ -1,26 +1,29 @@
<div nhname="container_board">
<div class="project_r_h">
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<!--display the board--> <% if User.current.logged? %>
<div class="project_r_h"> <a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %> <% end %>
<div class="cl"></div>
</h2> </div>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div> <div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" nhname="about_talk" id="about_newtalk" style="display:none;" >
<ul>
<%= render :partial => 'course_new' %>
</ul>
</div><!--talknew end-->
</div>
</div> </div>
<!-- 发布新帖部分 --> <!-- 发布新帖部分 -->
<div class="cl"></div>
<div class=" talklist_box" > <div class=" talklist_box" >
<div class="talk_new ml15 mb10" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;" >
<ul>
<%= render :partial => 'course_new' %>
</ul>
</div><!--talknew end-->
<% if !User.current.logged?%> <% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;"> <div style="font-size: 14px;margin:20px;">
@ -29,135 +32,109 @@
<hr/> <hr/>
</div> </div>
<% end %> <% end %>
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p> <p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %> <% if @topics.any? %>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>"> <div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5"> <div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %> <% author = topic.author.to_s %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> <div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
</div>
<p style="float:left;color:#ff5722;">&nbsp;&nbsp;:</p>
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p> <p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.course_editable_by?(User.current) %> <% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: right; <a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;
margin-right: 10px;"><%= l(:button_edit) %></a> margin-right: 10px;"><%= l(:button_edit) %></a>
<% end %> <% end %>
<%= link_to( <%= link_to(
l(:button_delete), l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post, :method => :post,
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr', :class => 'talk_edit fr',
:style => ' margin-right: 10px;' :style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %> ) if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %> <% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a> <a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<script> <script>
$(function(){if($("#contentmessage<%=topic.id %>").height()>55){$("#project_show_<%= topic.id%>").show();}}); $(function(){if($("#contentmessage<%=topic.id %>").height()>182){$("#project_show_<%= topic.id%>").show();}});
</script> </script>
<div class="project_board_content break_word" id="content_<%=topic.id%>"> <div class="project_board_content break_word" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img"> <div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content.html_safe %> <%= topic.content.html_safe %>
</div>
</div> </div>
</div>
<p style="display: none" id="project_show_<%= topic.id%>"> <p style="display: none" id="project_show_<%= topic.id%>">
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label> <a id="expend_more_information<%= topic.id%>" href="javascript:void(0)" style="color: #0781b4;" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
<span class="g-arr-down"> <span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" /> <img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span> </span>
</p> </p>
<%= link_to_attachments_course topic, :author => false %> <%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %> <%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div> </div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> <a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
<div class="cl"></div> <div class="cl"></div>
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
<ul> <ul>
<%= render :partial => 'edit',locals: {:topic => topic} %> <%= render :partial => 'edit',locals: {:topic => topic} %>
</ul> </ul>
</div> </div>
<div class="cl"></div>
<div class="talkWrapBox"> <div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> <% reply = Message.new(:subject => "RE: #{topic.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %> <% if !topic.locked? && authorize_for('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
<em class="talkWrapArrow"></em> <em class="talkWrapArrow"></em>
<div class="cl"></div> <div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>"> <div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %> <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %> <div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a> <div style="padding-top:5px;" class="fr">
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
</div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div>
<% end %> <% end %>
<% replies_all = topic.children. <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
includes(:author, :attachments, {:board => :project}). reorder("#{Message.table_name}.created_on DESC").all %>
reorder("#{Message.table_name}.created_on DESC").offset(2). <% unless replies_all.empty? %>
all %> <% replies_all_i = 0 %>
<% replies_show = topic.children. <div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").limit(2).
all %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul> <ul>
<% replies_all.each do |message| %> <% replies_all.each do |message| %>
<% replies_all_i=replies_all_i+1 %>
<li> <li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt"> <div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/> <br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p> <div class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></div>
<input nhname="nh_content_val" value="<%= message.content %>" type="hidden"/>
<br/> <br/><div class="cl"></div>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span> <span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to( <%= link_to(
@ -168,6 +145,13 @@
:title => l(:button_delete), :title => l(:button_delete),
:class => ' c_dblue fr' :class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %> ) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_reply),
'javascript:;',
:nhname =>'showbtn_child_reply',
:class => ' c_dblue fr',
:style => 'margin-right: 10px;',
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -175,20 +159,23 @@
<% end %> <% end %>
</ul> </ul>
</div> </div>
<%if replies_all.first %> <%if topic.replies_count>2 %>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div> <div class="talkWrapMsg"><a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" class=" ml258" href="javascript:void(0)" id="showgithelp<%= topic.id%>" value="show_help" class="c_dblue lh23" style="color: #0781b4;" >展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<% end %> <div class="cl"></div>
<% else %> </div><!--讨论主类容 end-->
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> </ul>
<%# other_formats_links do |f| %> <%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %> <%# end %>
<% html_title @board.name %> <% html_title @board.name %>
@ -196,3 +183,81 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %> <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %>
<% end %> <% end %>
</div>
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
$(".talkmain_box").each(function(){
var target = $("li[nhname='reply_rec']",$(this));
var btn = $("a[nhname='reply_ex_btn']",$(this));
var jumpobj = $("div[nhname='nh_reply_div']",$(this));
btn.click(function(){
if($(this).data('init')=='0'){
$(this).data('init',1);
$(this).html('收起回复('+$(this).data('count')+')');
target.show();
}else{
$(this).data('init',0);
$(this).html('展开回复('+$(this).data('count')+')');
target.hide();
target.eq(0).show();
target.eq(1).show();
$("#nhjump").attr('href','#'+jumpobj.attr('id'));
$("#nhjump")[0].click();
}
});
});
KindEditor.ready(function(K){
$("div[nhname='container_board']").each(function(){
var container = $(this);
var about_talk = $("div[nhname='about_talk']",container);
var params = ({
kindutil:K,
showbtn:$("a[nhname='showbtn']",container),
about_talk:about_talk,
inputsubject:$("input[nhname='inputsubject']",about_talk),
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
textarea:$("textarea[nhname='textarea']",about_talk),
contentmsg:$("p[nhname='contentmsg']",about_talk),
submitbtn:$("a[nhname='submitbtn']",about_talk),
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
form:$("form[nhname='form']",about_talk),
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
init_content_val:$("input[nhname='init_content_val']",about_talk)
});
nh_init_board(params);
});
$("div[mhname='container_board_reply']").each(function(){
var container = $(this);
var about_talk = $("div[nhname='about_talk_reply']",container);
var params = {
type:'reply',
kindutil:K,
showbtn:$("a[nhname='showbtn_reply']",container),
showbtn_child:$("a[nhname='showbtn_child_reply']",container),
about_talk:about_talk,
inputsubject:$("input[nhname='inputsubject']",about_talk),
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
textarea:$("textarea[nhname='textarea']",about_talk),
contentmsg:$("p[nhname='contentmsg']",about_talk),
submitbtn:$("a[nhname='submitbtn']",about_talk),
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
form:$("form[nhname='form']",about_talk),
quote_show:$("div[nhname='quote_show']",about_talk),
quote_input:$("textarea[nhname='quote_input']",about_talk),
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
jumphref:$("#nhjump")
};
params.get_ref_str_call=function(btn){
var div = btn.parent('div');
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'</blockquote>';
return str;
}
nh_init_board(params);
});
<% if(!@flag.nil? && @flag=='true') %>
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
<% end %>
});
});
</script>

View File

@ -2,18 +2,19 @@
<% if topic.project %> <% if topic.project %>
<%#= board_breadcrumb(@message) %> <%#= board_breadcrumb(@message) %>
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>--> <!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
<div class="talk_new ml15" name='containerxxoo'> <div class="talk_new ml15">
<ul> <ul>
<%= form_for topic, { :as => :message, <%= form_for topic, { :as => :message,
:url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id}, :url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id},
:html => {:multipart => true, :name=>'message-form', :html => {:multipart => true, :name=>'message-form',
:id => 'message-form' + topic.id.to_s, :id => 'message-form' + topic.id.to_s,
:method => :post} :method => :post,:nhname=>'form'}
} do |f| %> } do |f| %>
<%= render :partial => 'form_project', <%= render :partial => 'form_project',
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="javascript:void(0)" name='submitbtn' class="blue_btn fl c_white" ><%= l(:button_submit)%></a> <div class="ml55 fl" nhname="toolbar_container"></div>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a> <a href="javascript:void(0)" nhname='cancelbtn' class="blue_btn grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
<a href="javascript:void(0)" nhname='submitbtn' class="blue_btn fr c_white" ><%= l(:button_submit)%></a>
<%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %> <%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul> </ul>
</div> </div>
@ -25,14 +26,15 @@
<%= form_for topic, { <%= form_for topic, {
:as => :message, :as => :message,
:url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id}, :url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id},
:html => {:multipart => true, :html => {:multipart => true, :name=>'message-form',
:id => 'message-form' + topic.id.to_s, :id => 'message-form' + topic.id.to_s,
:method => :post} :method => :post,:nhname=>'form'}
} do |f| %> } do |f| %>
<%= render :partial => 'form_course', <%= render :partial => 'form_course',
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="javascript:void(0)" onclick="submitProjectsBoard('<%= topic.id%>');"class="blue_btn fl c_white"><%= l(:button_submit)%></a> <div class="ml55 fl" nhname="toolbar_container"></div>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a> <a href="javascript:void(0)" nhname='cancelbtn' class="blue_btn grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
<a href="javascript:void(0)" nhname='submitbtn' class="blue_btn fr c_white"><%= l(:button_submit)%></a>
<% end %> <% end %>
</ul> </ul>

View File

@ -5,19 +5,19 @@
<li style="display: none"> <li style="display: none">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
<p id="subject_span<%= topic.id%>" class="ml55"></p> <p nhname="subjectmsg" class="ml55"></p>
</li> </li>
<% else %> <% else %>
<li> <li >
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
<p id="subject_span<%= f.object.id%>" class="ml55"></p> <p nhname="subjectmsg" class="ml55"></p>
</li> </li>
<% end %> <% end %>
<li class="ml60 mb5"> <li class="ml60 mb5">
@ -34,18 +34,42 @@
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li> <li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div> <div nhname="quote_show" id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<% unless replying %> <% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label> <label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %> <% end %>
<%= text_area :quote,:quote,:style => 'display:none' %> <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
<% if replying%> <div class="content">
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% if replying%>
<% else %>
<%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <%= f.text_area :content,
<% end %> :width => '89%',
:height => 300,
:id => "message_content#{f.object.id}",
:nhname => 'textarea',
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %>
<% else %>
<input nhname="init_content_val" value="<%=topic.content%>" type="hidden"/>
<%= f.text_area :content,
:width => '90%',
:height => 300,
:class => 'talk_text fl',
:editor_id => "message_content#{f.object.id}_edit",
:id => "message_content#{f.object.id}",
:onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl',
:nhname => 'textarea',
:placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %>
<% end %>
</div>
<div class="cl"></div> <div class="cl"></div>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p> <p id="message_content_span<%= f.object.id%>" nhname="contentmsg" class="ml55"></p>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li> <li>

View File

@ -1,4 +1,3 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<style> <style>
.comment{ .comment{
position: relative; position: relative;
@ -15,22 +14,22 @@
<% replying ||= false %> <% replying ||= false %>
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> <% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
<% if replying %> <% if replying %>
<li style="display: none"> <li style="display: none;">
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585" }.merge(extra_option) %> <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
<p id="subject_span<%= f.object.id%>" class="ml55"></p> <p nhname="subjectmsg" class="ml55"></p>
</li> </li>
<% else %> <% else %>
<li> <li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label>
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", :class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
<p id="subject_span<%= f.object.id%>" class="ml55"></p> <p nhname="subjectmsg" class="ml55"></p>
</li> </li>
<% end %> <% end %>
<li class="ml60 mb5"> <li class="ml60 mb5">
@ -47,25 +46,27 @@
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li> <li>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div> <div nhname="quote_show" id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<% unless replying %> <% unless replying %>
<label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label> <label class="fl ml3" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;</label>
<% end %> <% end %>
<%= f.text_area :quote,:quote,:style => 'display:none' %> <%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
<div class="content">
<div class="content <%= replying ? '':'ml55' %>">
<% if replying%> <% if replying%>
<%= f.text_area :content, <%= f.text_area :content,
:width => '89%', :width => '89%',
:height => 300, :height => 300,
:id => "message_content#{f.object.id}", :id => "message_content#{f.object.id}",
:name => 'content', :nhname => 'textarea',
:onkeyup => "regexContent('#{f.object.id}');", :onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl', :class => 'talk_text fl',
:placeholder => "最多3000个汉字(或6000个英文字符)", :placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %> :maxlength => 5000 %>
<% else %> <% else %>
<input nhname="init_content_val" value="<%=topic.content%>" type="hidden"/>
<%= f.text_area :content, <%= f.text_area :content,
:width => '90%', :width => '90%',
:height => 300, :height => 300,
@ -74,14 +75,18 @@
:id => "message_content#{f.object.id}", :id => "message_content#{f.object.id}",
:onkeyup => "regexContent('#{f.object.id}');", :onkeyup => "regexContent('#{f.object.id}');",
:class => 'talk_text fl', :class => 'talk_text fl',
:name => 'content', :nhname => 'textarea',
:placeholder => "最多3000个汉字(或6000个英文字符)", :placeholder => "最多3000个汉字(或6000个英文字符)",
:maxlength => 5000 %> :maxlength => 5000 %>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<p id="message_content_span<%= f.object.id%>" class="ml55"></p> <% if replying%>
<p nhname="contentmsg"></p>
<% else %>
<p nhname="contentmsg" class="ml55"></p>
<%end %>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li> <li>

View File

@ -1,10 +1,11 @@
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> <%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %> <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
<li> <li>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a> <div class="ml55 fl" nhname="toolbar_container"></div>
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="javascript:;" name="submitbtn" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a> <a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>

View File

@ -1,270 +1,251 @@
<div class="project_r_h" xmlns="http://www.w3.org/1999/html"> <div nhname="container_board">
<h2 class="project_h2 fl"> <div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<% if User.current.language == "zh"%> <h2 class="project_h2 fl">
<%= h @board.name %> <% if User.current.language == "zh"%>
<% else %> <%= h @board.name %>
<%= l(:project_module_boards) %> <% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<% if User.current.logged? %>
<a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
<% end %> <% end %>
<div class="cl"></div>
</h2> </div>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a> <% if !User.current.logged? %>
<div class="cl"></div> <div class="c_grey f14">
</div>
<!--display the board-->
<% if !User.current.logged? %>
<div class="c_grey f14">
<%= l(:label_user_login_project_board) %> <%= l(:label_user_login_project_board) %>
<%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %> <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
</div> </div>
<% end %> <% end %>
<div class="cl"></div>
<!-- 发布新帖部分 --> <div class=" talklist_box" >
<div class="cl"></div> <div class="talk_new ml15 mb10" nhname="about_talk" style="display:none;">
<ul>
<%= render :partial => 'project_new_topic' %>
</ul>
</div><!--talknew end-->
</div>
</div>
<div class=" talklist_box" > <div class=" talklist_box" >
<div class="talk_new ml15 mb10" name="containerxxoo" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
<ul>
<%= render :partial => 'project_new_topic' %>
</ul>
</div><!--talknew end-->
<!-- 帖子内容显示 -->
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p> <p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %> <% if @topics.any? %>
<% @topics.each do |topic| %> <% @topics.each do |topic| %>
<div class="talkmain_box" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s %>
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
</div>
<p style="float:left;color:#ff5722;">&nbsp;&nbsp;:</p>
<div class="talkmain_box" id="topic<%= topic.id %>" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;"> <p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> <div style="float:right;max-width:110px;">
<div class="talkmain_txt fl mt5"> <% if topic.editable_by?(User.current) %>
<% author = topic.author.to_s + "" %> <a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> <% end %>
<%= link_to(
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p> l(:button_delete),
<% if topic.editable_by?(User.current) %> {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: right; :data => {:confirm => l(:text_are_you_sure)},
margin-right: 10px;"><%= l(:button_edit) %></a> :class => 'talk_edit fr',
<% end %> :style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %>
<%= link_to( <% if topic.sticky? %>
l(:button_delete), <a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, <% end %>
:method => :post, <script>
:data => {:confirm => l(:text_are_you_sure)}, $(function(){if($("#contentmessage<%=topic.id %>").height()>182){$("#project_show_<%= topic.id%>").show();}});
:class => 'talk_edit fr', </script>
:style => ' margin-right: 10px;' </div>
) if topic.destroyable_by?(User.current) %> <div class="cl"></div>
<div class="project_board_content break_word" id="content_<%=topic.id%>">
<% if topic.sticky? %> <div id="contentmessage<%=topic.id %>" class="upload_img">
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a> <%= topic.content.html_safe %>
</div>
</div>
<p style="display: none;" id="project_show_<%= topic.id%>">
<a id="expend_more_information<%= topic.id%>" style="color: #0781b4;" href="javascript:void(0)" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<% if User.current.logged? %>
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
<% end %>
<div class="cl"></div>
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="cl"></div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<div style="padding-top:5px;" class="fr">
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
</div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<script>
$(function(){if($("#contentmessage<%=topic.id %>").height()>55){$("#project_show_<%= topic.id%>").show();}});
</script>
<div class="project_board_content break_word" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content %>
</div>
</div>
<p style="display: none" id="project_show_<%= topic.id%>">
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div> </div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %> </div>
<% end %>
<div class="cl"></div>
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.id desc").all %>
<% unless replies_all.empty? %>
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
<ul>
<% replies_all_i = 0 %>
<% replies_all.each do |message| %>
<% replies_all_i=replies_all_i+1 %>
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<div class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></div>
<input nhname="nh_content_val" type="hidden" value="<%= message.content %>"/>
<br/><div class="cl"></div>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
<div class="cl"></div> l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
</div><!--讨论主类容 end--> :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none"> :class => ' c_dblue fr'
<ul> ) if message.course_destroyable_by?(User.current) %>
<%= render :partial => 'edit',locals: {:topic => topic} %> <%= link_to(
</ul> l(:button_reply),
</div> 'javascript:;',
<div class="talkWrapBox"> :nhname =>'showbtn_child_reply',
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> :class => ' c_dblue fr',
<% if !topic.locked? && authorize_for('messages', 'reply') %> :style => 'margin-right: 10px;',
<em class="talkWrapArrow"></em> :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
<div class="cl"></div> </div>
<div class="talkConIpt ml15 mb10" style="display: none" name="containerxxoo" id="reply<%= topic.id %>">
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
<a href="javascript:(0)" name="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div> <div class="cl"></div>
</div> </li>
<% end %> <% end %>
<% replies_all = topic.children. </ul>
includes(:author, :attachments, {:board => :project}). </div>
reorder("#{Message.table_name}.id asc").offset(2). <%if topic.replies_count>2 %>
all %> <div class="talkWrapMsg">
<% replies_show = topic.children. <a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" href="javascript:void(0)" class="ml258 c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a>
includes(:author, :attachments, {:board => :project}). </div>
reorder("#{Message.table_name}.id asc").limit(2). <% end %>
all %> <% end %>
<% unless replies_show.empty? %>
<% reply_count = 0 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_quote),
{:controller => 'messages', :action => 'quote', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:class => ' c_dblue fr',
:style => 'margin-right: 10px;',
:remote => true,
:method => 'get',
:onclick => "$('#reply#{topic.id}').slideToggle(); return false;",
:focus => "about_newtalk#{topic.id}",
:title => l(:button_quote)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_quote),
{:controller => 'messages', :action => 'quote', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:remote => true,
:method => 'get',
:focus => "about_newtalk#{topic.id}",
:class => ' c_dblue fr',
:style => 'margin-right: 10px;',
:title => l(:button_quote)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<%if replies_all.first %>
<div class="talkWrapMsg"><a class=" c_blue ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div> </div>
</div>
<% end %> <% end %>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <p class="nodata"><%= l(:label_no_data) %></p>
<% end %> <% end %>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
</ul> </ul>
<!--讨论主类容 end--> <!--讨论主类容 end-->
<%# other_formats_links do |f| %> <%# other_formats_links do |f| %>
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %> <%# end %>
<% html_title @board.name %>
<% html_title @board.name %> <% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<% content_for :header_tags do %> <% end %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> </div>
<% end %> <div style="display:none;"><a href="#" id="nhjump"></a></div>
</div>
<script type="text/javascript">
// var flag = false;
// jQuery(document).ready(function($) {
// transpotUrl('#content');
// });
function submit_message_replay()
{
if(flag)
{
$("#message_form").submit();
}
}
</script>
<script type="text/javascript"> <script type="text/javascript">
//submitProjectsBoard() $(function(){
KindEditor.ready(function(K){ $(".talkmain_box").each(function(){
$("div[name='containerxxoo']").each(function(){ var target = $("li[nhname='reply_rec']",$(this));
var container=$(this); var btn = $("a[nhname='reply_ex_btn']",$(this));
var jumpobj = $("div[nhname='nh_reply_div']",$(this));
var textarea= $("textarea[name='content']",container); btn.click(function(){
var editor = K.create(textarea, { if($(this).data('init')=='0'){
resizeType : 1, $(this).data('init',1);
allowPreviewEmoticons : false, $(this).html('收起回复('+$(this).data('count')+')');
allowImageUpload : false, target.show();
width:"89%", }else{
items : ['emoticons'] $(this).data('init',0);
}); $(this).html('展开回复('+$(this).data('count')+')');
target.hide();
$("a[name='submitbtn']",container).click(function(){ target.eq(0).show();
textarea[0].value = editor.html(); target.eq(1).show();
var id = textarea[0].id.toString().substr(15); $("#nhjump").attr('href','#'+jumpobj.attr('id'));
$("#nhjump")[0].click();
if(this.parentNode.name == 'message-form') { }
this.parentNode.submit(); });
} });
else KindEditor.ready(function(K){
this.parentNode.parentNode.submit(); $("div[nhname='container_board']").each(function(){
}); var container = $(this);
var about_talk = $("div[nhname='about_talk']",container);
}); var params = ({
}); kindutil:K,
showbtn:$("a[nhname='showbtn']",container),
about_talk:about_talk,
inputsubject:$("input[nhname='inputsubject']",about_talk),
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
textarea:$("textarea[nhname='textarea']",about_talk),
contentmsg:$("p[nhname='contentmsg']",about_talk),
submitbtn:$("a[nhname='submitbtn']",about_talk),
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
form:$("form[nhname='form']",about_talk),
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
init_content_val:$("input[nhname='init_content_val']",about_talk)
});
nh_init_board(params);
});
$("div[mhname='container_board_reply']").each(function(){
var container = $(this);
var about_talk = $("div[nhname='about_talk_reply']",container);
var params = {
type:'reply',
kindutil:K,
showbtn:$("a[nhname='showbtn_reply']",container),
showbtn_child:$("a[nhname='showbtn_child_reply']",container),
about_talk:about_talk,
inputsubject:$("input[nhname='inputsubject']",about_talk),
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
textarea:$("textarea[nhname='textarea']",about_talk),
contentmsg:$("p[nhname='contentmsg']",about_talk),
submitbtn:$("a[nhname='submitbtn']",about_talk),
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
form:$("form[nhname='form']",about_talk),
quote_show:$("div[nhname='quote_show']",about_talk),
quote_input:$("textarea[nhname='quote_input']",about_talk),
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
jumphref:$("#nhjump")
};
params.get_ref_str_call=function(btn){
var div = btn.parent('div');
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'</blockquote>';
return str;
}
nh_init_board(params);
});
<% if(!@flag.nil? && @flag=='true') %>
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
<% end %>
});
});
</script> </script>

View File

@ -1,3 +1,13 @@
<style>
.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ke-toolbar-icon-url{background-image:url( '/images/public_icon.png' )}
.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ke-toolbar .ke-outline{border:none;}
.break_word {width:100%;}
</style>
<script type="text/javascript"> <script type="text/javascript">
//头部导航 //头部导航
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
@ -21,54 +31,182 @@
else if (window.attachEvent) else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus) window.attachEvent("onload", buildsubmenus)
</script> </script>
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<script type="text/javascript">//侧导航
window.onload = function () {
var topic_id = getParam('topic_id');
document.getElementById(topic_id).focus();
}
var getParam = function(name){
var search = document.location.search;
var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
var matcher = pattern.exec(search);
var items = null;
if(null != matcher){
try{
items = decodeURIComponent(decodeURIComponent(matcher[1]));
}catch(e){
try{
items = decodeURIComponent(matcher[1]);
}catch(e){
items = matcher[1];
}
}
}
return items;
};
function show_newtalk()
{
$("#about_newtalk").toggle();
}
function show_newtalk1(id)
{
$(id).toggle();
}
</script>
<% if @project %> <% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %> <%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %> <% elsif @course %>
<%= render :partial => 'course_show', locals: {course: @course} %> <%= render :partial => 'course_show', locals: {course: @course} %>
<% end %> <% end %>
<script type="text/javascript">//侧导航
//window.onload = function () {
// var topic_id = getParam('topic_id');
// document.getElementById(topic_id).focus();
//}
//
//var getParam = function(name){
// var search = document.location.search;
// var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
// var matcher = pattern.exec(search);
// var items = null;
// if(null != matcher){
// try{
// items = decodeURIComponent(decodeURIComponent(matcher[1]));
// }catch(e){
// try{
// items = decodeURIComponent(matcher[1]);
// }catch(e){
// items = matcher[1];
// }
// }
// }
// return items;
//};
//
//function show_newtalk()
//{
// $("#about_newtalk").toggle();
//
//
//
//}
//
//function show_newtalk1(id)
//{
// $(id).toggle();
// $(id).focus();
//
//
//}
function nh_check_field(params){
var result=true;
if(params.subject!=undefined){
if($.trim(params.subject.val()) == ""){
params.subjectmsg.html('主题不能为空');
params.subjectmsg.css({color:'#ff0000'});
result=false;
}else{
params.subjectmsg.html('填写正确');
params.subjectmsg.css({color:'#008000'});
}
params.subjectmsg.show();
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function nh_init_board(params){
//发帖/编辑/回复按钮的click
params.showbtn.click(function(){
if(params.textarea.data('init') == undefined){
//初始化编辑器
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,
allowPreviewEmoticons : false,
allowImageUpload : false,
minWidth:"1px",
width:"565px",
items : ['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.about_talk);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
});
//主题输入框按键事件
params.inputsubject.keyup(function(){
nh_check_field({subject:params.inputsubject,subjectmsg:params.subjectmsg});
})
//表单提交
params.form.submit(function(){
var is_checked = nh_check_field({
issubmit:true,
subject:params.inputsubject,
subjectmsg:params.subjectmsg,
content:editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
//return true 居然不提交 fuck your sister
$(this)[0].submit();
// return true;
}
return false;
});
//提交按钮click
params.submitbtn.click(function(){
params.form.submit();
});
//取消按钮click
params.cancelbtn.click(function(){
params.about_talk.toggle();//显示/隐藏编辑区
if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
params.form[0].reset();
if(params.type=='reply'){
params.textarea.empty();
}else{
params.textarea.html(params.init_content_val.val());
}
var str = params.textarea.html();
str=str.replace(new RegExp(/&lt;/g),'<');
str=str.replace(new RegExp(/&gt;/g),'>');
editor.html(str);
params.subjectmsg.hide();
params.contentmsg.hide();
if(params.quote_show!=undefined)params.quote_show.empty();
if(params.quote_input!=undefined)params.quote_input.empty();
}else{
if(params.type=='reply'){
params.jumphref.attr('href','#'+params.form.attr('id'));
params.jumphref[0].click();
}else params.inputsubject.focus();
}
});
params.textarea.data('init','1');//标记为已经初始化
}
params.cancelbtn.click();//显示/隐藏编辑区
});
if(params.type == 'reply'){
params.showbtn_child.click(function(){
if(params.textarea.data('init') == undefined){
params.showbtn.click();
}else{
params.cancelbtn.click();
if(params.about_talk.is(':hidden')){
params.cancelbtn.click();
}
}
var ref_str = params.get_ref_str_call($(this));
params.quote_show.html(ref_str);
params.quote_input.html(ref_str);
});
}
}
</script>

View File

@ -31,7 +31,7 @@
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<script> <script>
$(function(){if($("#bid_description_<%= bid.id%>_content").height()>38){$("#bid_show_more_des_button<%= bid.id%>").show();}}); $(function(){if($("#bid_description_<%= bid.id%>_content").height()>360){$("#bid_show_more_des_button<%= bid.id%>").show();}});
</script> </script>
<div id="bid_description_<%= bid.id%>" class="news_description mt5"> <div id="bid_description_<%= bid.id%>" class="news_description mt5">
<div id="bid_description_<%= bid.id%>_content" class="upload_img"> <div id="bid_description_<%= bid.id%>_content" class="upload_img">

View File

@ -1,11 +1,13 @@
<%= render :partial => "layouts/base_feedback" %> <%= render :partial => "layouts/base_feedback" %>
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;"> <div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div class="welcome_logo"> <div class="welcome_logo">
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px")%> <%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px")%>
</div> </div>
<div id="account"> <div id="account">
<%= render_menu :account_menu -%> <%= render_menu :account_menu -%>
</div> </div>
<% if User.current.logged? -%> <% if User.current.logged? -%>
<div id="loggedas"> <div id="loggedas">
<ul style="padding:0 0; margin:0 0;display:inline;"> <ul style="padding:0 0; margin:0 0;display:inline;">

View File

@ -3,12 +3,14 @@
<%=link_to l(:label_my_course), user_courses_user_path(User.current.id) %> <%=link_to l(:label_my_course), user_courses_user_path(User.current.id) %>
<ul class="course_sub_menu"> <ul class="course_sub_menu">
<% course_index = 0 %> <% course_index = 0 %>
<% User.current.courses.each do |course| %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %> <% if !course_endTime_timeout?(course) %>
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %> <%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
<% course_index += 1 %> <% course_index += 1 %>
<% end %> <% end %>
<% end %> <% end %>
</ul> </ul>
</li> </li>
<% end %> <% end %>

View File

@ -9,4 +9,4 @@
<% end %> <% end %>
</ul> </ul>
</li> </li>
<% end %> <% end %>

View File

@ -12,7 +12,7 @@
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %> <%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
@ -31,7 +31,7 @@
<div style="clear:both;"></div> <div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%> <%=render :partial => 'layouts/base_footer'%>
</div> </div>
</div> </div>
</div> </div>

View File

@ -23,6 +23,7 @@
<!--add by huang--> <!--add by huang-->
<body> <body>
<div id="Container"> <div id="Container">
<%= render :partial => 'layouts/new_header'%> <%= render :partial => 'layouts/new_header'%>
<div class="cl"></div> <div class="cl"></div>
@ -50,6 +51,7 @@
<% end %> <% end %>
</div> </div>
</div><!--TopBar end--> </div><!--TopBar end-->
<div id="content"> <div id="content">
<div id="LSide" class="fl"> <div id="LSide" class="fl">
<div class="project_info"> <div class="project_info">
@ -115,6 +117,7 @@
<% end %><!--end--> <% end %><!--end-->
<!--menu 左侧工具栏 --> <!--menu 左侧工具栏 -->
<%#--project_new_type: 1为开发组2为科研组3为朋友圈子--%> <%#--project_new_type: 1为开发组2为科研组3为朋友圈子--%>
<div id="project_memu_list"> <div id="project_memu_list">
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %> <% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
<%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %> <%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
@ -124,6 +127,7 @@
<%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %> <%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
<% end %> <% end %>
</div> </div>
<!-- end --> <!-- end -->
</div><!--项目侧导航 end--> </div><!--项目侧导航 end-->
<div class="cl"></div> <div class="cl"></div>

View File

@ -5,10 +5,9 @@
<title><%=h html_title %></title> <title><%=h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" /> <meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'public', 'pleft', 'project', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_include_tag "jquery.leanModal.min" %> <%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
@ -18,32 +17,26 @@
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<body class="<%=h body_css_classes %>"> <body id="Container">
<div id="wrapper"> <div id="Container">
<div id="wrapper2"> <%= render :partial => 'layouts/new_header' %>
<div id="wrapper3"> <div class="cl"></div>
<%=render :partial => 'layouts/base_header'%>
<div id="main" class="nosidebar"> <div id="main" class="nosidebar">
<div id="content_"> <div id="content_">
<%= render_flash_messages %> <%= render_flash_messages %>
<%= yield %> <%= yield %>
<%= call_hook :view_layouts_base_content %> <%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div> <div style="clear:both;"></div>
<%=render :partial => 'layouts/base_footer'%> <%=render :partial => 'layouts/new_footer'%>
</div> </div>
</div> </div>
</div> </div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span> <span><%= l(:label_loading) %></span>
<%= l(:label_loading) %>
</span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
</div>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

View File

@ -3,10 +3,10 @@
<% end %> <% end %>
<div class="resource_sum" id="IE_resource_sum_css"> <div class="resource_sum" id="IE_resource_sum_css">
<% @attach_array.each do |k|%> <% @attach_array.each_with_index do |k, index|%>
<div class="line_block" > <div class="line_block" >
<p> <p>
<%= @str_arr.shift %> <%= @str_arr[index] %>
</p> </p>
<div class="table1"> <div class="table1">
@ -24,10 +24,12 @@
</div> </div>
<div class="table1"> <div class="table1">
<% if index == 2%>
<% k.each do |c1|%> <% k.each do |c1|%>
<div class="table_row1 <%= cycle 'odd', 'even' %>"> <div class="table_row1 <%= cycle 'odd', 'even' %>">
<div class="filename table_cell1 filename1" > <div class="filename table_cell1 filename1" >
<%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
<%= link_to_attachment c1, {:download => true}%>
</div> </div>
<div class="table_cell1 filedown1"> <div class="table_cell1 filedown1">
<%= c1.downloads %> <%= c1.downloads %>
@ -37,6 +39,23 @@
</div> </div>
</div> </div>
<% end -%> <% end -%>
<%else%>
<% k.each do |c1|%>
<div class="table_row1 <%= cycle 'odd', 'even' %>">
<div class="filename table_cell1 filename1" >
<%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
</div>
<div class="table_cell1 filedown1">
<%= c1.downloads %>
</div>
<div class="table_cell1 downicon1 filename download_icon" >
<%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>
</div>
</div>
<% end -%>
<% end %>
</div> </div>
</div> </div>
@ -75,4 +94,4 @@
} }
}); });
</script> </script>
<% html_title(l(:label_stores_index)) -%> <% html_title(l(:label_stores_index)) -%>

View File

@ -25,7 +25,7 @@
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %> <%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %> <% end %>
(<%= course.members.count %>人) (<%= course.members.count %>人)
<% files_count = course.attachments.count %> <% files_count = visable_attachemnts_incourse(course).count %>
<% if files_count > 0%> <% if files_count > 0%>
(<%= link_to "#{files_count.to_s}份", course_files_path(course) %>公开资料) (<%= link_to "#{files_count.to_s}份", course_files_path(course) %>公开资料)
<% end %> <% end %>

View File

@ -141,15 +141,15 @@
<%= @contest_page.title %> <%= @contest_page.title %>
!--> !-->
<%= l(:label_welcome_trustie_contest) %> <%= l(:label_welcome_trustie_contest) %>
</span> </span>
<span class="font_welcome_tdescription">, <span class="font_welcome_tdescription">,
<!-- <!--
edit by meng edit by meng
@course_page.description存储在first_page表中的description字段 @course_page.description存储在first_page表中的description字段
原本代码 原本代码
<%= @contest_page.description %> <%= @contest_page.description %>
!--> !-->
<%= l(:label_welcome_trustie_contest_description) %> <%= l(:label_welcome_trustie_contest_description) %>
</span> </span>
<% end %> <% end %>
</div> </div>

View File

@ -129,6 +129,7 @@
<%# User.current.logged? ? course_count = 9 : course_count = 10 %> <%# User.current.logged? ? course_count = 9 : course_count = 10 %>
<% course_count = 9 %> <% course_count = 9 %>
<% all_new_hot_course = find_all_new_hot_course(course_count, @school_id, year_now, course_term)%> <% all_new_hot_course = find_all_new_hot_course(course_count, @school_id, year_now, course_term)%>
<% while all_new_hot_course.count < course_count%> <% while all_new_hot_course.count < course_count%>
<% if course_term == "春季学期" <% if course_term == "春季学期"
year_now -= 1 year_now -= 1
@ -139,10 +140,13 @@
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%> <%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%> <% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
<% end%> <% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %> <% cache all_new_hot_course.max().created_at do %>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% end %>
</ul> </ul>
</div> </div>
<% else %> <% else %>
<% if cur_school_course.count < 9 %> <% if cur_school_course.count < 9 %>
<span> <span>
<%= render :partial => 'more_course', :locals => {:school_id => nil}%> <%= render :partial => 'more_course', :locals => {:school_id => nil}%>
@ -160,6 +164,7 @@
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %> <%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
</li> </li>
<% all_new_hot_course = find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)%> <% all_new_hot_course = find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)%>
<% while (all_new_hot_course.count + cur_school_course.count) < 9%> <% while (all_new_hot_course.count + cur_school_course.count) < 9%>
<% if course_term == "春季学期" <% if course_term == "春季学期"
year_now -= 1 year_now -= 1
@ -170,10 +175,13 @@
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%> <%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%> <% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
<% end%> <% end%>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %> <% cache all_new_hot_course.max().created_at do %>
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
<% end %>
<% end %> <% end %>
</ul> </ul>
</div> </div>
<% end %> <% end %>
</div> </div>
@ -186,10 +194,12 @@
</h3> </h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span> <span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<% topics = find_new_forum_topics(10) %>
<%# cache topics.maximum(:created_at) do%>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% find_new_forum_topics(10).each do |topic| %>
<% topics.each do |topic| %>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; border-bottom: 1px dashed; padding-bottom: 3px"> <li class="message-brief-intro" style="min-height: 65px; line-height:2em; border-bottom: 1px dashed; padding-bottom: 3px">
<div style="display: inline-block; width: 100%;"> <div style="display: inline-block; width: 100%;">
<span class="memo_activity text_nowrap" title="<%= topic.subject%>" <span class="memo_activity text_nowrap" title="<%= topic.subject%>"
@ -220,8 +230,10 @@
</div> </div>
</li> </li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
<%# end %>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>

View File

@ -23,7 +23,7 @@
$(document).ready(function($) { $(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank"); $("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
}); });
</script> </script>
<div class='top_bar'> <div class='top_bar'>
@ -45,7 +45,7 @@
<% if @organization.nil? %> <% if @organization.nil? %>
<% unless @first_page.nil? %> <% unless @first_page.nil? %>
<!-- 改为国际化后无法通过后台配置 <!-- 改为国际化后无法通过后台配置
<%= @first_page.description.html_safe %> <%= @first_page.description.html_safe %>
--> -->
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie_project)%></span>,&nbsp; <span class="font_welcome_trustie"><%= l(:label_welcome_trustie_project)%></span>,&nbsp;
<span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span> <span class="font_welcome_tdescription"><span class="font_welcome_tdescription"><%= l(:label_welcome_trustie_project_description)%></span></span>
@ -68,7 +68,7 @@
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<% cache :expire_in => 2.hours do%>
<div id="J_Slide" class="d-p-index-box d-p-index-hot"> <div id="J_Slide" class="d-p-index-box d-p-index-hot">
<h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3> <h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3>
<span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %> <span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %>
@ -113,7 +113,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<% end %>
<div class="right" style="float: right; width: 48%; padding-top: 8px;"> <div class="right" style="float: right; width: 48%; padding-top: 8px;">
<ul class="welcome-message-list"> <ul class="welcome-message-list">
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;"> <div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
@ -123,6 +123,7 @@
</div> </div>
<div class="welcome-box-list-new memo_activity"> <div class="welcome-box-list-new memo_activity">
<% topics = find_new_forum_topics(12) %> <% topics = find_new_forum_topics(12) %>
<% cache topics.maximum(:created_at) do%>
<% topics.includes(:forum, :last_reply, :author).each do |topic|%> <% topics.includes(:forum, :last_reply, :author).each do |topic|%>
<li class="message-brief-intro" style="line-height:1.4em;"> <li class="message-brief-intro" style="line-height:1.4em;">
<div class='memo_title text_nowrap'> <div class='memo_title text_nowrap'>
@ -151,7 +152,8 @@
</span> </span>
</div> </div>
</li> </li>
<%end %> <% end %>
<% end %>
</div> </div>
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,3 @@
if Rails.env.production?
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes }
end

View File

@ -1,10 +0,0 @@
# Copy this file to additional_environment.rb and add any statements
# that need to be passed to the Rails::Initializer. `config` is
# available in this context.
#
# Example:
#
# config.log_level = :debug
# ...
#

View File

@ -31,7 +31,7 @@ module RedmineApp
end end
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += %w(#{RAILS_ROOT}/app/sweepers)
# Only load the plugins named here, in the order given (default is alphabetical). # Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named. # :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ] # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

View File

@ -90,7 +90,6 @@ default:
user_name: "huang.jingquan@163.com" user_name: "huang.jingquan@163.com"
password: 'xinhu1ji2qu366' password: 'xinhu1ji2qu366'
cookie_domain: ".trustie.net"
# Absolute path to the directory where attachments are stored. # Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance. # The default is the 'files' directory in your Redmine instance.
# Your Redmine instance needs to have write permission on this # Your Redmine instance needs to have write permission on this
@ -104,7 +103,7 @@ default:
# autologin_cookie_name: the name of the cookie (default: autologin) # autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /) # autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false) # autologin_cookie_secure: true sets the cookie secure flag (default: false)
autologin_cookie_name: autologin_cookie_name: "autologin_trustie"
autologin_cookie_path: autologin_cookie_path:
autologin_cookie_secure: autologin_cookie_secure:
@ -201,7 +200,7 @@ default:
# specific configuration options for production environment # specific configuration options for production environment
# that overrides the default ones # that overrides the default ones
production: production:
# CJK support cookie_domain: ".trustie.net"
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
email_delivery: email_delivery:
delivery_method: :smtp delivery_method: :smtp

View File

@ -10,8 +10,9 @@ RedmineApp::Application.configure do
config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly
# Show full error reports and disable caching # Show full error reports and disable caching
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
#config.cache_store = :dalli_store
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true

View File

@ -0,0 +1 @@
$redis = Redis.new(:host => "127.0.0.1", :port => 6379)

View File

@ -342,6 +342,7 @@ zh:
label_invite_trustie_user_tips: "输入姓名、邮箱、昵称" label_invite_trustie_user_tips: "输入姓名、邮箱、昵称"
label_user_role_null: 用户和角色不能留空! label_user_role_null: 用户和角色不能留空!
label_invite_project: 邀请您加入项目 label_invite_project: 邀请您加入项目
label_mail_invite_success: 您已成功加入项目!
label_invite_success: 邀请成功 label_invite_success: 邀请成功
label_invite_members: 邀请用户 label_invite_members: 邀请用户
# #

View File

@ -0,0 +1,10 @@
class CreateInviteLists < ActiveRecord::Migration
def change
create_table :invite_lists do |t|
t.integer :project_id
t.integer :user_id
t.timestamps
end
end
end

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -67,15 +67,34 @@ function show_more_reply(contentid, id2, id3) {
if (val == "show_more") { if (val == "show_more") {
$(id2).text("[收起]"); $(id2).text("[收起]");
information.attr("value", "hide_more"); information.attr("value", "hide_more");
information.attr("style", "color:#3ca5c6");
arrow.attr("src", "/images/jiantouup.jpg") arrow.attr("src", "/images/jiantouup.jpg")
} }
else { else {
$(id2).text("[展开]"); $(id2).text("[展开]");
information.attr("value", "show_more"); information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg") arrow.attr("src", "/images/jiantou.jpg")
information.attr("style", "color:#0781b4;");
}
}
function show_more_reply1(contentid, id2, id3) {
$(contentid).toggleClass("course_description_none");
var information = $(id2);
var arrow = $(id3);
var val = information.attr("value");
if (val == "show_more") {
$(id2).text("[收起]");
information.attr("value", "hide_more");
information.attr("style", "color:#3ca5c6");
arrow.attr("src", "/images/jiantouup.jpg")
}
else {
$(id2).text("[展开]");
information.attr("value", "show_more");
arrow.attr("src", "/images/jiantou.jpg")
information.attr("style", "color:#0781b4;");
} }
} }
//项目版本库git帮助文档显示 //项目版本库git帮助文档显示
function showhelpAndScrollTo(id) { function showhelpAndScrollTo(id) {
$('#' + id).toggle(); $('#' + id).toggle();
@ -116,11 +135,13 @@ function showhelpAndScrollToMessage(id, id1, count) {
{ {
$(id1).text("收起回复(" + count + ")" ); $(id1).text("收起回复(" + count + ")" );
information.attr("value", "hide_help"); information.attr("value", "hide_help");
information.attr("style", "color:#3ca5c6");
} }
else else
{ {
$(id1).text("展开回复(" + count + ")"); $(id1).text("展开回复(" + count + ")");
information.attr("value", "show_help"); information.attr("value", "show_help");
information.attr("style", "color:#0781b4;");
} }
} }

View File

@ -19,7 +19,7 @@ a:hover.project_name{ color:#016f33;}
a.project_txt02{ color:#0781b4; width:618px; display:block; float:left; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a.project_txt02{ color:#0781b4; width:618px; display:block; float:left; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a:hover.project_txt{ color:#066e9a;} a:hover.project_txt{ color:#066e9a;}
.noline{ border-bottom:none;} .noline{ border-bottom:none;}
.news_description{max-height: 38px;overflow:hidden; } .news_description{max-height: 360px;overflow:hidden; }
.news_description_none{max-height: none;} .news_description_none{max-height: none;}
a.news_foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:600px; height:20px; padding-top:3px; cursor:pointer;} a.news_foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:600px; height:20px; padding-top:3px; cursor:pointer;}
a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}

View File

@ -45,7 +45,8 @@ a:hover.subnav_green{ background:#14ad5a;}
/*简介*/ /*简介*/
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} .course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
.project_board_content{overflow: hidden;max-height: 55px;word-break: break-all;word-wrap: break-word;} .project_board_content{overflow: hidden;max-height: 182px;word-break: break-all;word-wrap: break-word;}
.project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;}
.course_description_none{max-height: none;} .course_description_none{max-height: none;}
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;}

View File

@ -49,7 +49,8 @@ a:hover.subnav_green{ background:#14ad5a;}
/*简介*/ /*简介*/
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} .course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
.project_board_content{overflow: hidden;max-height: 55px;word-break: break-all;word-wrap: break-word;} .project_board_content{overflow: hidden;max-height: 182px;word-break: break-all;word-wrap: break-word;}
.project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;}
.course_description_none{max-height: none;} .course_description_none{max-height: none;}
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;}

View File

@ -0,0 +1,7 @@
FactoryGirl.define do
factory :invite_list do
project_id 1
user_id 1
end
end

View File

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

File diff suppressed because it is too large Load Diff