diff --git a/.gitignore b/.gitignore index 5e8a94339..ffa4a1bc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,30 @@ -*.swp -/.project -/.idea -/.bundle -*.swp -/config/database.yml -/config/configuration.yml -/config/additional_environment.rb -/files/* -/log/* -/public/tmp/* -/tmp/* -/public/cache/* -.gitignore -/config/newrelic.yml -/public/images/avatars/* -/Gemfile -/Gemfile.lock -/db/schema.rb -/Gemfile.lock -/lib/plugins/acts_as_versioned/test/debug.log -.rbenv-gemsets -.DS_Store -public/api_doc/ -/.metadata -vendor/cache -/files -/public/images/avatars -/public/files -/tags +*.swp +/.project +/.idea +/.bundle +*.swp +/config/database.yml +/config/configuration.yml +/config/additional_environment.rb +/files/* +/log/* +/public/tmp/* +/tmp/* +/public/cache/* +.gitignore +/config/newrelic.yml +/public/images/avatars/* +/Gemfile +/Gemfile.lock +/db/schema.rb +/Gemfile.lock +/lib/plugins/acts_as_versioned/test/debug.log +.rbenv-gemsets +.DS_Store +public/api_doc/ +/.metadata +vendor/cache +/files +/public/images/avatars +/public/files +/tags diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 3089386bf..caa199a72 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -315,7 +315,7 @@ class AccountController < ApplicationController #根据home_url生产正则表达式 eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != '' - redirect_to user_activities_path(user) + redirect_to user_activities_path(user,host: Setting.user_domain) else if last_login_on == '' redirect_to my_account_url diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index b1cca68ed..c98df27d3 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -490,7 +490,7 @@ class BidsController < ApplicationController (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 FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1 - WHERE table1.t_score IS NULL OR table1.t_score = 0") + WHERE table1.t_score IS NULL") @not_batch_homework = true @cur_type = 1 else diff --git a/app/controllers/discuss_demos_controller.rb b/app/controllers/discuss_demos_controller.rb new file mode 100644 index 000000000..9a03f3b86 --- /dev/null +++ b/app/controllers/discuss_demos_controller.rb @@ -0,0 +1,42 @@ +class DiscussDemosController < ApplicationController + def index + + @discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10) + end + + def new + @discuss_demo = DiscussDemo.create + @discuss_demo.save! + @discuss_demo + end + + def create + + end + + def update + @discuss_demo = DiscussDemo.find(params[:id]) + @discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body]) + redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id] + end + + def delete + + end + + def destroy + asset = Kindeditor::Asset.find_by_owner_id(params[:id]) + if !asset.nil? + filepath = File.join(Rails.root,"public","files","uploads", + asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s, + asset[:asset].to_s) + File.delete(filepath) if File.exist?filepath + end + DiscussDemo.destroy(params[:id]) + redirect_to :controller=> 'discuss_demos',:action => 'index' + end + + def show + @discuss_demo = DiscussDemo.find(params[:id]) + end +end diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 4982a4b6b..f6b044c63 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -51,7 +51,7 @@ class HomeworkAttachController < ApplicationController order_by = "created_at #{direction}" end all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (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 AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, + (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 FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY #{order_by}) AS table1 @@ -445,7 +445,8 @@ class HomeworkAttachController < ApplicationController is_teacher = @is_teacher ? 1 : 0 #保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0)) @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 - if @m_score && (@is_teacher || @is_anonymous_comments) + if @is_teacher || @is_anonymous_comments + @m_score ||= 0 rate = @homework.rates(:quality).where(:rater_id => User.current.id, :is_teacher_score => is_teacher).first if rate rate.stars = @m_score @@ -502,7 +503,7 @@ class HomeworkAttachController < ApplicationController get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id elsif @cur_type == "2" #老师已批列表 @result_homework = HomeworkAttach.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 AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, + (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 FROM homework_attaches WHERE id = #{@homework.id}").first elsif @cur_type == "3" #全部作业列表 @@ -629,7 +630,7 @@ class HomeworkAttachController < ApplicationController (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 FROM homework_attaches WHERE bid_id = #{bid_id} ORDER BY #{order_by}) AS table1 - WHERE table1.t_score IS NULL OR table1.t_score = 0 ") + WHERE table1.t_score IS NULL ") @all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name # @homework_list = paginateHelper @all_homework_list,10 @homework_list = @all_homework_list diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 80be8c5d5..12ee4bc3b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -75,7 +75,11 @@ class IssuesController < ApplicationController else @limit = 10#per_page_option end - + @assign_to_id = params[:assigned_to_id] + @author_id = params[:author_id] + @priority_id = params[:priority_id] + @status_id = params[:status_id] + @subject = params[:subject] @issue_count = @query.issue_count @issue_pages = Paginator.new @issue_count, @limit, params['page'] @offset ||= @issue_pages.offset diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 436418430..fd1266095 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -93,7 +93,15 @@ class MessagesController < ApplicationController end call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) render_attachment_warning_if_needed(@message) - redirect_to board_message_url(@board, @message) + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + redirect_to board_message_url(@board, @message) + end else layout_file = @project ? 'base_projects' : 'base_courses' render :action => 'new', :layout => layout_file @@ -131,9 +139,16 @@ class MessagesController < ApplicationController render_attachment_warning_if_needed(@reply) else #render file: 'messages#show', layout: 'base_courses' + end + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + redirect_to board_message_url(@board, @topic, :r => @reply) end - redirect_to board_message_url(@board, @topic, :r => @reply) - end # Edit a message @@ -150,7 +165,15 @@ class MessagesController < ApplicationController render_attachment_warning_if_needed(@message) flash[:notice] = l(:notice_successful_update) @message.reload - redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + end elsif request.get? respond_to do |format| format.html { @@ -172,16 +195,20 @@ class MessagesController < ApplicationController @message.destroy # modify by nwb if @project - if @message.parent - redirect_to board_message_url(@board, @message.parent, :r => r) - else + if params[:is_board] redirect_to project_boards_url(@project) + else + redirect_to board_message_url(@board, @topic, :r => @reply) end elsif @course - if @message.parent - redirect_to board_message_url(@board, @message.parent, :r => r) + if params[:is_board] + redirect_to course_boards_url(@course) else - redirect_to course_board_url(@course, @board) + if @message.parent + redirect_to board_message_url(@board, @message.parent, :r => r) + else + redirect_to course_board_url(@course, @board) + end end end end diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 01bc47a2f..64ad9c83a 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -38,12 +38,13 @@ class TrackersController < ApplicationController @tracker ||= Tracker.new(params[:tracker]) @trackers = Tracker.sorted.all @projects = Project.where("project_type = #{Project::ProjectType_project}").all - @courses = Course.all - @course_activity_count=Hash.new - @courses.each do |course| - @course_activity_count[course.id]=0 - end - @course_activity_count=get_course_activity @courses,@course_activity_count + # 去掉原因,这块代码已经没有用到 + # @courses = Course.all + # @course_activity_count=Hash.new + # @courses.each do |course| + # @course_activity_count[course.id]=0 + # end + # @course_activity_count=get_course_activity @courses,@course_activity_count end def create diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 801d98b0b..babd8cb12 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -797,4 +797,17 @@ module CoursesHelper end result end + + def zh_course_role role + if role == "TeachingAsistant" + result = l(:label_TA) + elsif role == "Teacher" + result = l(:label_teacher) + elsif role == "Student" + result = l(:label_student) + elsif role == "Manager" + result = l(:field_admin) + end + result + end end diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index e1d8c3e12..d9d910a66 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -243,15 +243,15 @@ module QueriesHelper # Retrieve query from session or build a new query def retrieve_query - if !params[:query_id].blank? - cond = "project_id IS NULL" - cond << " OR project_id = #{@project.id}" if @project - @query = IssueQuery.find(params[:query_id], :conditions => cond) - raise ::Unauthorized unless @query.visible? - @query.project = @project - session[:query] = {:id => @query.id, :project_id => @query.project_id} - sort_clear - elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) + # if !params[:query_id].blank? + # cond = "project_id IS NULL" + # cond << " OR project_id = #{@project.id}" if @project + # @query = IssueQuery.find(params[:query_id], :conditions => cond) + # raise ::Unauthorized unless @query.visible? + # @query.project = @project + # session[:query] = {:id => @query.id, :project_id => @query.project_id} + # sort_clear + # elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) # Give it a name, required to be valid @query = IssueQuery.new(:name => "_") @query.project = @project @@ -268,12 +268,12 @@ module QueriesHelper 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? @query.build_from_params(params) #session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names} - else - # retrieve from session - @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] - @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) - @query.project = @project - end + # else + # # retrieve from session + # @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] + # @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) + # @query.project = @project + # end end def retrieve_query_from_session diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb index 09c88e6df..d9a0f520a 100644 --- a/app/models/user_extensions.rb +++ b/app/models/user_extensions.rb @@ -1,86 +1,86 @@ -# encoding: utf-8 -=begin - identity字段含义 - 0 教师教授 - 1 学生 - 2 企业 - 3 开发者 -=end -class UserExtensions < ActiveRecord::Base - validate :school, presence: true - - belongs_to :user - belongs_to :school, :class_name => 'School', :foreign_key => :school_id - attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id - TEACHER = 0 - STUDENT = 1 - ENTERPRISE = 2 - DEVELOPER = 3 - #this method was used to update the table user_extensions - def update_user_extensions(birthday=nil,brief_introduction=nil, - gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) - self.birthday = birthday - self.brief_introduction = brief_introduction - self.gender = gender - self.location = location - self.occupation = occupation - self.work_experience = work_experience - self.zip_code = zip_code - self.save - end - - def get_brief_introduction - return self.brief_introduction - end - - -# added by meng - def show_identity - if User.current.language == 'zh'||User.current.language == '' - case self.identity - when 0 - user_identity = l(:label_account_identity_teacher) - when 1 - user_identity = l(:label_account_identity_student) - when 2 - user_identity = l(:label_account_identity_enterprise) - when 3 - user_identity = l(:label_account_identity_developer) - else - user_identity = '' - end - else - case self.identity - when 0 - user_identity = l(:label_account_identity_teacher) - when 1 - user_identity = l(:label_account_identity_student) - when 2 - user_identity = l(:label_account_identity_enterprise) - when 3 - user_identity = l(:label_account_identity_developer) - else - user_identity = '' - end - end - return user_identity - end -# end - - - def self.introduction(user, message) - unless user.user_extensions.nil? - info = user.user_extensions - info.brief_introduction = message - info.save - else - info = UserExtensions.new - info.user_id = user.id - info.brief_introduction = message - info.save - end - end - - - -end +# encoding: utf-8 +=begin + identity字段含义 + 0 教师教授 + 1 学生 + 2 企业 + 3 开发者 +=end +class UserExtensions < ActiveRecord::Base + validate :school, presence: true + + belongs_to :user + belongs_to :school, :class_name => 'School', :foreign_key => :school_id + attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id + TEACHER = 0 + STUDENT = 1 + ENTERPRISE = 2 + DEVELOPER = 3 + #this method was used to update the table user_extensions + def update_user_extensions(birthday=nil,brief_introduction=nil, + gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) + self.birthday = birthday + self.brief_introduction = brief_introduction + self.gender = gender + self.location = location + self.occupation = occupation + self.work_experience = work_experience + self.zip_code = zip_code + self.save + end + + def get_brief_introduction + return self.brief_introduction + end + + +# added by meng + def show_identity + if User.current.language == 'zh'||User.current.language == '' + case self.identity + when 0 + user_identity = l(:label_account_identity_teacher) + when 1 + user_identity = l(:label_account_identity_student) + when 2 + user_identity = l(:label_account_identity_enterprise) + when 3 + user_identity = l(:label_account_identity_developer) + else + user_identity = '' + end + else + case self.identity + when 0 + user_identity = l(:label_account_identity_teacher) + when 1 + user_identity = l(:label_account_identity_student) + when 2 + user_identity = l(:label_account_identity_enterprise) + when 3 + user_identity = l(:label_account_identity_developer) + else + user_identity = '' + end + end + return user_identity + end +# end + + + def self.introduction(user, message) + unless user.user_extensions.nil? + info = user.user_extensions + info.brief_introduction = message + info.save + else + info = UserExtensions.new + info.user_id = user.id + info.brief_introduction = message + info.save + end + end + + + +end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 94efb375a..22249b953 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -86,7 +86,7 @@ class CoursesService gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender work_unit = get_user_work_unit m.user location = get_user_location m.user - users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction} + users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, :brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname} end users end diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index 4893d22fe..d2a3a11a1 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -1,8 +1,8 @@ -$('#attachments_<%= j params[:attachment_id] %>').remove(); -var count=$('#attachments_fields>span').length; -if(count<=0){ - $("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>); - $(".remove_all").remove(); -}else{ - $("#upload_file_count").html("已上传"+""+count+""+"个文件"); +$('#attachments_<%= j params[:attachment_id] %>').remove(); +var count=$('#attachments_fields>span').length; +if(count<=0){ + $("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>); + $(".remove_all").remove(); +}else{ + $("#upload_file_count").html("已上传"+""+count+""+"个文件"); } \ No newline at end of file diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 2f2dbcd07..1ecf8be90 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -1,201 +1,201 @@ - - - - -<% if bids.blank? %> -<%#= l(:label_uncommit_homework) %> -暂无作业! -<% else %> -<% bids.each do |bid|%> - - - - - -
- <%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %> - - - - - - - - - - - - - - - - - - -
- - <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %> - - - <%= l(:label_user_create_project_homework) %> - - - <%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %> - - - - <% if User.current.logged? && is_cur_course_student(@course) %> - <% cur_user_homework = cur_user_homework_for_bid(bid) %> - - <% if bid.open_anonymous_evaluation == 1 %> - <% case bid.comment_status %> - <% when 0 %> - 未开启匿评 - <% when 1 %> -   匿评中..   - <% when 2 %> -   匿评结束   - <% end %> - <% end%> - - <% if cur_user_homework && cur_user_homework.empty? %> - - <%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %> - - <% else %> - - 已 提 交 - - <% end %> - <% end %> - <% if (User.current.admin?||User.current.allowed_to?(:as_teacher,@course)) %> - <% if bid.open_anonymous_evaluation == 1 && bid.homeworks.count >= 2%> - - <% case bid.comment_status %> - <% when 0 %> - <%= link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %> - <% when 1 %> - <%= link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true %> - <% when 2 %> - 匿评结束 - <% end %> - - <%end%> - - <%= link_to( - l(:button_edit), - {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id} - ) %> - - <%#= link_to( - l(:button_delete), - {:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'icon icon-del' - ) %> - <% end %> - -
- - <% bidding_project = bid.biding_projects.all - temp = [] - bidding_project.each do |pro| - if pro.project && pro.project.project_status - temp << pro - end - temp - end - %> - <% if bid.homework_type == 1%> - <%= l(:label_x_homework_project, :count => bid.homeworks.count) %> - ( - - <%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %> - ) - <% else %> - <%= l(:label_x_homework_project, :count => temp.count) %> - ( - - <%= link_to temp.count, course_for_bid_path(bid.id) %> - ) - <% end %> - -
- <% if bid.reward_type.nil? or bid.reward_type == 1 %> - - <%= l(:label_bids_reward_method) %> - - <%= l(:label_call_bonus) %> -   - <%= l(:label_RMB_sign) %> - <%= bid.budget%> - - - <% elsif bid.reward_type == 2 %> - - <%= l(:label_bids_reward_method) %> - - <%= bid.budget%> - - - <% end %> -
- - <%=h sanitize(bid.description.html_safe) %> - -
- - <%= l(:label_end_time) %> - :  - <%= bid.deadline %> - - - <% if betweentime(bid.deadline) < 0 %> - - <%= l(:label_commit_limit)%> - - <% else %> - - - - <% end %> - -
-<% end %> -<% end %> -
diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb index 16f78491b..7a5f628f9 100644 --- a/app/views/bids/_new_homework_form.html.erb +++ b/app/views/bids/_new_homework_form.html.erb @@ -35,7 +35,7 @@
  • - + <%= l(:label_evaluation_description)%>

  • diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb new file mode 100644 index 000000000..94ba51529 --- /dev/null +++ b/app/views/boards/_course_new.html.erb @@ -0,0 +1,9 @@ +<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> + + <%= render :partial => 'form_course', :locals => {:f => f} %> +
  • + <%= link_to l(:button_cancel), course_boards_path(@course), :class => 'grey_btn fr ml10' %> + <%= l(:button_submit)%> +
    +
  • +<% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index ed2c20448..e4db6bef1 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -10,7 +10,7 @@ <%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form_course', :locals => {:f => f} %>

    - <%= l(:button_submit)%> + <%= l(:button_submit)%> <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>

    <% end %> @@ -42,14 +42,14 @@ :class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
    - <% if @topics.any? %> - <% @topics.each do |topic| %> +<% if @topics.any? %> + <% @topics.each do |topic| %>
    <%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %>
    - <%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %> + <%= link_to h(topic.subject), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %> <% if topic.sticky? %> - 置顶 + 置顶 <% end %>

    由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %>

    @@ -58,17 +58,17 @@
    - <% end %> - <% else %> -

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

    - <% end %> + <% end %> +<% else %> +

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

    +<% end %> <%# other_formats_links do |f| %> - <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%# end %> <% html_title @board.name %> diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb new file mode 100644 index 000000000..c41f723de --- /dev/null +++ b/app/views/boards/_edit.html.erb @@ -0,0 +1,42 @@ + + <% if topic.project %> + <%#= board_breadcrumb(@message) %> + +
    + +
    + <% end %> +<% elsif topic.course %> + <%#= course_board_breadcrumb(@message) %> +
    + +
    +<% end %> + + +
    diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb new file mode 100644 index 000000000..5cd2d8a2f --- /dev/null +++ b/app/views/boards/_form_course.html.erb @@ -0,0 +1,60 @@ +<%= error_messages_for 'message' %> +<% replying ||= false %> +<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> +<% if replying %> +
  • + + + <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> + + +

    +
  • +<% else %> +
  • + + + + <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> + +

    +
  • +<% end %> +
  • + <% unless replying %> + <% if @message.safe_attribute? 'sticky' %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <% end %> + <% if @message.safe_attribute? 'locked' %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> + <% end %> + <% end %> +
    +
  • +
  • +
    + <% unless replying %> + + <% end %> + <%= text_area :quote,:quote,:style => 'display:none' %> + <% if replying%> + <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + <% else %> + <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <% end %> +
    +

    +
  • +
    +
  • + <% unless replying %> +
    + <%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %> +
    + <% end %> +
  • +
  • +
    +
  • \ No newline at end of file diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb new file mode 100644 index 000000000..b42cabbeb --- /dev/null +++ b/app/views/boards/_form_project.html.erb @@ -0,0 +1,60 @@ +<%= error_messages_for 'message' %> +<% replying ||= false %> +<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> +<% if replying %> +
  • + + + <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> + + +

    +
  • +<% else %> +
  • + + + + <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> + +

    +
  • +<% end %> +
  • + <% unless replying %> + <% if @message.safe_attribute? 'sticky' %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <% end %> + <% if @message.safe_attribute? 'locked' %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> + <% end %> + <% end %> +
    +
  • +
  • +
    + <% unless replying %> + + <% end %> + <%= text_area :quote,:quote,:style => 'display:none' %> + <% if replying%> + <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + <% else %> + <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <% end %> +
    +

    +
  • +
    +
  • +<% unless replying %> +
    + <%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %> +
    + <% end %> +
  • +
  • +
    +
  • \ No newline at end of file diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb new file mode 100644 index 000000000..371007a72 --- /dev/null +++ b/app/views/boards/_project_new_topic.html.erb @@ -0,0 +1,9 @@ +<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> + + <%= render :partial => 'form_project', :locals => {:f => f} %> +
  • + <%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn fr ml10' %> + <%= l(:button_submit)%> +
    +
  • +<% end %> \ No newline at end of file diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 410648c15..d0fd6215a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -1,11 +1,14 @@ -
    -

    +
    +

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

    + <%= l(:label_message_new) %> +
    @@ -16,34 +19,158 @@

    <% end %> - -
    -
    <%= l(:label_project_board_count , :count => @topic_count)%>
    -<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %> - <%= link_to l(:project_module_boards_post), new_board_message_path(@board), - :class => 'problem_new_btn fl c_dorange', - :onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> - <% end %> -
    -
    + +
    +
    +
    +
      + <%= render :partial => 'project_new_topic' %> +
    +
    + +

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

    <% if @topics.any? %> <% @topics.each do |topic| %> -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %> -
    - <%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %> - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> -
    - <%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %> -  <%= l(:label_post_by_time)%><%= format_time topic.created_on %> +
    + <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> +
    + <% author = topic.author.to_s + ":" %> + <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> + +

      <%= h(topic.subject) %>

    + <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %> + <%= link_to( + l(:button_delete), + {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'talk_edit fr', + :style => ' margin-right: 10px;' + ) if topic.destroyable_by?(User.current) %> + + +
    + +

    + <%= topic.content %> +

    +

    + + + + + +

    + + + + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %>
    - <%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %> + <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> +
    - <% end %> + +
    +
      + <%= render :partial => 'edit',locals: {:topic => topic} %> +
    +
    +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + + <% end %> + <% replies_all = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").offset(2). + all %> + <% replies_show = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").limit(2). + all %> + <% unless replies_show.empty? %> + <% reply_count = 0 %> +
    +
      + <% replies_show.each do |message| %> + +
    • + <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> +
      + <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> +
      +

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

      + +
      + <%= format_time(message.created_on) %> + <%= link_to( + + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete), + :class => ' c_dblue fr' + ) if message.course_destroyable_by?(User.current) %> +
      +
      + +
    • + <% end %> +
    +
    + + <%if replies_all.first %> + + <% end %> + <% end %> +
    + <% end %> <% else %>

    <%= l(:label_no_data) %>

    <% end %> @@ -61,3 +188,33 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> <% end %> +
    + \ No newline at end of file diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index c9a8645de..9faf07b9a 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,4 +1,41 @@ + + + <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> <% elsif @course %> diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 0e1b5caa6..755dd63b0 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -58,14 +58,14 @@ <%= content_tag('span', "#{garble @course.members.count}", :class => "info") %> <%= content_tag('span', l(:label_x_member, :count => memberCount(@course))) %>

    - +

    <%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %> <%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %>

    - +
    <% if(course_endTime_timeout? @course) %> diff --git a/app/views/courses/_course_members.html.erb b/app/views/courses/_course_members.html.erb index 88ac405dc..9f15405dc 100644 --- a/app/views/courses/_course_members.html.erb +++ b/app/views/courses/_course_members.html.erb @@ -21,7 +21,7 @@ <%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>