diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 5f823ee3d..fdd12030f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -100,4 +100,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/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 %> +
  • + <%= link_to pro.name, project_path(pro.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => pro.name%> +
  • +<% end %> +<% if projects.size == 5%> +
  • + + +
  • +<% end%> \ No newline at end of file diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 32ada4729..6b4eab72a 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -50,13 +50,9 @@ <% end %> <% end%> -
    组织id:<%= @organization.id %>
    - <% if User.current.admin_of_org?(@organization) %> - 配置 - <% end %> - -
    - <%= link_to l(:label_org_name)+"#{@organization.name}", organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %> + +
    + <%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %> <% if @organization.is_public? %> <%= l(:label_public)%> <% else %> @@ -64,6 +60,19 @@ <% end %>
    + <% if User.current.admin_of_org?(@organization) %> + 配置 + <% end %> + + + + + + + + + +
    <%= link_to '文章', organization_org_document_comments_path(@organization) %> ( @@ -76,17 +85,18 @@
    <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
    - - - - - - - - +
    项目 + +
    +
    +
      + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.org_projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%> + + + - - +
    +
    diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb index 930c8ebb0..5d54af2bf 100644 --- a/app/views/org_document_comments/add_reply.js.erb +++ b/app/views/org_document_comments/add_reply.js.erb @@ -1,3 +1,3 @@ -$("#organization_document_<%= @document.id %>").html(""); -$("#organization_document_<%= @document.id %>").html("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>"); + +$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>"); init_activity_KindEditor_data(<%= @document.id %>,"","87%"); \ No newline at end of file diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index ffb04a4f9..b4f8662a3 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -21,6 +21,7 @@
    +
    <%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %> diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index a636b2ec8..d9b1d9579 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -16,12 +16,9 @@ <% @documents.each do |document| %> -

    <%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %> -

    <% end %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index f1c633320..4177c3688 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -1,75 +1,76 @@ -
    -
    -
    - <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %> -
    -
    -
    - <%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %> - TO  <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | - <% if defined?(home_id) %> - 首页 - <% else %> - 组织 - <% end %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %>
    -
    <%= document.title %>
    -
    - 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
    - <% unless document.content.blank? %> -
    - <%= document.content.html_safe %> -
    - <% end %> - - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> -
    -
      -
    • -
        -
      • - <%= form_for('new_form',:url => {:controller => 'organizations',:action => 'set_homepage',:id => document.organization_id, :home_id => document.id},:method => "put",:remote => true) do |f|%> - 设为首页 - <% end %> -
      • -
      • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :class => "postOptionLink" %> -
      • -
      • - <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', - :data => {:confirm => l(:text_are_you_sure)}, - :remote => true, :class => 'postOptionLink' %> -
      • -
      -
    • -
    -
    -
    -
    -
    - <% end %> -<% comments_for_doc = document.children.reorder("created_at desc") %> -<% count = document.children.count() %> - -
    -
    -
    回复(<%= count %>)
    - <% if count > 3 %> - - <% end %> + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> +
    +
      +
    • +
        +
      • + <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %> + 设为首页 + <% end %> +
      • +
      • + <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :class => "postOptionLink" %> +
      • +
      • + <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', + :data => {:confirm => l(:text_are_you_sure)}, + :remote => true, :class => 'postOptionLink' %> +
      • +
      +
    • +
    +
    +
    + <% end %> +
    -
    + <% comments_for_doc = document.children.reorder("created_at desc") %> + <% count = document.children.count() %> + +
    +
    +
    回复(<%= count %>)
    + <% if count > 3 %> + + <% end %> +
    +
      <% reply_id = 0 %> <% comments_for_doc.each do |comment| %> <% reply_id += 1 %> -
    • +
    • <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_path(comment.creator_id) %>
      @@ -87,12 +88,12 @@
      - <%=link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %> + <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
      <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id), :method => "post", :remote => true) do |f| %> - +
      @@ -110,15 +111,15 @@
      -

      + <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %> -

      <% end %> <% unless @activities.nil? %> @@ -52,15 +51,13 @@
      <% end %> - <% if act.org_act_type == 'OrgDocumentComment' %> + <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %> -

      <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> -

      <% end %> <% end %>
        @@ -69,3 +66,4 @@ <% end %> + diff --git a/config/routes.rb b/config/routes.rb index 5cb42fd58..0f05c3521 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -37,6 +37,7 @@ RedmineApp::Application.routes.draw do get 'clear_org_avatar_temp' put 'set_homepage' get 'members' + get 'more_org_projects' end collection do get 'check_uniq' diff --git a/db/schema.rb b/db/schema.rb index 1f48eaf02..73924d83c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151110011003) do +ActiveRecord::Schema.define(:version => 20151112072948) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -960,6 +960,7 @@ ActiveRecord::Schema.define(:version => 20151110011003) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.integer "sticky", :default => 0 end add_index "news", ["author_id"], :name => "index_news_on_author_id" diff --git a/public/javascripts/org.js b/public/javascripts/org.js index f74277a9e..e26995931 100644 --- a/public/javascripts/org.js +++ b/public/javascripts/org.js @@ -1,4 +1,4 @@ -//֯Աύ +//�����֯��Ա���ύ���� function submit_add_org_members(){ $("#org_member_add_form").submit(); } @@ -31,4 +31,15 @@ function observeSearchfield(fieldId, targetId, url) { var timer = setInterval(check, 300); $this.bind('keyup click mousemove', reset); }); +} + +//显示更多的项目 +function show_more_org_project(url){ + $.get( + url, + { page: $("#org_project_page_num").val() }, + function (data) { + + } + ); } \ No newline at end of file