diff --git a/Gemfile b/Gemfile index a04059bfa..3784e60d8 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,22 @@ gem 'acts-as-taggable-on' group :development do gem 'better_errors', path: 'lib/better_errors' gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' + if ENV['PRY'] + gem 'pry' + gem 'pry-nav' + end +end + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer', :platforms => :ruby + + gem 'uglifier', '>= 1.0.3' end # Optional gem for LDAP authentication diff --git a/Gemfile.lock b/Gemfile.lock index 25cc9f48f..6680070a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,7 +53,16 @@ GEM arel (3.0.2) builder (3.0.0) coderay (1.0.9) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.6.1) erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) fastercsv (1.5.0) hike (1.2.3) i18n (0.6.1) @@ -99,6 +108,11 @@ GEM rdoc (3.12.2) json (~> 1.4) ruby-openid (2.1.8) + sass (3.2.7) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -110,6 +124,9 @@ GEM polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) + uglifier (1.0.3) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) PLATFORMS x86-mingw32 @@ -121,6 +138,7 @@ DEPENDENCIES better_errors! builder (= 3.0.0) coderay (~> 1.0.6) + coffee-rails (~> 3.2.1) fastercsv (~> 1.5.0) i18n (~> 0.6.0) jquery-rails (~> 2.0.2) @@ -130,4 +148,6 @@ DEPENDENCIES rack-openid rails (= 3.2.13) ruby-openid (~> 2.1.4) + sass-rails (~> 3.2.3) seems_rateable! + uglifier (>= 1.0.3) diff --git a/ReadMe.txt b/ReadMe.txt index e7444a6c5..9d223259a 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,11 +1,18 @@ patch: -用户姓名的部分,根据issues#655。 -为了修改方便 -alias: -方法 之前显示 调整之后 +鐢ㄦ埛濮撳悕鐨勯儴鍒嗭紝鏍规嵁issues#655銆 +涓轰簡淇敼鏂逛究 +alias锛 +鏂规硶 涔嬪墠鏄剧ず 璋冩暣涔嬪悗 name firstname+lastname login nickname xxx login realname xxx firstname+lastname + +User model缁忚繃淇敼锛屽凡缁忓畬鍏ㄩ泦鎴愪簡user_extensions鐨勫姛鑳 +渚嬪 +user.gender=1 +user.save +user_extensions瀛楁浼氳嚜鍔ㄤ繚瀛 +涓嶅繀瑕佹瘡娆ser.user_extensions.xxx浠ュ強鍒ゆ柇鏄惁涓虹┖ ================================================================================ app/models/setting.rb :165 # fixed domain url in development. tantantan's bug @@ -14,22 +21,22 @@ app/models/setting.rb :165 define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/ end end - 程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。 - 为了开发方便,使之功能在development模式下失效。 + 绋嬪簭閮ㄥ垎閾炬帴涓埗瀹氫簡subdomain鍙傛暟锛屼娇閾炬帴鍦ㄤ簩绾у煙鍚嶄腑鏉ュ洖璺宠浆銆 + 涓轰簡寮鍙戞柟渚匡紝浣夸箣鍔熻兘鍦╠evelopment妯″紡涓嬪け鏁堛 # => nyan ================================================================================ app/controller/projects_controller.rb ===> projects#fake - fake filter: 修改了传到页面中的Count后缀的数量 - 改为正确的数量,删掉fake过滤器即可 + fake filter: 淇敼浜嗕紶鍒伴〉闈腑鐨凜ount鍚庣紑鐨勬暟閲 + 鏀逛负姝g‘鐨勬暟閲忥紝鍒犳帀fake杩囨护鍣ㄥ嵆鍙 ================================================================================ -#导航栏匹配域名显示和改变 +#瀵艰埅鏍忓尮閰嶅煙鍚嶆樉绀哄拰鏀瑰彉 app\helper\application_helper.rb # rewrite navigation app\views\layouts\_base_header.html.erb # reset navigation by domain name and url through regular match ================================================================================ -#首页根据域名匹配进入不同的页面 +#棣栭〉鏍规嵁鍩熷悕鍖归厤杩涘叆涓嶅悓鐨勯〉闈 app\controller\welcome_controller.rb def entry_select_user if request.original_url.match(/user\.trustie\.net/) diff --git a/app/assets/javascripts/applied_project.js b/app/assets/javascripts/applied_project.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/applied_project.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/javascripts/attachment_type_edit.js b/app/assets/javascripts/attachment_type_edit.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/attachment_type_edit.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/applied_project.css b/app/assets/stylesheets/applied_project.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/applied_project.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/assets/stylesheets/attachment_type_edit.css b/app/assets/stylesheets/attachment_type_edit.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/attachment_type_edit.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 2f642f544..99160b0c0 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -139,9 +139,9 @@ class AttachmentsController < ApplicationController # Make sure association callbacks are called container = @attachment.container @attachment.container.attachments.delete(@attachment) - if container.attachments.empty? - container.delete - end + #if container.attachments.empty? + #container.delete + #end respond_to do |format| format.html { redirect_to_referer_or respond_path(@bid) } diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index d63f0cfbb..cdf6e7d5a 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -695,7 +695,7 @@ class BidsController < ApplicationController @bid.budget = 0 @bid.author_id = User.current.id @bid.commit = 0 - @bid.homework_type = params[:bid][:homework_type] + @bid.homework_type = 1 @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) # @bid. if @bid.save @@ -881,6 +881,7 @@ class BidsController < ApplicationController def memberAccess # 鏄绋嬶紝鍒欏垽鏂綋鍓嶇敤鎴锋槸鍚﹀弬鍔犱簡璇剧▼ + return true if current_user.admin? return 0 if @bid.courses.first.project_type == Project::ProjectType_project currentUser = User.current render_403 unless currentUser.member_of?(@bid.courses.first) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index cd6d5abbe..b83040ef6 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -5,7 +5,8 @@ class ContestsController < ApplicationController menu_item :project, :only => :show_project menu_item :application, :only => :show_softapplication menu_item :attendingcontest, :only => :show_attendingcontest - before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, + menu_item :contestnotification, :only => :show_notification + before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :show_notification, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq @@ -355,6 +356,17 @@ class ContestsController < ApplicationController end ###end + +def show_notification + @contest = Contest.find_by_id(params[:id]) + respond_to do |format| + format.html { + render :layout => 'base_newcontest' + } + format.api + end +end + def set_reward_project @c_p = nil diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 5b81b7291..ed6f9937d 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -70,7 +70,7 @@ class FilesController < ApplicationController Mailer.attachments_added(attachments[:files]).deliver end - # 涓存椂鐢 + # TODO: 涓存椂鐢 nyan sort_init 'created_on', 'desc' sort_update 'created_on' => "#{Attachment.table_name}.created_on", 'filename' => "#{Attachment.table_name}.filename", diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 64bfe5c40..24e1a86e4 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -18,7 +18,7 @@ class HomeworkAttachController < ApplicationController end def create - if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) + #if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) user_id = params[:user_id] bid_id = params[:bid_id] sta = 0 @@ -32,21 +32,22 @@ class HomeworkAttachController < ApplicationController :bid_id => bid_id } + #@bid = Bid.find bid_id + #@homework_list = @bid.homeworks + @homework = HomeworkAttach.new(options) @homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@homework) - @homework.save - respond_to do |format| - if @homework.save - format.html { redirect_to @homework, notice: 'Post was successfully created.' } - format.json { render json: @homework, status: :created, location: @homework } - else - format.html { render action: "new" } - format.json { render json: @homework.errors, status: :unprocessable_entity } + if @homework.save + respond_to do |format| + format.html { redirect_to project_for_bid_path @homework.bid } + format.json { head :no_content } end + else + end - end + #end end def new @@ -65,23 +66,30 @@ class HomeworkAttachController < ApplicationController def update @homework = HomeworkAttach.find(params[:id]) - respond_to do |format| - if @post.update_attributes(params[:homework]) - format.html { redirect_to @homework, notice: 'Homework was successfully updated.' } + name = params[:homework_name] + description = params[:homework_description] + @homework.name = name + @homework.description = description + if params[:attachments] + @homework.save_attachments(params[:attachments]) + end + if @homework.save + respond_to do |format| + format.html { redirect_to project_for_bid_path @homework.bid } format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @homework.errors, status: :unprocessable_entity } end + else end end def destroy - @homework = HomeworkAttach.find(params([:id])) - @homework.destroy - respond_to do |format| - format.html {render @homework} - format.json {render json: @homework} + @homework = HomeworkAttach.find(params[:id]) + if @homework.destroy + respond_to do |format| + format.html { redirect_to project_for_bid_path @homework.bid } + format.json { head :no_content } + end + else end end diff --git a/app/controllers/mail_handler_controller.rb b/app/controllers/mail_handler_controller.rb index 3a4b219bb..183a1ea52 100644 --- a/app/controllers/mail_handler_controller.rb +++ b/app/controllers/mail_handler_controller.rb @@ -29,6 +29,11 @@ class MailHandlerController < ActionController::Base end end + #鍙栨秷閭欢閫氱煡 + def cancel_mail_notify + + end + private def check_credential diff --git a/app/controllers/open_source_projects_controller.rb b/app/controllers/open_source_projects_controller.rb index 1ca7ddcef..ee3af10ce 100644 --- a/app/controllers/open_source_projects_controller.rb +++ b/app/controllers/open_source_projects_controller.rb @@ -1,8 +1,8 @@ class OpenSourceProjectsController < ApplicationController - + before_filter :find_osp, :only => [:master_apply, :accept_master_apply, :refuse_master_apply] before_filter :require_master, :only => [:master_apply, :accept_master_apply, :refuse_master_apply] - + helper :sort include SortHelper helper :apply_project_masters @@ -12,6 +12,7 @@ class OpenSourceProjectsController < ApplicationController # GET /open_source_projects # GET /open_source_projects.json def index + @app_dir = params[:app_dir] @language = params[:language] @created_at = params[:created_at] @@ -22,8 +23,10 @@ class OpenSourceProjectsController < ApplicationController @os_project_count = @open_source_projects.count @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page'] - + @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page) + + @bugs = BugToOsp.order('created_at desc').limit(8) # @open_source_projects = OpenSourceProject.all @@ -32,11 +35,11 @@ class OpenSourceProjectsController < ApplicationController format.json { render json: @open_source_projects } end end - + def master_apply @apply = @open_source_project.apply_tips @applicants = @open_source_project.applicants - + respond_to do |format| format.html { render :layout => "base_opensource_p" @@ -49,7 +52,7 @@ class OpenSourceProjectsController < ApplicationController # GET /open_source_projects/1.json def show @open_source_project = OpenSourceProject.find(params[:id]) - + sort_init 'updated_at', 'desc' sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at", 'replies' => "#{RelativeMemo.table_name}.replies_count", @@ -63,9 +66,9 @@ class OpenSourceProjectsController < ApplicationController includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). - order(sort_clause). + order(sort_clause). all - + @bugs = @open_source_project.bugs.limit(6) respond_to do |format| @@ -75,26 +78,36 @@ class OpenSourceProjectsController < ApplicationController format.json { render json: @open_source_project } end end - - -def search + + def allbug + @bugs = BugToOsp.visible + @bug_count = @bugs.count + @bug_pages = Paginator.new @bug_count, per_page_option, params['page'] + @bugs = @bugs.includes(:bug).reorder("#{RelativeMemo.table_name}.created_at DESC").limit(@bug_pages.per_page).offset(@bug_pages.offset).all + + respond_to do |format| + format.html + format.json { render json: @open_source_project } + end end + def search -# added by yiang 鏆村姏娣诲姞,璇风粫閬 -def showmemo - @open_source_project = OpenSourceProject.find(params[:id]) + end - sort_init 'updated_at', 'desc' - sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at", + def showbug + @open_source_project = OpenSourceProject.find(params[:id]) + + sort_init 'updated_at', 'desc' + sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at", 'replies' => "#{RelativeMemo.table_name}.replies_count", 'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)" - @memo = RelativeMemo.new(:open_source_project => @open_source_project) - @topic_count = @open_source_project.topics.count - @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] - @memos = @open_source_project.topics. + @memo = RelativeMemo.new(:open_source_project => @open_source_project) + @topic_count = @open_source_project.bugs.count + @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + @memos = @open_source_project.bugs. reorder("#{RelativeMemo.table_name}.sticky DESC"). includes(:last_reply). limit(@topic_pages.per_page). @@ -102,13 +115,42 @@ def showmemo order(sort_clause). all - respond_to do |format| - format.html { - render :layout => "base_opensource_p" - } - format.json { render json: @open_source_project } + respond_to do |format| + format.html { + render :layout => "base_opensource_p" + } + format.json { render json: @open_source_project } + end end -end + + # added by yiang 鏆村姏娣诲姞,璇风粫閬 + def showmemo + @open_source_project = OpenSourceProject.find(params[:id]) + + sort_init 'updated_at', 'desc' + sort_update 'created_at' => "#{RelativeMemo.table_name}.created_at", + 'replies' => "#{RelativeMemo.table_name}.replies_count", + 'updated_at' => "COALESCE (last_replies_relative_memos.created_at, #{RelativeMemo.table_name}.created_at)" + + @memo = RelativeMemo.new(:open_source_project => @open_source_project) + @topic_count = @open_source_project.topics.count + @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + @memos = @open_source_project.topics. + reorder("#{RelativeMemo.table_name}.sticky DESC"). + includes(:last_reply). + limit(@topic_pages.per_page). + offset(@topic_pages.offset). + order(sort_clause). + all + + respond_to do |format| + format.html { + render :layout => "base_opensource_p" + } + format.json { render json: @open_source_project } + end + end + # GET /open_source_projects/new # GET /open_source_projects/new.json def new @@ -168,52 +210,51 @@ end format.json { head :no_content } end end - + def remove_condition @app_dir = params[:app_dir] @language = params[:language] @created_at = params[:created_at] redirect_to open_source_projects_path(:app_dir => @app_dir, :language => @language, :created_at => @created_at, :name => params[:name]) end - + def search # per_page_option = 10 -# + # # @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at) # @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present? -# + # # @os_project_count = @open_source_projects.count # @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page'] -# + # # @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page) redirect_to open_source_projects_path(:name => params[:name]) end - + def refuse_master_apply @apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id) @apply.first.destory - + redirect_to master_apply_open_source_project_path end - + def accept_master_apply @apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id) if @apply.count == 1 - @apply.first.update_attributes(:status => 2) + @apply.first.update_attributes(:status => 2) end - + redirect_to master_apply_open_source_project_path end - - + private - + def require_master render_403 unless @open_source_project.admin?(User.current) end - + def find_osp @open_source_project = OpenSourceProject.find(params[:id]) render_404 unless @open_source_project.present? diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 31675ca5d..b8d81b108 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -47,7 +47,7 @@ class SoftapplicationsController < ApplicationController def show @softapplication = Softapplication.find(params[:id]) - @project = Project.find_by_identifier(@softapplication.deposit_project) + @project = @softapplication.project # 鎵撳垎缁熻 stars_reates = @softapplication. rates(:quality) @@ -142,13 +142,16 @@ class SoftapplicationsController < ApplicationController def create @softapplication = Softapplication.new(params[:softapplication]) @softapplication.user = User.current - @softapplication.deposit_project = params[:project] + #@softapplication.deposit_project = params[:project] + @softapplication.project = Project.find_by_id(params[:project]) @softapplication.save_attachments(params[:attachments]) respond_to do |format| if @softapplication.save ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id) + #ProjectingSoftapplication.create_softapplication_projecting(:project_id => params[:project_id], :softapplication_id => @softapplication.id) + #ProjectingSoftapplication.create_softapplication_projecting(@project.id, softapplication.id) format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) } # format.json { render json: @softapplication, status: :created, location: @softapplication } else @@ -170,7 +173,8 @@ class SoftapplicationsController < ApplicationController # @softapplication = Softapplication.find(params[:id]) @softapplication.attachments.map{|attach| attach.destroy } @softapplication.save_attachments(params[:attachments]) - @softapplication.deposit_project = params[:project] + #@softapplication.deposit_project = params[:project] + @softapplication.project = Project.find_by_id(params[:project]) respond_to do |format| if @softapplication.update_attributes(params[:softapplication]) format.html { redirect_to @softapplication, notice: l(:notice_softapplication_was_successfully_updated) } diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index c662c44f7..c92f39d34 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -21,13 +21,7 @@ class WelcomeController < ApplicationController before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index] def index - projectActive = Project.project_entities.active - @projectCount = projectActive.count - @projectPublicCount = projectActive.all_public.count - @projectHidenCount = @projectCount - @projectPublicCount - @developerCount = User.developer.count - @allUsercount = User.count end def robots @@ -36,10 +30,7 @@ class WelcomeController < ApplicationController end def course - @courseCount = Project.course_entities.count - @teacherCount = User.teacher.count - @studentCount = User.student.count - @logoLink = logolink() + @logoLink ||= logolink() end @@ -121,25 +112,25 @@ class WelcomeController < ApplicationController end end - def render(*args) - _fake if @fake_filter - super - end + # def render(*args) + # _fake if @fake_filter + # super + # end - private + # private - def fake - @fake_filter = true - end + # def fake + # @fake_filter = true + # end - # 楠楀瓙鏂规硶 - def _fake - instance_variables.map { |variable| - if variable.to_s =~ /Count$/ - self.instance_variable_set(variable.to_sym, - ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i) - end - } - end + # # 楠楀瓙鏂规硶 + # def _fake + # instance_variables.map { |variable| + # if variable.to_s =~ /Count$/ + # self.instance_variable_set(variable.to_sym, + # ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i) + # end + # } + # end end diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 57078a436..5f5a22279 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -20,8 +20,36 @@ class ZipdownController < ApplicationController #@error = e end + #涓嬭浇鏌愪竴瀛︾敓鐨勪綔涓氱殑鎵鏈夋枃浠 + def download_user_homework + obj_class = params[:obj_class] + obj_id = params[:obj_id] + user_id = params[:user_id] + obj = obj_class.constantize.find(obj_id) + zipfile = nil + case obj.class.to_s.to_sym + when :Bid + zipfile = zip_user_bid obj,user_id + else + logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!" + end + send_file zipfile, :filename => obj.name, :type => detect_content_type(zipfile) if zipfile + end + private + def zip_user_bid(bid,user_id) + # Todo: User Access Controll + + homeattaches = bid.homeworks.where("user_id = ?",user_id) + # 寰楀埌姣忎竴涓汉鎵鏈夋枃浠舵墦鍖呯殑zip鏂囦欢 + # 骞跺皢姣忎竴涓汉鐨剒ip鎵撳寘涓轰竴涓苟杩斿洖璺緞 + user_zip_paths = homeattaches.map do |homeattach| + zip_homework_by_user homeattach + end + zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER + end + def zip_bid(bid) # Todo: User Access Controll diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index da674bb56..53982482b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -796,7 +796,7 @@ module ApplicationHelper tmp = Hash.new tmp={"" => ""} option.each do |project| - tmp[project.name] = project.identifier + tmp[project.name] = project.id end tmp end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 4c27af480..70029a55a 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -216,4 +216,9 @@ module CoursesHelper end people.include?(User.current) end + #鑾峰彇褰撳墠鐢ㄦ埛鍦ㄦ寚瀹氫綔涓氫笅鎻愪氦鐨勪綔涓氱殑闆嗗悎 + def cur_user_homework_for_bid bid + cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,params[:id]) + cur_user_homework + end end diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb new file mode 100644 index 000000000..1abac35d6 --- /dev/null +++ b/app/helpers/homework_attach_helper.rb @@ -0,0 +1,10 @@ +module HomeworkAttachHelper + def attach_delete(project) + if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id) + true + else + false + end + + end +end \ No newline at end of file diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 23351d919..5e7f7c18c 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -59,12 +59,11 @@ module IssuesHelper def issue_heading(issue) #h("#{issue.tracker} ##{issue.id}") - #h("#{issue.tracker} #{issue.source_from}") + # h("#{issue.tracker} #{issue.source_from}") s = '' - s << ">>" - s << link_to(@issue.project.name+l(:issue_list), project_issues_path(@issue.project)) - s << " >" - s << @issue.source_from + s << link_to(@issue.project.name, project_issues_path(@issue.project)) + s << " > #" + s << @issue.project_index s.html_safe end diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 480524457..26b4c13b9 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module JournalsHelper - def render_notes(issue, journal, options={}) + def render_links(issue, journal, options={}) content = '' editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1)) @@ -38,7 +38,35 @@ module JournalsHelper :title => l(:button_delete)) end end - content << content_tag('div', links.join(' ').html_safe, :class => 'contextual', :style => 'margin-top:-25px;') unless links.empty? + content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? + #content << textilizable(journal, :notes) + #css_classes = "wiki" + #css_classes << " editable" if editable + #content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes) + content.html_safe + end + + def render_notes (issue, journal, options={}) + content = '' + editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) + destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1)) + links = [] + if !journal.notes.blank? + links << link_to(l(:button_quote), + {:controller => 'journals', :action => 'new', :id => issue.id, :journal_id => journal}, + :remote => true, + :method => 'post', + :title => l(:button_quote)) if options[:reply_links] + links << link_to_in_place_notes_editor(l(:button_edit), "journal-#{journal.id}-notes", + { :controller => 'journals', :action => 'edit', :id => journal, :format => 'js' }, + :title => l(:button_edit)) if editable + #Added by young + if destroyable + links << link_to(l(:button_delete), { :controller => 'journals', :action => 'destroy', :id => journal, :format => 'js' }, + :title => l(:button_delete)) + end + end + #content << content_tag('div', links.join(' ').html_safe, :class => 'contextual', :style => 'margin-top:-25px;') unless links.empty? content << textilizable(journal, :notes) css_classes = "wiki" css_classes << " editable" if editable diff --git a/app/helpers/open_source_projects_helper.rb b/app/helpers/open_source_projects_helper.rb index f1c1cd35e..dfc7cc8d0 100644 --- a/app/helpers/open_source_projects_helper.rb +++ b/app/helpers/open_source_projects_helper.rb @@ -46,4 +46,12 @@ module OpenSourceProjectsHelper end description end + + def show_description_of_bug(bug) + description = bug.description + if description.nil? || description == '' + description = bug.open_source_project.name + l(:label_bug) + end + description + end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index f412e0c8e..87b495f00 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -69,28 +69,30 @@ module UsersHelper #
  • <%= link_to("鎵鏈夊弽棣", {:controller => 'users', :action => 'show', :type => 2}) %>
  • # - def show_activity(state) - content = ''.html_safe - case state - when 0 - s = content_tag('span', l(:label_user_all_activity), :class => "current-page") - content << content_tag('li', s) - content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) - content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) - when 1 - s = content_tag('span', l(:label_user_activity_myself), :class => "current-page") - content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) - content << content_tag('li', s, :class => "current-page") - content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) - when 2 - s = content_tag('span', l(:label_user_all_respond), :class => "current-page") - content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) - content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) - content << content_tag('li', s, :class => "current-page") - end - content_tag('div', content, :class => "pagination") - end + # TODO: 寰呭垹 + # def show_activity(state) + # content = ''.html_safe + # case state + # when 0 + # s = content_tag('span', l(:label_user_all_activity), :class => "current-page") + # content << content_tag('li', s) + # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) + # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) + # when 1 + # s = content_tag('span', l(:label_user_activity_myself), :class => "current-page") + # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) + # content << content_tag('li', s, :class => "current-page") + # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) + # when 2 + # s = content_tag('span', l(:label_user_all_respond), :class => "current-page") + # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) + # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) + # content << content_tag('li', s, :class => "current-page") + # end + # content_tag('div', content, :class => "pagination") + # end + #TODO: 寰呭垹 def watch_projects(state) content = ''.html_safe case state diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 330010212..c00f629dc 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -237,7 +237,7 @@ module WelcomeHelper content_tag('span', find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url) << - link_to((' ['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container), :class => "attachments_list_color") + link_to((' ['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container.project), :class => "attachments_list_color") else str << content_tag("span", "鏇存柊浜") << content_tag("span", find_all_event_type(event)) << diff --git a/app/models/bug_to_osp.rb b/app/models/bug_to_osp.rb index 5471bd3f9..9cd1d7359 100644 --- a/app/models/bug_to_osp.rb +++ b/app/models/bug_to_osp.rb @@ -5,4 +5,8 @@ class BugToOsp < ActiveRecord::Base validates_presence_of :osp_id, :relative_memo_id + scope :visible, lambda {|*args| + nil + } + end diff --git a/app/models/issue.rb b/app/models/issue.rb index d2332350a..7e899eafc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1156,7 +1156,11 @@ class Issue < ActiveRecord::Base # back string obj which is belong to project. def source_from "" << self.project.name.to_s << - "#" << (self.project.issues.index(self).to_i + 1).to_s + "#" << project_index + end + + def project_index + (self.project.issues.index(self).to_i + 1).to_s end private diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e0ad54296..bb7a2424f 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -57,12 +57,16 @@ class Mailer < ActionMailer::Base #濡傛灉鏄洿鎺ョ暀瑷骞朵笖鐣欒█瀵硅薄鏄疨roject骞朵笖Project绫诲瀷鏄绋 if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Project && journals_for_message.jour.project_type == 1 project = journals_for_message.jour + @author = journals_for_message.user #璇剧▼鐨勬暀甯 @teachers = searchTeacherAndAssistant journals_for_message.jour #鏀朵欢浜洪偖绠 @recipients ||= [] @teachers.each do |teacher| - @recipients << teacher.user.mail + if teacher.user.notify_about? journals_for_message + @recipients << teacher.user.mail + end + end mail :to => @recipients, :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} " @@ -440,10 +444,7 @@ class Mailer < ActionMailer::Base headers[:to].delete(@author.mail) if headers[:to].is_a?(Array) headers[:cc].delete(@author.mail) if headers[:cc].is_a?(Array) end - if !User.current.nil? - #涓嶇粰鏈汉鍙戦偖浠 - headers[:to].delete(User.current.mail) if headers[:to].is_a?(Array) - end + if @author && @author.logged? redmine_headers 'Sender' => @author.login end diff --git a/app/models/relative_memo.rb b/app/models/relative_memo.rb index 073d1ca12..f087fce2b 100644 --- a/app/models/relative_memo.rb +++ b/app/models/relative_memo.rb @@ -70,6 +70,11 @@ class RelativeMemo < ActiveRecord::Base def cannot_reply_to_locked_topic errors.add :base, l(:label_memo_locked) if root.locked? && self != root end + + def short_content(length = 25) + str = "^(.{,#{length}})[^\n\r]*.*$" + content.gsub(Regexp.new(str), '\1...').strip if content + end # def update_memos_forum # if forum_id_changed? diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb index 5e1e1bd50..f7eed43fc 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -6,10 +6,11 @@ class Softapplication < ActiveRecord::Base has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :contesting_softapplications, :dependent => :destroy - has_many :projecting_softapplications, :dependent => :destroy + #has_many :projecting_softapplications, :dependent => :destroy belongs_to :user belongs_to :project has_many :contests, :through => :contesting_softapplications + belongs_to :project def add_jour(user, notes, reference_user_id = 0, options = {}) if options.count == 0 diff --git a/app/models/user.rb b/app/models/user.rb index d376cd858..d664a0881 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -86,8 +86,6 @@ class User < Principal ## added by xianbo for delete has_many :biding_projects, :dependent => :destroy has_many :contesting_projects, :dependent => :destroy - has_many :contesting_softapplications, :dependent => :destroy - has_many :projecting_softapplications, :dependent => :destroy belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy ##ended by xianbo @@ -199,6 +197,53 @@ class User < Principal end } + + # ====================================================================== + # 闆嗕腑澶勭悊 User 鎵╁睍琛ㄤ负绌虹殑闂 + validate :valid_user_extensions + after_save :save_user_extensions + + def extensions + self.user_extensions ||= UserExtensions.new + end + + def respond_to?(m, include_private = false) + flag = UserExtensions.instance_methods.include? m.to_sym + if flag + flag + else + super + end + end + + def method_missing m, *args, &block + if extensions.respond_to? m.to_sym + self.class.send :define_method, m.to_sym, *args do + self.extensions.__send__ m.to_sym, *args + end + __send__ m.to_sym, *args, &block + + else + super + end + end + + def valid_user_extensions + if !self.extensions.valid? + self.extensions.errors.messages.each do |key, values| + values.each do |value| + self.errors.add key, value + end + end + end + end + + def save_user_extensions + self.extensions.save + end + # 闆嗕腑澶勭悊 User 鎵╁睍琛ㄤ负绌虹殑闂 < end + # ====================================================================== + #閫夋嫨椤圭洰鎴愬憳鏃舵樉绀虹殑鐢ㄦ埛淇℃伅鏂囧瓧 def userInfo info=self.nickname + ' (' + self.realname + ')'; @@ -665,6 +710,7 @@ class User < Principal end end + # Return true if the user is allowed to do the specified action on a specific context # Action can be: # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit') @@ -768,10 +814,39 @@ class User < Principal when News # always send to project members except when mail_notification is set to 'none' true + #鍒ゅ畾鐢ㄦ埛鏄惁鎺ュ彈鐣欒█鎻愰啋閭欢 + when JournalsForMessage + ##濡傛灉鏄洿鎺ョ暀瑷骞朵笖鐣欒█瀵硅薄鏄疨roject骞朵笖Project绫诲瀷鏄绋嬶紙璇剧▼鐣欒█锛 + if !object.at_user && object.jour.class.to_s.to_sym == :Project && object.jour.project_type == 1 + #鏍规嵁鐢ㄦ埛璁剧疆閭欢鎺ユ敹妯″紡鍒ゅ畾褰撳墠鐢ㄦ埛鏄惁鎺ュ彈閭欢鎻愰啋 + is_notified_project object.jour + end + end end end + #鐢ㄦ埛鏄惁鎺ユ敹project鐨勬秷鎭彁閱 + def is_notified_project arg + if arg.is_a?(Project) + case mail_notification + when 'selected' + notified_projects_ids.include?(arg.id) + when 'only_my_events' + projects.include?(arg) + when 'only_assigned' + false + when 'only_owner' + course = Course.find_by_extra(arg.identifier) + course.teacher == self + end + #鍕鹃夌殑椤圭洰鎴栫敤鎴风殑椤圭洰 TODO锛氶渶鏀 + #notified_projects_ids.include?(arg) || projects.include?(arg) + else + false + end + end + def self.current=(user) Thread.current[:current_user] = user end diff --git a/app/models/user_scores.rb b/app/models/user_score.rb similarity index 96% rename from app/models/user_scores.rb rename to app/models/user_score.rb index c939a20ff..f383d6670 100644 --- a/app/models/user_scores.rb +++ b/app/models/user_score.rb @@ -1,36 +1,36 @@ -# Redmine - project management software -# Copyright (C) 2006-2013 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class UserScore < ActiveRecord::Base - belongs_to :user - - def self.find_max_file - self.maximum(:file) - end - - def self.find_min_file - self.minimum(:file) - end - - def self.find_max_issue - self.maximum(:issue) - end - - def self.find_min_issue - self.minimum(:file) - end -end +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class UserScore < ActiveRecord::Base + belongs_to :user + + def self.find_max_file + self.maximum(:file) + end + + def self.find_min_file + self.minimum(:file) + end + + def self.find_max_issue + self.maximum(:issue) + end + + def self.find_min_issue + self.minimum(:file) + end +end diff --git a/app/views/attachments/_temp.html.erb b/app/views/attachments/_temp.html.erb new file mode 100644 index 000000000..c5a3661da --- /dev/null +++ b/app/views/attachments/_temp.html.erb @@ -0,0 +1,3 @@ +
    + <%= render :partial => 'tags/tagEx', :locals => {:obj => file, :object_flag => "6"} %> +
    \ No newline at end of file diff --git a/app/views/bids/_fork_form.html.erb b/app/views/bids/_fork_form.html.erb index ea110473c..1bfb4550b 100644 --- a/app/views/bids/_fork_form.html.erb +++ b/app/views/bids/_fork_form.html.erb @@ -15,9 +15,10 @@ <%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>

    -->

    <%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> -

    +
    <%= l(:label_attachment_plural) %>

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

    \ No newline at end of file diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index eb6b9bbf5..4e2681ba6 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -13,19 +13,22 @@ <% end %> -<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %> +<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && + (Member.where('user_id = ? and project_id = ?', User.current.id, + @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>
    - <%= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %> + + <%= link_to l(:label_course_new_homework),new_homework_attach_path %>
    <% end %> diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 5aa3462fa..f726c038f 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -32,8 +32,10 @@

    -->

    <%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>

    +

    <%= hidden_field_tag 'course_id', @project_id %>

    <%= l(:label_attachment_plural) %> diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index aa4140f95..fd4b0a93e 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -25,25 +25,35 @@ <% end %> <% display_id = im_watching_student_id? @bid%> <% @homework_list.each do |homework|%> - <% if homework.attachments.any?%> - +
    <%= image_tag(url_to_avatar(homework.user), :class => "avatar")%> - - + + +
    +   浣滀笟   :  - <% attachments = homework.attachments.map %> - <% for attachment in attachments %> - <% if attachments.count > 1 && attachment != attachments.first %> -
    - <% for item in 1..7 %> -   + <% if homework.name == nil || homework.name == "" %> + <% attachments = homework.attachments.map %> + <% for attachment in attachments %> + <% if attachments.count > 1 %> + <% homework_filename = attachment.filename + "绛" + attachments.count.to_s + "涓枃浠" %> + <% else %> + <% homework_filename = attachment.filename %> <% end %> + <% end %> - <%= link_to_attachment attachment , :download => true -%> + <% else %> + <% homework_filename = homework.name %> <% end %> + <%= link_to homework_filename, :controller => "zipdown", :action => "download_user_homework",:obj_class => @bid.class,:obj_id => @bid, :user_id =>homework.user%>
    <% if is_student %> @@ -70,33 +80,43 @@ <%= format("%.2f", sum * 1.0 / stars_reates_count) %> - <% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %> + <% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.created_at.to_s) %> 杩熶氦 <% end %>
      +   <% if is_cur_course_user? @bid %> <%= l(:label_bidding_user_studentcode) %>  锛 <%= homework.user.user_extensions.student_id%> <% end %> + <% if (User.current == homework.user) || (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && + (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',3,7, 9)).size >0) %> + <%= link_to l(:button_edit), edit_homework_attach_path(homework) %> + <%= link_to(l(:label_bid_respond_delete), homework, + method: :delete, :confirm => l(:text_are_you_sure)) %> + <% end %> +
    -
    - <% end %> +
    <% end %> diff --git a/app/views/contests/_list_softapplications.html.erb b/app/views/contests/_list_softapplications.html.erb index 9b99b675c..89e8a3172 100644 --- a/app/views/contests/_list_softapplications.html.erb +++ b/app/views/contests/_list_softapplications.html.erb @@ -4,7 +4,7 @@
    - 搴旂敤杞欢: + <%=l(:label_softapplication)%>: <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> @@ -12,7 +12,7 @@
    - 绠浠: + <%=l(:label_profile)%>: <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> @@ -20,7 +20,7 @@
    - 鍙戝竷鏃堕棿锛 + <%=l(:label_activity_time)%>锛 <%=format_time c_softapplication.created_at %> diff --git a/app/views/contests/_new.html.erb b/app/views/contests/_new.html.erb index 2462d3fb1..804c59429 100644 --- a/app/views/contests/_new.html.erb +++ b/app/views/contests/_new.html.erb @@ -45,7 +45,7 @@ <% else %> -
    +
    <%= l(:label_user_login_tips) %> <%= link_to l(:label_user_login_new), signin_path %>
    diff --git a/app/views/contests/_new_join.html.erb b/app/views/contests/_new_join.html.erb index c764690de..3b0cff690 100644 --- a/app/views/contests/_new_join.html.erb +++ b/app/views/contests/_new_join.html.erb @@ -36,7 +36,7 @@ } -

    璇疯緭鍏ョ珵璧涘瘑鐮

    +

    <%=l(:label_please_input_password)%>

    <%= form_tag( join_in_contest_contests_path(id: contest.id), :remote => true, diff --git a/app/views/contests/add.js.erb b/app/views/contests/add.js.erb index 9c696d8aa..0706d0c56 100644 --- a/app/views/contests/add.js.erb +++ b/app/views/contests/add.js.erb @@ -1,4 +1,4 @@ $('#contesting_project_list').html('<%= escape_javascript(render(:partial => 'project_list', :locals => {:contesting_project => @contesting_project})) %>'); -$("#project_id").val("璇烽夋嫨椤圭洰"); +$("#project_id").val("<%= l(:label_please_select_project) %>"); $("#contest_message").val( "<%= l(:label_bid_reason) %>" ); $("#put-bid-form").hide(); \ No newline at end of file diff --git a/app/views/contests/add_softapplication.js.erb b/app/views/contests/add_softapplication.js.erb index 6071c7070..dfe774100 100644 --- a/app/views/contests/add_softapplication.js.erb +++ b/app/views/contests/add_softapplication.js.erb @@ -1,4 +1,4 @@ $('#contesting_softapplication_list').html('<%= escape_javascript(render(:partial => 'softapplication_list', :locals => {:contesting_softapplication => @contesting_softapplication})) %>'); -$("#softapplication_id").val("璇烽夋嫨鍙傝禌搴旂敤"); +$("#softapplication_id").val("<%= l(:label_please_select_contestingsoftapplication) %>"); $("#contest_message").val( "<%= l(:label_bid_reason) %>" ); $("#put-bid-form").hide(); \ No newline at end of file diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index bbd01c241..8a567bd53 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -1,170 +1,177 @@ <%= render_flash_messages %>
    -
    娓╅Θ鎻愮ず锛氬鏋滄偍鍑嗗鍙傚姞绔炶禌锛岃鐐瑰嚮涓嬮潰鐨"鏂板缓鍙傝禌浣滃搧"锛
    -
    1) 鑻ユ偍宸插畬鎴愬紑鍙戯紝涓斿彧甯屾湜鍙戝竷鎮ㄧ殑浣滃搧锛屸滄墭绠¢」鐩濅竴椤瑰彲浠ヤ笉閫夛紱
    -
    2) 鑻ユ偍甯屾湜鎵樼绔炶禌鏁版嵁鍜屼唬鐮佷互鍙婁繚鐣欏紑鍙戝拰鎻愪氦浠g爜鐨勮建杩癸紝璇蜂粠鈥滄墭绠¢」鐩濅腑閫夋嫨涓椤规偍宸插垱寤哄ソ鐨勯」鐩綔涓鸿鍙傝禌浣滃搧鐨勬墭绠¢」鐩紝鑻ユ偍杩樻病鏈夊垱寤洪」鐩紝璇风偣鍑诲彸杈圭殑鈥滃垱寤洪」鐩濓紝鐒跺悗鍥炲埌鏈〉鍐嶉夋嫨銆
    +
    <%= l(:label_wellmeaning_intimation_contentone) %>
    +
    1) <%= l(:label_wellmeaning_intimation_contenttwo) %>
    +
    2) <%= l(:label_wellmeaning_intimation_contentthree) %>
    <% if User.current.logged? %> -
    -
    - 鍙傚姞绔炶禌锛 - <%= link_to '鏂板缓鍙傝禌浣滃搧', "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %> -
    - - -
    +
    +
    + <%= l(:label_attending_contest) %>锛 + <%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %> +
    +
    <% else %> -
    - <%= l(:label_user_login_attending_contest) %> - <%= link_to l(:label_user_login_new), signin_path %> -
    +
    + <%= l(:label_user_login_attending_contest) %> + <%= link_to l(:label_user_login_new), signin_path %> +
    <% end %> @@ -176,173 +183,185 @@ <% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %> -<% @contesting_project.sort.reverse.each do |c_project|%> -<% if c_project.project %> -
    -
    -
    -
    鍙傝禌浣滃搧: <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> -
    - - - - <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> + <% @contesting_project.sort.reverse.each do |c_project| %> + <% if c_project.project %> +
    +
    +
    +
    <%= l(:label_contest_work) %> + : <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> + +
    + + + + <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> <% if @contest.deadline < Date.today %> - <%= l(:label_noawards)%> - <% else%> - <%= l(:label_noawards_current)%> + <%= l(:label_noawards) %> + <% else %> + <%= l(:label_noawards_current) %> <% end %> <% else %> - <% case get_prize(c_project) %> + <% case get_prize(c_project) %> <% when '-1' %> - <%= image_tag("/images/bid/special_reward.png")%> + <%= image_tag("/images/bid/special_reward.png") %> <% when '0' %> - <%= image_tag("/images/bid/first_reward.png")%> + <%= image_tag("/images/bid/first_reward.png") %> <% when '1' %> - <%= image_tag("/images/bid/second_reward.png")%> + <%= image_tag("/images/bid/second_reward.png") %> <% when '2' %> - <%= image_tag("/images/bid/third_reward.png")%> + <%= image_tag("/images/bid/third_reward.png") %> <% when '3' %> - <%= image_tag("/images/bid/forth_reward.png")%> + <%= image_tag("/images/bid/forth_reward.png") %> <% when '4' %> - <%= image_tag("/images/bid/fifth_reward.png")%> + <%= image_tag("/images/bid/fifth_reward.png") %> <% when '5' %> - <%= image_tag("/images/bid/qualified.png")%> + <%= image_tag("/images/bid/qualified.png") %> <% end %> <% end %> - - - - - <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> - - <%= toggle_link '璇勫', c_project.id.to_s %> - - + + + + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + + <%= toggle_link l(:label_reward), c_project.id.to_s %> + + - - <% end %> -
    -
    -

    -
    -
    - - 绠浠: - <%= c_project.project.description.truncate(90, omission: '...') %> -
    -
    -
    - 鍙傝禌鏃堕棿锛<%= format_time c_project.created_at%> - 鍙傝禌浠h〃锛<%= c_project.user.name %> -
    + + + <% end %> +
    +
    +
    +
    +
    +
    + + <%= l(:label_profile) %>: + <%= c_project.project.description.truncate(90, omission: '...') %> + +
    +
    +
    + <%= l(:label_attendingcontest_time) %> + 锛<%= format_time c_project.created_at %> + <%= l(:label_attendingcontest_spoksman) %> + 锛<%= c_project.user.name %> +
    -
    +
    -
    -
    -<% end %> -
    -<% end %> +
    +
    + <% end %> +
    + <% end %> <% else %> -<% @contesting_softapplication.each do |c_softapplication|%> -<% if c_softapplication.softapplication %> -
    -
    - - 鍙傝禌浣滃搧: - <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> -
    -
    - -
    - - 绠浠: - <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> -
    -
    - -
    - 鍙傝禌鏃堕棿锛<%= format_time c_softapplication.created_at %> - 鍙傝禌浠h〃锛<%= c_softapplication.softapplication.user.name %> -
    - - -
    - 鏈缁堝緱鍒嗭細<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>鍒 + <% @contesting_softapplication.each do |c_softapplication| %> + <% if c_softapplication.softapplication %> +
    +
    + + <%= l(:label_contest_work) %>: + <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> + +
    +
    + +
    + + <%= l(:label_profile) %>: + <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> + +
    +
    + +
    + <%= l(:label_attendingcontest_time) %> + 锛<%= format_time c_softapplication.created_at %> + <%= l(:label_attendingcontest_spoksman) %> + 锛<%= c_softapplication.softapplication.user.name %> +
    + + +
    + <%= l(:label_final_scores) %> + 锛<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s %> + 鍒 - - - <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> + + + <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> <% if @contest.deadline < Date.today %> - <%= l(:label_noawards)%> - <% else%> - <%= l(:label_noawards_current)%> + <%= l(:label_noawards) %> + <% else %> + <%= l(:label_noawards_current) %> <% end %> <% else %> - <% case get_prize(c_softapplication) %> + <% case get_prize(c_softapplication) %> <% when '-1' %> - <%= image_tag("/images/bid/special_reward.png")%> + <%= image_tag("/images/bid/special_reward.png") %> <% when '0' %> - <%= image_tag("/images/bid/first_reward.png")%> + <%= image_tag("/images/bid/first_reward.png") %> <% when '1' %> - <%= image_tag("/images/bid/second_reward.png")%> + <%= image_tag("/images/bid/second_reward.png") %> <% when '2' %> - <%= image_tag("/images/bid/third_reward.png")%> + <%= image_tag("/images/bid/third_reward.png") %> <% when '3' %> - <%= image_tag("/images/bid/forth_reward.png")%> + <%= image_tag("/images/bid/forth_reward.png") %> <% when '4' %> - <%= image_tag("/images/bid/fifth_reward.png")%> + <%= image_tag("/images/bid/fifth_reward.png") %> <% when '5' %> - <%= image_tag("/images/bid/qualified.png")%> + <%= image_tag("/images/bid/qualified.png") %> <% end %> <% end %> - - + + - <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> -
    + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> +
    <%= toggle_link '璇勫', c_softapplication.id.to_s %> -
    + +
    <% end %> -
    -
    -
    -<% end %> -
    -<% end %> + +
    +
    + <% end %> +
    + <% end %> <% end %> diff --git a/app/views/contests/show_notification.html.erb b/app/views/contests/show_notification.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/contests/show_project.html.erb b/app/views/contests/show_project.html.erb index 202d3b632..3e759cfc1 100644 --- a/app/views/contests/show_project.html.erb +++ b/app/views/contests/show_project.html.erb @@ -68,7 +68,7 @@

    - <%= link_to '鍒涘缓椤圭洰', new_project_path(course: 0, project_type: 0), :target=>'_blank'%> + <%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target=>'_blank'%>

    diff --git a/app/views/contests/show_softapplication.html.erb b/app/views/contests/show_softapplication.html.erb index 14c907d82..d12a70e35 100644 --- a/app/views/contests/show_softapplication.html.erb +++ b/app/views/contests/show_softapplication.html.erb @@ -68,7 +68,7 @@

    - <%= link_to '鍙戝竷搴旂敤', new_softapplication_path(:target=>'_blank'), :target=>'_blank' %> + <%= link_to l(:label_release_softapplication), new_softapplication_path(:target=>'_blank'), :target=>'_blank' %>

    diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb index 7dcf82e19..a1cfb37e2 100644 --- a/app/views/files/_new.html.erb +++ b/app/views/files/_new.html.erb @@ -2,7 +2,7 @@ <% versions = project.versions.sort %> <% attachmenttypes = project.attachmenttypes %> <%= error_messages_for 'attachment' %> -<%= form_tag(project_files_path(project), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %> +<%= form_tag(project_files_path(project), :multipart => true,:remote => false,:method => :post,:name=>"upload_form", :class => "tabular") do %>

    diff --git a/app/views/files/create.html.erb b/app/views/files/create.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb new file mode 100644 index 000000000..443fdfec8 --- /dev/null +++ b/app/views/files/create.js.erb @@ -0,0 +1,30 @@ +<%if @addTag%> +<% if @obj_flag == '3'%> + +$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$('#put-tag-form-issue').hide(); +$('#name-issue').val(""); +<% elsif @obj_flag == '6'%> +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$("#put-tag-form- +<%=@obj.class%>- +<%=@obj.id%>").hide(); +$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val(""); +<% else %> + +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>'); +$('#put-tag-form #name').val(""); +//$('#put-tag-form').hide(); +<% end %> +<%else%> +$("#attachments_fields").children().remove(); +$("#upload_file_count").text("鏈笂浼犳枃浠"); +$('#upload_file_div').slideToggle('slow'); +$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>'); +<% end %> + diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 231be8beb..9c1eee9d8 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -5,6 +5,7 @@ <%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %>璧勬簮鍏变韩鍖
    + <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
    @@ -25,9 +26,9 @@ :onchange => "attachment_contenttypes_searchex(this.value)" %> <% end %> - +
    - + <% contest = @softapplication.contests.first %> - + - - + + - + - - + + - -
    - + -<% end; reset_cycle %> - -
    <%= link_to h(topic.subject), topic.url %><%= link_to h(topic.subject), topic.url, :target => '_blank' %> - + @@ -449,7 +430,7 @@ diff --git a/app/views/open_source_projects/allbug.html.erb b/app/views/open_source_projects/allbug.html.erb new file mode 100644 index 000000000..d5c0c2e55 --- /dev/null +++ b/app/views/open_source_projects/allbug.html.erb @@ -0,0 +1,89 @@ + + + + +
    + +
    + 鍏辨湁 <%= link_to @bug_count %> 涓畨鍏ㄨ创瀛 +
    +
    + <% if @bugs.any? %> + <% @bugs.each do |bug| %> + <% topic = bug.bug %> +
    <%= link_to (topic.replies_count), open_source_project_relative_memo_path(open_source_project, topic) %><%= link_to (topic.replies_count), topic.url, :target => '_blank' %>
    鍥炲笘 - + @@ -459,7 +440,7 @@ - + - + - - +
    <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %>
    鍏虫敞 - + @@ -467,17 +448,17 @@
    <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(open_source_project, topic) %><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %>
    娴忚
    甯栧瓙鏉ユ簮锛<%=link_to 'OSChina', topic.url %> + 甯栧瓙鏉ユ簮锛<%=link_to 'OSChina', topic.url %> <%= no_use_link(topic, User.current) %> <%= no_use_link(topic, User.current) %>
    + + + + + +
    <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> + <%= image_tag('../images/avatars/User/0', :class => "avatar") unless topic.author%> + + + + + + + + + + + + + + + + + + + + + +
    + <% if topic.url.nil? || topic.url == '' %> + <%= link_to h(topic.subject), open_source_project_relative_memo_path(bug.open_source_project, topic) %> + <% else %> + <%= link_to h(topic.subject), topic.url, :target => '_blank' %> + <% end %> + + + + + + + +
    <%= link_to (topic.replies_count), topic.url, :target => '_blank' %>
    鍥炲笘
    + + + + + + + +
    <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %>
    鍏虫敞
    + + + + + + + +
    <%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), topic.url, :target => '_blank' %>
    娴忚
    <%= topic.short_content(100) %>
    <%= user_url_and_time topic.username, topic.userhomeurl, topic.created_at %> +
    +
    甯栧瓙鏉ユ簮锛<%=link_to topic.topic_resource, topic.url, :target => '_blank' %> +
    + + <% end %> + + <% else %> +

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

    + <% end %> + + +<%#= render :partial => 'open_source_projects/show_memo', :locals => {:memos => @memos, :open_source_project => @open_source_project} %> + \ No newline at end of file diff --git a/app/views/open_source_projects/index.html.erb b/app/views/open_source_projects/index.html.erb index e51ef4fc1..99e34333f 100644 --- a/app/views/open_source_projects/index.html.erb +++ b/app/views/open_source_projects/index.html.erb @@ -48,7 +48,7 @@ background-position: -266px 3px; } .navigation .icon-search, .navigation .nav-pill-cancle, .navigation .nav-switch-icon, .navigation .nav-topbar .topbar-search .topbar-submit, .navigation .nav-topbar-arror { - background: url(); + /*background: url()*/ } .nav-switch-icon { width: 15px; @@ -129,8 +129,6 @@ li { .nav-search-con{ padding-top: 7px; } - - <%= javascript_include_tag "ichart.1.2.min" %> <%= stylesheet_link_tag "buglist-div-use.css" %> @@ -146,29 +144,13 @@ li {
    -

    杞欢瀹夊叏婕忔礊

    More >>
    +

    杞欢瀹夊叏鎬佸娍

    <%= link_to '鏇村 >>', allbug_open_source_projects_path %>
    -
    +
    @@ -236,7 +218,7 @@ li { parseText:function(tip,name,value,text,i){ return name+"婕忔礊鏁:"+value; } - } , + } }, tipMocker:function(tips,i){ var index; @@ -272,7 +254,7 @@ li { label:false, //鏄惁鏄剧ず鏁板 // hollow_inside:false, smooth : true,//骞虫粦鏇茬嚎 - point_size:2, // 鐒︾偣澶у皬 + point_size:2 // 鐒︾偣澶у皬 // point_hollow : true, @@ -298,7 +280,7 @@ li { start_scale:0, scale_space:50, end_scale:70, - scale_color:'#9f9f9f', + scale_color:'#9f9f9f' // label : {color:'#ffffff',fontsize:11}, },{ @@ -417,7 +399,7 @@ line.target.line(28,97,400,97,2,'#b32c0d')
    \ No newline at end of file diff --git a/app/views/projects/_homework_form.html.erb b/app/views/projects/_homework_form.html.erb index e4a471367..13255120f 100644 --- a/app/views/projects/_homework_form.html.erb +++ b/app/views/projects/_homework_form.html.erb @@ -32,8 +32,10 @@

    -->

    <%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%>

    +

    <%= hidden_field_tag 'course_id', @project.id %>

    <%= l(:label_attachment_plural) %> diff --git a/app/views/projects/settings/_members.html.erb b/app/views/projects/settings/_members.html.erb index f97e9d0f2..f69f9edff 100644 --- a/app/views/projects/settings/_members.html.erb +++ b/app/views/projects/settings/_members.html.erb @@ -1,125 +1,88 @@ <%= error_messages_for 'member' %> -<% roles = Role.find_all_givable - members = @project.member_principals.includes(:roles, :principal).all.sort %> +<% + roles = Role.givable.all + if @project.project_type == Project::ProjectType_course + roles = roles[3..5] + else + roles = roles[0..2] + end + members = @project.member_principals.includes(:roles, :principal).all.sort +%> +
    -<% if members.any? %> - - - - - + <% if members.any? %> +
    <%= l(:label_user) %><%= l(:label_role_plural) %>
    + + + + + <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %> - - - <% members.each do |member| %> - <% next if member.new_record? %> - - - + + + <% members.each do |member| %> + <% next if member.new_record? %> + + + - - <%= error_messages_for 'member' %> -<% roles = Role.find_all_givable - members = @project.member_principals.includes(:roles, :principal).all.sort %> - <% if @project.project_type == 1 %> - <%if member.roles.first.to_s == "Manager" %> - - <% else %> - - <% end %> - <% else %> - + <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), + :method => :put, + :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} + ) do |f| %> + +

    + <% roles.each do |role| %> +
    + <% end %>

    + <%= hidden_field_tag 'membership[role_ids][]', '' %> +

    <%= submit_tag l(:button_change), :class => "small" %> + <%= link_to_function l(:button_cancel), + "$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;" + %>

    + <% end %> + + + <% if @project.project_type == 1 %> + <% if member.roles.first.to_s == "Manager" %> + + <% else %> + + <% end %> + <% else %> + + <% end %> + + <%= call_hook(:view_projects_settings_members_table_row, {:project => @project, :member => member}) %> + + <% end; reset_cycle %> + +
    <%= l(:label_user) %><%= l(:label_role_plural) %>
    <%= link_to_user member.principal %> - - - <% if @project.project_type == 1 %> - <% if member.roles.sort.collect(&:to_s).join(', ') =='Manager' %> - 鑰佸笀 - <% else %> - <%=h member.roles.sort.collect(&:to_s).join(', ') %> - <% end %> - <% else %> - <%=h member.roles.sort.collect(&:to_s).join(', ') %> - <% end %> +
    <%= link_to_user member.principal %> + + <%= h member.roles.sort.collect(&:to_s).join(', ') %> - <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), - :method => :put, - :html => { :id => "member-#{member.id}-roles-form", :class => 'hol' }} - ) do |f| %> - -<%= error_messages_for 'member' %> -<% if @project.project_type == 1 %> -<% r = [] %> -<% for i in 3..5 %> -<% roles = Role.givable.all[i] - members = @project.member_principals.includes(:roles, :principal).all.sort %> - <% r << roles %> - <% end %> -<% else %> -<% r = [] %> -<% for i in 0..2 %> -<% roles = Role.givable.all[i] - members = @project.member_principals.includes(:roles, :principal).all.sort %> - <% r << roles %> - <% end %> -<% end %> - -

    <% r.each do |role| %> -
    - <% end %>

    - <%= hidden_field_tag 'membership[role_ids][]', '' %> -

    <%= submit_tag l(:button_change), :class => "small" %> - <%= link_to_function l(:button_cancel), - "$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;" - %>

    - <% end %> -
    - <%= link_to_function l(:button_edit), - "$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;", - :class => 'icon icon-edit' %> - <%= delete_link membership_path(member), - :remote => true, - :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %> - - <%= link_to_function l(:button_edit), - "$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;", - :class => 'icon icon-edit' %> - <%= delete_link membership_path(member), - :remote => true, - :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %> - + <%= link_to_function l(:button_edit), + "$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;", + :class => 'icon icon-edit' %> + <%= delete_link membership_path(member), + :remote => true, + :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %> + + <%= link_to_function l(:button_edit), + "$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;", + :class => 'icon icon-edit' %> + <%= delete_link membership_path(member), + :remote => true, + :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %> +
    + <% else %> +

    <%= l(:label_no_data) %>

    <% end %> - - <%= call_hook(:view_projects_settings_members_table_row, { :project => @project, :member => member}) %> -
    -<% else %> -

    <%= l(:label_no_data) %>

    -<% end %> - -<%= error_messages_for 'member' %> -<% if @project.project_type == 1 %> -<% r = [] %> -<% for i in 3..5 %> -<% roles = Role.givable.all[i] - members = @project.member_principals.includes(:roles, :principal).all.sort %> - <% r << roles %> - <% end %> -<% else %> -<% r = [] %> -<% for i in 0..2 %> -<% roles = Role.givable.all[i] - members = @project.member_principals.includes(:roles, :principal).all.sort %> - <% r << roles %> - <% end %> -<% end %> - -
    -<% if r.any? %> + <% if roles.any? %> <% if @project.applied_projects.any? %>
    <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> @@ -131,7 +94,7 @@

    <%= l(:label_role_plural) %>: - <% r.each do |role| %> + <% roles.each do |role| %> <% end %>

    @@ -144,24 +107,25 @@
    <% end %> - <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> -
    <%=l(:label_member_new)%> + <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> +
    + <%= l(:label_member_new) %> -

    <%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %>

    - <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %> +

    <%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %>

    + <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %> -
    - <%= render_principals_for_new_members(@project) %> -
    - -

    <%= l(:label_role_plural) %>: - <% r.each do |role| %> - - - <% end %>

    +
    + <%= render_principals_for_new_members(@project) %> +
    + +

    <%= l(:label_role_plural) %>: + <% roles.each do |role| %> -

    <%= submit_tag l(:button_add), :id => 'member-add-submit' %>

    -
    + + <% end %>

    + +

    <%= submit_tag l(:button_add), :id => 'member-add-submit' %>

    +
    + <% end %> <% end %> -<% end %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 173fc26a4..6be2a4d72 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -17,8 +17,13 @@
    <%= h(e.project) if @project.nil? || @project.id != e.project.id %> - - <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>) + + <% if @canShowRealName %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>) + <% else %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> + <% end %> + <%= l(:label_new_activity) %> <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %> diff --git a/app/views/softapplications/_form.html.erb b/app/views/softapplications/_form.html.erb index 4703af9be..fd946cfc5 100644 --- a/app/views/softapplications/_form.html.erb +++ b/app/views/softapplications/_form.html.erb @@ -65,7 +65,7 @@
    - 涓婁紶浣滃搧杞欢鍖呭拰浣滃搧鎴浘 + <%=l(:label_upload_softworkpacket_photo)%> <%= render_flash_messages %>

    <%= render :partial => 'attachments/form' %> diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index 841a8a207..5b355f65c 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -16,13 +16,13 @@

    <%= softapplication.description.truncate(95, omission: '...') %>
    <%contest = softapplication.contests.first%> -

    鎵灞炵珵璧涳細<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '灏氭湭鍔犲叆绔炶禌'%>

    -

    鎵灞炵被鍒細<%= softapplication.app_type_name.truncate(10, omission: '...') %>

    -

    绯荤粺鏀寔锛<%= softapplication.android_min_version_available %>

    +

    <%=l(:label_attendingcontestwork_belongs_contest)%>锛<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '灏氭湭鍔犲叆绔炶禌'%>

    +

    <%=l(:label_attendingcontestwork_belongs_type)%>锛<%= softapplication.app_type_name.truncate(10, omission: '...') %>

    +

    <%=l(:label_attendingcontestwork_adaptive_system)%>锛<%= softapplication.android_min_version_available %>

    - 寮鍙戜汉鍛橈細<%= softapplication.application_developers %> - 鍙戝竷鏃堕棿锛<%=format_time softapplication.created_at %> + <%=l(:label_attendingcontestwork_developers)%>锛<%= softapplication.application_developers %> + <%=l(:label_attendingcontestwork_release_time)%>锛<%=format_time softapplication.created_at %>
    diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 8b9b3260d..e41ecb842 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -16,38 +16,35 @@
    鎵灞炵被鍒細<%= @softapplication.app_type_name %><%=l(:label_attendingcontestwork_belongs_type)%>锛<%= @softapplication.app_type_name %>鎵灞炵珵璧涳細<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '灏氭湭鍔犲叆绔炶禌' %><%=l(:label_attendingcontestwork_belongs_contest)%>锛<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '灏氭湭鍔犲叆绔炶禌' %>
    鍙戝竷浜哄憳锛<%= @softapplication.user.name %>绯荤粺鏀寔锛<%= @softapplication.android_min_version_available %><%=l(:label_attendingcontestwork_release_person)%>锛<%= @softapplication.user.name %><%=l(:label_attendingcontestwork_adaptive_system)%>锛<%= @softapplication.android_min_version_available %>
    - 浣滃搧涓嬭浇锛 + <%=l(:label_attendingcontestwork_download)%>锛 <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> 寮鍙戜汉鍛橈細<%= @softapplication.application_developers %><%=l(:label_attendingcontestwork_developers)%>锛<%= @softapplication.application_developers %>
    骞冲潎璇勫垎: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>鍙戝竷鏃堕棿锛<%=format_time @softapplication.created_at %><%=l(:label_attendingcontestwork_average_scores)%>: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %><%=l(:label_attendingcontestwork_release_time)%>锛<%=format_time @softapplication.created_at %>
    - <% if (@softapplication.deposit_project != "nil" && @softapplication.deposit_project != "") %> - <%#= textilizable ("鎵樼椤圭洰锛 " + @project.name) %> - 鎵樼椤圭洰锛<%= link_to "#@project", project_path(@project.id) %> - <% end %> + <% if @project %> + <%=l(:label_attendingcontestwork_deposit_project)%>锛<%= link_to "#@project", project_path(@project) %> + <% end %>
    @@ -56,7 +53,7 @@

    -
    浣滃搧绠浠嬶細
    +
    <%=l(:label_work_description)%>锛
    <%= @softapplication.description %>
    @@ -64,11 +61,11 @@
    -
    浣滃搧寰楀垎锛
    +
    <%=l(:label_work_scores)%>锛
    -
    寰楀垎姣斾緥
    +
    <%=l(:label_work_scores_proportion)%>
    <% 100.step(20, -20) do |star| %>
    @@ -83,14 +80,12 @@
    -
    鏈缁堝緱鍒
    -
    <%= @softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s %> - 鍒 -
    +
    <%=l(:label_final_scores)%>
    +
    <%= @softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s %>鍒
    <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
    -
    鎵撳垎鎬讳汉鏁
    +
    <%=l(:label_rating_person_amount)%>
    <%= @softapplication.raters(:quality).count %>
    @@ -100,7 +95,7 @@
    -
    浣滃搧鎴浘锛
    +
    <%=l(:label_work_photo)%>锛
    @@ -119,10 +114,10 @@
    -
    浣滃搧璇勮锛
    +
    <%=l(:label_work_comment)%>锛
    <% if (User.current.logged? and User.current.id != @softapplication.user_id) %> -
    璇勫垎: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %> - (鎮ㄥ彲浠ラ噸鏂版墦鍒嗭紝鎵撳垎缁撴灉浠ユ渶鍚庝竴娆℃墦鍒嗕负涓伙紒)
    +
    <%=l(:label_work_rating)%>: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %> + (<%=l(:label_attendingcontestwork_sorting_intimation)%>)
    <% end %>
    diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb index 4891cc233..dad5d53f7 100644 --- a/app/views/tags/_tag_name.html.erb +++ b/app/views/tags/_tag_name.html.erb @@ -51,14 +51,14 @@ <% when '2' %> - <% if (ProjectInfo.find_by_project_id(obj.id)).user_id == User.current.id %> + <% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, :taggable_id => obj.id, :taggable_type => object_flag %> <% end %> <% when '3' %> - <% if (ProjectInfo.find_by_project_id(obj.project_id)).user_id == User.current.id %> + <% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, :taggable_id => obj.id, :taggable_type => object_flag %> <% end %> diff --git a/app/views/users/_course_list_have_entity.html.erb b/app/views/users/_course_list_have_entity.html.erb index 87dd52635..19fb88a6a 100644 --- a/app/views/users/_course_list_have_entity.html.erb +++ b/app/views/users/_course_list_have_entity.html.erb @@ -1,4 +1,4 @@ -
    +