diff --git a/.gitignore b/.gitignore deleted file mode 100644 index af337a4e7..000000000 --- a/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.swp -/.project -/.idea -/.bundle -*.swp -/config/database.yml -/config/configuration.yml -/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/ diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 383da0bbe..67355fdfa 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -57,6 +57,7 @@ class BoardsController < ApplicationController def show respond_to do |format| + format.js format.html { sort_init 'updated_on', 'desc' sort_update 'created_on' => "#{Message.table_name}.created_on", diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 932ffaa7a..545d61155 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -61,6 +61,10 @@ class DocumentsController < ApplicationController if @project.project_type ==1 render :action => 'show', :layout => 'base_courses' end + respond_to do |format| + format.html + format.api + end end def new diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 5336ab54d..474f199a2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -148,7 +148,11 @@ class FilesController < ApplicationController show_attachments @containers - render :layout => !request.xhr? + + respond_to do |format| + format.html + format.js + end elsif params[:course_id] @isproject = false diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 5dc945cc7..6a251a80c 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -90,6 +90,7 @@ class IssuesController < ApplicationController respond_to do |format| + format.js format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young format.api { Issue.load_visible_relations(@issues) if include_in_api_response?('relations') @@ -103,6 +104,7 @@ class IssuesController < ApplicationController format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young format.any(:atom, :csv, :pdf) { render(:nothing => true) } format.api { render_validation_errors(@query) } + format.js end end rescue ActiveRecord::RecordNotFound @@ -154,7 +156,7 @@ class IssuesController < ApplicationController call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue }) @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) # 给该issue在它所在的项目中所有的issues中所在的位置给一个序号 - @issue.project_issues_index = @issue.project.issues.last.project_issues_index + 1 + @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 if @issue.save call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) respond_to do |format| diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 88ebbb1c1..41b9201ba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -307,7 +307,6 @@ class ProjectsController < ApplicationController # @events = @activity.events(@date_from, @date_to, :is_public => 1) end - =begin @events_pages = Paginator.new events.count, 10, params['page'] # 总的数据中取出某一页 @@ -315,11 +314,13 @@ class ProjectsController < ApplicationController # 按天分组 @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} =end - + boards = @project.boards.includes(:last_message => :author).all + @topic_count = @project.boards.count # 根据对应的请求,返回对应的数据 respond_to do |format| format.html format.api + format.js end end @@ -331,6 +332,20 @@ class ProjectsController < ApplicationController @wiki ||= @project.wiki end + + #发送邮件邀请新用户 + def invite_members_by_mail + + end + + # 邀请Trustie注册用户 + def invite_members_had_loged + @member ||= @project.members.new + respond_to do |format| + format.js + end + end + def edit end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5579fe79b..30b2e7a21 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,7 +48,7 @@ module ApplicationHelper def authorize_for(controller, action) User.current.allowed_to?({:controller => controller, :action => action}, @project) end - + # add by nwb def authorize_for_course(controller, action) User.current.allowed_to?({:controller => controller, :action => action}, @course) @@ -1841,7 +1841,7 @@ module ApplicationHelper # course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'} course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain} # courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'} - users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain} + #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_forum_all), {:controller => "forums", :action => "index"} @@ -1860,7 +1860,7 @@ module ApplicationHelper nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1 # nav_list.push(projects_link) if @nav_dispaly_project_label - nav_list.push(users_link) if @nav_dispaly_user_label + #nav_list.push(users_link) if @nav_dispaly_user_label # nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1 nav_list.push(bids_link) if @nav_dispaly_bid_label nav_list.push(forum_link) if @nav_dispaly_forum_label diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ccc750462..3c1663fcb 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -374,6 +374,10 @@ module ProjectsHelper def project_organizations_id_option type = [] + option1 = [] + option1 << l(:label_organization_choose) + option1 << 0 + type << option1 Organization.all.each do |org| option = [] option << org.name diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 842e1f1b7..f47ced545 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -283,6 +283,6 @@ module WatchersHelper def exit_project_link(project) link_to(l(:label_exit_project),exit_cur_project_path(project.id), - :remote => true, :confirm => l(:lable_sure_exit_project) ) + :remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:20px;text-aligh:center;" ) end end diff --git a/app/models/message.rb b/app/models/message.rb index 413a4f91c..85a87132d 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -164,8 +164,11 @@ class Message < ActiveRecord::Base # Author lizanle # Description def act_as_forge_activity - self.forge_acts << ForgeActivity.new(:user_id => self.author_id, - :project_id => self.board.project.id) + # 如果project为空,那么就是课程相关的消息 + if !self.board.project.nil? + self.forge_acts << ForgeActivity.new(:user_id => self.author_id, + :project_id => self.board.project.id) + end end #更新用户分数 -by zjc diff --git a/app/models/news.rb b/app/models/news.rb index fa9f31712..d2547fc02 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -98,8 +98,11 @@ class News < ActiveRecord::Base # Author lizanle # Description 公用表中也要记录 def act_as_forge_activity - self.forge_acts << ForgeActivity.new(:user_id => self.author_id, - :project_id => self.project.id) + # 如果是project为空,那么是课程相关的,不需要保存 + if !self.project.nil? + self.forge_acts << ForgeActivity.new(:user_id => self.author_id, + :project_id => self.project.id) + end end end diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 1a5cbd2fa..97ed903d9 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -9,9 +9,7 @@
-<%= l(:label_no_data) %> diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 45f54ad9b..5632c9d63 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -1,3 +1,6 @@ +
<%#=h @document.category.name %>
<%= format_date @document.created_on %>
+ <%= l(:label_no_data) %> +
+ <% else %> + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> +- <%= l(:label_no_data) %> -
- <% else %> - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> -