From ca770f2727b77a31e7531e2572a8a8085b91b245 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 13 Nov 2015 18:16:41 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=9A=84=E6=8F=90=E7=A4=BA=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index 08311d51b..1ab3ad933 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -31,7 +31,7 @@
  • - (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。) + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
  • From e905489157df9de2c5cc8011905dfc2a8330be4f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 13 Nov 2015 18:23:20 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A2=AB=E5=89=AA?= =?UTF-8?q?=E5=88=87=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 3bf109f37..be178607f 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -581,7 +581,10 @@ } }); - + //查询学校 + $("input[name='province']").on('input', function (e) { + throttle(shcool_search_fn,window,e); + }); function throttle(method,context,e){ clearTimeout(method.tId); @@ -603,10 +606,7 @@ type: 'post', success: function (data) { schoolsResult = data.schools; - count = data.count; //查询学校 - $("input[name='province']").on('input', function (e) { - throttle(shcool_search_fn,window,e); - }); + count = data.count; maxPage = Math.ceil(count/100) //最大页码值 if(schoolsResult.length != undefined && schoolsResult.length != 0) { var i = 0; From a5a413eda018b9231c86d67b5b26c934fdece9a1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 13 Nov 2015 19:46:04 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=9F=A5=E8=AF=A2sql?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 0352d80f2..5f823ee3d 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -27,8 +27,9 @@ 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 = OrgActivity.where('container_id =? and container_type =? ', + @organization.id, 'Organization ').order('updated_at desc') + @activities = paginateHelper @activities, 10 else render_403 From 4471b6c4856b9fa6a4a9c380f733873cd94819f5 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 13 Nov 2015 20:14:02 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/index.html.erb | 4 ++-- app/views/organizations/_org_members.html.erb | 4 ++-- app/views/organizations/show.html.erb | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index a7340c08a..a636b2ec8 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -20,8 +20,8 @@ init_activity_KindEditor_data(<%= document.id%>, null, "87%"); }); -
    +

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

    +

    <% end %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_members.html.erb b/app/views/organizations/_org_members.html.erb index 8719ad275..3940a6576 100644 --- a/app/views/organizations/_org_members.html.erb +++ b/app/views/organizations/_org_members.html.erb @@ -1,11 +1,11 @@ <%= stylesheet_link_tag 'courses' %> -
    +

    组织成员

    - 加入时间 +
    <% members.each do |member| %> diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 5f1d0e003..e77cc7d09 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -30,9 +30,9 @@ init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%"); }); -
    +

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

    +

    <% end %> <% unless @activities.nil? %> @@ -58,9 +58,9 @@ init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%"); }); -
    +

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

    +

    <% end %> <% end %>
      From 36b3d0b6368e494e9816f20ae4b37975cf956988 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 13 Nov 2015 20:22:13 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=81=AB=E7=8B=90?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=8A=E5=8A=A8=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=96=87=E7=AB=A0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_organizations.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb index ec66358f5..50fa03bbe 100644 --- a/app/views/users/user_organizations.html.erb +++ b/app/views/users/user_organizations.html.erb @@ -6,10 +6,10 @@
      组织列表 -
      - - -
      + + + +
      <% @orgs.each do |org| %> From bee355e7478585b8c6946a9c600c75648c5cfaa8 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 14 Nov 2015 09:43:15 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=87=E7=AB=A0=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9B=20=E5=8A=A8=E6=80=81=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E4=B8=8D=E5=86=97=E4=BD=99=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/edit.html.erb | 1 + app/views/org_document_comments/index.html.erb | 1 - app/views/organizations/show.html.erb | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) 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..d53ce543c 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -16,7 +16,6 @@ <% @documents.each do |document| %> diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index e77cc7d09..358b30c7d 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -52,7 +52,7 @@
    <% end %> - <% if act.org_act_type == 'OrgDocumentComment' %> + <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %> -

    <%= 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..700db0eeb 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -1,4 +1,4 @@ -
    +
    <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %> diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index e77cc7d09..55d296cd1 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -30,9 +30,8 @@ init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%"); }); -

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

    <% end %> <% unless @activities.nil? %> @@ -58,9 +57,7 @@ init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%"); }); -

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

    <% end %> <% end %>
      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" From e1a88dedbbe20cc0511cec88274da90763d71788 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Sat, 14 Nov 2015 09:58:53 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=20=E9=A6=96=E9=A1=B5=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=20=E4=BC=9A=E5=8F=98=E6=88=90=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_org_document.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 700db0eeb..b9c8c19aa 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -7,7 +7,7 @@
      <%= 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) %> + <% if document.organization.home_id == document.id %> 首页 <% else %> 组织 From f313509d991a170db68c27c4350cbe63b9ae965c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 14 Nov 2015 10:01:30 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E7=BB=84=E7=BB=87id=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=98=BE=E7=A4=BA=E7=BB=84=E7=BB=87=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org.html.erb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 32ada4729..b1434bb0f 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) %> ( From 9bf8f6058faeb2d43af2588d537d6bcf22d59f60 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 14 Nov 2015 10:25:51 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=92=8C=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_show_org_document.html.erb | 141 +++++++++--------- 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index b9c8c19aa..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 document.organization.home_id == document.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 @@
        + diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb new file mode 100644 index 000000000..ed80ba7b1 --- /dev/null +++ b/app/views/organizations/_org_project_issue.html.erb @@ -0,0 +1,136 @@ +
        +
        +
        + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
        +
        +
        + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> +
        +
        + <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> + + <%#= get_issue_priority(activity.priority_id)[1] %> + +
        +
        +
        指派给   + <% unless activity.assigned_to_id.nil? %> + <% if activity.try(:assigned_to).try(:realname) == ' ' %> + <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> + <% end %> + <% end %> +
        +
        + 时间: + <%=format_time(activity.created_on) %> +
        +
        +
        +
        + <% if activity.description? %> + <%= textAreailizable activity, :description, :attachments => activity.attachments %> + <% end %> +
        +
        +
        + + +
        +
        + <% if activity.attachments.any? %> + <% activity.attachments.each do |attachment| %> +
        + + + <%= link_to_short_attachment attachment,:length=> 58, :class => 'link_file_a fl newsBlue', :download => true -%> + + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :class => 'fl', + :filename => attachment.filename %> + <% end %> + + ( + <%= number_to_human_size attachment.filesize %>) + + + <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= format_time(attachment.created_on) %> + +
        + <% end %> + <% end %> +
        +
        +
        +
        + <% count = activity.journals.count %> +
        +
        +
        +
        回复(<%= count %>)
        +
        <%#= format_date(activity.updated_on) %>
        + <% if count > 3 %> + + <% end %> +
        + + <% replies_all_i = 0 %> + <% if count > 0 %> +
        +
          + <% activity.journals.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i + 1 %> +
        • +
          + <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> +
          +
          +
          + <% if reply.try(:user).try(:realname) == ' ' %> + <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> +
          +
          + <% if reply.details.any? %> + <% details_to_strings(reply.details).each do |string| %> +

          <%= string %>

          + <% end %> + <% end %> +

          <%= reply.notes %>

          +
          +
          +
          +
        • + <% end %> +
        +
        + <% end %> + + + +
        +
        diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index deaec4437..0b624d479 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -34,8 +34,8 @@ <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %> <% end %> - <% unless @activities.nil? %> - <% @activities.each do |act| %> + <% unless @org_activities.nil? %> + <% @org_activities.each do |act| %> <% if act.org_act_type == 'CreateOrganization' %>
        @@ -60,10 +60,20 @@ <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %> <% end %> <% end %> -
          - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
        + + <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> + <% end %> + <%# @org_project_activties.each do |org_act|%> + <%= render :partial => 'organizations/org_project_activities', + :locals => {:org_project_activties =>@org_project_activties, + :page=>@page, + :org => @organization, + :org_act_count=>@org_activities.count, + :pro_act_count=>@org_project_activties.count}%> + <%# end %> + + diff --git a/app/views/organizations/show.js.erb b/app/views/organizations/show.js.erb new file mode 100644 index 000000000..b0a447910 --- /dev/null +++ b/app/views/organizations/show.js.erb @@ -0,0 +1,7 @@ +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_project_activities', + :locals => {:org_project_activties =>@org_project_activties, + :page=>@page, + :org => @organization, + :org_act_count=>@org_activities.count, + :pro_act_count=>@org_project_activties.count} )%>"); + From 1e1c2109396bdcd00c092e7efc9da3b2d7bce42b Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 14 Nov 2015 14:57:49 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- .../_org_project_activities.html.erb | 8 +- .../organizations/_org_project_issue.html.erb | 2 +- .../organizations/_project_create.html.erb | 38 +++++++ .../organizations/_project_message.html.erb | 100 ++++++++++++++++++ 5 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 app/views/organizations/_project_create.html.erb create mode 100644 app/views/organizations/_project_message.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index daf443d07..cad617e47 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -60,7 +60,7 @@ class OrganizationsController < ApplicationController @org_activities_count = OrgActivity.where('container_id =? and container_type =? ', @organization.id, 'Organization ').order('updated_at desc').count project_ids = @organization.projects.map(&:id) - @org_project_activties = ForgeActivity.where('project_id in (?)',project_ids.join(',')).page(params[:page]).per(10) + @org_project_activties = ForgeActivity.where('project_id in (?) and forge_act_type in("Issue","Message","ProjectCreateInfo")',project_ids.join(',')).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] diff --git a/app/views/organizations/_org_project_activities.html.erb b/app/views/organizations/_org_project_activities.html.erb index 0a6a8fae4..b46996661 100644 --- a/app/views/organizations/_org_project_activities.html.erb +++ b/app/views/organizations/_org_project_activities.html.erb @@ -1,17 +1,15 @@ <% org_project_activties.each do |act|%> <% if act %> - - <% unless act.forge_act_type == "ProjectCreateInfo" %> <% if act %> <% case act.forge_act_type.to_s %> <% when 'Issue' %> <%= render :partial => 'organizations/org_project_issue', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %> <% when 'Message' %> - <%= render :partial => 'users/project_message', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %> + <%= render :partial => 'organizations/project_message', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %> <% when 'ProjectCreateInfo'%> - <%= render :partial => 'users/project_create', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %> + <%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %> <% end %> - <% end %><% end %> + <% end %> <% end %> <% end %> <% if org_act_count == 10 || pro_act_count == 10 %> diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index ed80ba7b1..573429752 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -120,7 +120,7 @@

        <%= string %>

        <% end %> <% end %> -

        <%= reply.notes %>

        +

        <%= reply.notes.nil? ? "" : reply.notes.html_safe %>

        diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb new file mode 100644 index 000000000..d966d8e18 --- /dev/null +++ b/app/views/organizations/_project_create.html.erb @@ -0,0 +1,38 @@ +<% project = Project.find(activity.project_id) %> +<% user = User.find(project.user_id)%> +
        +
        +
        + <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> +
        +
        +
        + <% if user.try(:realname) == ' ' %> + <%= link_to user, user_path(user), :class => "newsBlue mr15" %> + <% else %> + <%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> +
        +
        + <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> +
        +
        + 创建时间:<%= format_time(project.created_on) %> +
        + +
        +
        +
        +
        \ No newline at end of file diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb new file mode 100644 index 000000000..85ed08f2f --- /dev/null +++ b/app/views/organizations/_project_message.html.erb @@ -0,0 +1,100 @@ +
        +
        +
        + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
        +
        +
        + <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> + +
        +
        + <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey" + %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey" + %> + <% end %> +
        +
        + 时间:<%= format_time(activity.created_on) %> +
        +
        +
        + <% if activity.parent_id.nil? %> + <%= activity.content.to_s.html_safe%> + <% else %> + <%= activity.parent.content.to_s.html_safe%> + <% end %> +
        +
        +
        + + +
        +
        +
        +
        + <% count = 0 %> + <% if activity.parent %> + <% count=activity.parent.children.count%> + <% else %> + <% count=activity.children.count%> + <% end %> +
        +
        +
        +
        回复( + <%=count %> + )
        +
        <%#=format_date(activity.updated_on)%>
        + <%if count>3 %> + + <% end %> +
        + + <% activity= activity.parent_id.nil? ? activity : activity.parent %> + <% replies_all_i = 0 %> + <% if count > 0 %> +
        +
          + <% activity.children.reorder("created_on desc").each do |reply| %> + + <% replies_all_i=replies_all_i+1 %> +
        • +
          + <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %> +
          +
          +
          + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(reply.created_on) %> +
          +
          + <%= reply.content.html_safe %>
          +
          +
          +
        • + <% end %> +
        +
        + <% end %> + + +
        +
        \ No newline at end of file From c9a7a9476708916f5836309640f4ea82b3c6e863 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 14 Nov 2015 15:15:54 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index cad617e47..774cde02d 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -60,7 +60,7 @@ class OrganizationsController < ApplicationController @org_activities_count = OrgActivity.where('container_id =? and container_type =? ', @organization.id, 'Organization ').order('updated_at desc').count project_ids = @organization.projects.map(&:id) - @org_project_activties = ForgeActivity.where('project_id in (?) and forge_act_type in("Issue","Message","ProjectCreateInfo")',project_ids.join(',')).order("updated_at desc").page(params[:page] || 1).per(10) + @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] From f5460d11264d67a19809f229928f1dd02207efae Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 14 Nov 2015 15:19:49 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 774cde02d..b75742164 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -59,7 +59,7 @@ class OrganizationsController < ApplicationController @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) + 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