diff --git a/Gemfile b/Gemfile index afd6a667a..037c606c8 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "builder", "3.0.0" gem 'acts-as-taggable-on', '2.4.1' gem 'spreadsheet' gem 'ruby-ole' -#gem 'email_verifier' +#gem 'email_verifier', path: 'lib/email_verifier' group :development do gem 'grape-swagger' diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index ae3637106..9be9bc53e 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -35,6 +35,11 @@ module Mobile #作业状态 0:新建,1:已开启匿评,2:已关闭匿评 #只有作业启用了匿评功能且当前用户是课程老师且已提交的作品数量大于或等于2才能开启匿评 homework_expose :homework_state + + expose :homework_for_anonymous_comments,using: Mobile::Entities::HomeworkAttach do |f, opt| + f[:homework_for_anonymous_comments] if f.is_a?(Hash) && f.key?(:homework_for_anonymous_comments) + end + end end end \ No newline at end of file diff --git a/app/assets/javascripts/enterprises.js.coffee b/app/assets/javascripts/enterprises.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/enterprises.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/enterprises.css.scss b/app/assets/stylesheets/enterprises.css.scss new file mode 100644 index 000000000..174f3a2ec --- /dev/null +++ b/app/assets/stylesheets/enterprises.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Enterprises controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9b1e045e3..aab9d7b69 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -283,4 +283,43 @@ class AdminController < ApplicationController end end + #企业主页定制 + def enterprise_page_made + @enterprise_page = FirstPage.find_by_page_type('enterprise') + if @enterprise_page.nil? + @enterprise_page = FirstPage.new + @enterprise_page.page_type = 'enterprise' + end + if request.get? + @first_page = FirstPage.find_by_page_type('project') + elsif request.post? + @first_page = FirstPage.find_by_page_type('project') + @first_page.web_title = params[:web_title] + @enterprise_page.web_title = params[:web_title] + @enterprise_page.title = params[:course_title] + @enterprise_page.image_width = params[:image_width] + @enterprise_page.image_height = params[:image_height] + @enterprise_page.description = params[:course_description] + if @first_page.save && @enterprise_page.save + respond_to do |format| + format.html { + flash[:notice] = l(:notice_successful_update) + redirect_to enterprise_page_made_url + } + format.api { render_api_ok } + end + else + respond_to do |format| + flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@enterprise_page.errors.full_messages[0]}" + #flash.now[:error] = "#{l :label_first_page_create_fail}: #{@course_page.errors.full_messages[0]}" + format.html { + render :action => 'enterprise_page_made' + } + format.api { render_validation_errors(@first_page) } + format.api { render_validation_errors(@enterprise_page) } + end + end + end + end + end diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index f5c42f7b4..f2c0eb056 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -6,13 +6,18 @@ class AppliedProjectController < ApplicationController @project = Project.find_by_id(params[:project_id]) if params[:project_join] if @project - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.applied_project(appliedproject).deliver - @status = 2 + user = User.find @user_id + if user.member_of?(@project) + @status = 3 else - @status = 1 + @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + if @applieds.count == 0 + appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + Mailer.applied_project(appliedproject).deliver + @status = 2 + else + @status = 1 + end end else @status = 0 diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 8e69d1d72..2c943e778 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -101,13 +101,7 @@ class HomeworkAttachController < ApplicationController #获取学生匿评列表 def get_student_batch_homework @is_student_batch_homework = true - all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score - FROM homework_attaches - INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id - WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY m_score DESC") + all_homework_list = get_student_batch_homework_list @bid,User.current @cur_page = params[:page] || 1 @cur_type = 4 @homework_list = paginateHelper all_homework_list,10 diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb new file mode 100644 index 000000000..c9cce5752 --- /dev/null +++ b/app/controllers/organizations_controller.rb @@ -0,0 +1,6 @@ +class OrganizationsController < ApplicationController + layout 'project_base' + def index + @projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)") + end +end diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 394c52f13..1b2794034 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -83,6 +83,12 @@ class PollController < ApplicationController def destroy if @poll && @poll.destroy + if @is_teacher + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}") + else + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2") + end + @polls = paginateHelper polls,20 #分页 respond_to do |format| format.js end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1f78836ae..64706887b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -30,6 +30,12 @@ class ProjectsController < ApplicationController :course, :enterprise_course, :course_enterprise,:view_homework_attaches] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] + # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, + # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, + # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] + #此条勿删 课程相关权限 ,:new_homework,:homework,:feedback,,:member + before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :file, :statistics, :watcherlist @@ -541,6 +547,14 @@ class ProjectsController < ApplicationController end end end + + #加入私有项目 + def join_project + respond_to do |format| + format.js + end + end + private def memberAccess diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 8e11bceb5..144199b86 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -25,6 +25,22 @@ class WelcomeController < ApplicationController before_filter :entry_select, :only => [:index] def index + unless params[:project].nil? + @cur_projects = Project.find(params[:project]) + @organization = @cur_projects.enterprise_name + @organization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @organization]) + @e_count = @organization_projects.count + @enterprise_page = FirstPage.find_by_page_type('enterprise') + if @enterprise_page.nil? + @enterprise_page = FirstPage.new + @enterprise_page.page_type = 'enterprise' + end + if @e_count < 9 + part_count = 9 - @e_count + # @part_projects = find_all_hot_project part_count, order + @part_projects = find_miracle_project(part_count, 3,"score desc") + end + end if @first_page.nil? || @first_page.sort_type.nil? @projects = find_miracle_project(10, 3,"score desc") else diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index b329e4c27..6c5385115 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -7,6 +7,7 @@ class ZipdownController < ApplicationController SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip" + def assort if params[:obj_class] == "Bid" bid = Bid.find params[:obj_id] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1face5c38..5579fe79b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1844,7 +1844,7 @@ module ApplicationHelper users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain} # contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'} bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'} - forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"} + forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"} stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'} school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'} @@ -1963,6 +1963,15 @@ module ApplicationHelper end def get_technical_title user - #user.user_extensions.technical_title + if user.user_extensions.technical_title == "Professor" || user.user_extensions.technical_title == "教授" + technical_title = l(:label_technicl_title_professor) + elsif user.user_extensions.technical_title == "Associate professor" || user.user_extensions.technical_title == "副教授" + technical_title = l(:label_technicl_title_associate_professor) + elsif user.user_extensions.technical_title == "Lecturer" || user.user_extensions.technical_title == "讲师" + technical_title = l(:label_technicl_title_lecturer) + elsif user.user_extensions.technical_title == "Teaching assistant" || user.user_extensions.technical_title == "助教" + technical_title = l(:label_technicl_title_teaching_assistant) + end + technical_title end end diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index 4744df624..c41ba54ee 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -119,4 +119,15 @@ module HomeworkAttachHelper #end ary end + + def get_student_batch_homework_list bid,user + student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score + FROM homework_attaches + INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id + WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC") + student_batch_homework_list + end end \ No newline at end of file diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb new file mode 100644 index 000000000..10321ba16 --- /dev/null +++ b/app/helpers/organizations_helper.rb @@ -0,0 +1,2 @@ +module EnterprisesHelper +end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 27caa8306..d101fd36c 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -314,38 +314,38 @@ module WelcomeHelper str = ' '.html_safe case event.event_type when 'news' - str << content_tag("span", "发表了") << + str << content_tag("span", l(:field_user_active_published)) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(strip_tags(event.event_description).gsub(/ /,''), event.event_url, {:title => event.event_description}) when 'issue', 'message' , 'bid' , 'wiki-page' , 'document' - str << content_tag("span", "发表了") << + str << content_tag("span", l(:field_user_active_published)) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) when 'reply' ,'Reply', 'Memo' - str << content_tag("span", "发表了") << - content_tag("span", find_all_event_type(event)) << + str << content_tag("span", l(:field_user_active_published)) << + content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(strip_tags(event.event_description).gsub(/ /,''), event.event_url, {:title => event.event_description}) when 'attachment' - str << content_tag('span', '上传了') << + str << content_tag('span', l(:field_user_active_uploaded)) << content_tag('span', find_all_event_type(event)) << ': '.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) << 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", "更新了") << + str << content_tag("span", l(:field_user_active_updated)) << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) end str rescue Exception => e - str << content_tag("span", '未知内容') + str << content_tag("span", l(:field_user_active_unknow)) end def show_event_reply event - str = "回复(" + str = l(:field_active_reply) case event.event_type when 'news' str << link_to( event.comments.count, news_path(event)) << ")" @@ -463,25 +463,25 @@ module WelcomeHelper def find_all_event_type event case event.event_type when 'news' - '新闻' + l(:field_user_active_news) when 'issue' - '缺陷' + l(:field_user_active_issue) when 'attachment' - '附件' + l(:field_user_active_attachment) when 'message' - '主题' + l(:field_user_active_message) when 'Reply','reply' - '回复' + l(:field_user_active_reply) when 'bid' - '作业' + l(:field_user_active_bid) when 'Memo' - '主题' + l(:field_user_active_memo) when 'document' - '文件' + l(:field_user_active_document) when 'changeset' - '版本库' + l(:field_user_active_changeset) when 'issue-note' - '问题说明' + l(:field_user_active_issue_note) else event.event_type end diff --git a/app/models/course.rb b/app/models/course.rb index a5de93cf7..610f52f71 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -6,7 +6,7 @@ class Course < ActiveRecord::Base STATUS_CLOSED = 5 STATUS_ARCHIVED = 9 - attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student + attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 @@ -35,7 +35,7 @@ class Course < ActiveRecord::Base acts_as_nested_set :order => 'name', :dependent => :destroy acts_as_attachable :view_permission => :view_course_files, :delete_permission => :manage_files - + validates_presence_of :password, :term,:name validates_format_of :class_period, :with =>/^[1-9]\d*$/ validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ diff --git a/app/models/course_group.rb b/app/models/course_group.rb index c7fc81df4..c6aa1299d 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -12,8 +12,7 @@ class CourseGroup < ActiveRecord::Base before_destroy :set_member_nil attr_accessible :name - validates :name, :presence => true, :length => {:maximum => 20} - validate :unique_name_and_course + validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => { :scope => :course_id} @@ -22,10 +21,5 @@ class CourseGroup < ActiveRecord::Base self.members.update_all("course_group_id = 0") end end - private - def unique_name_and_course - if CourseGroup.where("name=? and course_id=?", name, course_id).first - errors.add(:name, :groupname_repeat) - end - end + end diff --git a/app/models/project.rb b/app/models/project.rb index ca80d90f8..df403bb5c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -114,9 +114,10 @@ class Project < ActiveRecord::Base validates_presence_of :name, :identifier validates_uniqueness_of :identifier validates_uniqueness_of :name - validates_associated :repository, :wiki - # validates_length_of :description, :maximum => 255 + validates_associated :wiki#, :repository + # validates_length_of :description, :maximum => 255 validates_length_of :name, :maximum => 255 + validates_length_of :enterprise_name, :maximum => 255 validates_length_of :homepage, :maximum => 255 validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH # donwcase letters, digits, dashes but not digits only @@ -763,7 +764,8 @@ class Project < ActiveRecord::Base 'issue_custom_field_ids', 'project_type', 'dts_test', - 'attachmenttype' + 'attachmenttype', + 'enterprise_name' diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 7e3b2a545..41b6f2c68 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -1,6 +1,7 @@ class CoursesService include ApplicationHelper include CoursesHelper + include HomeworkAttachHelper #TODO:尚未整合权限系统 #参数school_id为0或不传时返回所有课程,否则返回对应学校的课程 #参数per_page_count分页功能,每页显示的课程数 @@ -306,10 +307,8 @@ class CoursesService bids = course.homeworks.order('deadline DESC') bids = bids.like(params[:name]) if params[:name].present? homeworks = [] - if is_course_teacher(current_user,course) - bids.each do |bid| - homeworks << show_homework_info(course,bid) - end + bids.each do |bid| + homeworks << show_homework_info(course,bid,current_user,is_course_teacher(current_user,course)) end homeworks else @@ -318,7 +317,7 @@ class CoursesService end private - def show_homework_info course,bid + def show_homework_info course,bid,current_user,is_course_teacher author = bid.author.lastname + bid.author.firstname many_times = course.homeworks.index(bid) + 1 name = bid.name @@ -327,8 +326,27 @@ class CoursesService description = bid.description #if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2 state = bid.comment_status + unless is_course_teacher + homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user + end #end open_anonymous_evaluation = bid.open_anonymous_evaluation + {:course_name => course.name,:id => bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, + :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments} + end + + #显示作业列表的同时显示分配给当前学生匿评的作业 + def show_homework_info_with_batch course,bid + author = bid.author.lastname + bid.author.firstname + many_times = course.homeworks.index(bid) + 1 + name = bid.name + homework_count = bid.homeworks.count #已提交的作业数量 + student_questions_count = bid.commit.nil? ? 0 : bid.commit + description = bid.description + #if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2 + state = bid.comment_status + #end + open_anonymous_evaluation = bid.open_anonymous_evaluation {:course_name => course.name,:id => bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation} end diff --git a/app/views/account/email_valid.html.erb b/app/views/account/email_valid.html.erb index e6bc2a2db..1aecc6904 100644 --- a/app/views/account/email_valid.html.erb +++ b/app/views/account/email_valid.html.erb @@ -1,7 +1,7 @@ - 注册帐号 + <%= l(:label_regiter_account)%> diff --git a/app/views/layouts/base_memos.html.erb b/app/views/layouts/base_memos.html.erb index 14944792d..a8b48804b 100644 --- a/app/views/layouts/base_memos.html.erb +++ b/app/views/layouts/base_memos.html.erb @@ -36,13 +36,41 @@ 软件项目托管社区 <%= l(:label_user_location) %> : - + diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index d525f65a2..957c8498b 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -80,6 +80,7 @@ <%=link_to l(:field_homepage), home_path %> > <%=l(:label_contests_management_platform)%> + > <%= link_to h(truncate(@contest.name, length: 20, omission: '...')), contest_contestnotifications_path(@contest) %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index dbd6503b0..3b2bd8dfe 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -21,8 +21,6 @@ <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> - <% title1 = @user.user_extensions.technical_title %> - <% language1 = @user.language %> - +
@@ -283,10 +233,14 @@ <% if @user.user_extensions.identity == 0 %> - <%= l(:label_technical_title) %>: + + <%= l(:label_technical_title) %>: + - + + <%= get_technical_title @user %> + <% end %> diff --git a/app/views/members/create.js.erb b/app/views/members/create.js.erb index 3b01980ad..35280b7a4 100644 --- a/app/views/members/create.js.erb +++ b/app/views/members/create.js.erb @@ -12,7 +12,11 @@ hideOnLoad(); $("#member-<%= member.id %>").effect("highlight"); <% end %> <% else %> - <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %> - alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors))) %>'); + <% if @members %> + <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')%> + alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors || ''))) %>'); + <% else%> +// alert(''); + <% end%> <% end %> <% end %> diff --git a/app/views/news/_form.html.erb b/app/views/news/_form.html.erb index f76aaad88..5e5cdf532 100644 --- a/app/views/news/_form.html.erb +++ b/app/views/news/_form.html.erb @@ -3,12 +3,25 @@ <%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
-

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %>

-

(60个字符以内)

+

+ <%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %> +

+

+ (60个字符以内) +

-

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %>

-

-

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

+

+ <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %> +

+

+ +

+

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

<%= wikitoolbar_for 'news_description' %> diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index 526c7a1a5..b18c2abd8 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -83,7 +83,7 @@ <%= render :partial => 'news/form', :locals => {:f => f} %> <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %> <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %> - | + <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %> diff --git a/app/views/organizations/index.html.erb b/app/views/organizations/index.html.erb new file mode 100644 index 000000000..3e0e507c5 --- /dev/null +++ b/app/views/organizations/index.html.erb @@ -0,0 +1,23 @@ +<%= l(:label_all_enterprises) %> +
+
<%= l(:label_all_enterprises) %>
+
+ <% if @projects.count == 0 %> +

<%= l(:label_enterprise_nil) %>

+ <% else %> + <% @projects.each do |project| %> + <% unless project.enterprise_name.blank? %> +
    +
  • #{project.enterprise_name} + <%= link_to project.enterprise_name, home_path(:project => project) %>
  • +
+ <% end %> + <% end %> + <% end %> +
+
+
+
+
    +
    +<% html_title(l(:label_enterprise_all)) -%> diff --git a/app/views/poll/_edit_MC.html.erb b/app/views/poll/_edit_MC.html.erb index f89407247..19a1e1e89 100644 --- a/app/views/poll/_edit_MC.html.erb +++ b/app/views/poll/_edit_MC.html.erb @@ -39,7 +39,7 @@
    @@ -87,20 +97,25 @@
    <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
    - <%= l(:label_apply_project) %> - + + <%= l(:label_apply_project) %> +
    <%= render_principals_for_applied_members(@project) %>

    -

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

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

    - -

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

    +

    + <%= submit_tag l(:label_approve), :id => 'member-add-submit' %> <%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>

    @@ -110,9 +125,13 @@ <%= 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 %>

    + + <%= 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') }')" %>
    @@ -120,13 +139,18 @@

    -

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

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

    - -

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

    + + <% end %> +

    +

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

    <% end %> <% end %> diff --git a/app/views/welcome/_hot_projects_list.html.erb b/app/views/welcome/_hot_projects_list.html.erb new file mode 100644 index 000000000..92e1469cd --- /dev/null +++ b/app/views/welcome/_hot_projects_list.html.erb @@ -0,0 +1,23 @@ +
  • +
    + <%= image_tag(get_project_avatar(project), :class => "avatar-4") %> +
    + +
    + <% unless project.is_public %> + <%= l(:label_private) %> + <% end %> + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> + (<%= link_to l(:label_project_member_amount, :count=>projectCount(project)), project_member_path(project) ,:course =>'0' %>) +
    +
    + <%=project.description.truncate(90, omission: '...')%> +
    +
    + <%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s, + :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;", + :title => l(:label_project_score_tips), + :class => "tooltip", + :id => "tooltip-#{project.id}" %> +
    +
  • \ No newline at end of file diff --git a/app/views/welcome/_no_course_title.html.erb b/app/views/welcome/_no_course_title.html.erb index f16b91dba..3b3849e4e 100644 --- a/app/views/welcome/_no_course_title.html.erb +++ b/app/views/welcome/_no_course_title.html.erb @@ -1,5 +1,5 @@

    - <%= course_title%> + <%= course_title %>

    \ No newline at end of file diff --git a/app/views/welcome/_search_course.html.erb b/app/views/welcome/_search_course.html.erb index 895f696fb..79088a757 100644 --- a/app/views/welcome/_search_course.html.erb +++ b/app/views/welcome/_search_course.html.erb @@ -1,8 +1,8 @@ <% select_option = [] - (select_option << ['项目', 'projects']) if project_type == Project::ProjectType_project - (select_option << ['课程', 'courses']) if project_type == Project::ProjectType_course - select_option << ['用户', 'users'] + (select_option << [l(:label_select_project), 'projects']) if project_type == Project::ProjectType_project + (select_option << [l(:label_select_course), 'courses']) if project_type == Project::ProjectType_course + select_option << [l(:label_select_user), 'users'] #select_option << ['教师', 'users_teacher'], #select_option << ['学生', 'users_student'] %> @@ -49,7 +49,7 @@ form #search_type{ <%= form_tag({controller: :welcome, action: :search }, method: :get) do %>