From 72ef4e1db4bf56e8c0aeca354425ef72b97f5eb9 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 14 May 2015 15:11:20 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E7=BC=96=E8=BE=91=E6=98=AF=E4=B8=BB=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=B8=BA=E7=A9=BA=E6=97=B6=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=8A=A8=E6=80=81=E9=A1=B5=E9=9D=A2=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=97=AE=E9=A2=98=20Signed-off-by:=20alan=20<54753343?= =?UTF-8?q?4@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_new.html.erb | 2 +- app/views/boards/_course_show.html.erb | 2 +- app/views/boards/_edit.html.erb | 2 +- app/views/boards/_form_course.html.erb | 12 +++--- app/views/boards/_form_project.html.erb | 16 +++---- app/views/boards/_project_show.html.erb | 19 +-------- app/views/boards/show.html.erb | 30 +++++++++++--- app/views/courses/show.html.erb | 2 +- app/views/projects/show.html.erb | 4 +- public/javascripts/course.js | 55 +++++++++++++------------ public/javascripts/project.js | 39 +++++++++++------- public/stylesheets/project.css | 2 +- 12 files changed, 98 insertions(+), 87 deletions(-) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index fba80127b..a380ad67f 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
  • <%= l(:button_cancel) %> - <%= l(:button_submit)%> + <%= l(:button_submit)%>
  • <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 5dde6c460..19d0e6bc9 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -32,7 +32,7 @@

    讨论区共有<%= @topic_count %>个帖子

    <% if @topics.any? %> <% @topics.each do |topic| %> -
    +
    <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
    <% author = topic.author.to_s + ":" %> diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb index 15358c03a..a9acbf85f 100644 --- a/app/views/boards/_edit.html.erb +++ b/app/views/boards/_edit.html.erb @@ -12,7 +12,7 @@ } do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> - <%= l(:button_submit)%> + <%= l(:button_submit)%> <%= l(:button_cancel) %> <%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %> diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb index 09ee1c3b4..945f58c22 100644 --- a/app/views/boards/_form_course.html.erb +++ b/app/views/boards/_form_course.html.erb @@ -8,16 +8,16 @@ <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

    <% else %>
  • - <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% end %>
  • @@ -40,12 +40,12 @@ <% end %> <%= text_area :quote,:quote,:style => 'display:none' %> <% if replying%> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <% end %>
    -

    +

  • diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 3ecffa3e2..8288debe2 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -5,19 +5,19 @@
  • - <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% else %>
  • - <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> -

    +

  • <% end %>
  • @@ -36,16 +36,16 @@
  • <% unless replying %> - + <% end %> <%= text_area :quote,:quote,:style => 'display:none' %> <% if replying%> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)", :style=>"width: 575px;" %> <% else %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= f.text_area :content, :class => 'talk_text fl', :id => "message_content#{f.object.id}", :onkeyup => "regexContent('#{f.object.id}');", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> <% end %>
    -

    +

  • diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 8a9ffd990..63bb66a6a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -33,7 +33,7 @@ <% if @topics.any? %> <% @topics.each do |topic| %> -
    +
    <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
    <% author = topic.author.to_s + ":" %> @@ -215,20 +215,5 @@ $("#message_form").submit(); } } - function regexContent() - { - var content = $.trim($("#message_content").val()); - if(content.length ==0) - { - $("#message_content_span").text("<%= l(:label_reply_empty) %>"); - $("#message_content_span").css('color','#ff0000'); - flag = false; - } - else - { - $("#message_content_span").text("<%= l(:label_field_correct) %>"); - $("#message_content_span").css('color','#008000'); - flag = true; - } - } + \ No newline at end of file diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 2e736bdf7..c111aeaf0 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -25,14 +25,29 @@ <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 2a818b892..29e7f1097 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -15,7 +15,7 @@   <%= l(:label_new_activity) %>: <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : e.event_url),:class => "problem_tit c_dblue fl fb"%> + (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>

    <%= e.event_description.html_safe %>
    diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index abc63601e..6aab0a4a9 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -66,9 +66,7 @@ <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}), + project_boards_path(@project,:topic_id => act.id), :class => "problem_tit fl fb " %>

    <%= textAreailizable act,:content %>
    diff --git a/public/javascripts/course.js b/public/javascripts/course.js index f0b1338da..227048ef6 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -151,45 +151,48 @@ function submit_edit_course(id) /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////课程讨论区 -function regexSubject() -{ - var content = $.trim($("#message_subject").val()); - if(content.length ==0) - { - $("#subject_span").text("主题不能为空"); - $("#subject_span").css('color','#ff0000'); +function regexSubject(id) { + var subjectid = "#message_subject" + id ; + var content = $.trim($(subjectid).val()); + var message = "#subject_span" + id; + if (content.length == 0) { + $(message).text("主题不能为空"); + $(message).css('color', '#ff0000'); return false; } - else - { - $("#subject_span").text("填写正确"); - $("#subject_span").css('color','#008000'); + else { + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } -function regexContent() -{ - var content = message_content_editor.html(); - if(content.length ==0) - { - $("#message_content_span").text("描述不能为空"); - $("#message_content_span").css('color','#ff0000'); +function regexContent(id) { + var contentid = "#message_content" + id; + var message = "#message_content_span"+ id; + var content = $.trim($(contentid).val()); + if (content.length == 0) { + $(message).text("描述不能为空"); + $(message).css('color', '#ff0000'); return false; } - else - { - $("#message_content_span").text("填写正确"); - $("#message_content_span").css('color','#008000'); + else { + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } -function submitCoursesBoard() -{ - message_content_editor.sync(); - if(regexSubject()&®exContent()){$("#message-form").submit();} + +// 项目讨论区编辑和提交 +function submitProjectsBoard(id) { + var formid = "#message-form" + id; + if (regexSubject(id) && regexContent(id)) { + $(formid).submit(); + } } + + /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// 课程通知 function regexTitle() diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 0bc094b1d..c892f964b 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -144,42 +144,49 @@ $(function(){ /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////项目讨论区 -function regexSubject() { - var content = $.trim($("#message_subject").val()); +function regexSubject(id) { + var subjectid = "#message_subject" + id ; + var content = $.trim($(subjectid).val()); + var message = "#subject_span" + id; if (content.length == 0) { - $("#subject_span").text("主题不能为空"); - $("#subject_span").css('color', '#ff0000'); + $(message).text("主题不能为空"); + $(message).css('color', '#ff0000'); return false; } else { - $("#subject_span").text("填写正确"); - $("#subject_span").css('color', '#008000'); + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } -function regexContent() { - var content = $.trim($("#message_content").val()); +function regexContent(id) { + + var contentid = "#message_content" + id; + var message = "#message_content_span"+ id; + var content = $.trim($(contentid).val()); if (content.length == 0) { - $("#message_content_span").text("描述不能为空"); - $("#message_content_span").css('color', '#ff0000'); + alert(message); + $(message).text("描述不能为空"); + $(message).css('color', '#ff0000'); return false; } else { - $("#message_content_span").text("填写正确"); - $("#message_content_span").css('color', '#008000'); + + $(message).text("填写正确"); + $(message).css('color', '#008000'); return true; } return false; } // 项目讨论区编辑和提交 -function submitProjectsBoard() { - if (regexSubject() && regexContent()) { - $("#message-form").submit(); +function submitProjectsBoard(id) { + var formid = "#message-form" + id; + if (regexSubject(id) && regexContent(id)) { + $(formid).submit(); } } - // 提交新闻 function regexTitle() { var name = $("#news_title").val(); diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 14a7a9a34..3b04e23bf 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -738,6 +738,6 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .Replybox{ float:left; width:495px; margin-left:5px;} .talk_nextpage{ border:none; width:410px; margin:0 auto;} .newtalk { margin-top:8px; margin-right:8px;} -.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;} + #about_newtalk{ display:none;} From 8a52225f4df6482472d6f38c64c84167a2169cab Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 14 May 2015 15:19:15 +0800 Subject: [PATCH 2/6] Signed-off-by: alan <547533434@qq.com> --- public/javascripts/project.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/project.js b/public/javascripts/project.js index c892f964b..c28a86f08 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -166,7 +166,7 @@ function regexContent(id) { var message = "#message_content_span"+ id; var content = $.trim($(contentid).val()); if (content.length == 0) { - alert(message); + $(message).text("描述不能为空"); $(message).css('color', '#ff0000'); return false; From 2c568ed3701629eb79d2c154352244fc3aae0e85 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 May 2015 15:37:25 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E8=B5=84?= =?UTF-8?q?=E6=BA=90500=E9=94=99=E8=AF=AF=20=E5=AE=9A=E4=B9=89helper?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 11 +++++++++++ app/views/files/_project_file_list.html.erb | 8 +++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9c261df85..bb62695c0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -593,6 +593,17 @@ module ApplicationHelper Project.project_tree(projects, &block) end + # 判断当前用户是否为项目管理员 + def is_project_manager?(user_id,project_id) + @result = false + mem = Member.where("user_id = ? and project_id = ?",user_id, project_id) + unless mem.blank? + mem.first.roles.to_s.include?("Manager") + @result = false + end + return @result + end + def principals_check_box_tags(name, principals) s = '' principals.each do |principal| diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index b2862a634..d3e383a4e 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -20,16 +20,14 @@

    <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> - - - <%# if project.is_public? %> + <%#--私有项目资源不能引用,不能设置公开私有--%> + <%#--公开项目资源可以应用,管理员和资源上传者拥有设置公开私有权限--%> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> - <% if (Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" %> + <% if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" %> <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %> <% end %> - <%# end %> <% end %>
    From 0708279c5ec60b687711a5e8053603c3b128302a Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 14 May 2015 15:42:20 +0800 Subject: [PATCH 4/6] Signed-off-by: alan <547533434@qq.com> --- app/views/boards/_course_show.html.erb | 14 +++++++------- app/views/boards/_edit.html.erb | 4 ++-- public/javascripts/project.js | 4 +++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 19d0e6bc9..617b9428a 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -40,12 +40,10 @@

      <%= h(topic.subject) %>

    <% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> + <%= l(:button_edit) %> <% end %> + <%= link_to( l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, @@ -55,7 +53,9 @@ :style => ' margin-right: 10px;' ) if topic.destroyable_by?(User.current) %> - + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %>
    - <%= topic.content %> + <%= topic.content.html_safe %>
    diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb index a9acbf85f..46131ca51 100644 --- a/app/views/boards/_edit.html.erb +++ b/app/views/boards/_edit.html.erb @@ -12,7 +12,7 @@ } do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> - <%= l(:button_submit)%> + <%= l(:button_submit)%> <%= l(:button_cancel) %> <%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %> @@ -31,7 +31,7 @@ } do |f| %> <%= render :partial => 'form_course', :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> - <%= l(:button_submit)%> + <%= l(:button_submit)%> <%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %> <% end %> diff --git a/public/javascripts/project.js b/public/javascripts/project.js index c28a86f08..70888e5d0 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -145,6 +145,7 @@ $(function(){ /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////项目讨论区 function regexSubject(id) { + var subjectid = "#message_subject" + id ; var content = $.trim($(subjectid).val()); var message = "#subject_span" + id; @@ -166,7 +167,7 @@ function regexContent(id) { var message = "#message_content_span"+ id; var content = $.trim($(contentid).val()); if (content.length == 0) { - + $(message).text("描述不能为空"); $(message).css('color', '#ff0000'); return false; @@ -183,6 +184,7 @@ function regexContent(id) { // 项目讨论区编辑和提交 function submitProjectsBoard(id) { var formid = "#message-form" + id; + if (regexSubject(id) && regexContent(id)) { $(formid).submit(); } From 725a6e4238a4141e9d4e70738fdd359d309c48cc Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 May 2015 16:03:37 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=97=A5=E5=8E=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index a6d4bcb63..371015dbf 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2004,9 +2004,15 @@ color:#505050; } img.ui-datepicker-trigger { - cursor: pointer; - vertical-align: middle; - margin-left: 4px; + display:block; + background:url(../images/public_icon.png) -31px 0 no-repeat; + cursor: pointer; + vertical-align: middle; + margin-left: 5px; + margin-top: 5px; + width:16px; + height:15px; + float:left; } /***** Progress bar *****/ From e3d277163feca681c9c0a885ba22a3b3a0057e6c Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 14 May 2015 16:59:43 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E7=9A=84=E9=93=BE=E6=8E=A5=20Signed-off-by:?= =?UTF-8?q?=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 4 ++-- app/views/attachments/upload.js.erb | 15 ++++++++------- app/views/boards/_course_show.html.erb | 3 ++- app/views/boards/_edit.html.erb | 4 ++-- app/views/boards/_project_new_topic.html.erb | 2 +- app/views/courses/show.html.erb | 2 +- app/views/users/show.html.erb | 7 +++---- app/views/users/user_activities.html.erb | 8 +++++++- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 03581d0c2..7ccfb0e10 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -80,7 +80,7 @@ class BoardsController < ApplicationController includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). - order(sort_clause). + order("last_replies_messages.created_on desc"). preload(:author, {:last_reply => :author}). all elsif @course @@ -88,7 +88,7 @@ class BoardsController < ApplicationController includes(:last_reply). # limit(@topic_pages.per_page). # offset(@topic_pages.offset). - order(sort_clause). + order("last_replies_messages.created_on desc"). preload(:author, {:last_reply => :author}). all : [] @topics = paginateHelper board_topics,10 diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 24256ccab..c3e7fc3ff 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -3,14 +3,15 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); fileSpan.hide(); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); <% else %> -$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); fileSpan.find('a.remove-upload') - .attr({ - "data-remote": true, - "data-method": 'delete', - "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' - }) - .off('click'); + .attr({ + "data-remote": true, + "data-method": 'delete', + "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' + }) + .off('click'); +$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); + //var divattach = fileSpan.find('div.div_attachments'); //divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>'); <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 617b9428a..2d0bda162 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -100,7 +100,8 @@ <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> - <%= l(:label_memo_create)%> + <%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %> + <%= l(:label_memo_create)%> <% end %>
    diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb index 46131ca51..0bb15b167 100644 --- a/app/views/boards/_edit.html.erb +++ b/app/views/boards/_edit.html.erb @@ -32,9 +32,9 @@ <%= render :partial => 'form_course', :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> <%= l(:button_submit)%> - <%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %> + <%= l(:button_cancel) %> - <% end %> + <% end %>
    <% end %> diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 3f7c569e1..cab1bbb7b 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -4,7 +4,7 @@
  • <%= l(:button_cancel) %> - <%= l(:button_submit)%> + <%= l(:button_submit)%>
  • <% end %> \ No newline at end of file diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 29e7f1097..cc3bb33f1 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -15,7 +15,7 @@   <%= l(:label_new_activity) %>: <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%> + (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>

    <%= e.event_description.html_safe %>
    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fe36b2cd1..6083b547c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -323,10 +323,9 @@   <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> - + act.board.project ? project_boards_path(act.board.project,:topic_id => act.id) : course_boards_path(act.board.course,:topic_id => act.id), + :class => "problem_tit fl fb " %> + <% else %> diff --git a/app/views/users/user_activities.html.erb b/app/views/users/user_activities.html.erb index 080e772a1..9165e6f2e 100644 --- a/app/views/users/user_activities.html.erb +++ b/app/views/users/user_activities.html.erb @@ -28,7 +28,13 @@ - +
    <%= content_tag('span', h(e.project), :class => 'project') %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(e.event_title), e.event_url %> <%= content_tag('span', h(e.project), :class => 'project') %> <%= l(:label_new_activity) %> + <% if e.event_type.eql?("message") || e.event_type.eql?("reply") %> + <%= link_to format_activity_title(e.event_title), e.board.project ? project_boards_path(e.board.project,:topic_id => e.id):course_boards_path(e.board.course,:topic_id => e.id) %> + <%else %> + <%= link_to format_activity_title(e.event_title), e.event_url %> + <%end%> +

    <%= format_activity_description(e.event_description) %>