From 0d98dba25c524031953c7be8126aa271501b3f20 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 29 Dec 2015 09:53:44 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=B8=96=E5=AD=90=E4=B8=AD=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=8F=96=E6=B6=88=E6=8C=89=E9=92=AE=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8F=8D=E5=BA=94=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_project_show.html.erb | 4 ++-- db/schema.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 8a11d2859..4b8101cf7 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -6,8 +6,8 @@ function reset_topic(){ $("#message_subject").val(""); $("#subjectmsg").text(""); - document.getElementById("message_sticky").checked=false; - document.getElementById("message_locked").checked=false; +// document.getElementById("message_sticky").checked=false; +// document.getElementById("message_locked").checked=false; $("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => Message.new, :isReply => @isReply})%>"); message_content_editor.html(""); $("#topic_editor").toggle(); diff --git a/db/schema.rb b/db/schema.rb index 6448833c6..fab2d5700 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 => 20151223062932) do +ActiveRecord::Schema.define(:version => 20151224090313) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From 5060ec26bb667d60217d99472e9752175e2f7499 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 29 Dec 2015 11:04:20 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attachments/_form_project_new.html.erb | 77 +++++ app/views/boards/_project_new.html.erb | 65 ++++ app/views/boards/_project_show.html.erb | 307 ++---------------- .../boards/_project_show_detail.html.erb | 72 ++++ app/views/boards/show.html.erb | 2 +- public/javascripts/project.js | 62 +++- public/stylesheets/project.css | 9 +- 7 files changed, 316 insertions(+), 278 deletions(-) create mode 100644 app/views/attachments/_form_project_new.html.erb create mode 100644 app/views/boards/_project_new.html.erb create mode 100644 app/views/boards/_project_show_detail.html.erb diff --git a/app/views/attachments/_form_project_new.html.erb b/app/views/attachments/_form_project_new.html.erb new file mode 100644 index 000000000..09a1ea847 --- /dev/null +++ b/app/views/attachments/_form_project_new.html.erb @@ -0,0 +1,77 @@ + +<% if defined?(container) && container && container.saved_attachments %> + <% if isReply %> + <% container.saved_attachments.each_with_index do |attachment, i| %> + + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% else %> + <% container.attachments.each_with_index do |attachment, i| %> + + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> + <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + <%= l(:field_is_public)%>: + <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%> + + <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + + <% end %> + <% end %> +<% end %> + + + +<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + +<%#= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %> + <% id ="file#{container.id}"%> + 上传附件 + <%= file_field_tag 'attachments[dummy][file]', + :id => "file#{container.id}", + :class => 'file_selector', + :multiple => true, + :onchange => "addInputFiles_board(this, '#{container.id}');", + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all), + :lebel_file_uploding => l(:lebel_file_uploding), + :containerid => "#{container.id}" + } %> + <% if container.nil? %> + <%= l(:label_no_file_uploaded)%> + <% end %> + + + +<% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> +<% end %> + + diff --git a/app/views/boards/_project_new.html.erb b/app/views/boards/_project_new.html.erb new file mode 100644 index 000000000..44895a48e --- /dev/null +++ b/app/views/boards/_project_new.html.erb @@ -0,0 +1,65 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
+
+
+
+ +

+
+ +
+
+
\ No newline at end of file diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 839d587b2..9d08194d8 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -1,278 +1,35 @@ -
-
-

- <% if User.current.language == "zh"%> - <%= h @board.name %> - <% else %> - <%= l(:project_module_boards) %> - <% end %> -

- <% if User.current.logged? %> - <%= l(:label_message_new) %> - <% end %> -
-
- <% if !User.current.logged? %> -
- <%= l(:label_user_login_project_board) %> - <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %> -
- <% end %> -
-
- -
-
-
-

讨论区共有<%= @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 %> -
- <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl f14",:title=>author, - :style=>'max-width:80px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %> -
-

  :

- -

  <%= h(topic.subject) %>

- - <% if topic.editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> - <%= link_to(l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr', - :style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %> - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> - - -
-
-
- <%= topic.content.html_safe %> - -
-
- - <%= link_to_attachments_course topic, :author => false %> - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> -
- <% if User.current.logged? %> - <%= l(:button_reply) %> - <% end %> -
- -
-
- <% reply = Message.new(:subject => "RE: #{topic.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - - <% end %> -
- <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).reorder("#{Message.table_name}.id desc").all %> - <% unless replies_all.empty? %> -
-
    - <% replies_all_i = 0 %> - <% replies_all.each do |message| %> - <% replies_all_i=replies_all_i+1 %> -
  • - <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> -
    - <%= link_to_user_header message.author,false,:class => 'fl c_orange f14 ' %> -
    -
    - <%= textAreailizable message,:content,:attachments => message.attachments %> - -
    - -
    - <%= format_time(message.created_on) %> - <%= link_to(l(:button_delete),{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete), - :class => ' c_dblue fr f14') if message.course_destroyable_by?(User.current) %> - <%= link_to(l(:button_reply), 'javascript:;', - :nhname =>'showbtn_child_reply', - :class => ' c_dblue fr f14', - :style => 'margin-right: 10px;', - :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %> -
    -
    -
  • - <% end %> -
-
- <%if topic.replies_count>2 %> - - <% end %> - <% end %> -
-
- <% end %> - <% else %> -

<%= l(:label_no_data) %>

- <% end %> -
    - <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> -
- - -<%# other_formats_links do |f| %> - <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<%# end %> - <% html_title @board.name %> - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> - <% end %> -
-
- \ No newline at end of file + function reset_topic(){ + $("#message_subject").val(""); + $("#subjectmsg").text(""); + document.getElementById("message_sticky").checked=false; + document.getElementById("message_locked").checked=false; + $("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_project_new', :locals => {:container => Message.new, :isReply => @isReply})%>"); + message_content_editor.html(""); + $("#topic_editor").toggle(); + } + <% if @is_new%> + $(function(){ + $("#message_subject").focus(); + }); + <%end%> + + +
+
+
+ 项目讨论区 +
+
+ <% if User.current.logged? %> + <%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, + :html => {:nhname=>'form',:multipart => true, :id => 'message-form-project'} do |f| %> + <%= render :partial => 'project_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %> + <% end %> + <% end %> + <%= render :partial=> 'project_show_detail',:locals =>{:topics => @topics, :page => 0} %> +
\ No newline at end of file diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb new file mode 100644 index 000000000..c0d020b1d --- /dev/null +++ b/app/views/boards/_project_show_detail.html.erb @@ -0,0 +1,72 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + + +<% if topics%> + <% topics.each do |topic| %> + + <% if topic %> + <%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> + <% end %> + <% end %> + + <% if topics.count == 10 %> + + <%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end %> +<% end%> + + diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 5ae3459a5..d6d825d46 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -34,7 +34,7 @@ <% if @project %> - <%= render :partial => 'project_show', locals: {project: @project} %> + <%= render :partial => 'project_show', locals: {:topics => @topics, :page => 0, project: @project} %> <% elsif @course %> <%= render :partial => 'course_show', :locals => {:topics => @topics, :page => 0, :course => @course} %> <% end %> diff --git a/public/javascripts/project.js b/public/javascripts/project.js index cc679847a..1e2e71e4e 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -551,4 +551,64 @@ function issueEditShow(){ function issueDetailShow(){ $("#issue_edit").hide(); $("#issue_detail").show(); -} \ No newline at end of file +} + +//项目讨论区提交 +function regexTopicSubject() { + var name = $("#message_subject").val(); + if(name.length ==0) + { + $("#subjectmsg").text("标题不能为空"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } + else if(name.length <= 255) + { + $("#subjectmsg").text("填写正确"); + $("#subjectmsg").css('color','#008000'); + return true; + } + else + { + $("#subjectmsg").text("标题超过255个字符"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } +} + +function regexTopicDescription() +{ + var name = message_content_editor.html(); + if(message_content_editor.isEmpty()) + { + $("#message_content_span").text("描述不能为空"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else if(name.length >=6000){ + $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else + { + $("#message_content_span").text("填写正确"); + $("#message_content_span").css('color','#008000'); + return true; + } +} +function submit_topic_project() +{ + if(regexTopicSubject() && regexTopicDescription()) + { + alert("Test"); + message_content_editor.sync(); + $("#message-form-project").submit(); + } +} + +function reset_topic(){ + +} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index c9d303f1d..672db9bcc 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1094,4 +1094,11 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;} .upload_img img{max-width: 100%;} -.table_maxWidth table {max-width: 642px;} \ No newline at end of file +.table_maxWidth table {max-width: 642px;} + +/*新讨论区*/ +select.InputBox, input.InputBox, textarea.InputBox {border: 1px solid #D9D9D9;color: #888;height: 28px;line-height: 28px;padding-left: 5px;font-size: 14px;} +.w713 {width: 713px;} +a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} +a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} +a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} \ No newline at end of file From b6cf7096962b5079673aab5c009cc6341e047818 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 29 Dec 2015 11:29:43 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_project_show.html.erb | 8 +++----- app/views/boards/_project_show_detail.html.erb | 9 --------- app/views/boards/show.html.erb | 9 ++++----- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 50fd7f34b..3dac2a3d5 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -21,14 +21,12 @@
-
- 项目讨论区 -
+
<%= l(:label_borad_project) %>
<% if User.current.logged? %> <%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, - :html => {:nhname=>'form',:multipart => true, :id => 'message-form-project'} do |f| %> - <%= render :partial => 'project_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %> + :html => {:nhname=>'form',:multipart => true, :id => 'message-form-project'} do |f| %> + <%= render :partial => 'project_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %> <% end %> <% end %> <%= render :partial=> 'project_show_detail',:locals =>{:topics => @topics, :page => 0} %> diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb index 428d987aa..6d77452a8 100644 --- a/app/views/boards/_project_show_detail.html.erb +++ b/app/views/boards/_project_show_detail.html.erb @@ -1,16 +1,7 @@ -<<<<<<< .mine <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false) %> <%= javascript_include_tag "init_activity_KindEditor" %> <% end %> - -======= -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> -<% end %> - ->>>>>>> .theirs