diff --git a/.rspec b/.rspec index 8c18f1abd..83e16f804 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,2 @@ ---format documentation --color +--require spec_helper diff --git a/Gemfile b/Gemfile index 0aa77ae99..fbe74f8dd 100644 --- a/Gemfile +++ b/Gemfile @@ -28,28 +28,21 @@ gem "rmagick", ">= 2.0.0" group :development do gem 'grape-swagger' - #gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' - gem 'puma' if RbConfig::CONFIG['host_os'] =~ /linux/ - gem 'pry-rails' - if RUBY_VERSION >= '2.0.0' - gem 'pry-byebug' - else - # gem 'pry-debugger' - end - gem 'pry-stack_explorer' gem 'better_errors', '~> 1.1.0' gem 'rack-mini-profiler', '~> 0.9.3' end -group :test do - gem "shoulda", "~> 3.5.0" - gem "mocha", "~> 1.1.0" - gem 'capybara', '~> 2.4.1' - gem 'nokogiri', '~> 1.6.3' - gem 'factory_girl', '~> 4.4.0' - gem 'selenium-webdriver', '~> 2.42.0' +group :development, :test do + unless RUBY_PLATFORM =~ /w32/ + gem 'pry-rails' + if RUBY_VERSION >= '2.0.0' + gem 'pry-byebug' + end + gem 'pry-stack_explorer' + end - gem "faker" + gem 'rspec-rails', '~> 3.0' + gem 'factory_girl_rails' end # Gems used only for assets and not required diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 0d0c4651f..b2a2532bc 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -168,6 +168,14 @@ module Mobile present :status, 0 end + desc "设置教辅" + params do + + end + post 'set_user_as_assitant' do + + end + desc "返回单个课程" params do requires :id, type: Integer @@ -254,6 +262,18 @@ module Mobile present :status, 0 end + desc '查看用户历次作业成绩' + params do + requires :token,type:String + requires :member_id,type:Integer,desc:'课程member_id' + optional :homeworkName,type:String,desc:'作业名称以及作业名称可能包含的字符' + end + get '/show_member_score/:member_id' do + cs = CoursesService.new + homeworkscore = cs.show_member_score params + present :data,homeworkscore,with: Mobile::Entities::Homeworkscore + present :status,0 + end end end end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 063cfafae..3ef2c3237 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -83,6 +83,7 @@ module Mobile params do requires :name, type: String, desc: '用户名关键字' requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' + optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' end get 'search/search_user' do us = UsersService.new diff --git a/app/api/mobile/entities/homework_attach.rb b/app/api/mobile/entities/homework_attach.rb index 690ec8e94..2ad11fe36 100644 --- a/app/api/mobile/entities/homework_attach.rb +++ b/app/api/mobile/entities/homework_attach.rb @@ -37,7 +37,6 @@ module Mobile f.send(:attachments) end end - #homework_attach_expose :user end end end \ No newline at end of file diff --git a/app/api/mobile/entities/homeworkscore.rb b/app/api/mobile/entities/homeworkscore.rb new file mode 100644 index 000000000..e0c501c58 --- /dev/null +++ b/app/api/mobile/entities/homeworkscore.rb @@ -0,0 +1,18 @@ +module Mobile + module Entities + class Homeworkscore < Grape::Entity + include Redmine::I18n + include ApplicationHelper + def self.homeworkscore_expose(field) + expose field do |f,opt| + if f.is_a?(Hash) && f.key?(field) + f[field] + end + end + end + + homeworkscore_expose :name + homeworkscore_expose :score + end + end +end \ No newline at end of file diff --git a/app/api/mobile/entities/member.rb b/app/api/mobile/entities/member.rb index 837ec788a..f9dd1e849 100644 --- a/app/api/mobile/entities/member.rb +++ b/app/api/mobile/entities/member.rb @@ -28,6 +28,7 @@ module Mobile end member_expose :student_id member_expose :score + member_expose :id end end end \ No newline at end of file diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index 84b8a92e4..ef7cdf2f7 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -8,23 +8,26 @@ class AvatarController < ApplicationController # Make sure that API users get used to set this content type # as it won't trigger Rails' automatic parsing of the request body for parameters unless request.content_type == 'application/octet-stream' - render :nothing => true, :status => 406 - return - end - - unless request.raw_post.nil? - @source_type = params[:source_type] + @source_type = params[:source_type] @source_id = params[:source_id] - @temp_file = request.raw_post - if @temp_file.size > 0 - if @temp_file.respond_to?(:original_filename) - @image_file = @temp_file.original_filename - #image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding) - else - @image_file=params[:filename] - end + @temp_file = params[:avatar][:image] + @image_file = @temp_file.original_filename + else + unless request.raw_post.nil? + @source_type = params[:source_type] + @source_id = params[:source_id] + @temp_file = request.raw_post + if @temp_file.size > 0 + if @temp_file.respond_to?(:original_filename) + @image_file = @temp_file.original_filename + #image_file.force_encoding("UTF-8") if filename.respond_to?(:force_encoding) + else + @image_file=params[:filename] + end + end end end + if @temp_file && (@temp_file.size > 0) diskfile=disk_filename(@source_type,@source_id) @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) @@ -61,6 +64,10 @@ class AvatarController < ApplicationController image.compress(300) respond_to do |format| + format.json{ + render :inline => "#{@urlfile.to_s}?#{Time.now.to_i}",:content_type => 'text/html' + return + } format.js format.api { if saved diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index f6ec09b2a..7ccfb0e10 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -27,7 +27,7 @@ class BoardsController < ApplicationController include SortHelper helper :watchers helper :project_score - + helper :attachments def index #modify by nwb @flag = params[:flag] || false @@ -80,7 +80,7 @@ class BoardsController < ApplicationController includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). - order(sort_clause). + order("last_replies_messages.created_on desc"). preload(:author, {:last_reply => :author}). all elsif @course @@ -88,7 +88,7 @@ class BoardsController < ApplicationController includes(:last_reply). # limit(@topic_pages.per_page). # offset(@topic_pages.offset). - order(sort_clause). + order("last_replies_messages.created_on desc"). preload(:author, {:last_reply => :author}). all : [] @topics = paginateHelper board_topics,10 diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a1e547a84..1d1212bf1 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -5,6 +5,7 @@ class CoursesController < ApplicationController helper :activities helper :members helper :words + helper :attachments before_filter :auth_login1, :only => [:show, :feedback] menu_item :overview diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 12ee4bc3b..b6035ca51 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -58,7 +58,7 @@ class IssuesController < ApplicationController def index retrieve_query - sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) + sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns) @query.sort_criteria = sort_criteria.to_a @@ -387,7 +387,7 @@ class IssuesController < ApplicationController def retrieve_previous_and_next_issue_ids retrieve_query_from_session if @query - sort_init(@query.sort_criteria.empty? ? [['updated_on', 'desc']] : @query.sort_criteria) + sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns, 'issues_index_sort') limit = 500 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 431577f9a..619f91245 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -93,10 +93,27 @@ 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 + if params[:is_board] + if @project + redirect_to project_boards_path(@project, :flag => true) + elsif @course + redirect_to course_boards_path(@course, :flag => true) + end + else + layout_file = @project ? 'base_projects' : 'base_courses' + render :action => 'new', :layout => layout_file + end + end else respond_to do |format| @@ -111,7 +128,15 @@ class MessagesController < ApplicationController # Reply to a topic def reply if params[:reply][:content] == "" - (redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return) + if params[:is_board] + if @project + (redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return) + elsif @course + (redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return) + end + else + (redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return) + end end @quote = params[:quote][:quote] @reply = Message.new @@ -132,7 +157,15 @@ class MessagesController < ApplicationController else #render file: 'messages#show', layout: 'base_courses' end - redirect_to board_message_url(@board, @topic, :r => @reply) + 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 end @@ -144,19 +177,36 @@ class MessagesController < ApplicationController else (render_403; return false) unless @message.course_editable_by?(User.current) end + @message.safe_attributes = params[:message] if request.post? && @message.save attachments = Attachment.attach_files(@message, params[:attachments]) 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 { - layout_file = @project ? 'base_projects' : 'base_courses' - render :layout => layout_file - } + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + respond_to do |format| + format.html { + layout_file = @project ? 'base_projects' : 'base_courses' + render :layout => layout_file + } + end end end end @@ -172,16 +222,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/repositories_controller.rb b/app/controllers/repositories_controller.rb index 5fe953563..d0af82c8c 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -244,12 +244,12 @@ update def show ## TODO: the below will move to filter, done. - # if !User.current.member_of?(@project) - # if @project.hidden_repo - # render_403 - # return -1 - # end - # end + if !User.current.member_of?(@project) + if @project.hidden_repo + render_403 + return -1 + end + end #if( !User.current.member_of?(@project) || @project.hidden_repo) @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 405dc72ed..bb62695c0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -593,6 +593,17 @@ module ApplicationHelper Project.project_tree(projects, &block) end + # 判断当前用户是否为项目管理员 + def is_project_manager?(user_id,project_id) + @result = false + mem = Member.where("user_id = ? and project_id = ?",user_id, project_id) + unless mem.blank? + mem.first.roles.to_s.include?("Manager") + @result = false + end + return @result + end + def principals_check_box_tags(name, principals) s = '' principals.each do |principal| @@ -1770,8 +1781,7 @@ module ApplicationHelper def get_memo @new_memo = Memo.new - #@new_memo.subject = "有什么想说的,尽管来咆哮吧~~" - @public_forum = Forum.find(1) + @public_forum = Forum.find(1) rescue ActiveRecord::RecordNotFound end #获取用户未过期的课程 diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 773560932..9ee11e392 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -232,6 +232,18 @@ module RepositoriesHelper :label => l(:label_git_report_last_commit) )) end + + # 判断项目是否有主版本库 + def judge_main_repository(pro) + if pro.repositories.blank? + return false + else + pro.repositories.sort.each do |rep| + rep.is_default? + return true + end + end + end # def cvs_field_tags(form, repository) # content_tag('p', form.text_field( # :root_url, diff --git a/app/models/token.rb b/app/models/token.rb index d9fc75d76..e0accb59c 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -32,6 +32,8 @@ class Token < ActiveRecord::Base token = Token.get_token_from_user(user, 'autologin') unless token token = Token.create(:user => user, :action => 'autologin') + else + token.update_attribute(:created_on, Time.now) end token end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 22249b953..fd7ec55fb 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -458,6 +458,21 @@ class CoursesService @all_members = searchmember_by_name(student_homework_score(0,params[:course_id], 10,"desc"),params[:name]) end + def show_member_score params + @member_score = Member.find(params[:member_id]) if params[:member_id] + atta = @member_score.student_homework_score[0] + result = [] + atta.each do |t| + if !params[:homeworkName].nil? && params[:homeworkName] != "" + result << {:name=>t[:name],:score=>t[:score]} if t[:name].include?(params[:homeworkName]) + else + result << {:name=>t[:name],:score=>t[:score]} + end + + end + result + end + private def searchmember_by_name members, name #searchPeopleByRoles(project, StudentRoles) @@ -559,4 +574,6 @@ class CoursesService end + + end \ No newline at end of file diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 3a92bf8f1..17557872b 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -205,10 +205,14 @@ class UsersService "show_changesets" => true } scope = User.logged.status(status) - watcher = User.watched_by(params[:user_id]) - watcher.push(params[:user_id]) - search_by = params[:search_by] ? params[:search_by] : "0" - scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present? + if params[:is_search_assitant].nil? + watcher = User.watched_by(params[:user_id]) + watcher.push(params[:user_id]) + search_by = params[:search_by] ? params[:search_by] : "0" + scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present? + else + scope = scope.like(params[:name],search_by) if params[:name].present? + end scope end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 2e8800617..845e2b6a0 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -17,6 +17,7 @@ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> +
<% end %> <% container.saved_attachments.each_with_index do |attachment, i| %> @@ -34,10 +35,12 @@ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> +
<% end %> <% end %> <% project = project %> +
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> diff --git a/app/views/attachments/_form_course.html.erb b/app/views/attachments/_form_course.html.erb index 1e81aaf65..4a297fb7b 100644 --- a/app/views/attachments/_form_course.html.erb +++ b/app/views/attachments/_form_course.html.erb @@ -1,4 +1,4 @@ - + <% if defined?(container) && container && container.saved_attachments %> <% if isReply %> <% container.saved_attachments.each_with_index do |attachment, i| %> @@ -38,12 +38,12 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> -<%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"_file.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> +<%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= file_field_tag 'attachments[dummy][file]', - :id => '_file', + :id => "file#{container.id}", :class => 'file_selector', :multiple => true, - :onchange => 'addInputFiles(this);', + :onchange => "addInputFiles_board(this, '#{container.id}');", :style => 'display:none', :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, @@ -56,7 +56,7 @@ :file_count => l(:label_file_count), :delete_all_files => l(:text_are_you_sure_all) } %> -<%= l(:label_no_file_uploaded)%> +<%= l(:label_no_file_uploaded)%> (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) diff --git a/app/views/attachments/_form_project.html.erb b/app/views/attachments/_form_project.html.erb index 9778d3242..515e307f6 100644 --- a/app/views/attachments/_form_project.html.erb +++ b/app/views/attachments/_form_project.html.erb @@ -1,26 +1,32 @@ - +<% if defined?(container) %> + <% if defined?(container) && container && container.saved_attachments %> <% if isReply %> <% container.saved_attachments.each_with_index do |attachment, i| %> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + - link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> - <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%> - <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <% end %> <% else %> <% container.attachments.each_with_index do |attachment, i| %> + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> - <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + - link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> - <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> - <%= l(:field_is_public)%>: - <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <% end %> @@ -38,12 +44,12 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file#{container.id}.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> <%= file_field_tag 'attachments[dummy][file]', - :id => '_file', + :id => "_file#{container.id}", :class => 'file_selector', :multiple => true, - :onchange => 'addInputFiles(this);', + :onchange => "addInputFiles_board(this, '#{container.id}');", :style => 'display:none', :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, @@ -56,10 +62,73 @@ :file_count => l(:label_file_count), :delete_all_files => l(:text_are_you_sure_all) } %> - <%= l(:label_no_file_uploaded)%> + <%= l(:label_no_file_uploaded)%> +(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) + +<% else %> + +<% if defined?(container) && container && container.saved_attachments %> + <% if isReply %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% else %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") + + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% end %> +<% end %> + + + +<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + + <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all) + } %> + <%= l(:label_no_file_uploaded)%> (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) +<% end %> <% content_for :header_tags do %> <%= javascript_include_tag 'attachments' %> <% end %> diff --git a/app/views/attachments/_homework_jour_link.html.erb b/app/views/attachments/_homework_jour_link.html.erb index e0efa211c..8721d41ac 100644 --- a/app/views/attachments/_homework_jour_link.html.erb +++ b/app/views/attachments/_homework_jour_link.html.erb @@ -13,6 +13,6 @@ :target => "_blank"%> <% end %> -
+
<% end %> diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 24256ccab..c3e7fc3ff 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -3,14 +3,15 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); fileSpan.hide(); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); <% else %> -$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); fileSpan.find('a.remove-upload') - .attr({ - "data-remote": true, - "data-method": 'delete', - "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' - }) - .off('click'); + .attr({ + "data-remote": true, + "data-method": 'delete', + "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' + }) + .off('click'); +$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); + //var divattach = fileSpan.find('div.div_attachments'); //divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>'); <% end %> diff --git a/app/views/avatar/_new_avatar_form.html.erb b/app/views/avatar/_new_avatar_form.html.erb index e341bc83a..793252d3a 100644 --- a/app/views/avatar/_new_avatar_form.html.erb +++ b/app/views/avatar/_new_avatar_form.html.erb @@ -7,8 +7,7 @@ :id => nil, :class => 'upload_file', :size => "1", - :multiple => false, - :onchange => 'addInputAvatar(this);', + :multiple => true, :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), @@ -22,6 +21,6 @@ } %> <% content_for :header_tags do %> - <%= javascript_include_tag 'avatars' %> + <%= javascript_include_tag 'jq-upload/jquery.ui.widget', 'jq-upload/jquery.iframe-transport', 'jq-upload/jquery.fileupload', 'jq-upload/upload' %> <% end %> -
\ No newline at end of file +
diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index b39e308ec..1fa90c5a3 100644 --- a/app/views/avatar/upload.js.erb +++ b/app/views/avatar/upload.js.erb @@ -1,4 +1,4 @@ -var imgSpan = $('#avatar_image'); +var imgSpan = jQuery('#avatar_image'); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 94ba51529..a380ad67f 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,9 +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} %> + <%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
  • - <%= link_to l(:button_cancel), course_boards_path(@course), :class => 'grey_btn fr ml10' %> - <%= l(:button_submit)%> + <%= l(:button_cancel) %> + <%= l(:button_submit)%>
  • <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index e4db6bef1..2d0bda162 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,28 +1,26 @@ - +
    -

    <%= l(:label_board_plural) %>

    -
    +

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

    + <%= l(:label_message_new) %> +
    + + +
    +
    +
    +
      + <%= render :partial => 'course_new' %> +
    +
    <% if !User.current.logged?%>
    @@ -31,44 +29,165 @@
    <% end %> -
    -

    - <%= l(:label_totle) %> - <%= @topic_count %> - <%= l(:label_course_momes_count) %> -

    - <%= link_to l(:label_message_new), - new_board_message_path(@board), - :class => 'problem_new_btn fl c_dorange' if User.current.logged? %> -
    -
    -<% 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 fb c_dblue" %> - <% if topic.sticky? %> - 置顶 - <% end %> -
    -

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

    +

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

    + <% if @topics.any? %> + <% @topics.each do |topic| %> +
    + <%= 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.course_editable_by?(User.current) %> + <%= l(:button_edit) %> + <% 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) %> + + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %> +
    + + +
    +
    + <%= topic.content.html_safe %> +
    +
    + + + + <%= link_to_attachments_course topic, :author => false %> + + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> + +
    + <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> + +
    + + +
    + - <%=link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic),:class => "talk_btn fr c_white" %> +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + - <% end %> -<% else %> -

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

    -<% end %> + <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> + <%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %> + <%= l(:label_memo_create)%> + <% end %> +
    +
    + <% 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 %>
      <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
    <%# 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 index c41f723de..0bb15b167 100644 --- a/app/views/boards/_edit.html.erb +++ b/app/views/boards/_edit.html.erb @@ -11,9 +11,10 @@ :method => :post} } do |f| %> <%= render :partial => 'form_project', - :locals => {:f => f, :replying => !topic.parent.nil?} %> - <%= l(:button_submit)%> - <%= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %> + :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> + <%= l(:button_submit)%> + <%= l(:button_cancel) %> + <%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
    <% end %> @@ -29,11 +30,11 @@ :method => :post} } do |f| %> <%= render :partial => 'form_course', - :locals => {:f => f, :replying => !topic.parent.nil?} %> - <%= l(:button_submit)%> - <%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %> + :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> + <%= l(:button_submit)%> + <%= l(:button_cancel) %> - <% end %> + <% end %>
    <% end %> diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb index 5cd2d8a2f..945f58c22 100644 --- a/app/views/boards/_form_course.html.erb +++ b/app/views/boards/_form_course.html.erb @@ -8,16 +8,16 @@ <%= 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) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% end %>
  • @@ -40,18 +40,18 @@ <% 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;" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <% end %>
    -

    +

  • <% unless replying %>
    - <%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %> + <%= render :partial => 'attachments/form_course', :locals => {:container => topic,:isReply => @isReply} %>
    <% end %>
  • diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index b42cabbeb..8288debe2 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -5,19 +5,19 @@
  • - <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",: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) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% end %>
  • @@ -36,22 +36,22 @@
  • <% 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;" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <% end %>
    -

    +

  • <% unless replying %>
    - <%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %> + <%= render :partial => 'attachments/form_project', :locals => {:container => topic,:isReply => @isReply} %>
    <% end %>
  • diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 371007a72..cab1bbb7b 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -1,9 +1,10 @@ <%= 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} %> + <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
  • - <%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn fr ml10' %> - <%= l(:button_submit)%> + <%= l(:button_cancel) %> + + <%= 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 af568bbff..63bb66a6a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -1,59 +1,200 @@ -
    -

    +
    +

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

    + <%= l(:label_message_new) %> +
    <% if !User.current.logged? %>
    - <%= l(:label_user_login_project_board) %> - <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %> + <%= l(:label_user_login_project_board) %> + <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
    <% 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)%> + <% @topics.each do |topic| %> + +
    + <%= 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 %> + + <%= 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) %> + + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %> +
    + +
    +
    + <%= topic.content %> +
    +
    + + + + + <%= link_to_attachments_course topic, :author => false %> + + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> + +
    + <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> + +
    + + +
    + + +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + <% 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 (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %> -
    -
    - <% end %> -<% else %> -

    <%= l(:label_no_data) %>

    -<% 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 %>
      - <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> -
    - + <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> + + <%# 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 %> @@ -61,3 +202,18 @@ <% 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 9faf07b9a..c111aeaf0 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -24,7 +24,29 @@ <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 755dd63b0..222d90458 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -56,7 +56,7 @@

    <%= content_tag('span', "#{garble @course.members.count}", :class => "info") %> - <%= content_tag('span', l(:label_x_member, :count => memberCount(@course))) %> + <%= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>

    diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 1d2c42457..cc3bb33f1 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -15,12 +15,13 @@   <%= l(:label_new_activity) %>: <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : e.event_url),:class => "problem_tit c_dblue fl fb"%> + (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>

    <%= e.event_description.html_safe %>
    <%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %>

    + <%= link_to_attachments_course(e) if e.is_a?(News) %>

    @@ -49,4 +50,4 @@
      <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
    -
    \ No newline at end of file +
    diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index 3dd5134d7..d3e383a4e 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -20,20 +20,14 @@
    <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> - <% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %> + <%#--私有项目资源不能引用,不能设置公开私有--%> + <%#--公开项目资源可以应用,管理员和资源上传者拥有设置公开私有权限--%> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> - - <% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %> + <% if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" %> <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %> - <% else %> - <% end %> - <% else %> - <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> - <% end %> - <% else %> <% end %>
    diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index 59ed1092e..ac27235eb 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -48,8 +48,8 @@ - <% end %> -