diff --git a/.gitignore b/.gitignore index 93c7eb248..bc936c34c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ .DS_Store public/api_doc/ /.metadata +vendor/cache diff --git a/.metadata/.plugins/com.aptana.index.core/2874248206.index b/.metadata/.plugins/com.aptana.index.core/2874248206.index deleted file mode 100644 index 2200403a8..000000000 Binary files a/.metadata/.plugins/com.aptana.index.core/2874248206.index and /dev/null differ diff --git a/.metadata/.plugins/com.aptana.index.core/2924452064.index b/.metadata/.plugins/com.aptana.index.core/2924452064.index deleted file mode 100644 index 982acfcbc..000000000 Binary files a/.metadata/.plugins/com.aptana.index.core/2924452064.index and /dev/null differ diff --git a/.metadata/.plugins/com.aptana.index.core/4010369919.index b/.metadata/.plugins/com.aptana.index.core/4010369919.index deleted file mode 100644 index e2902378c..000000000 Binary files a/.metadata/.plugins/com.aptana.index.core/4010369919.index and /dev/null differ diff --git a/Gemfile b/Gemfile index 835857625..fb0312d5b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://rubygems.org' +source 'http://ruby.taobao.org' #source 'http://ruby.sdutlinux.org/' unless RUBY_PLATFORM =~ /w32/ @@ -10,11 +10,11 @@ end gem 'grape', '~> 0.9.0' gem 'grape-entity' -gem 'seems_rateable', path: 'lib/seems_rateable' +gem 'seems_rateable', '~> 1.0.13' gem "rails", "3.2.13" gem "jquery-rails", "~> 2.0.2" gem "i18n", "~> 0.6.0" -gem "coderay", "~> 1.0.6" +gem 'coderay', '~> 1.1.0' gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "builder", "3.0.0" gem 'acts-as-taggable-on', '2.4.1' @@ -23,14 +23,20 @@ gem 'ruby-ole' #gem 'email_verifier', path: 'lib/email_verifier' gem 'rufus-scheduler' #gem 'dalli', path: 'lib/dalli-2.7.2' +gem 'rails_kindeditor',path:'lib/rails_kindeditor' group :development do gem 'grape-swagger' #gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' - #gem 'puma' - # gem 'pry-rails' - # gem 'pry-byebug' - gem 'better_errors', path: 'lib/better_errors' - gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' + gem 'puma' if RbConfig::CONFIG['host_os'] =~ /linux/ + gem 'pry-rails' + if RUBY_VERSION >= '2.0.0' + gem 'pry-byebug' + else + gem 'pry-debugger' + end + gem 'pry-stack_explorer' + gem 'better_errors', '~> 1.1.0' + gem 'rack-mini-profiler', '~> 0.9.3' end group :test do diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index 75932d60f..2e84fe5a9 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -2,6 +2,7 @@ module Mobile module Apis class Comments < Grape::API + include ApplicationHelper resource :comments do desc '课程通知评论' params do @@ -82,8 +83,8 @@ module Mobile memo: {:subject => params[:subject],:content => '该贴来自手机App意见反馈'}, } cs = CommentService.new - memo = cs.create_feedback cs_params, current_user - raise "commit failed #{memo.errors.full_messages}" if memo.new_record? + memo,message = cs.create_feedback cs_params, current_user + raise message if memo.new_record? present :status, 0 end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 9a5307be6..b6d1db25c 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -82,7 +82,7 @@ module Mobile desc "用户搜索" params do requires :name, type: String, desc: '用户名关键字' - requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱' + requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' end get 'search/search_user' do us = UsersService.new diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index aa8aadbb6..b6e4630e4 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -15,6 +15,8 @@ module Mobile course_dynamic_expose :type course_dynamic_expose :count course_dynamic_expose :course_name + course_dynamic_expose :course_term + course_dynamic_expose :course_time course_dynamic_expose :course_id course_dynamic_expose :course_img_url course_dynamic_expose :message diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d57802cb7..b1ca39997 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -678,11 +678,13 @@ class CoursesController < ApplicationController "show_course_news" => true, "show_course_messages" => true, "show_bids" => true, - "show_course_journals_for_messages" => true + "show_course_journals_for_messages" => true, + "show_homeworks" => true } @date_to ||= Date.today + 1 @date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) + @author ||= @course.teacher # 决定显示所用用户或单个用户活动 @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, :with_subprojects => false, diff --git a/app/controllers/discuss_demos_controller.rb b/app/controllers/discuss_demos_controller.rb new file mode 100644 index 000000000..b0c9791cb --- /dev/null +++ b/app/controllers/discuss_demos_controller.rb @@ -0,0 +1,42 @@ +class DiscussDemosController < ApplicationController + def index + + @discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10) + end + + def new + @discuss_demo = DiscussDemo.create + @discuss_demo.save! + @discuss_demo + end + + def create + + end + + def update + @discuss_demo = DiscussDemo.find(params[:id]) + @discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body]) + redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id] + end + + def delete + + end + + def destroy + asset = Kindeditor::Asset.find_by_owner_id(params[:id]) + if !asset.nil? + filepath = File.join(Rails.root,"public","files","uploads", + asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s, + asset[:asset].to_s) + File.delete(filepath) if File.exist?filepath + end + DiscussDemo.destroy(params[:id]) + redirect_to :controller=> 'discuss_demos',:action => 'index' + end + + def show + @discuss_demo = DiscussDemo.find(params[:id]) + end +end diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 545d61155..9bf2ee846 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -91,6 +91,7 @@ class DocumentsController < ApplicationController def update @document.safe_attributes = params[:document] + @document.save_attachments(params[:attachments]) if request.put? and @document.save flash[:notice] = l(:notice_successful_update) redirect_to document_url(@document) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 2f7092d9a..c347ba6b8 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -1,7 +1,7 @@ # added by fq class ForumsController < ApplicationController layout "users_base" - + include ApplicationHelper # GET /forums # GET /forums.json before_filter :find_forum_if_available @@ -20,7 +20,7 @@ class ForumsController < ApplicationController #@memo.author_id = User.current.id #@forum = @memo.forum cs = CommentService.new - @memo = cs.create_feedback params,User.current + @memo,message = cs.create_feedback params,User.current respond_to do |format| if !@memo.new_record? format.html { redirect_to forum_path(@memo.forum) } @@ -63,6 +63,9 @@ class ForumsController < ApplicationController respond_to do |format| if @memo.save + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids ,@memo.id,1 + #end format.html { redirect_to (forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo } else @@ -163,6 +166,13 @@ class ForumsController < ApplicationController @forum = Forum.new(params[:forum]) @forum.creator_id = User.current.id if @forum.save + # Time 2015-03-24 17:07:05 + # Author lizanle + # Description after save后需要进行资源记录的更新 + # owner_type = 2 对应的是 forum + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids ,@forum.id,2 + #end respond_to do |format| format.html { redirect_to @forum, notice: l(:label_forum_create_succ) } diff --git a/app/controllers/git_callback_controller.rb b/app/controllers/git_callback_controller.rb new file mode 100644 index 000000000..717a22961 --- /dev/null +++ b/app/controllers/git_callback_controller.rb @@ -0,0 +1,9 @@ +class GitCallbackController < ApplicationController + + def post_update + @repository = Repository.find_by_root_url(params[:root_url]) + @repository.fetch_changesets + render :text => 'success' + end + +end \ No newline at end of file diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6a251a80c..790718e5d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -58,7 +58,7 @@ class IssuesController < ApplicationController def index retrieve_query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) + sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns) @query.sort_criteria = sort_criteria.to_a @@ -162,7 +162,8 @@ class IssuesController < ApplicationController respond_to do |format| format.html { render_attachment_warning_if_needed(@issue) - flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.source_from}", issue_path(@issue), :title => @issue.subject)) + flash[:notice] = l(:label_successful_create) + #flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject)) #flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject)) if params[:continue] attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} @@ -381,7 +382,7 @@ class IssuesController < ApplicationController def retrieve_previous_and_next_issue_ids retrieve_query_from_session if @query - sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) + sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns, 'issues_index_sort') limit = 500 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index ba312c74a..aaaa4484d 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -109,7 +109,7 @@ class MembersController < ApplicationController end if params[:flag] unless members.present? && members.all? {|m| m.valid? } - flash[:error] = members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') + flash[:error] = members.empty? ? l(:label_user_role_null) :members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') else flash[:notice] = l(:label_invite_success) end diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index aaa99e417..54bcc0496 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -59,6 +59,20 @@ class MemosController < ApplicationController @memo.content = @quote + @memo.content respond_to do |format| if @memo.save + # Time 2015-03-24 14:47:05 + # Author lizanle + # Description after save后需要进行资源记录的更新 + # owner_type = 1 对应的是 memo + if !params[:asset_id].nil? + ids = params[:asset_id].split(',') + ids.each do |id| + asset = Kindeditor::Asset.find(id.to_i) + asset.owner_id = @memo.id + asset.owner_type = 1 + asset.save + end + end + #end format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo } else diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 44e5fd8a3..41876e041 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -340,6 +340,7 @@ class ProjectsController < ApplicationController @is_zhuce =false flash[:notice] = l(:notice_email_sent, :value => email) else + flash[:error] = l(:notice_registed_error, :value => email) @is_zhuce = true end respond_to do |format| diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 0c1f65317..6c115fc11 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -92,6 +92,22 @@ class RepositoriesController < ApplicationController render :action => 'show', :layout => 'base_projects' end + + HOOK_TEMPLATE = %Q{#!/bin/sh +exec sh -c ' +function update() +{ + CMD_PATH=`dirname $0`; + cd $CMD_PATH; + PY_PATH=$PWD/../../git_refresh_changes.py; + [[ -s "$PY_PATH" ]] && $(which python) $PY_PATH $PWD; + cd -; +} +git update-server-info +update +' + } + def create if params[:repository_scm].to_s == 'Gitlab' # add by nwb @@ -127,7 +143,6 @@ class RepositoriesController < ApplicationController if attrs[:attrs_extra].keys.any? @repository.merge_extra_info(attrs[:attrs_extra]) end - #by xianbo @repository.project = @project if request.post? && @repository.save @@ -145,12 +160,11 @@ class RepositoriesController < ApplicationController " \n ' >> "+ @root_path+"htdocs/"+ @repository_name+"/.htaccess" system "cd "+@project_path+" ;git update-server-info" - # if(create_repo_file&&create_passwd&&create_group&&init_repository&&add_privilege&&init_server_info) - # else - # logger.info "An error occured when authenticating "+"create passwd"+@creat_passwd+"create_group"+ - # crate_group+"create repository file "+create_repo_file+"init repository"+init_repostory+ - # "aad privilege to rpository"+add_privilege+"init server infos"+init_server_info - # end + + File.open(@project_path+"/hooks/post-update", "w+") do |f| + f.write(HOOK_TEMPLATE) + end + @repository.update_attributes(:login => User.current.login.to_s) end redirect_to settings_project_url(@project, :tab => 'repositories') @@ -160,6 +174,8 @@ class RepositoriesController < ApplicationController render :action => 'new', :layout =>'base_projects' end end + + end end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 949ddd643..f35210f01 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -20,7 +20,7 @@ class WelcomeController < ApplicationController include WelcomeHelper helper :project_score caches_action :robots - before_filter :find_first_page, :only => [:index] + #before_filter :find_first_page, :only => [:index] # before_filter :fake, :only => [:index, :course] before_filter :entry_select, :only => [:index] diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index c865a500b..afdc306a4 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -60,4 +60,8 @@ module ApiHelper end [count,is_teacher] end + + def get_user_language user + (user.language.nil? || user.language == "") ? 'zh':user.language + end end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1f628c8e1..c8168455c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,35 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + # Time 2015-03-24 15:27:29 + # Author lizanle + # Description 从硬盘上删除对应的资源文件 + def delete_kindeditor_assets_from_disk owner_id,owner_type + assets = Kindeditor::Asset.where(["owner_id = ? and owner_type = ?",owner_id,owner_type]) + if !assets.nil? && !assets.blank? + assets.all.each do |asset| + next if asset.nil? + filepath = File.join(Rails.root,"public","files","uploads", + asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s, + asset[:asset].to_s) + File.delete(filepath) if File.exist?filepath + end + end + end + + # Time 2015-03-24 16:38:05 + # Author lizanle + # Description after save后需要进行资源记录的更新 + # owner_type = 1 对应的是 memo + def update_kindeditor_assets_owner ids,owner_id,owner_type + ids.each do |id| + asset = Kindeditor::Asset.find(id.to_i) + asset.owner_id = owner_id + asset.owner_type = owner_type + asset.save + end + end + # Added by young # Define the course menu's link class # 不是数组的转化成数组,然后判断当前menu_item是否在给定的列表 @@ -2019,4 +2048,10 @@ module ApplicationHelper end technical_title end + + + def ie8? + request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/ + end + end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4de269b7b..384fcaa9b 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -389,7 +389,7 @@ module CoursesHelper # 课程time+term简写(2014.春/2014.秋)国际化输出 def get_course_term course strterm = course.try(:term).to_s - if !(User.current.language == 'zh') + if !(User.current.language == 'zh'||User.current.language == '') strterm == '春季学期' ? strterm = 'spring term' : strterm = 'autumn term' str = ( course.try(:time).to_s << '.' << strterm ) str[0..-6] @@ -403,7 +403,7 @@ module CoursesHelper # 课程term(春季学期/秋季学期)国际化输出 def get_course_term_locales course str = course.try(:term).to_s - if !(User.current.language == 'zh') + if !(User.current.language == 'zh'||User.current.language == '') str == '春季学期' ? str = ' ' + 'spring term' : str = ' ' + 'autumn term' end return str diff --git a/app/helpers/discuss_demos_helper.rb b/app/helpers/discuss_demos_helper.rb new file mode 100644 index 000000000..71bf8fb62 --- /dev/null +++ b/app/helpers/discuss_demos_helper.rb @@ -0,0 +1,2 @@ +module DiscussDemosHelper +end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 9eff409ff..884ebc2eb 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -87,7 +87,10 @@ module FilesHelper def visable_attachemnts attachments result = [] attachments.each do |attachment| - if attachment.is_public? || (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id + if attachment.is_public? || + (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || + (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| + attachment.author_id == User.current.id result << attachment end end diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index b9e658bb5..294d895a5 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -278,11 +278,48 @@ module WatchersHelper ) method = applied ? 'delete' : 'post' - link_to text, url, :remote => true, :method => method ,:class=>css + link_to text, url, :remote => true, :method => method , :class => css end def exit_project_link(project) link_to(l(:label_exit_project),exit_cur_project_path(project.id), - :remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 22px; line-height: 22px; background: none repeat scroll 0% 0% #64BDD9; TES" ) + :remote => true, :confirm => l(:lable_sure_exit_project), + :style => "color: #fff; display:block;font-size:12px; padding: 0px 5px; margin-right: 10px; height: 20px; line-height: 22px; background: none repeat scroll 0% 0% #64BDD9; TES;padding-top:1px;" ) + end + + #项目关注、取消关注 + #REDO:项目样式确定后方法需要对CSS变量进行改进 + def watcher_link_for_project(objects, user, options=[]) + return '' unless user && user.logged? + objects = Array.wrap(objects) + watched = objects.any? {|object| object.watched_by?(user)} + @watch_flag = objects.first.instance_of?(Project) + id = watcher_css(objects) + text = @watch_flag ? + (watched ? l(:button_unfollow) : l(:label_button_following)) : (watched ? l(:button_unwatch) : l(:label_button_following)) + url = watch_path(:object_type => objects.first.class.to_s.underscore, + :object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)) + method = watched ? 'delete' : 'post' + link_to text, url, :remote => true, :method => method, + :class => "project_watch_new" ,:id=>id + end + + #申请加入项目 + def join_in_project_link(project, user, options=[]) + return '' unless user && user.logged? + applied = project.applied_projects.find_by_user_id(user.id) + text = applied ? l(:label_unapply_project) : l(:label_apply_project) + @applied_flag = project.instance_of?(Project) + if applied + appliedid = applied.id + end + id = applied_css(project) + url = appliedproject_path( + :id=>appliedid, + :user_id => user.id, + :project_id => project.id) + method = applied ? 'delete' : 'post' + link_to text, url, :remote => true, :method => method , :class => "project_watch_new",:id => id end + end diff --git a/app/models/bid.rb b/app/models/bid.rb index e5de47b24..10476b4d3 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -61,14 +61,21 @@ class Bid < ActiveRecord::Base end } + scope :course_visible, lambda {|*args| + includes(:courses).where(Course.allowed_to_condition(args.shift || User.current, :view_homeworks, *args)) + } + acts_as_watchable acts_as_taggable - acts_as_event :title => Proc.new {|o| "#{l(:label_requirement)} ##{o.id}: #{o.name}" }, + acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}} + acts_as_activity_provider :type => 'homeworks', + :author_key => :author_id + acts_as_activity_provider :find_options => {:include => [:projects, :author]}, :author_key => :author_id diff --git a/app/models/discuss_demo.rb b/app/models/discuss_demo.rb new file mode 100644 index 000000000..6ed8d15b6 --- /dev/null +++ b/app/models/discuss_demo.rb @@ -0,0 +1,4 @@ +class DiscussDemo < ActiveRecord::Base + attr_accessible :title, :body + has_many_kindeditor_assets :assets, :dependent => :destroy +end diff --git a/app/models/forum.rb b/app/models/forum.rb index 878937ea7..6843ab678 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -1,5 +1,7 @@ class Forum < ActiveRecord::Base include Redmine::SafeAttributes + include ApplicationHelper + has_many_kindeditor_assets :assets, :dependent => :destroy has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL" belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' @@ -15,7 +17,7 @@ class Forum < ActiveRecord::Base validates_length_of :name, maximum: 50 #validates_length_of :description, maximum: 255 validates :name, :uniqueness => true - + after_destroy :delete_kindeditor_assets acts_as_taggable scope :by_join_date, order("created_at DESC") #after_create :send_email @@ -47,5 +49,11 @@ class Forum < ActiveRecord::Base ["id = ?", forum_id]) end + # Time 2015-03-26 15:50:54 + # Author lizanle + # Description 删除论坛后删除对应的资源 + def delete_kindeditor_assets + delete_kindeditor_assets_from_disk self.id,2 + end end diff --git a/app/models/kindeditor/asset.rb b/app/models/kindeditor/asset.rb new file mode 100644 index 000000000..bae948c99 --- /dev/null +++ b/app/models/kindeditor/asset.rb @@ -0,0 +1,15 @@ +class Kindeditor::Asset < ActiveRecord::Base + self.table_name = 'kindeditor_assets' + mount_uploader :asset, Kindeditor::AssetUploader + validates_presence_of :asset + before_save :update_asset_attributes + attr_accessible :asset + + private + def update_asset_attributes + if asset.present? && asset_changed? + self.file_size = asset.file.size + self.file_type = asset.file.content_type + end + end +end \ No newline at end of file diff --git a/app/models/kindeditor/file.rb b/app/models/kindeditor/file.rb new file mode 100644 index 000000000..4b5f11441 --- /dev/null +++ b/app/models/kindeditor/file.rb @@ -0,0 +1,3 @@ +class Kindeditor::File < Kindeditor::Asset + mount_uploader :asset, Kindeditor::FileUploader +end \ No newline at end of file diff --git a/app/models/kindeditor/flash.rb b/app/models/kindeditor/flash.rb new file mode 100644 index 000000000..efaf5de9b --- /dev/null +++ b/app/models/kindeditor/flash.rb @@ -0,0 +1,3 @@ +class Kindeditor::Flash < Kindeditor::Asset + mount_uploader :asset, Kindeditor::FlashUploader +end \ No newline at end of file diff --git a/app/models/kindeditor/image.rb b/app/models/kindeditor/image.rb new file mode 100644 index 000000000..a400c816d --- /dev/null +++ b/app/models/kindeditor/image.rb @@ -0,0 +1,3 @@ +class Kindeditor::Image < Kindeditor::Asset + mount_uploader :asset, Kindeditor::ImageUploader +end \ No newline at end of file diff --git a/app/models/kindeditor/media.rb b/app/models/kindeditor/media.rb new file mode 100644 index 000000000..071763319 --- /dev/null +++ b/app/models/kindeditor/media.rb @@ -0,0 +1,3 @@ +class Kindeditor::Media < Kindeditor::Asset + mount_uploader :asset, Kindeditor::MediaUploader +end \ No newline at end of file diff --git a/app/models/mailer.rb b/app/models/mailer.rb index b404ea531..e1c538fd0 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -125,7 +125,7 @@ class Mailer < ActionMailer::Base end - + # 公共讨论区发帖、回帖添加邮件发送信息 def forum_message_added(memo) @memo = memo redmine_headers 'Memo' => memo.id @@ -134,9 +134,11 @@ class Mailer < ActionMailer::Base @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) @issue_author_url = url_for(user_activities_url(@author)) recipients ||= [] - if @forum.author.mail_notification != 'day' && @forum.author.mail_notification != 'week' + #将帖子创建者邮箱地址加入数组 + if @forum.creator.mail_notification != 'day' && @forum.creator.mail_notification != 'week' recipients << @forum.creator.mail end + #回复人邮箱地址加入数组 if @author.mail_notification != 'day' && @author.mail_notification != 'week' recipients << @author.mail end diff --git a/app/models/memo.rb b/app/models/memo.rb index 052ca03db..eb0c86855 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -1,7 +1,9 @@ class Memo < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper + include ApplicationHelper belongs_to :forum + has_many_kindeditor_assets :assets, :dependent => :destroy belongs_to :author, :class_name => "User", :foreign_key => 'author_id' validates_presence_of :author_id, :forum_id, :subject,:content # 若是主题帖,则内容可以是空 @@ -42,9 +44,9 @@ class Memo < ActiveRecord::Base "parent_id", "replies_count" - after_create :add_author_as_watcher, :reset_counters! #, :sendmail#,:be_user_score -- 公共区发帖暂不计入得分 + after_create :add_author_as_watcher, :reset_counters!, :sendmail # after_update :update_memos_forum - after_destroy :reset_counters!#,:down_user_score -- 公共区发帖暂不计入得分 + after_destroy :reset_counters!,:delete_kindeditor_assets#,:down_user_score -- 公共区发帖暂不计入得分 # after_create :send_notification # after_save :plusParentAndForum # after_destroy :minusParentAndForum @@ -170,4 +172,10 @@ class Memo < ActiveRecord::Base update_replay_for_memo(User.current,1) end + # Time 2015-03-26 15:20:24 + # Author lizanle + # Description 从硬盘上删除资源 + def delete_kindeditor_assets + delete_kindeditor_assets_from_disk self.id,1 + end end diff --git a/app/models/user.rb b/app/models/user.rb index 83e08254c..9abe80779 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -214,6 +214,8 @@ class User < Principal where(" LOWER(login) LIKE '#{pattern}' ") elsif type == "1" where(" LOWER(concat(lastname, firstname)) LIKE '#{pattern}' ") + elsif type == "3" + where(" LOWER(concat(lastname, firstname,login)) LIKE '#{pattern}' ") else where(" LOWER(mail) LIKE '#{pattern}' ") end @@ -776,7 +778,7 @@ class User < Principal (block_given? ? yield(role, self) : true) } #添加课程相关的权限判断 - elsif context && context.is_a?(Course) + elsif context && context.is_a?(Course) return false unless context.allows_to?(action) # Admin users are authorized for anything else return true if admin? diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb index 92690d1db..09c88e6df 100644 --- a/app/models/user_extensions.rb +++ b/app/models/user_extensions.rb @@ -32,40 +32,42 @@ class UserExtensions < ActiveRecord::Base def get_brief_introduction return self.brief_introduction end - + + # added by meng def show_identity - if self.identity == 0 - if User.current.language == 'zh' - user_identity = '教师' - else - user_identity = 'Teacher' - end - elsif self.identity == 1 - if User.current.language == 'zh' - user_identity = '学生' - else - user_identity = 'Student' - end - elsif self.identity == 2 - if User.current.language == 'zh' - user_identity = '企业' - else - user_identity = 'Enterprise' - end - elsif self.identity == 3 - if User.current.language == 'zh' - user_identity = '开发者' - else - user_identity = 'Developer' + if User.current.language == 'zh'||User.current.language == '' + case self.identity + when 0 + user_identity = l(:label_account_identity_teacher) + when 1 + user_identity = l(:label_account_identity_student) + when 2 + user_identity = l(:label_account_identity_enterprise) + when 3 + user_identity = l(:label_account_identity_developer) + else + user_identity = '' end else - user_identity = '' + case self.identity + when 0 + user_identity = l(:label_account_identity_teacher) + when 1 + user_identity = l(:label_account_identity_student) + when 2 + user_identity = l(:label_account_identity_enterprise) + when 3 + user_identity = l(:label_account_identity_developer) + else + user_identity = '' + end end return user_identity end -# end - +# end + + def self.introduction(user, message) unless user.user_extensions.nil? info = user.user_extensions diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index e74cc902b..f75e14b85 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -1,4 +1,6 @@ class CommentService + include ApiHelper + include Redmine::I18n #评论 def news_comments params,current_user @news = News.find(params[:id]) @@ -84,7 +86,8 @@ class CommentService @memo.forum_id = "1" @memo.author_id = current_user.id @memo.save - @memo + message = "#{l(:label_commit_failed,:locale => get_user_language(current_user))}: #{@memo.errors.full_messages}" if @memo.new_record? + [@memo,message] end #课程留言列表 diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 2010c8252..7c816ec19 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -38,7 +38,7 @@ class CoursesService if name.blank? raise 'sumbit empty' end - @courses = courses_all.visible + @courses = courses_all.visible(current_user) if params[:name].present? @courses_all = @courses.like(params[:name]) else @@ -348,7 +348,7 @@ class CoursesService membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user)) end if membership.nil? || membership.count == 0 - raise l(:label_no_courses,:locale => current_user.language.nil? ? 'zh':current_user.language) + raise l(:label_no_courses,:locale => get_user_language(current_user)) end membership.sort! {|older, newer| newer.created_on <=> older.created_on } result = [] @@ -357,19 +357,19 @@ class CoursesService latest_course_dynamics = [] latest_news = course.news.order("created_on desc").first unless latest_news.nil? - latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => l(:label_recently_updated_notification,:locale => current_user.language.nil? ? 'zh':current_user.language)} + latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => l(:label_recently_updated_notification,:locale => get_user_language(current_user))} end latest_message = course.journals_for_messages.order("created_on desc").first unless latest_message.nil? - latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => l(:label_recently_updated_message,:locale => current_user.language.nil? ? 'zh':current_user.language)} + latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))} end latest_attachment = course.attachments.order("created_on desc").first unless latest_attachment.nil? - latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => l(:label_recently_updated_courseware,:locale => current_user.language.nil? ? 'zh':current_user.language)} + latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => l(:label_recently_updated_courseware,:locale => get_user_language(current_user))} end latest_bid = course.homeworks.order('updated_on DESC').first unless latest_bid.nil? - latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => current_user.language.nil? ? 'zh':current_user.language)} + latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))} end #每个作业中的最新留言 messages = [] @@ -384,7 +384,7 @@ class CoursesService end latest_bid_message = messages.first unless latest_bid_message.nil? - latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => current_user.language.nil? ? 'zh':current_user.language)} + latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))} end #每个作业中学生最后提交的作业 homeworks = [] @@ -399,12 +399,12 @@ class CoursesService end latest_homework_attach = homeworks.first unless latest_homework_attach.nil? - latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message => l(:label_recently_updated_homework,:locale => current_user.language.nil? ? 'zh':current_user.language)} + latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))} end latest_course_dynamics.sort!{|order,newer| newer[:time] <=> order[:time]} latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? - result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => latest_course_dynamic[:type],:update_time => latest_course_dynamic[:time],:message => latest_course_dynamic[:message],:count => nil} + result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:course_time => course.time,:course_term => course.term,:type => latest_course_dynamic[:type],:update_time => latest_course_dynamic[:time],:message => latest_course_dynamic[:message],:count => nil} end end result.sort!{|order,newer| newer[:update_time] <=> order[:update_time]} diff --git a/app/services/users_service.rb b/app/services/users_service.rb index f75a84c5b..39ca37d26 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -193,7 +193,6 @@ class UsersService @current_user.save #raise @current_user.errors.full_message #return @current_user - else raise 'wrong password' end diff --git a/app/views/applied_project/_set_applied.js.erb b/app/views/applied_project/_set_applied.js.erb index 7403b963b..33d862d1c 100644 --- a/app/views/applied_project/_set_applied.js.erb +++ b/app/views/applied_project/_set_applied.js.erb @@ -1,5 +1,14 @@ <% selector = ".#{applied_css(@project)}" %> -$("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript applied_link(@project, User.current) %>")}); +<% id_selector = "#{applied_css(@project)}" %> +if($("<%= selector %>").get(0) == undefined) +{ + $("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript join_in_project_link(@project, User.current) %>")}); +} +else +{ + $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript applied_link(@project, User.current) %>")}); +} + if (window.Messenger) { Messenger.options = { extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right', diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 5fe95f919..b026fead2 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,6 +1,6 @@ <% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> + <% container.attachments.each_with_index do |attachment, i| %> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> @@ -48,19 +48,23 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + <%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()', :style => ie8? ? 'display:none' : '' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', :multiple => true, :onchange => 'addInputFiles(this);', - :style => 'display:none', + :style => ie8? ? '' : 'display:none', :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :upload_path => uploads_path(:format => 'js',:project =>project), - :description_placeholder => l(:label_optional_description) + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all) } %> <%= l(:label_no_file_uploaded)%> diff --git a/app/views/attachments/_form_course.html.erb b/app/views/attachments/_form_course.html.erb index bfe600131..73b637c22 100644 --- a/app/views/attachments/_form_course.html.erb +++ b/app/views/attachments/_form_course.html.erb @@ -50,7 +50,11 @@ :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :upload_path => uploads_path(:format => 'js'), - :description_placeholder => l(:label_optional_description) + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all) } %> <%= l(:label_no_file_uploaded)%> (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 8913febd0..4c2ee0c8f 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -7,9 +7,9 @@ <% end%> <% if options[:length] %> - <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> + <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> <% else %> - <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> + <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%> <% end %> <%if is_float%> diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index 04cd4e02d..4893d22fe 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -1,7 +1,7 @@ $('#attachments_<%= j params[:attachment_id] %>').remove(); var count=$('#attachments_fields>span').length; if(count<=0){ - $("#upload_file_count").text("未上传文件"); + $("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>); $(".remove_all").remove(); }else{ $("#upload_file_count").html("已上传"+""+count+""+"个文件"); diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 25c6f6c7a..6cb975055 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -165,7 +165,7 @@ - <%= textilizable bid, :description %> + <%=h sanitize(bid.description.html_safe) %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 1d9408e86..7ddd37ad6 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -24,10 +24,6 @@ -
-

<%= h @board.name %>

-
- <% if !User.current.logged? %>
<% if @project.project_type == 1 %> @@ -39,62 +35,52 @@
<% end %> -
- - 共有 - <%= link_to @topic_count,:controller => 'boards',:action => 'index' %> - 个贴子 - - <% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %> - - <%= link_to l(:label_message_new), - new_board_message_path(@board), - :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> - - <% end %> -
-
- <% if @topics.any? %> - <% @topics.each do |topic| %> - - - - - -
- <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %> - - - - - - - - - -
- <%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title:topic.subject.to_s %> - - - - - - - - -
<%= link_to (topic.replies_count), board_message_path(@board, topic) %>
回答
-
- <%= authoring topic.created_on, topic.author %>
-
- <% end %> - + + +
+
+

<%= h @board.name %>

+
+
+
项目讨论区共有<%= @topic_count %>个帖子
+ <% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %> + <%= link_to l(:label_message_new), new_board_message_path(@board), + :class => 'problem_new_btn fl', + :onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> + <% end %> +
+
+ + <% if @topics.any? %> + <% @topics.each do |topic| %> +
+ + <%= link_to image_tag(url_to_avatar(topic.author), :class => "problem_pic talk_pic fl"), user_path(topic.author) %> + +
+
+ <%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %> + <% if topic.sticky? %> + 置顶 + <% end %> +
+
+ 由<%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %> + 添加于<%= format_time topic.created_on %> +
+
+ 回复<%= link_to (topic.replies_count), board_message_path(@board, topic), :style =>"color:#fff;" %> +
+
+ <% end %> +
    + <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> +
<% else %>

<%= l(:label_no_data) %>

<% end %> + +
<% other_formats_links do |f| %> diff --git a/app/views/contests/watcherlist.html.erb b/app/views/contests/watcherlist.html.erb index 4987f3616..5628e5e95 100644 --- a/app/views/contests/watcherlist.html.erb +++ b/app/views/contests/watcherlist.html.erb @@ -15,7 +15,7 @@

<% unless user.memberships.empty? %> - <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <%= l(:label_contribute_to, :count => "#{user.memberships.count}") %> <% for member in user.memberships %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> <% end %> diff --git a/app/views/discuss_demos/index.html.erb b/app/views/discuss_demos/index.html.erb new file mode 100644 index 000000000..b24937357 --- /dev/null +++ b/app/views/discuss_demos/index.html.erb @@ -0,0 +1,25 @@ +

文章列表

+
+ + <% @discuss_demo_list.each do |e| %> + + + + + + + + + + <% end %> +
<%= truncate(e.title,:length => 50) %> + <%= truncate(e.body,:length => 50) %>   + + <%= link_to '查看文章',{:controller => 'discuss_demos',:action => 'show',:id=>e.id} %> + +    + <%= link_to '删除文章',discuss_demo_path(e.id), :method => :delete,:confirm => l(:text_are_you_sure) %> +
+ <% paginate @discuss_demo_list %> + <%= link_to '新建文章',new_discuss_demo_path %> +
\ No newline at end of file diff --git a/app/views/discuss_demos/new.html.erb b/app/views/discuss_demos/new.html.erb new file mode 100644 index 000000000..8cf1630e2 --- /dev/null +++ b/app/views/discuss_demos/new.html.erb @@ -0,0 +1,7 @@ +<%= javascript_include_tag src='/assets/kindeditor/kindeditor' %> +

新建文章

+<%= form_for @discuss_demo,:url => {:controller => 'discuss_demos',:action => "show",:id =>@discuss_demo.id, :method => :put} do |f| %> + <%= f.text_field :title %> + <%= f.kindeditor :body ,:owner_id => @discuss_demo.id%> + <%= f.submit :value=> '提交' %> +<% end %> \ No newline at end of file diff --git a/app/views/discuss_demos/show.html.erb b/app/views/discuss_demos/show.html.erb new file mode 100644 index 000000000..4b6bd3cee --- /dev/null +++ b/app/views/discuss_demos/show.html.erb @@ -0,0 +1,3 @@ +

<%= @discuss_demo.title %>

+<%= textAreailizable @discuss_demo.body %> +<%=link_to "返回首页",discuss_demos_path %> \ No newline at end of file diff --git a/app/views/documents/_form.html.erb b/app/views/documents/_form.html.erb index 72361b9ab..50f47e5f7 100644 --- a/app/views/documents/_form.html.erb +++ b/app/views/documents/_form.html.erb @@ -11,8 +11,8 @@ <%= wikitoolbar_for 'document_description' %> -<% if @document.new_record? %> +

<%= render :partial => 'attachments/form', :locals => {:container => @document} %>

-<% end %> + diff --git a/app/views/documents/edit.html.erb b/app/views/documents/edit.html.erb index 8a6122f8c..5c6ed2383 100644 --- a/app/views/documents/edit.html.erb +++ b/app/views/documents/edit.html.erb @@ -1,4 +1,6 @@ -

<%=l(:label_document)%>

+
+

<%=l(:label_document_plural)%>

+
<%= labelled_form_for @document do |f| %> <%= render :partial => 'form', :locals => {:f => f} %> diff --git a/app/views/files/_attachement_list.html.erb b/app/views/files/_attachement_list.html.erb index d36ff2bd6..59f1b66fd 100644 --- a/app/views/files/_attachement_list.html.erb +++ b/app/views/files/_attachement_list.html.erb @@ -28,13 +28,17 @@ :class => 'file_selector', :multiple => true, :onchange => 'addInputFiles(this);', - :style => 'display:none', + :style => ie8? ? '': 'display:none', :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :upload_path => uploads_path(:format => 'js'), - :description_placeholder => l(:label_optional_description) + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all) } %> diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 7dc047c5e..de2a5a82c 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -14,9 +14,10 @@

+
<% curse_attachments.each do |file| %>
-
+
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> @@ -50,6 +51,7 @@
<% end %> +
    <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb index 6e8e806cf..76aab9a73 100644 --- a/app/views/files/_new.html.erb +++ b/app/views/files/_new.html.erb @@ -8,10 +8,10 @@ <% if versions.any? %> - + <% if attachmenttypes.any? %> @@ -31,14 +31,10 @@ <% end %>

<% end %> -

<%= l(:field_version) %>

<%= l(:field_version) %>

<%= select_tag "version_id", content_tag('option', '') + - options_from_collection_for_select(versions, "id", "name"), {style: 'width:100px'} %> + options_from_collection_for_select(versions, "id", "name"), {style: 'width:230px'} %> <%= l(:attachment_type) %>
- - +

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form', locals: {project: project} %>

- -

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form', locals: {project: project} %>

<%= submit_tag l(:button_add) %> <% end %> diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index aa597f3f2..b4d849cd6 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -1,7 +1,7 @@ <% attachmenttypes = @project.attachmenttypes %> <% sufixtypes = @project.contenttypes %>
-

资源共享区

+

<%= l(:lable_file_sharingarea) %>

@@ -16,12 +16,12 @@
diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 5faa73b0f..27aaf2f3d 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -15,8 +15,8 @@ <%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure" ,:class => "tableth") %> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children",:class => "tableth") %> - <%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype",:class => "tableth") %> - <%= content_tag('th', l(:attachment_sufix_browse), id: 'vzebra-contenttype', class: 'tableth', style: 'color: black')%> + <%= sort_header_tag('attach_type', :caption => l(:field_filecontenttype), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype",:class => "tableth") %> + <%= content_tag('th', l(:field_filetype), id: 'vzebra-contenttype', class: 'tableth', style: 'color: black')%> <%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense",:class => "tableth") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action",:class => "tableth") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children",:class => "tableth") %> @@ -76,7 +76,7 @@
diff --git a/app/views/files/_upload_show.html.erb b/app/views/files/_upload_show.html.erb index ca3eda73c..959fcb7bf 100644 --- a/app/views/files/_upload_show.html.erb +++ b/app/views/files/_upload_show.html.erb @@ -5,7 +5,8 @@
<%= error_messages_for 'attachment' %> - <%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form") do %> + + <%= form_tag(course_files_path(course), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> <%= render :partial => 'attachement_list',:locals => {:course => course} %>
diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index 90215c16c..69ea896c9 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -31,4 +31,5 @@ closeModal(); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); <%end%> <% end %> +$(document).ready(img_thumbnails); diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form_create_mode.html.erb similarity index 81% rename from app/views/forums/_form.html.erb rename to app/views/forums/_form_create_mode.html.erb index ac9c298ff..63162c7a0 100644 --- a/app/views/forums/_form.html.erb +++ b/app/views/forums/_form_create_mode.html.erb @@ -1,49 +1,51 @@ - - -
- <%= labelled_form_for(@forum) do |f| %> - <% if @forum.errors.any? %> - - <% end %> -
-
- <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> -
-
- <% if User.current.logged? && User.current.admin? %> - <% if @forum.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'message_sticky', l(:label_board_sticky) %> - <% end %> - <% if @forum.safe_attribute? 'locked' %> - <%= f.check_box :locked %> - <%= label_tag 'message_locked', l(:label_board_locked) %> - <% end %> - <% end %> -
-
- -

- <%= f.text_area :description, :required => true, :id => 'editor01' %> -

- - -

- (<%= l(:label_forums_max_length) %>) -

-
-
- <%= submit_tag l(:button_submit) %> - <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> -
-
- <% end %> -
+ + + +
+ <%= labelled_form_for(@forum) do |f| %> + <% if @forum.errors.any? %> + + <% end %> +
+
+ <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> +
+
+ <% if User.current.logged? && User.current.admin? %> + <% if @forum.safe_attribute? 'sticky' %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <% end %> + <% if @forum.safe_attribute? 'locked' %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> + <% end %> + <% end %> +
+
+ + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> +

+ <%= f.kindeditor :description, :required => true %> +

+ + +

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

+
+
+ <%= submit_tag l(:button_submit) %> + <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> +
+
+ <% end %> +
diff --git a/app/views/forums/_form_edit_mode.html.erb b/app/views/forums/_form_edit_mode.html.erb new file mode 100644 index 000000000..a9bb05f79 --- /dev/null +++ b/app/views/forums/_form_edit_mode.html.erb @@ -0,0 +1,49 @@ + + + +
+ <%= labelled_form_for(@forum) do |f| %> + <% if @forum.errors.any? %> + + <% end %> +
+
+ <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> +
+
+ <% if User.current.logged? && User.current.admin? %> + <% if @forum.safe_attribute? 'sticky' %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <% end %> + <% if @forum.safe_attribute? 'locked' %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> + <% end %> + <% end %> +
+
+

+ <%= f.kindeditor :description, :required => true,:owner_id => @forum.id,:owner_type => 2 %> +

+ + +

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

+
+
+ <%= submit_tag l(:button_submit) %> + <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> +
+
+ <% end %> +
diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index 4aafbac7f..9fe72fdb7 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -1,4 +1,4 @@

编辑讨论区

- -<%= render 'form' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= render 'form_edit_mode' %> diff --git a/app/views/forums/new.html.erb b/app/views/forums/new.html.erb index 0d51db57a..35814d843 100644 --- a/app/views/forums/new.html.erb +++ b/app/views/forums/new.html.erb @@ -5,7 +5,7 @@ <% @nav_dispaly_forum_label = 1%>

<%= l :label_forum_new %>

- -<%= render 'form' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= render 'form_create_mode' %> <%#= link_to l(:button_back), forums_path %> diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 85fa8093a..2f4ec56a0 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -6,13 +6,14 @@ <% if User.current.logged? %> <%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>

<%= f.text_field :subject, :required => true, :maxlength => 50%>

- <%= f.text_area :content, :required => true, :id => 'editor02' %> + <%= f.kindeditor :content, :required => true %>

- +

(<%= l(:label_memos_max_length) %>)

diff --git a/app/views/issues/_newissue_index.html.erb b/app/views/issues/_newissue_index.html.erb deleted file mode 100644 index 4b282aa8f..000000000 --- a/app/views/issues/_newissue_index.html.erb +++ /dev/null @@ -1,139 +0,0 @@ -
-

问题跟踪

-
-
- <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> - - <% if User.current.member_of?(@project) %> - <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, - :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> - <% end %> - <%= link_to l(:label_query), '#', :class => 'icon icon-help', - :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> - - <% end %> - 问题总数:<%= @project.issues.count %> 未解决:<%= @project.issues.where('status_id in (1,2,4,6)').count %> -
-
- <% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query) %> - <% end %> -
- -<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> -
- <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> - -
- ---<%= l :label_query_new %>--- - -
-
"> - - <%= l(:label_issue_query_condition) %> - -
"> - <%= render :partial => 'queries/filters', :locals => {:query => @query} %> -
-
- -
- <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> - <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> -
-
-
- <% end %> -
- -<%= error_messages_for 'query' %> - -<% if @query.valid? %> - <% if @issues.empty? %> -

- <%= l(:label_no_data) %> -

- <% else %> - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> - - <% end %> -
- <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> - <%= f.link_to 'PDF', :url => params %> - <% end %> -
- - - - -<% end %> - -<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> - -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> -<% end %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, - {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_issue_plural)) %> - <%= auto_discovery_link_tag(:atom, - {:controller => 'journals', :action => 'index', - :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_changes_details)) %> -<% end %> - -<%= context_menu issues_context_menu_path %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index b3750a770..012178ae2 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1 +1,139 @@ -<%= render :partial => 'issues/newissue_index' %> \ No newline at end of file +
+

<%= l(:label_issue_tracking) %>

+
+
+ <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> + + <% if User.current.member_of?(@project) %> + <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, + :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> + <% end %> + <%= link_to l(:label_query), '#', :class => 'icon icon-help', + :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> + + <% end %> + <%= l(:label_issues_sum) %>:<%= @project.issues.count %> <%= l(:lable_issues_undo) %> <%= @project.issues.where('status_id in (1,2,4,6)').count %> +
+
+ <% if !@query.new_record? && @query.editable_by?(User.current) %> + <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query) %> + <% end %> +
+ +<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> +
+ <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> + +
+ ---<%= l :label_query_new %>--- + +
+
"> + + <%= l(:label_issue_query_condition) %> + +
"> + <%= render :partial => 'queries/filters', :locals => {:query => @query} %> +
+
+ +
+ <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> + <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> +
+
+
+ <% end %> +
+ +<%= error_messages_for 'query' %> + +<% if @query.valid? %> + <% if @issues.empty? %> +

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

+ <% else %> + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> + + <% end %> +
+ <% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> + <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> + <%= f.link_to 'PDF', :url => params %> + <% end %> +
+ + + + +<% end %> + +<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> + +<% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> +<% end %> + +<% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, + {:query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_issue_plural)) %> + <%= auto_discovery_link_tag(:atom, + {:controller => 'journals', :action => 'index', + :query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_changes_details)) %> +<% end %> + +<%= context_menu issues_context_menu_path %> diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb deleted file mode 100644 index 866882053..000000000 --- a/app/views/issues/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>'); diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 69abf79a6..38afc672d 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,181 +1,181 @@ -
-

<%= l(:label_issue_plural) %>

-
-<%# html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> -<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %> - -<%= render :partial => 'action_menu' %> - -

- <%= issue_heading(@issue) %> -

- - - -
- <% if @prev_issue_id || @next_issue_id %> - - <% end %> - - - -
-<%= render_issue_subject_with_tree(@issue) %> -
- - - - <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @issue,:show_flag => true,:user_id =>User.current.id,:horizontal => false}%> - - -

- <%= authoring @issue.created_on, @issue.author %>. - <% if @issue.created_on != @issue.updated_on %> - <%= l(:label_updated_time, time_tag(@issue.updated_on)).html_safe %>. - <% end %> -

- -
- <%= render :partial => 'tags/tag', :locals => {:obj => @issue,:object_flag => "3" }%> -
- -<%= issue_fields_rows do |rows| - rows.left l(:field_status), h(@issue.status.name), :class => 'status' - rows.left l(:field_priority), h(@issue.priority.name), :class => 'priority' - - unless @issue.disabled_core_fields.include?('assigned_to_id') - #modified by nie - #modified by huang - rows.left l(:field_assigned_to), (image_tag url_to_avatar(@issue.assigned_to(@user)), :class => 'avatar').to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to' - end - # end huang - unless @issue.disabled_core_fields.include?('category_id') - rows.left l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category' - end - unless @issue.disabled_core_fields.include?('fixed_version_id') - rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version' - end - - unless @issue.disabled_core_fields.include?('start_date') - rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date' - end - unless @issue.disabled_core_fields.include?('due_date') - rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date' - end - unless @issue.disabled_core_fields.include?('done_ratio') - rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress' - end - unless @issue.disabled_core_fields.include?('estimated_hours') - unless @issue.estimated_hours.nil? - rows.right l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours' - end - end - if User.current.allowed_to?(:view_time_entries, @project) - rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), project_issue_time_entries_path(@project, @issue)) : "-"), :class => 'spent-time' - end -end %> -<%= render_custom_fields_rows(@issue) %> -<%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> -
-woca -<% if @issue.description? || @issue.attachments.any? -%> -
-<% if @issue.description? %> -
-
- <%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> -
- -

<%=l(:field_description)%>

-
- <%= textilizable @issue, :description, :attachments => @issue.attachments %> -
-
-<% end %> -<%= link_to_attachments @issue, :thumbnails => true %> -<% end -%> - -<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> - -<% if false # !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> -
- -
-
- <%= link_to_new_subtask(@issue) if User.current.allowed_to?(:manage_subtasks, @project) %> -
- -

<%=l(:label_subtask_plural)%>

-<%= render_descendants_tree(@issue) unless @issue.leaf? %> -
-<% end %> - -<% if @relations.present? || User.current.allowed_to?(:manage_issue_relations, @project) %> -
-
-<%= render :partial => 'relations' %> -
-<% end %> - -
- -<% if @changesets.present? %> -
-

<%=l(:label_associated_revisions)%>

-<%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> -
-<% end %> - -<% if @journals.present? %> -
-

<%=l(:label_history)%>

-<%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %> -
-<% end %> - - -
-<%= render :partial => 'action_menu' %> - -
-<% if @issue.editable? %> -
-

<%= l(:button_update) %>

- <%= render :partial => 'edit' %> -
-<% end %> - -<% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> - <%= f.link_to 'PDF' %> -<% end %> - - -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> - - <% if User.current.allowed_to?(:add_issue_watchers, @project) || - (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %> -
- <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> -
- <% end %> -<% end %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> -<% end %> - -<%= context_menu issues_context_menu_path %> +
+

<%= l(:label_issue_plural) %>

+
+<%# html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> +<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %> + +<%= render :partial => 'action_menu' %> + +

+ <%= issue_heading(@issue) %> +

+ + + +
+ <% if @prev_issue_id || @next_issue_id %> + + <% end %> + + + +
+<%= render_issue_subject_with_tree(@issue) %> +
+ + + + <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @issue,:show_flag => true,:user_id =>User.current.id,:horizontal => false}%> + + +

+ <%= authoring @issue.created_on, @issue.author %>. + <% if @issue.created_on != @issue.updated_on %> + <%= l(:label_updated_time, time_tag(@issue.updated_on)).html_safe %>. + <% end %> +

+ +
+ <%= render :partial => 'tags/tag', :locals => {:obj => @issue,:object_flag => "3" }%> +
+ +<%= issue_fields_rows do |rows| + rows.left l(:field_status), h(@issue.status.name), :class => 'status' + rows.left l(:field_priority), h(@issue.priority.name), :class => 'priority' + + unless @issue.disabled_core_fields.include?('assigned_to_id') + #modified by nie + #modified by huang + rows.left l(:field_assigned_to), (image_tag url_to_avatar(@issue.assigned_to(@user)), :class => 'avatar').to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to' + end + # end huang + unless @issue.disabled_core_fields.include?('category_id') + rows.left l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category' + end + unless @issue.disabled_core_fields.include?('fixed_version_id') + rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version' + end + + unless @issue.disabled_core_fields.include?('start_date') + rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date' + end + unless @issue.disabled_core_fields.include?('due_date') + rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date' + end + unless @issue.disabled_core_fields.include?('done_ratio') + rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress' + end + unless @issue.disabled_core_fields.include?('estimated_hours') + unless @issue.estimated_hours.nil? + rows.right l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours' + end + end + if User.current.allowed_to?(:view_time_entries, @project) + rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), project_issue_time_entries_path(@project, @issue)) : "-"), :class => 'spent-time' + end +end %> +<%= render_custom_fields_rows(@issue) %> +<%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> +
+ +<% if @issue.description? || @issue.attachments.any? -%> +
+<% if @issue.description? %> +
+
+ <%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> +
+ +

<%=l(:field_description)%>

+
+ <%= textilizable @issue, :description, :attachments => @issue.attachments %> +
+
+<% end %> +<%= link_to_attachments @issue, :thumbnails => true %> +<% end -%> + +<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> + +<% if false # !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> +
+ +
+
+ <%= link_to_new_subtask(@issue) if User.current.allowed_to?(:manage_subtasks, @project) %> +
+ +

<%=l(:label_subtask_plural)%>

+<%= render_descendants_tree(@issue) unless @issue.leaf? %> +
+<% end %> + +<% if @relations.present? || User.current.allowed_to?(:manage_issue_relations, @project) %> +
+
+<%= render :partial => 'relations' %> +
+<% end %> + +
+ +<% if @changesets.present? %> +
+

<%=l(:label_associated_revisions)%>

+<%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> +
+<% end %> + +<% if @journals.present? %> +
+

<%=l(:label_history)%>

+<%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %> +
+<% end %> + + +
+<%= render :partial => 'action_menu' %> + +
+<% if @issue.editable? %> +
+

<%= l(:button_update) %>

+ <%= render :partial => 'edit' %> +
+<% end %> + +<% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> + <%= f.link_to 'PDF' %> +<% end %> + + +<% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> + + <% if User.current.allowed_to?(:add_issue_watchers, @project) || + (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %> +
+ <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> +
+ <% end %> +<% end %> + +<% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> +<% end %> + +<%= context_menu issues_context_menu_path %> diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 1dc15e481..823fbc3e8 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -89,7 +89,7 @@ closeBtn.bind("click",function(){ sideContent.animate({width: '0px'},"fast"); show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); - cookiesave('minStatue','false','','',''); + cookiesave('minStatue','true','','',''); }); //show??? show_btn.bind("click",function() { @@ -121,15 +121,15 @@ function cookiesave(n, v, mins, dn, path) { if(n) { - + if(!mins) mins = 365 * 24 * 60; if(!path) path = "/"; var date = new Date(); - + date.setTime(date.getTime() + (mins * 60 * 1000)); - + var expires = "; expires=" + date.toGMTString(); - + if(dn) dn = "domain=" + dn + "; "; document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path; @@ -167,11 +167,11 @@ function cookieget(n) <% get_memo %> <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> <%= f.text_area :subject, :class => "opnionText", :placeholder => l(:label_feedback_tips) %> - <%= f.hidden_field :content, :required => true , :value => l(:label_feedback_value) %> + <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> <%= l(:label_submit)%> - <% end %> -
+ <% end %> +
<%= l(:label_technical_support) %>黄井泉 <%= l(:label_technical_support) %>白   羽 diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 0c4e54317..a5269d422 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -1,11 +1,11 @@
<% if ( !(User.current.member_of? @project) && User.current.login?) %> - <%= watcher_link(@project, User.current) %> + <%= watcher_link_for_project(@project, User.current) %> <% end %> <% if ( !(User.current.member_of? @project) && User.current.login?) %> - <%= applied_link(@project, User.current) %> + <%= join_in_project_link(@project, User.current) %> <% end %> <% if ((User.current.member_of? @project) && diff --git a/app/views/layouts/_point_browser.html.erb b/app/views/layouts/_point_browser.html.erb new file mode 100644 index 000000000..e936a6b11 --- /dev/null +++ b/app/views/layouts/_point_browser.html.erb @@ -0,0 +1,46 @@ + + + + + 升级浏览器 + + + + + + +
+ 您当前使用的是IE8浏览器,建议升级您的浏览器。 + + +
+
+ + + + - - <%=h html_title %> - - - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> - <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> - <%= javascript_include_tag "jquery.leanModal.min" %> - <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= call_hook :view_layouts_base_html_head %> - - <%= yield :header_tags -%> + +<%=h html_title %> + <%= render :partial => "layouts/point_browser" %> + + +<%= csrf_meta_tag %> +<%= favicon %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> +<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> +<%= javascript_heads %> +<%= javascript_include_tag "jquery.leanModal.min" %> +<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> +<%= heads_for_theme %> +<%= call_hook :view_layouts_base_html_head %> + +<%= yield :header_tags -%> -
-
-
- <%=render :partial => 'layouts/base_header'%> -
-
- <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
- <%=render :partial => 'layouts/base_footer'%> -
+
+
+
+<%=render :partial => 'layouts/base_header'%> +
+
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+ <%=render :partial => 'layouts/base_footer'%> +
+ +
+
-
-
- - + + -
-
- <%= call_hook :view_layouts_base_body_bottom %> +
+
+<%= call_hook :view_layouts_base_body_bottom %> diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb index a11defebf..42a7eccd1 100644 --- a/app/views/layouts/base_contest.html.erb +++ b/app/views/layouts/base_contest.html.erb @@ -194,7 +194,7 @@ <% if show_more_fans?(@bid) %> - <%= link_to l(:label_more), :controller => 'bids', :action => 'show_bid_user'%> + <%= link_to l(:button_more), :controller => 'bids', :action => 'show_bid_user'%> <% end %>
@@ -217,7 +217,7 @@ <% if show_more_bid_project?(@bid) %> - <%= link_to l(:label_more), :controller => 'bids', :action => 'show_project'%> + <%= link_to l(:button_more), :controller => 'bids', :action => 'show_project'%> <% end %>
@@ -244,7 +244,7 @@ <% if show_more_participate?(@bid) %> - <%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%> + <%= link_to l(:button_more), :controller => "bids", :action => "show_participator"%> <% end %> diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index cc9cdd071..a7e2ef08a 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -12,11 +12,12 @@ <%= csrf_meta_tag %> <%= favicon %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> - <%= javascript_include_tag "ckeditor/ckeditor.js" %> + <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -52,7 +53,7 @@ + <% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %> + <%= link_to "#{attaments_num}", project_files_path(@project), :style => "color:#3CA5C6;font-weight:bold" %>
) + +
+ <% end %> @@ -163,18 +164,18 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects',:style => "font-size:12px;color:#fff; padding:0px 3px 3px 3px;height:16px;margin-top:5px;background:#28be6c;float:right;line-height:20px;" %> + <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects',:style => "font-size:12px !important;color:#fff; padding:0px 3px 3px 3px;height:16px;margin-top:5px;background:#28be6c;float:right;line-height:20px;" %> <% end %> <% end%> <% unless @project.enabled_modules.where("name = 'files'").empty? %> <% end%> @@ -188,7 +189,7 @@ <% end %> - + diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index d68e6abe5..213c9ed07 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -258,10 +258,10 @@ <% else %> - <%= l(:label_identity)%>: + <%= l(:label_identity)%>: - <%= l(:label_account_student) %> + <%= l(:label_account_identity_student) %> @@ -269,10 +269,10 @@ <% elsif @user.user_extensions.identity == 3 %> - <%= l(:label_identity)%>: + <%= l(:label_identity)%>: - <%= l(:label_account_developer) %> + <%= l(:label_account_identity_developer) %> <% end %> @@ -295,7 +295,7 @@ <% if show_more_watchers?(@user) %>
- <%= link_to l(:label_more), :controller => "users", :action => "user_watchlist"%> + <%= link_to l(:button_more), :controller => "users", :action => "user_watchlist"%>
<% end %> @@ -319,7 +319,7 @@ <% if show_more_fans?(@user) %>
- <%= link_to l(:label_more), :controller => "users", :action => "user_fanslist"%> + <%= link_to l(:button_more), :controller => "users", :action => "user_fanslist"%>
<% end %> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index c5be3f4fd..c24ab84e7 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -41,7 +41,8 @@ a:hover.mail_reply{ background:#06a9bc; text-decoration:none;}
-

<%= l(:mail_issue_greetings)%>

+ +
<%= yield %>
diff --git a/app/views/memos/_reply_box.html.erb b/app/views/memos/_reply_box.html.erb index 938952c32..1ee94dd3e 100644 --- a/app/views/memos/_reply_box.html.erb +++ b/app/views/memos/_reply_box.html.erb @@ -3,12 +3,12 @@ <%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %> <%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
- + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %> <%= label_tag(l(:label_reply_plural)) %>: - <%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %> - + <%= f.kindeditor :content, :cols => 80, :rows => 15, :value => @content %> +

<%= l(:label_attachment_plural) %>
diff --git a/app/views/memos/_topic_form.html.erb b/app/views/memos/_topic_form.html.erb index d7d0aeca0..ec16fbc5c 100644 --- a/app/views/memos/_topic_form.html.erb +++ b/app/views/memos/_topic_form.html.erb @@ -1,9 +1,10 @@ <%= labelled_form_for(@memo, :url => forum_memos_path) do |f| %>

+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>

<%= f.text_field :subject, :required => true, :size => 95 %>

-

<%= f.text_area :content, :required => true, :id => 'editor01' %>

- +

<%= f.kindeditor :content, :required => true %>

+

diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 008522316..00ce81933 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,6 +1,6 @@ <% @replying = !@memo.parent.nil? %> - +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>

<%=l(:label_memo_edit)%>

<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo)) do |f| %> <% if @memo.errors.any? %> @@ -40,9 +40,9 @@

<% end %>

- <%= f.text_area :content, :required => true, :size => 80, id: 'editor01' %> + <%= f.kindeditor :content, :required => true, :size => 80,:owner_id => @memo.id,:owner_type => 1 %>

- +

<%= l(:label_attachment_plural) %>
diff --git a/app/views/memos/new.html.erb b/app/views/memos/new.html.erb index 7f5667663..b884df909 100644 --- a/app/views/memos/new.html.erb +++ b/app/views/memos/new.html.erb @@ -4,7 +4,7 @@ @nav_dispaly_main_contest_label = 1 %> <% @nav_dispaly_forum_label = 1%> -<%= javascript_include_tag "ckeditor/ckeditor.js" %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>

diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 995529fe9..0db7c4e4a 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -4,10 +4,11 @@ margin-bottom: 13px; } +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> -
+
<%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %>
@@ -30,7 +31,7 @@ :remote => true, :method => 'get', :title => l(:button_quote) - )if !@memo.locked? && User.current.logged? %> + )if !@memo.locked? && User.current.logged? %> <%= link_to( #image_tag('edit.png'), @@ -64,7 +65,7 @@
<%= textAreailizable(@memo,:content) %> -

+

<% if @memo.attachments.any?%> <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> @@ -100,7 +101,7 @@ :method => 'get', :title => l(:button_quote) )if !@memo.locked? && User.current.logged? %> - + <%= link_to( #image_tag('edit.png'), l(:button_edit), @@ -120,7 +121,7 @@ :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) - ) if reply.destroyable_by?(User.current) %> + ) if reply.destroyable_by?(User.current) %>


@@ -146,7 +147,7 @@ <%= authoring reply.created_at, reply.author %>
-
+
<% end %>