diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index 8f7f0342f..4808c84c0 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -41,7 +41,7 @@ module Mobile mount Apis::Comments #add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'}) - #add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? + add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? end end diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index afe3c720e..69aae8008 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -322,6 +322,13 @@ class AdminController < ApplicationController end end + #组织 + def organization + @organizations = Organization.all + respond_to do |format| + format.html + end + end #移动端版本管理 def mobile_version @versions = PhoneAppVersion.reorder('created_at desc') diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 2c6a002b4..252d823e9 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -186,6 +186,10 @@ class AttachmentsController < ApplicationController @attachment = Attachment.new(:file => request.raw_post) @attachment.author = User.current + if !params[:project].nil? + @attachment.container_type = 'Project' + @attachment.container_id = params[:project].split("?")[0] + end @attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16) saved = @attachment.save 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 c0d83fdcd..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 @@ -153,6 +155,8 @@ class IssuesController < ApplicationController def create 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.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/organization_controller.rb b/app/controllers/organization_controller.rb new file mode 100644 index 000000000..db8295e44 --- /dev/null +++ b/app/controllers/organization_controller.rb @@ -0,0 +1,55 @@ +class OrganizationController < ApplicationController + layout 'project_base' + before_filter :require_admin, :except => [:index] + + def index + #@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)") + @organizations = Organization.all + respond_to do |format| + format.html + end + end + + def new + @organizations = Organization.new + respond_to do |format| + format.html + end + end + + def create + @organizations = Organization.new + @organizations.name = params[:organization][:name] + if @organizations.save + redirect_to admin_organization_url + end + end + + def edit + @organization = Organization.find params[:id] + respond_to do |format| + format.html + end + rescue Exception => e + render_404 + end + + def update + @organization = Organization.find params[:id] + @organization.name = params[:organization][:name] + if @organization.save + redirect_to admin_organization_url + end + rescue Exception => e + render_404 + end + + def destroy + @organization = Organization.find params[:id] + if @organization.destroy + redirect_to admin_organization_url + end + rescue Exception => e + render_404 + end +end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb deleted file mode 100644 index c9cce5752..000000000 --- a/app/controllers/organizations_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class OrganizationsController < ApplicationController - layout 'project_base' - def index - @projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)") - end -end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 41ec5fbf4..41b9201ba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -179,6 +179,7 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] + @project.organization_id = params[:organization_id] if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin @@ -248,6 +249,7 @@ class ProjectsController < ApplicationController # Author lizanle # Description 项目动态展示方法,删除了不必要的代码 def show +=begin # 试图跳转到请求的按钮 if params[:login] login = params[:login] @@ -282,35 +284,43 @@ class ProjectsController < ApplicationController # 时间跨度不能太大,不然很慢,所以删掉了-1.years @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') +=end + @author = params[:user_id].blank? ? nil : User.active.find(params[:user_id]) # 决定显示所用用户或单个用户活动 +=begin @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects, :author => @author) @activity.scope_select {|t| !has["show_#{t}"].nil?} +=end # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? - events = @activity.events(@date_from, @date_to) + @events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20); + #events = @activity.events(@date_from, @date_to) else - events = @activity.events(@date_from, @date_to, :is_public => 1) + @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public + = ?",@project,1).order("created_at desc") + .page(params['page'|| 1]).per(10); + # @events = @activity.events(@date_from, @date_to, :is_public => 1) end - - @offset, @limit = api_offset_and_limit({:limit => 10}) - @events_count = events.count - @events_pages = Paginator.new @events_count, @limit, params['page'] - @offset ||= @events_pages.offset +=begin + @events_pages = Paginator.new events.count, 10, params['page'] # 总的数据中取出某一页 - events = events.slice(@offset,@limit) + events = events.slice(@events_pages.offset,10) # 按天分组 @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 @@ -322,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 @@ -404,6 +428,7 @@ class ProjectsController < ApplicationController def update @project.safe_attributes = params[:project] + @project.organization_id = params[:organization_id] #@project.dts_test = params[:project][:dts_test] if validate_parent_id && @project.save @course = Course.find_by_extra(@project.identifier) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8ef6f6b53..b3e808b19 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -408,6 +408,9 @@ class UsersController < ApplicationController def show pre_count = 10 #limit + # Time 2015-02-04 11:46:34 + # Author lizanle + # Description type 1 :所有动态包括我关注的人 type 2:我的动态 type 3:关于我的回复 case params[:type] when "1" if @user == User.current @@ -428,26 +431,27 @@ class UsersController < ApplicationController messages = message.sort {|x,y| y.created_on <=> x.created_on } @message = messages[@info_pages.offset, @info_pages.per_page] @state = 2 - else + else + # Time 2015-02-04 10:50:49 + # Author lizanle + # Description 所有动态 where_condition = nil; # where_condition = "act_type <> 'JournalsForMessage'" if @user == User.current watcher = User.watched_by(@user) watcher.push(User.current) - activity = Activity.where(where_condition).where('user_id in (?)', watcher).order('id desc') + activity = Activity.where(where_condition).where('user_id in (?)', watcher).order('id desc') else activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc') end - @activity_count = activity.count @activity_pages = Paginator.new @activity_count, pre_count, params['page'] - activity_page = activity.slice(@activity_pages.offset,@activity_pages.per_page * 2) - activity_page = activity_page.reject { |e| + @activity = activity.slice(@activity_pages.offset,@activity_pages.per_page ) + @activity = @activity.reject { |e| ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) || ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) || ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?))) } - @activity = activity.slice(0,@activity_pages.per_page) @state = 0 end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index db2f287eb..290af0068 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -27,28 +27,31 @@ class WelcomeController < ApplicationController def index # 企业版定制: params[:project]为传过来的参数 unless params[:organization].nil? - @cur_projects = Project.find(params[:organization]) - @organization = @cur_projects.enterprise_name - @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) - @e_count = @organization_projects.count - @part_projects = [] - # 取十个 - @organization_projects.each do |obj| - break if(@organization_projects[10] == obj) - @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil? - end - # 不够十个的用最火项目替代 - @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects - # 配置文件首页定制 + @organization = Organization.find params[:organization] + @organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all + @part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : [] + # @cur_projects = Project.find(params[:organization]) + # @organization = @cur_projects.enterprise_name + # @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) + # @e_count = @organization_projects.count + # @part_projects = [] + # # 取十个 + # @organization_projects.each do |obj| + # break if(@organization_projects[10] == obj) + # @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil? + # end + # # 不够十个的用最火项目替代 + # @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects + # # 配置文件首页定制 @enterprise_page = FirstPage.find_by_page_type('enterprise') if @enterprise_page.nil? @enterprise_page = FirstPage.new @enterprise_page.page_type = 'enterprise' end - # 主页配置部分结束 - + # 主页配置部分结束 end # end 企业版定制结束 + if @first_page.nil? || @first_page.sort_type.nil? @projects = find_miracle_project(10, 3,"score desc") else @@ -74,7 +77,8 @@ class WelcomeController < ApplicationController @projects = @projects_all.order("score desc") end end - + rescue Exception => e + render_404 end def robots 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/expire_helper.rb b/app/helpers/expire_helper.rb deleted file mode 100644 index 0a9cab69c..000000000 --- a/app/helpers/expire_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -module ExpireHelper - #index.html 中 “projects”塊 緩存過期 - def expire_project_cache - ActionController::Base.new.expire_fragment('projects') - end - - #index.html 中 “activities”塊 緩存過期 - def expire_activitie_cache - ActionController::Base.new.expire_fragment('activities') - end - - #welcome/index.html 中 “forums”塊 緩存過期 - def expire_forum_cache - ActionController::Base.new.expire_fragment('forums') - end -end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index fe6714186..3c1663fcb 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -371,4 +371,19 @@ module ProjectsHelper return projects end + + 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 + option << org.id + type << option + end + type + end end 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/attachment.rb b/app/models/attachment.rb index de7912667..7ac7d786d 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -25,7 +25,9 @@ class Attachment < ActiveRecord::Base belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" - + # 被ForgeActivity虚拟关联 + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # end include UserScoreHelper validates :filename, presence: true, length: {maximum: 254} @@ -70,7 +72,7 @@ class Attachment < ActiveRecord::Base @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") before_save :files_to_final_location - after_create :be_user_score # user_score + after_create :be_user_score ,:act_as_forge_activity# user_score after_update :be_user_score after_destroy :delete_from_disk,:down_user_score @@ -529,4 +531,14 @@ class Attachment < ActiveRecord::Base end end + # Time 2015-03-02 17:42:48 + # Author lizanle + # Description 上传该项目的文档资料也要保存一份在公共表中 + def act_as_forge_activity + if self.container_type == 'Project' + self.forge_acts << ForgeActivity.new(:user_id => self.author_id, + :project_id => self.container_id) + end + end + end diff --git a/app/models/bid.rb b/app/models/bid.rb index eb7e5d83f..e5de47b24 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -17,7 +17,6 @@ class Bid < ActiveRecord::Base HomeworkProject = 2 attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password include Redmine::SafeAttributes - include ExpireHelper belongs_to :author, :class_name => 'User', :foreign_key => :author_id belongs_to :course @@ -33,12 +32,6 @@ class Bid < ActiveRecord::Base has_many :join_in_contests, :dependent => :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy # has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}" - - - after_create :expire_activitie_cache - after_update :expire_activitie_cache - before_destroy :expire_activitie_cache - acts_as_attachable NAME_LENGTH_LIMIT = 60 diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 101647824..e05a7d2da 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -16,7 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class Changeset < ActiveRecord::Base - include ExpireHelper belongs_to :repository belongs_to :user include UserScoreHelper @@ -65,9 +64,8 @@ class Changeset < ActiveRecord::Base includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args)) } - after_create :scan_for_issues,:refresh_changests,:expire_activitie_cache#:be_user_score # user_score - after_update :be_user_score,:expire_activitie_cache - before_destroy :expire_activitie_cache + after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score + after_update :be_user_score after_destroy :down_user_score before_create :before_create_cs diff --git a/app/models/contest_notification.rb b/app/models/contest_notification.rb index 0ccd0d5a7..71c448f65 100644 --- a/app/models/contest_notification.rb +++ b/app/models/contest_notification.rb @@ -1,10 +1,6 @@ class ContestNotification < ActiveRecord::Base - include ExpireHelper attr_accessible :content, :title validates :title, length: {maximum: 30} - after_create :expire_forum_cache - after_update :expire_forum_cache - before_destroy :expire_forum_cache end diff --git a/app/models/document.rb b/app/models/document.rb index 48a0151eb..33ffdaa2f 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -17,18 +17,16 @@ class Document < ActiveRecord::Base include Redmine::SafeAttributes - include ExpireHelper belongs_to :project belongs_to :user belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" include UserScoreHelper after_save :be_user_score # user_score after_destroy :down_user_score - after_create :expire_activitie_cache - after_update :expire_activitie_cache - before_destroy :expire_activitie_cache acts_as_attachable :delete_permission => :delete_documents - + # 被ForgeActivity虚拟关联 + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # end acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"}, #:author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) }, @@ -39,7 +37,7 @@ class Document < ActiveRecord::Base validates_presence_of :project, :title, :category validates_length_of :title, :maximum => 60 - + after_create :act_as_forge_activity scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_documents, *args)) } @@ -81,5 +79,12 @@ class Document < ActiveRecord::Base update_document(self.user,2,self.project) end + # Time 2015-03-02 10:51:16 + # Author lizanle + # Description 新创建的document要在公共表ForgeActivity中记录 + def act_as_forge_activity + self.forge_acts << ForgeActivity.new(:user_id => self.user_id, + :project_id => self.project_id) + end end diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb new file mode 100644 index 000000000..e94a29867 --- /dev/null +++ b/app/models/forge_activity.rb @@ -0,0 +1,22 @@ +# Time 2015-02-06 10:42:34 +# Author lizanle +# Description 这是保存Project相关的动态的公共表 +class ForgeActivity < ActiveRecord::Base + # 公共表中活动类型,命名规则:TYPE_OF_{类名}_ACT + TYPE_OF_ISSUE_ACT = "Issue" + TYPE_OF_MESSAGE_ACT = "Message" + TYPE_OF_ATTACHMENT_ACT = "Attachment" + TYPE_OF_DOCUMENT_ACT = "Document" + TYPE_OF_JOURNAL_ACT = "Journal" + TYPE_OF_WIKI_ACT = "Wiki" + TYPE_OF_NEWS_ACT = "News" + attr_accessible :forge_act_id, :forge_act_type,:project_id,:user_id,:org_id + # 虚拟关联 + belongs_to :forge_act ,:polymorphic => true + belongs_to :project + belongs_to :user + validates :user_id,presence: true + validates :project_id,presence: true + validates :forge_act_id,presence: true + validates :forge_act_type, presence: true +end diff --git a/app/models/forum.rb b/app/models/forum.rb index baa8e6260..878937ea7 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -1,13 +1,8 @@ class Forum < ActiveRecord::Base include Redmine::SafeAttributes - include ExpireHelper has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL" belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' - - after_create :expire_forum_cache - after_update :expire_forum_cache - before_destroy :expire_forum_cache safe_attributes 'name', 'description', 'topic_count', diff --git a/app/models/issue.rb b/app/models/issue.rb index a7b1a5943..c2670a0cc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -19,7 +19,6 @@ class Issue < ActiveRecord::Base include Redmine::SafeAttributes include Redmine::Utils::DateCalculation include UserScoreHelper - include ExpireHelper belongs_to :project belongs_to :tracker belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id' @@ -46,6 +45,8 @@ class Issue < ActiveRecord::Base # added by fq has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # 被ForgeActivity虚拟关联 + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # end has_many :praise_tread, as: :praise_tread_object, dependent: :destroy @@ -64,7 +65,9 @@ class Issue < ActiveRecord::Base }, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o}}, :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') } - + # Time 2015-01-31 13:52:53 + # Author lizanle + # Description 将hash传进去 acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, :author_key => :author_id @@ -77,12 +80,9 @@ class Issue < ActiveRecord::Base attr_reader :current_journal # fq - after_create :act_as_activity,:be_user_score_new_issue + after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity after_update :be_user_score after_destroy :down_user_score - after_create :expire_activitie_cache - after_update :expire_activitie_cache - before_destroy :expire_activitie_cache # after_create :be_user_score # end @@ -129,7 +129,15 @@ class Issue < ActiveRecord::Base self.acts << Activity.new(:user_id => self.author_id) end # end - + + # Time 2015-02-26 10:51:16 + # Author lizanle + # Description 新创建的issue要在公共表ForgeActivity中记录 + def act_as_forge_activity + self.forge_acts << ForgeActivity.new(:user_id => self.author_id, + :project_id => self.project_id) + end + # end # Returns a SQL conditions string used to find all issues visible by the specified user @@ -1168,13 +1176,13 @@ class Issue < ActiveRecord::Base # back string obj which is belong to project. def source_from - "" << self.project.name.to_s << - "#" << project_index + "" << self.project.name.to_s end def project_index if self.project.issues.include?(self) (self.project.issues.index(self).to_i + 1).to_s + else issue_index = 1 self.project.issues.each do |issue| @@ -1185,8 +1193,10 @@ class Issue < ActiveRecord::Base issue_index = issue_index+1 end end + issue_index.to_s end + end private diff --git a/app/models/journal.rb b/app/models/journal.rb index a386c2b80..3b660132e 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -27,6 +27,8 @@ class Journal < ActiveRecord::Base # added by fq has_one :journal_reply has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # 被ForgeActivity虚拟关联 + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # end attr_accessor :indice @@ -46,7 +48,7 @@ class Journal < ActiveRecord::Base before_create :split_private_notes # fq - after_save :act_as_activity,:be_user_score + after_save :act_as_activity,:be_user_score,:act_as_forge_activity # end #after_destroy :down_user_score #before_save :be_user_score @@ -156,6 +158,15 @@ class Journal < ActiveRecord::Base end # end + # Time 2015-02-27 13:30:19 + # Author lizanle + # Description 公共表中需要保存一份该记录 + def act_as_forge_activity + self.forge_acts << ForgeActivity.new(:user_id => self.user_id, + :project_id => self.issue.project.id) + + end + # 更新用户分数 -by zjc def be_user_score #新建了缺陷留言且留言不为空,不为空白 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 39618e43b..23d9c7753 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -4,7 +4,6 @@ class JournalsForMessage < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper - include ExpireHelper safe_attributes "jour_type", # 留言所属类型 "jour_id", # 留言所属类型的id "notes", # 留言内容 @@ -55,9 +54,7 @@ class JournalsForMessage < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy validates :notes, presence: true - after_create :act_as_activity ,:expire_activitie_cache#huang - after_update :expire_activitie_cache - before_destroy :expire_activitie_cache + after_create :act_as_activity #huang after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score diff --git a/app/models/memo.rb b/app/models/memo.rb index 7d463c28b..052ca03db 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -1,13 +1,8 @@ class Memo < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper - include ExpireHelper belongs_to :forum belongs_to :author, :class_name => "User", :foreign_key => 'author_id' - - after_create :expire_cache - after_update :expire_cache - before_destroy :expire_cache validates_presence_of :author_id, :forum_id, :subject,:content # 若是主题帖,则内容可以是空 #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } @@ -174,8 +169,5 @@ class Memo < ActiveRecord::Base update_memo_number(User.current,1) update_replay_for_memo(User.current,1) end - def expire_cache - expire_forum_cache - expire_activitie_cache - end + end diff --git a/app/models/message.rb b/app/models/message.rb index 9ce4d583a..85a87132d 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -18,7 +18,6 @@ class Message < ActiveRecord::Base include Redmine::SafeAttributes include UserScoreHelper - include ExpireHelper belongs_to :board belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :praise_tread, as: :praise_tread_object, dependent: :destroy @@ -29,6 +28,8 @@ class Message < ActiveRecord::Base # added by fq has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # 被ForgeActivity虚拟关联 + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # end acts_as_searchable :columns => ['subject', 'content'], @@ -59,13 +60,12 @@ class Message < ActiveRecord::Base validates_length_of :subject, :maximum => 255 validate :cannot_reply_to_locked_topic, :on => :create - after_create :add_author_as_watcher, :reset_counters!,:expire_activitie_cache - after_update :update_messages_board,:expire_activitie_cache - before_destroy :expire_activitie_cache + after_create :add_author_as_watcher, :reset_counters! + after_update :update_messages_board after_destroy :reset_counters!,:down_user_score # fq - after_create :act_as_activity,:be_user_score + after_create :act_as_activity,:be_user_score,:act_as_forge_activity #before_save :be_user_score # end @@ -160,6 +160,17 @@ class Message < ActiveRecord::Base end # end + # Time 2015-02-27 14:32:25 + # Author lizanle + # Description + def act_as_forge_activity + # 如果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 def be_user_score #新建message且无parent的为发帖 diff --git a/app/models/news.rb b/app/models/news.rb index 9c37719f3..d2547fc02 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -17,7 +17,6 @@ class News < ActiveRecord::Base include Redmine::SafeAttributes - include ExpireHelper belongs_to :project #added by nwb belongs_to :course @@ -25,7 +24,9 @@ class News < ActiveRecord::Base has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on" # fq has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - #end + # 被ForgeActivity虚拟关联 + has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # end validates_presence_of :title, :description validates_length_of :title, :maximum => 60 @@ -46,11 +47,8 @@ class News < ActiveRecord::Base after_create :add_author_as_watcher # fq - after_create :act_as_activity + after_create :act_as_activity,:act_as_forge_activity # end - after_create :expire_activitie_cache - after_update :expire_activitie_cache - before_destroy :expire_activitie_cache scope :visible, lambda {|*args| includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) @@ -96,5 +94,15 @@ class News < ActiveRecord::Base self.acts << Activity.new(:user_id => self.author_id) end + # Time 2015-02-27 15:48:17 + # Author lizanle + # Description 公用表中也要记录 + def act_as_forge_activity + # 如果是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/models/organization.rb b/app/models/organization.rb new file mode 100644 index 000000000..5f52dee98 --- /dev/null +++ b/app/models/organization.rb @@ -0,0 +1,5 @@ +class Organization < ActiveRecord::Base + attr_accessible :logo_link, :name + + has_many :projects +end diff --git a/app/models/project.rb b/app/models/project.rb index df403bb5c..099870bc7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -17,7 +17,6 @@ class Project < ActiveRecord::Base include Redmine::SafeAttributes - include ExpireHelper ProjectType_project = 0 ProjectType_course = 1 @@ -90,7 +89,9 @@ class Project < ActiveRecord::Base :association_foreign_key => 'custom_field_id' has_many :tags, :through => :project_tags, :class_name => 'Tag' - has_many :project_tags, :class_name => 'ProjectTags' + has_many :project_tags, :class_name => 'ProjectTags' + + belongs_to :organization # has_many :journals @@ -130,9 +131,8 @@ class Project < ActiveRecord::Base #ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用 after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} # 创建project之后默认创建一个board,之后的board去掉了board的概念 - after_create :create_board_sync,:expire_project_cache - after_update :expire_project_cache - before_destroy :delete_all_members,:expire_project_cache + after_create :create_board_sync + before_destroy :delete_all_members def remove_references_before_destroy return if self.id.nil? Watcher.delete_all ['watchable_id = ?', id] diff --git a/app/models/tracker.rb b/app/models/tracker.rb index 6a0069975..af56d23bf 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -16,7 +16,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class Tracker < ActiveRecord::Base - + # Time 2015-02-6 09:34:44 + # Author lizanle + # Description freeze方法让字符串不可变 CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject description priority_id is_private).freeze # Fields that can be disabled # Other (future) fields should be appended, not inserted! diff --git a/app/views/admin/organization.html.erb b/app/views/admin/organization.html.erb new file mode 100644 index 000000000..582b8b44a --- /dev/null +++ b/app/views/admin/organization.html.erb @@ -0,0 +1,43 @@ +
+ <%= link_to l(:label_organization_new), new_organization_path, :class => 'icon icon-add' %> +
+ +

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

+ +
+ + + + + + + + + + <% @organizations.each do |org|%> + "> + + + + + <% end%> + +
+ <%=l(:label_organization)%> + + <%=l(:field_created_on)%> +
+ + <%= link_to org.name,home_path(:organization => org.id) %> + + + <%= format_date(org.created_at) %> + + <%= link_to(l(:button_change), edit_organization_path(org.id), :class => 'icon icon-copy') %> + <%= link_to(l(:button_delete), organization_path(org.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> +
+
+ +<% html_title(l(:label_project_plural)) -%> diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb index 762ceae9e..4c9479a6d 100644 --- a/app/views/admin/projects.html.erb +++ b/app/views/admin/projects.html.erb @@ -2,16 +2,25 @@ <%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %> -

<%=l(:label_project_plural)%>

+

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

<%= form_tag({}, :method => :get) do %> -
<%= l(:label_filter_plural) %> - -<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> - -<%= text_field_tag 'name', params[:name], :size => 30 %> -<%= submit_tag l(:button_apply), :class => "small", :name => nil %> -<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %> +
+ + <%= l(:label_filter_plural) %> + + + <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> + + <%= text_field_tag 'name', params[:name], :size => 30 %> + <%= submit_tag l(:button_apply), :class => "small", :name => nil %> + <%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
<% end %>   @@ -19,17 +28,31 @@
- - - + + + <% project_tree(@projects) do |project, level| %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> - - - + + +
<%=l(:label_project)%><%=l(:field_is_public)%><%=l(:field_created_on)%> + <%=l(:label_project)%> + + <%=l(:field_is_public)%> + + <%=l(:field_created_on)%> +
<%= link_to_project_settings(project, {}) %><%= checked_image project.is_public? %><%= format_date(project.created_on) %> + + <%= link_to_project_settings(project, {}) %> + + + <%= checked_image project.is_public? %> + + <%= format_date(project.created_on) %> + <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %> <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %> diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index c97da6d66..1d637919c 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -27,6 +27,7 @@ // file.click(); // } +<% project = project %> <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> @@ -41,7 +42,7 @@ :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'), + :upload_path => uploads_path(:format => 'js',:project =>project), :description_placeholder => l(:label_optional_description) } %> 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 @@ -
- <%= h @board.name %> +
+

<%= h @board.name %>

<% if !User.current.logged? %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index dae061251..39cab4a53 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,4 +1,6 @@ -

<%= @query.new_record? ? l(:label_calendar) : h(@query.name) %>

+
+

<%= @query.new_record? ? l(:label_calendar) : h(@query.name) %>

+
<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project}, :method => :get, :id => 'query_form') do %> diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index f7f76a812..e0c39eb33 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -1,3 +1,6 @@ +
+

<%=l(:label_document_plural)%>

+
<%= l(:label_documents_sort) %> @@ -8,24 +11,22 @@ | <%= link_to l(:label_document_new), new_project_document_path(@project), :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:add_documents, @project) %> + :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:add_documents, @project) %>
-

<%=l(:label_document_plural)%>

- <% if @grouped.empty? %>

<%= 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.title %>

+
@@ -9,7 +12,6 @@ <% end %>
-

<%=h @document.title %>

<%#=h @document.category.name %>
<%= format_date @document.created_on %>

diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb index bd66d93be..6e8e806cf 100644 --- a/app/views/files/_new.html.erb +++ b/app/views/files/_new.html.erb @@ -38,7 +38,7 @@

-

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form' %>

+

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form', locals: {project: project} %>

<%= submit_tag l(:button_add) %> <% end %> diff --git a/app/views/files/_newfile_index.html.erb b/app/views/files/_newfile_index.html.erb new file mode 100644 index 000000000..5ffaacae4 --- /dev/null +++ b/app/views/files/_newfile_index.html.erb @@ -0,0 +1,250 @@ + +
+ <% if @isproject %> + <%= render :partial => 'project_file', locals: {project: @project} %> + <% else %> + <%= render :partial => 'course_file', locals: {course: @course} %> + <% end %> +
+ + + + + diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index e2f928332..e204030f1 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -1,11 +1,8 @@ - <% attachmenttypes = @project.attachmenttypes %> <% sufixtypes = @project.contenttypes %> - - - <%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %> - 资源共享区 - +
+

资源共享区

+
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index fe04c4e3f..39bc8b52e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,250 +1 @@ - -
-<% if @isproject %> - <%= render :partial => 'project_file', locals: {project: @project} %> -<% else %> - <%= render :partial => 'course_file', locals: {course: @course} %> -<% end %> -
- - - - - +<%= render :partial => 'files/newfile_index' %> \ No newline at end of file diff --git a/app/views/files/index.js.erb b/app/views/files/index.js.erb new file mode 100644 index 000000000..59bc2407f --- /dev/null +++ b/app/views/files/index.js.erb @@ -0,0 +1,2 @@ +alert("eeee"); +$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>'); diff --git a/app/views/files/new.html.erb b/app/views/files/new.html.erb index 8fd99b195..be9bcd722 100644 --- a/app/views/files/new.html.erb +++ b/app/views/files/new.html.erb @@ -1,4 +1,6 @@ -

<%=l(:label_attachment_new)%>

+
+

<%=l(:label_attachment_new)%>

+
<%= error_messages_for 'attachment' %> <%= form_tag(project_files_path(@project), :multipart => true, :class => "tabular") do %> diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 6ec189256..2808a99cc 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -1,5 +1,7 @@ -<% @gantt.view = self %> -

<%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

+
+

<% @gantt.view = self %> + <%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

+
<%= form_tag({:controller => 'gantts', :action => 'show', :project_id => @project, :month => params[:month], diff --git a/app/views/issues/_newissue_index.html.erb b/app/views/issues/_newissue_index.html.erb new file mode 100644 index 000000000..f0b7c0108 --- /dev/null +++ b/app/views/issues/_newissue_index.html.erb @@ -0,0 +1,137 @@ +
+

问题跟踪

+
+
+ <% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %> + + <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, + :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> + <%= link_to l(:label_query), '#', :class => 'icon icon-help', + :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> + + <% end %> + 问题总数:100 未解决:20 +
+
+ <% if !@query.new_record? && @query.editable_by?(User.current) %> + <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query) %> + <% end %> +
+ +<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> +
+ <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> + +
+ ---<%= l :label_query_new %>--- + +
+
"> + + <%= l(:label_issue_query_condition) %> + +
"> + <%= render :partial => 'queries/filters', :locals => {:query => @query} %> +
+
+ +
+ <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> + <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> +
+
+
+ <% end %> +
+ +<%= error_messages_for 'query' %> + +<% if @query.valid? %> + <% if @issues.empty? %> +

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

+ <% else %> + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> + + <% end %> +
+ <% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> + <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> + <%= f.link_to 'PDF', :url => params %> + <% end %> +
+ + + + +<% end %> + +<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> + +<% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> +<% end %> + +<% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, + {:query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_issue_plural)) %> + <%= auto_discovery_link_tag(:atom, + {:controller => 'journals', :action => 'index', + :query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_changes_details)) %> +<% end %> + +<%= context_menu issues_context_menu_path %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 219a0f641..b3750a770 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1,135 +1 @@ -
- <% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %> -
- <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, - :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> - - <%= link_to l(:label_query), '#', :class => 'icon icon-help', - :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> -
- <% end %> -
- -
- <% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query) %> - <% end %> -
- -<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> -
- <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> - -
- ---<%= l :label_query_new %>--- - -
-
"> - - <%= l(:label_issue_query_condition) %> - -
"> - <%= render :partial => 'queries/filters', :locals => {:query => @query} %> -
-
- -
- <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> - <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> -
-
-
- <% end %> -
- -<%= error_messages_for 'query' %> - -<% if @query.valid? %> - <% if @issues.empty? %> -

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

- <% else %> - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> - - <% end %> -
- <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> - <%= f.link_to 'PDF', :url => params %> - <% end %> -
- - - - -<% end %> - -<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> - -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> -<% end %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, - {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_issue_plural)) %> - <%= auto_discovery_link_tag(:atom, - {:controller => 'journals', :action => 'index', - :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_changes_details)) %> -<% end %> - -<%= context_menu issues_context_menu_path %> +<%= render :partial => 'issues/newissue_index' %> \ No newline at end of file diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb new file mode 100644 index 000000000..866882053 --- /dev/null +++ b/app/views/issues/index.js.erb @@ -0,0 +1 @@ +$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>'); diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 05ec50c11..51ebd139e 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -1,3 +1,6 @@ +
+

问题跟踪

+
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %> <%= labelled_form_for @issue, :url => project_issues_path(@project), diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 204dd519a..fb8296f64 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,6 +1,8 @@ +
+

问题跟踪

+
<%# html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> - -<% html_title "#{@issue.tracker.name} #{@issue.source_from}: #{@issue.subject}" %> +<% html_title "#{@issue.tracker.name} #{@issue.source_from}'#'#{@issue.project_index}: #{@issue.subject}" %> <%= render :partial => 'action_menu' %> @@ -87,7 +89,7 @@ end %> <%= render_custom_fields_rows(@issue) %> <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
- +woca <% if @issue.description? || @issue.attachments.any? -%>
<% if @issue.description? %> diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb index 5250cd1a0..ace425d08 100644 --- a/app/views/kaminari/_paginator.html.erb +++ b/app/views/kaminari/_paginator.html.erb @@ -7,7 +7,7 @@ paginator: the paginator that renders the pagination tags inside -%> <%= paginator.render do -%> -