From ec5645fc662ac52063477b230ae0344075144414 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 27 Oct 2016 14:57:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A1=B9=E7=9B=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=B8=AD=E6=A0=B7=E5=BC=8F=E5=88=AB=E5=88=AB=E7=9A=84?= =?UTF-8?q?=E5=9C=B0=E6=96=B9=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 7 +- app/views/issues/_project_issue.html.erb | 76 ++++++++-------- app/views/issues/new.html.erb | 33 ------- .../_project_issue_expand_show.html.erb | 88 ++++++++++++++++++ .../projects/_project_issue_reply.html.erb | 91 +------------------ .../projects/_project_news_replies.html.erb | 68 +++----------- .../projects/_project_reply_banner.html.erb | 6 +- app/views/users/all_journals.js.erb | 2 +- public/javascripts/application.js | 35 ------- 9 files changed, 151 insertions(+), 255 deletions(-) create mode 100644 app/views/projects/_project_issue_expand_show.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 803202bc3..1315e8cbd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3558,11 +3558,16 @@ class UsersController < ApplicationController @journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc") @type = 'JournalsForMessage' @user_activity_id = params[:div_id].to_i if params[:div_id] - when 'Issue', 'is_project_issue' + when 'Issue' obj = Issue.where('id = ?', params[:id].to_i).first @journals = obj.journals.reorder("created_on desc") @type = 'Issue' @user_activity_id = params[:div_id].to_i if params[:div_id] + when 'is_project_issue' + @activity = Issue.where('id = ?', params[:id].to_i).first + @journals = @activity.journals.reorder("created_on desc") + @user_activity_id = params[:div_id].to_i if params[:div_id] + @user_activity = ForgeActivity.where(params[:div_id].to_i).first if params[:div_id] when 'BlogComment' obj = BlogComment.where('id = ?', params[:id].to_i).first @user_activity_id = params[:div_id].to_i if params[:div_id] diff --git a/app/views/issues/_project_issue.html.erb b/app/views/issues/_project_issue.html.erb index 0c3e0b8e6..841e06b1b 100644 --- a/app/views/issues/_project_issue.html.erb +++ b/app/views/issues/_project_issue.html.erb @@ -1,4 +1,4 @@ - <% unless activity.author.nil? %> +<% unless activity.author.nil? %>
<% if activity.status_id.to_i == 5 %> @@ -14,9 +14,9 @@
<%# if activity.try(:author).try(:realname) == ' ' %> - <%#= link_to activity.try(:author), user_path(activity.author_id), :class => "fl issues_list_name" %> + <%#= link_to activity.try(:author), user_path(activity.author_id), :class => "fl issues_list_name" %> <%# else %> - <%#= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "fl issues_list_name" %> + <%#= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "fl issues_list_name" %> <%# end %>

<%= format_time(activity.created_on) %> 发布

@@ -26,13 +26,13 @@
  • <% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id)%> + <%= link_to activity.try(:author), user_path(activity.author_id)%> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id)%> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id)%> <% end %>
  • - <% unless activity.assigned_to_id.nil? %> + <% if !activity.assigned_to_id.nil? && activity.assigned_to_id != 0 %> <% if activity.try(:assigned_to).try(:realname).empty? %> <%= link_to activity.assigned_to, user_path(activity.assigned_to_id)%> <% else %> @@ -68,19 +68,19 @@
  • <%= activity.status.name%>
  • <%= activity.done_ratio %>%
  • - <% if activity.journals.count > 0%> - - <%= activity.journals.count %> - <% end %> + <% if activity.journals.count > 0%> + + <%= activity.journals.count %> + <% end %>
    - <%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> - <% if !defined?(project_id) && !defined?(user_id) %> - <%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %> - <% elsif defined?(project_id) %> - <%= link_to "", issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %> - <% elsif defined?(user_id) %> - <%= link_to "", issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %> - <% end %> + <%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %> + <% if !defined?(project_id) && !defined?(user_id) %> + <%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% elsif defined?(project_id) %> + <%= link_to "", issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% elsif defined?(user_id) %> + <%= link_to "", issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15' if User.current.allowed_to?(:delete_issues, activity.project) %> + <% end %>
@@ -88,25 +88,25 @@ <% end %> diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index a488cfb7e..41fa1b1b3 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -25,36 +25,3 @@ - - - - - - - -
-
-
新建问题
-
-
- <%= call_hook(:view_issues_new_top, {:issue => @issue}) %> - <%= labelled_form_for @issue, :url => project_issues_path(@project), - :html => {:id => 'issue-form', :multipart => true} do |f| %> - <%= error_messages_for 'issue' %> - <%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %> -
- <%#= render :partial => 'issues/form', :locals => {:f => f} %> -
- - - - - <%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %> - <% end %> -
- - <% content_for :header_tags do %> - <%= robot_exclusion_tag %> - <% end %> -
-
\ No newline at end of file diff --git a/app/views/projects/_project_issue_expand_show.html.erb b/app/views/projects/_project_issue_expand_show.html.erb new file mode 100644 index 000000000..88e9407d8 --- /dev/null +++ b/app/views/projects/_project_issue_expand_show.html.erb @@ -0,0 +1,88 @@ +
    + <% comments.each do |comment| %> + +
  • +
    + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> +
    +
    + <%= render :partial => 'projects/project_issue_contents', :locals => {:comment => comment}%> + + <% if !comment.content_detail.blank? || comment.class == Journal %> +
    + <% if comment.class == Journal %> + <% if comment.details.any? %> + <% details_to_strings(comment.details).each do |string| %> +

    <%= string %>

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

    <%= comment.notes.html_safe %>

    + <% else %> + <%= comment.content_detail.html_safe %> + <% end %> +
    +
    +
    + + + <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> + + + + <%= link_to( + l(:button_reply), + {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :activity_id => activity.id, :is_project => true}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <%= link_to( + l(:button_delete), + {:controller => 'issues',:action => 'delete_journal', :id => activity.id,:journal_id=>comment.id, :user_activity_id => user_activity_id, :is_project => true}, + :method => 'get', + :confirm => l(:text_are_you_sure), + :remote=>true, + :id => "delete_reply_#{activity.id}_#{comment.id}", + :class => 'fr mr20 undis', + :title => l(:button_delete) + ) if comment.user_id == User.current.id %> + + +
    +
    +
    +

    + <% end %> +
    +
    +
  • + <% end %> +
+ +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+ <% if User.current.logged? %> +
+ <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id, :is_project => true),:method => "post", :remote => true) do |f| %> + +
+ + +
+

+ <% end%> +
+ <% else %> + <%= render :partial => "projects/show_unlogged" %> + <% end %> +
+
+
+
\ No newline at end of file diff --git a/app/views/projects/_project_issue_reply.html.erb b/app/views/projects/_project_issue_reply.html.erb index 78f5ce14c..50d3afe68 100644 --- a/app/views/projects/_project_issue_reply.html.erb +++ b/app/views/projects/_project_issue_reply.html.erb @@ -5,97 +5,10 @@ <% comments = activity.journals.includes(:user, :details).reorder("created_on desc").limit(3) %> <% if count > 0 %>
-
    - <% comments.each do |comment| %> - -
  • -
    - <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> -
    -
    - <%= render :partial => 'projects/project_issue_contents', :locals => {:comment => comment}%> - - <% if !comment.content_detail.blank? || comment.class == Journal %> -
    - <% if comment.class == Journal %> - <% if comment.details.any? %> - <% details_to_strings(comment.details).each do |string| %> -

    <%= string %>

    - <% end %> - <% end %> -

    <%= comment.notes.html_safe %>

    - <% else %> - <%= comment.content_detail.html_safe %> - <% end %> -
    -
    -
    - - - <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> - - - - <%= link_to( - l(:button_reply), - {:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :activity_id => activity.id, :is_project => true}, - :remote => true, - :method => 'get', - :title => l(:button_reply)) %> - - - <%= link_to( - l(:button_delete), - {:controller => 'issues',:action => 'delete_journal', :id => activity.id,:journal_id=>comment.id, :user_activity_id => user_activity_id, :is_project => true}, - :method => 'get', - :confirm => l(:text_are_you_sure), - :remote=>true, - :id => "delete_reply_#{activity.id}_#{comment.id}", - :class => 'fr mr20 undis', - :title => l(:button_delete) - ) if comment.user_id == User.current.id %> - - -
    -
    -
    -

    - <% end %> -
    -
    -
  • - <% end %> -
- - <%#= render :partial => 'users/news_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Issue', :activity_id => activity.id} %> + <%= render :partial => "projects/project_issue_expand_show", :locals => {:comments => comments, :activity => activity, :user_activity_id => user_activity_id} %>
<% end %> -
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
- <% if User.current.logged? %> -
- <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id, :is_project => true),:method => "post", :remote => true) do |f| %> - -
- - -
-

- <% end%> -
- <% else %> - <%= render :partial => "projects/show_unlogged" %> - <% end %> -
-
-
-
+
\ No newline at end of file diff --git a/app/views/projects/_project_news_replies.html.erb b/app/views/projects/_project_news_replies.html.erb index 8662beeae..6b6d9e1fc 100644 --- a/app/views/projects/_project_news_replies.html.erb +++ b/app/views/projects/_project_news_replies.html.erb @@ -1,4 +1,4 @@ -