diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 0352d80f2..b75742164 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -1,5 +1,33 @@ # encoding: utf-8 class OrganizationsController < ApplicationController + + + helper :sort + include SortHelper + helper :custom_fields + include CustomFieldsHelper + include AvatarHelper + include WordsHelper + include GitlabHelper + include UserScoreHelper + + include PollHelper + helper :user_score + helper :journals + + # added by liuping 关注 + + helper :watchers + helper :activities + + ### added by william + include ActsAsTaggableOn::TagsHelper + + # fq + helper :words + helper :project_score + helper :issues + include UsersHelper before_filter :find_organization, :only => [:show, :members] layout 'base_org' def index @@ -27,12 +55,22 @@ class OrganizationsController < ApplicationController def show if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) - @activities = OrgActivity.where('(org_act_id = ? and org_act_type = ?) || (container_id =? and org_act_type =? and org_act_id !=?)', - @organization.id, 'CreateOrganization ', @organization.id, 'OrgDocumentComment', @organization.home_id).order('updated_at desc') - @activities = paginateHelper @activities, 10 + @org_activities = OrgActivity.where('container_id =? and container_type =? ', + @organization.id, 'Organization ').order('updated_at desc').page(params[:page]).per(10) + @org_activities_count = OrgActivity.where('container_id =? and container_type =? ', + @organization.id, 'Organization ').order('updated_at desc').count + project_ids = @organization.projects.map(&:id) << 0 + @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10) + @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count + #@org_activities = paginateHelper @org_activities, 10 + @page = params[:page] else render_403 end + respond_to do |format| + format.html + format.js + end end def update @@ -99,4 +137,13 @@ class OrganizationsController < ApplicationController def members @members = OrgMember.where("organization_id =?", @organization.id) end + + def more_org_projects + @organization = Organization.find params[:id] + @page = params[:page] + @org_projects = @organization.org_projects.reorder('created_at').page((params[:page].to_i || 1) +1).per(5) + respond_to do |format| + format.js + end + end end diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 55a7a5d42..607d2af5c 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -17,4 +17,6 @@ module OrganizationsHelper s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end + + end diff --git a/app/views/layouts/_org_projects.html.erb b/app/views/layouts/_org_projects.html.erb new file mode 100644 index 000000000..be65fd516 --- /dev/null +++ b/app/views/layouts/_org_projects.html.erb @@ -0,0 +1,12 @@ +<% projects.each do |project|%> + <% pro = Project.find project.project_id %> +
<%= string %>
+ <% end %> + <% end %> +<%= reply.notes.nil? ? "" : reply.notes.html_safe %>
+