From 2220e0b7cc315aaab6c446c642bc42a010f4d0e7 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 22 Dec 2015 15:48:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B8=96=E5=AD=90-?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A0=8F=E7=9B=AE=E5=85=B3=E8=81=94=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 14 ++++++++++++-- app/models/board.rb | 2 ++ app/models/org_subfield.rb | 2 ++ app/models/org_subfield_board.rb | 5 +++++ config/routes.rb | 1 + .../20151221023622_create_org_subfield_boards.rb | 13 +++++++++++++ ...072758_add_board_type_to_org_subfield_boards.rb | 5 +++++ db/schema.rb | 14 +++++++++++++- spec/factories/org_subfield_boards.rb | 6 ++++++ spec/models/org_subfield_boards_spec.rb | 5 +++++ 10 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 app/models/org_subfield_board.rb create mode 100644 db/migrate/20151221023622_create_org_subfield_boards.rb create mode 100644 db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb create mode 100644 spec/factories/org_subfield_boards.rb create mode 100644 spec/models/org_subfield_boards_spec.rb diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 0c3236d4e..291593fc5 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -18,8 +18,8 @@ class BoardsController < ApplicationController layout 'base_projects'#by young default_search_scope :messages - before_filter :find_project_by_project_id, :find_board_if_available - before_filter :authorize, :except => [:new, :show, :create, :index] + before_filter :find_project_by_project_id, :find_board_if_available, :except => [:join_to_org_subfields] + before_filter :authorize, :except => [:new, :show, :create, :index, :join_to_org_subfields] accept_rss_auth :index, :show @@ -225,6 +225,16 @@ class BoardsController < ApplicationController redirect_to_settings_in_projects end + def join_to_org_subfields + if params[:id] + @board = Board.find(params[:id]) + @org_subfield_ids = params[:org_subfield_ids] + @org_subfield_ids.each do |id| + OrgSubfieldBoard.create(:org_subfield_id => id.to_i, :board_id => params[:id].to_i) + end + end + end + private def redirect_to_settings_in_projects redirect_to settings_project_url(@project, :tab => 'boards') diff --git a/app/models/board.rb b/app/models/board.rb index 67d59e599..ba1fae30a 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -19,6 +19,8 @@ class Board < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :project,:touch => true belongs_to :course,:touch=>true + has_many :org_subfield_boards + has_many :org_subfields, :class_name => "OrgSubfield", :through => :org_subfield_boards has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC" belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index f95bb3eba..062226e0e 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -2,6 +2,8 @@ class OrgSubfield < ActiveRecord::Base belongs_to :organization, :foreign_key => :organization_id has_many :org_document_comments, :dependent => :destroy has_many :files + has_many :org_subfield_boards + has_many :boards, :through => :org_subfield_boards acts_as_attachable def project diff --git a/app/models/org_subfield_board.rb b/app/models/org_subfield_board.rb new file mode 100644 index 000000000..ac820e319 --- /dev/null +++ b/app/models/org_subfield_board.rb @@ -0,0 +1,5 @@ +class OrgSubfieldBoard < ActiveRecord::Base + belongs_to :org_subfield + belongs_to :board + # attr_accessible :title, :body +end diff --git a/config/routes.rb b/config/routes.rb index 4121639c0..da04f63f3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -406,6 +406,7 @@ RedmineApp::Application.routes.draw do # boards match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message' + match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields' get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' diff --git a/db/migrate/20151221023622_create_org_subfield_boards.rb b/db/migrate/20151221023622_create_org_subfield_boards.rb new file mode 100644 index 000000000..06f6f2f17 --- /dev/null +++ b/db/migrate/20151221023622_create_org_subfield_boards.rb @@ -0,0 +1,13 @@ +class CreateTableOrgSubfieldBoards < ActiveRecord::Migration + def up + create_table :org_subfield_boards do |t| + t.integer :org_subfield_id + t.integer :board_id + t.timestamps + end + end + + def down + drop_table :org_subfield_boards + end +end diff --git a/db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb b/db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb new file mode 100644 index 000000000..d53f9952f --- /dev/null +++ b/db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb @@ -0,0 +1,5 @@ +class AddBoardTypeToOrgSubfieldBoards < ActiveRecord::Migration + def change + add_column :org_subfield_boards, :board_type, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e946c493..f2c61ac5f 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 => 20151218110033) do +ActiveRecord::Schema.define(:version => 20151222072758) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1196,6 +1196,14 @@ ActiveRecord::Schema.define(:version => 20151218110033) do t.datetime "created_at" end + create_table "org_subfield_boards", :force => true do |t| + t.integer "org_subfield_id" + t.integer "board_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "board_type" + end + create_table "org_subfields", :force => true do |t| t.integer "organization_id" t.integer "priority" @@ -1634,6 +1642,10 @@ ActiveRecord::Schema.define(:version => 20151218110033) do t.string "extra" end + create_table "temp", :id => false, :force => true do |t| + t.integer "id", :default => 0, :null => false + end + create_table "time_entries", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false diff --git a/spec/factories/org_subfield_boards.rb b/spec/factories/org_subfield_boards.rb new file mode 100644 index 000000000..0af4bc0d3 --- /dev/null +++ b/spec/factories/org_subfield_boards.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :org_subfield_board, :class => 'OrgSubfieldBoards' do + + end + +end diff --git a/spec/models/org_subfield_boards_spec.rb b/spec/models/org_subfield_boards_spec.rb new file mode 100644 index 000000000..9a011c015 --- /dev/null +++ b/spec/models/org_subfield_boards_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgSubfieldBoards, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 9dc2cb8541c5c2e0ec4fce897c98c7f97afbf967 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 23 Dec 2015 10:40:50 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E9=99=84=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 + .../org_document_comments_controller.rb | 5 +- app/models/org_document_comment.rb | 6 ++ .../_attachment.html.erb | 79 +++++++++++++++++++ app/views/org_document_comments/edit.html.erb | 7 +- app/views/org_document_comments/new.html.erb | 8 +- app/views/org_document_comments/show.html.erb | 3 + 7 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 app/views/org_document_comments/_attachment.html.erb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 664dc4cf5..9ce76dca8 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -242,6 +242,8 @@ class AttachmentsController < ApplicationController format.html { redirect_to_referer_or mobile_version_path } elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield) format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)} + elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgDocumentComment) + format.html {redirect_to_referer_or org_document_comment_path(@attachment.container)} else if @project.nil? format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index b8584fea3..67d3b247a 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -1,16 +1,18 @@ class OrgDocumentCommentsController < ApplicationController before_filter :find_organization, :only => [:new, :create, :show, :index] - + helper :attachments layout 'base_org' def new @org_document_comment = OrgDocumentComment.new end + def create @org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id) @org_document_comment.title = params[:org_document_comment][:title] @org_document_comment.content = params[:org_document_comment][:content] + @org_document_comment.save_attachments(params[:attachments]) if params[:field_id] @org_document_comment.org_subfield_id = params[:field_id].to_i end @@ -40,6 +42,7 @@ class OrgDocumentCommentsController < ApplicationController def update @org_document = OrgDocumentComment.find(params[:id]) @org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content]) + @org_document.save_attachments(params[:attachments]) if @org_document.parent.nil? act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first act.update_attributes(:updated_at => @org_document.updated_at) diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb index e2ce350ce..8febbf981 100644 --- a/app/models/org_document_comment.rb +++ b/app/models/org_document_comment.rb @@ -5,6 +5,7 @@ class OrgDocumentComment < ActiveRecord::Base belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id' has_many :editor_of_documents, :dependent => :destroy acts_as_tree :order => "#{OrgDocumentComment.table_name}.sticky asc, #{OrgDocumentComment.table_name}.created_at desc" + acts_as_attachable has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy after_create :document_save_as_org_activity @@ -17,4 +18,9 @@ class OrgDocumentComment < ActiveRecord::Base end end + + def project + + end + end diff --git a/app/views/org_document_comments/_attachment.html.erb b/app/views/org_document_comments/_attachment.html.erb new file mode 100644 index 000000000..86298a330 --- /dev/null +++ b/app/views/org_document_comments/_attachment.html.erb @@ -0,0 +1,79 @@ + +
+ +<% if defined?(container) && container && container.saved_attachments %> + <% 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 => 254, :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') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> + <% 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 => 254, :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') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> +<% end %> +
+
+ + <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + + <%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + 上传附件 + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '' : '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), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> + + <%= l(:label_no_file_uploaded) %> + + (<%= l(:label_max_size) %>: + <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) + + + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
+ diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb index 33244ef14..6ee42bb08 100644 --- a/app/views/org_document_comments/edit.html.erb +++ b/app/views/org_document_comments/edit.html.erb @@ -33,10 +33,15 @@
-

+
+
+ <%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %> +
+
+
确定 diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index 24160f6eb..6b0a275c3 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -39,10 +39,14 @@ <%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
- -

+
+
+ <%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %> +
+
+
确定 diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 0848bc4e5..5815483e5 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -29,6 +29,9 @@ <%= @document.content.html_safe %>
<% end %> +
+ <%= link_to_attachments_course @document, :author => false %> +
From b9ae579622e024060f7f3fb3891a7b3e70ba86b1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 23 Dec 2015 15:35:26 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=B0=86=E8=AF=BE=E7=A8=8B=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E8=BD=AC=E5=8F=91=E8=87=B3=E7=BB=84=E7=BB=87=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E6=A0=8F=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 20 ++++++- app/models/board.rb | 2 - app/models/message.rb | 2 + app/models/org_subfield.rb | 4 +- app/models/org_subfield_board.rb | 5 -- app/views/messages/_course_show.html.erb | 1 + .../messages/_join_org_subfield_menu.html.erb | 60 +++++++++++++++++++ .../messages/_show_org_subfields.html.erb | 13 ++++ .../messages/get_subfield_on_click_org.js.erb | 2 + app/views/messages/join_org_subfield.js.erb | 11 ++++ app/views/messages/join_org_subfields.js.erb | 2 + .../_org_left_subfield_list.html.erb | 1 + config/routes.rb | 3 + ...151221023622_create_org_subfield_boards.rb | 13 ---- ...8_add_board_type_to_org_subfield_boards.rb | 5 -- db/schema.rb | 8 +-- public/stylesheets/org.css | 15 ++++- public/stylesheets/public.css | 15 ++++- 18 files changed, 148 insertions(+), 34 deletions(-) delete mode 100644 app/models/org_subfield_board.rb create mode 100644 app/views/messages/_join_org_subfield_menu.html.erb create mode 100644 app/views/messages/_show_org_subfields.html.erb create mode 100644 app/views/messages/get_subfield_on_click_org.js.erb create mode 100644 app/views/messages/join_org_subfield.js.erb create mode 100644 app/views/messages/join_org_subfields.js.erb delete mode 100644 db/migrate/20151221023622_create_org_subfield_boards.rb delete mode 100644 db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 6f173b7c2..957d77b8a 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -22,7 +22,7 @@ class MessagesController < ApplicationController default_search_scope :messages before_filter :find_board, :only => [:new, :preview,:edit] before_filter :find_attachments, :only => [:preview] - before_filter :find_message, :except => [:new, :preview] + before_filter :find_message, :except => [:new, :preview, :join_org_subfield, :get_subfield_on_click_org, :join_org_subfields] before_filter :authorize, :except => [:preview, :edit, :destroy, :new] helper :boards @@ -301,6 +301,24 @@ class MessagesController < ApplicationController render :partial => 'common/preview' end + def join_org_subfield + @message = Message.find(params[:message_id]) + @organizations = User.current.organizations + end + + def get_subfield_on_click_org + @org = Organization.find(params[:organization_id]) + end + + def join_org_subfields + org_subfield_ids = params[:org_subfields] + @message = Message.find(params[:id]) + type = @message.board.course_id.nil? ? "Project":"Course" + org_subfield_ids.each do |field_id| + OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => @message.id, :message_type => type) + end + end + private def find_message return unless find_board diff --git a/app/models/board.rb b/app/models/board.rb index ba1fae30a..67d59e599 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -19,8 +19,6 @@ class Board < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :project,:touch => true belongs_to :course,:touch=>true - has_many :org_subfield_boards - has_many :org_subfields, :class_name => "OrgSubfield", :through => :org_subfield_boards has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC" has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC" belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id diff --git a/app/models/message.rb b/app/models/message.rb index 4cdae1f6e..19531e270 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -23,6 +23,8 @@ class Message < ActiveRecord::Base belongs_to :board,:touch => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :praise_tread, as: :praise_tread_object, dependent: :destroy + has_many :org_subfield_messages, :dependent => :destroy + has_many :org_subfields, :through => :org_subfield_messages acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC" acts_as_attachable diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 062226e0e..b63883e81 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -2,8 +2,8 @@ class OrgSubfield < ActiveRecord::Base belongs_to :organization, :foreign_key => :organization_id has_many :org_document_comments, :dependent => :destroy has_many :files - has_many :org_subfield_boards - has_many :boards, :through => :org_subfield_boards + has_many :org_subfield_messages, :dependent => :destroy + has_many :messages, :through => :org_subfield_messages acts_as_attachable def project diff --git a/app/models/org_subfield_board.rb b/app/models/org_subfield_board.rb deleted file mode 100644 index ac820e319..000000000 --- a/app/models/org_subfield_board.rb +++ /dev/null @@ -1,5 +0,0 @@ -class OrgSubfieldBoard < ActiveRecord::Base - belongs_to :org_subfield - belongs_to :board - # attr_accessible :title, :body -end diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index e06c04775..1b4c8a0f6 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -57,6 +57,7 @@ :data => {:confirm => l(:text_are_you_sure)}, :class => 'postOptionLink' ) if @message.course_destroyable_by?(User.current) %> + <%= link_to "转发",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %> diff --git a/app/views/messages/_join_org_subfield_menu.html.erb b/app/views/messages/_join_org_subfield_menu.html.erb new file mode 100644 index 000000000..692195892 --- /dev/null +++ b/app/views/messages/_join_org_subfield_menu.html.erb @@ -0,0 +1,60 @@ + + + + + + + + + + +
+
转发到
+
+
+
+ +
+ 我的组织 +
+
    + <% organizations.each do |org| %> +
  • <%= link_to org.name, messages_get_subfield_on_click_org_path(:organization_id => org.id), :remote => true %>
  • + <% end %> +
+
+ <%= form_tag url_for(:controller => 'messages', :action => 'join_org_subfields', :id => id), :id => 'join-form', :remote => true %> +
+ <%= render :partial => 'show_org_subfields', :locals => {:org => nil} %> +
+
+ + +
+ + + diff --git a/app/views/messages/_show_org_subfields.html.erb b/app/views/messages/_show_org_subfields.html.erb new file mode 100644 index 000000000..c1fa92990 --- /dev/null +++ b/app/views/messages/_show_org_subfields.html.erb @@ -0,0 +1,13 @@ +
    + + <% if !org.nil? %> + 组织:<%= org.name %> + <% org.org_subfields.where("field_type='Post'").each do |subfield| %> +
  • + +
  • + <% end %> + <% else %> + 请在左侧选择要转发的位置 + <% end %> +
\ No newline at end of file diff --git a/app/views/messages/get_subfield_on_click_org.js.erb b/app/views/messages/get_subfield_on_click_org.js.erb new file mode 100644 index 000000000..858236a96 --- /dev/null +++ b/app/views/messages/get_subfield_on_click_org.js.erb @@ -0,0 +1,2 @@ +$("#org_subfield_list").html(""); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'show_org_subfields', :locals => {:org => @org}) %>"); diff --git a/app/views/messages/join_org_subfield.js.erb b/app/views/messages/join_org_subfield.js.erb new file mode 100644 index 000000000..68e21d4e3 --- /dev/null +++ b/app/views/messages/join_org_subfield.js.erb @@ -0,0 +1,11 @@ +$('#topnav_course_menu').hide(); + +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_org_subfield_menu', :locals => {:organizations => @organizations, :id => @message.id}) %>'); +showModal('ajax-modal', '430px'); +$('#ajax-modal').siblings().hide(); +$('#ajax-modal').before( + ""); +//$('#ajax-modal').css('position','absolute') +$('#ajax-modal').css("top","").css("left",""); +$('#ajax-modal').parent().addClass("resourceSharePopup"); + diff --git a/app/views/messages/join_org_subfields.js.erb b/app/views/messages/join_org_subfields.js.erb new file mode 100644 index 000000000..7cb64e228 --- /dev/null +++ b/app/views/messages/join_org_subfields.js.erb @@ -0,0 +1,2 @@ +hideModal(); +alert("转发成功!"); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 4d85342a6..9032ba62e 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -9,6 +9,7 @@
    + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
diff --git a/config/routes.rb b/config/routes.rb index da04f63f3..c5e890d15 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -415,6 +415,9 @@ RedmineApp::Application.routes.draw do post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' + match 'messages/join_org_subfield', :to => 'messages#join_org_subfield' + match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org' + match 'messages/join_org_subfields', :to => 'messages#join_org_subfields' # boards end # Misc issue routes. TODO: move into resources diff --git a/db/migrate/20151221023622_create_org_subfield_boards.rb b/db/migrate/20151221023622_create_org_subfield_boards.rb deleted file mode 100644 index 06f6f2f17..000000000 --- a/db/migrate/20151221023622_create_org_subfield_boards.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateTableOrgSubfieldBoards < ActiveRecord::Migration - def up - create_table :org_subfield_boards do |t| - t.integer :org_subfield_id - t.integer :board_id - t.timestamps - end - end - - def down - drop_table :org_subfield_boards - end -end diff --git a/db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb b/db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb deleted file mode 100644 index d53f9952f..000000000 --- a/db/migrate/20151222072758_add_board_type_to_org_subfield_boards.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddBoardTypeToOrgSubfieldBoards < ActiveRecord::Migration - def change - add_column :org_subfield_boards, :board_type, :string - end -end diff --git a/db/schema.rb b/db/schema.rb index f2c61ac5f..50575eca8 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 => 20151222072758) do +ActiveRecord::Schema.define(:version => 20151223062932) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1196,12 +1196,12 @@ ActiveRecord::Schema.define(:version => 20151222072758) do t.datetime "created_at" end - create_table "org_subfield_boards", :force => true do |t| + create_table "org_subfield_messages", :force => true do |t| t.integer "org_subfield_id" - t.integer "board_id" + t.integer "message_id" + t.string "message_type" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "board_type" end create_table "org_subfields", :force => true do |t| diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 44dcc70e3..2ffefa48a 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -85,4 +85,17 @@ a.linkGrey8:hover {color:#585858;} .re_con_top span{ color:#999999; font-weight:bold;} ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } -.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} \ No newline at end of file +.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} + +/*转发样式*/ +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} +.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:220px; background-color:#f1f1f1; min-height:150px; padding-top:5px;} +.columnWrap {float:left; max-height:148px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; background-color:#fffff; min-height:148px; padding-top:5px; border:1px solid #f1f1f1;} +.columnWrap li {padding-left:10px; color:#585858;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {display:none;} +.sectionContent li {padding-left:30px;} +.sectionContent li:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;} \ No newline at end of file diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index d9f370c7d..f73f389ae 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -916,4 +916,17 @@ a.resourcesTypeUser {background:url(images/homepage_icon.png) -178px -453px no-r .list_style ul li{list-style-type: disc;margin-left: 20px;} /* @功能 定义 */ -span.at {color:#269ac9;} \ No newline at end of file +span.at {color:#269ac9;} + +/*转发样式*/ +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} +.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:220px; background-color:#f1f1f1; min-height:150px; padding-top:5px;} +.columnWrap {float:left; max-height:148px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; background-color:#fffff; min-height:148px; padding-top:5px; border:1px solid #f1f1f1;} +.columnWrap li {padding-left:10px; color:#585858;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {display:none;} +.sectionContent li {padding-left:30px;} +.sectionContent li:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;} \ No newline at end of file From 73d377d06d71cf6c626962b2fa7a53bc84310756 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 23 Dec 2015 16:49:05 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E6=98=BE=E7=A4=BA=E8=BD=AC=E5=8F=91=E7=9A=84?= =?UTF-8?q?=E5=B8=96=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 7 +++++++ app/controllers/org_subfields_controller.rb | 14 +++++++++++--- app/controllers/organizations_controller.rb | 2 +- app/models/org_subfield_message.rb | 3 +++ app/views/org_subfields/show.html.erb | 0 app/views/organizations/_org_activities.html.erb | 10 ++++++++++ .../20151223062932_create_org_subfield_messages.rb | 10 ++++++++++ spec/factories/org_subfield_messages.rb | 6 ++++++ spec/models/org_subfield_message_spec.rb | 5 +++++ 9 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 app/models/org_subfield_message.rb create mode 100644 app/views/org_subfields/show.html.erb create mode 100644 db/migrate/20151223062932_create_org_subfield_messages.rb create mode 100644 spec/factories/org_subfield_messages.rb create mode 100644 spec/models/org_subfield_message_spec.rb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 957d77b8a..d5ce9e0eb 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -313,9 +313,16 @@ class MessagesController < ApplicationController def join_org_subfields org_subfield_ids = params[:org_subfields] @message = Message.find(params[:id]) + # @message.update_attribute(:updated_on, Time.now) type = @message.board.course_id.nil? ? "Project":"Course" org_subfield_ids.each do |field_id| OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => @message.id, :message_type => type) + org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id) + if org_acts.all.size() > 0 + org_acts.first.update_attribute(:updated_at, Time.now) + else + OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => @message.id, :user_id => User.current.id) + end end end diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 1dc7885fe..26e35fc16 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -6,6 +6,17 @@ class OrgSubfieldsController < ApplicationController @subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type]) end + def show + @org_subfield = OrgSubfield.find(params[:id]) + @organization = @org_subfield.organization.id + @messages = [] + @messages << @org_subfield.org_document_comments + @messages << @org_subfield.messages + @messages.sort{|a, b| b.updated_at <=> a.updated_at} + respond_to do |format| + format.html{render :layout => 'base_org'} + end + end def destroy @subfield = OrgSubfield.find(params[:id]) @organization = Organization.find(@subfield.organization_id) @@ -18,7 +29,4 @@ class OrgSubfieldsController < ApplicationController @subfield.update_attributes(:name => params[:name]) end - def show - - end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 38402f68e..69437e87f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -71,7 +71,7 @@ class OrganizationsController < ApplicationController if params[:org_subfield_id] @org_subfield = OrgSubfield.find(params[:org_subfield_id]) @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 - @org_activities = OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})").order('updated_at desc').page(params[:page] || 1).per(10) + @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) else project_ids = @organization.projects.map(&:id) << 0 course_ids = @organization.courses.map(&:id) << 0 diff --git a/app/models/org_subfield_message.rb b/app/models/org_subfield_message.rb new file mode 100644 index 000000000..ba8778783 --- /dev/null +++ b/app/models/org_subfield_message.rb @@ -0,0 +1,3 @@ +class OrgSubfieldMessage < ActiveRecord::Base + # attr_accessible :title, :body +end diff --git a/app/views/org_subfields/show.html.erb b/app/views/org_subfields/show.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 8bd1f5bbf..f9dfa8ea2 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -49,6 +49,16 @@ <%= render :partial => 'org_course_create', :locals => {:activity => Course.find(act.org_act_id), :user_activity_id => act.id} %> <% end %> <% end %> + <% if act.container_type == 'OrgSubfield' %> + <% if act.org_act_type == 'Message' %> + <% message = Message.find(act.org_act_id) %> + <% if !message.board.course_id.nil? %> + <%= render :partial => 'org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %> + <% else %> + <%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %> + <% end %> + <% end %> + <% end %> <% end %> <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> diff --git a/db/migrate/20151223062932_create_org_subfield_messages.rb b/db/migrate/20151223062932_create_org_subfield_messages.rb new file mode 100644 index 000000000..b5e4c2028 --- /dev/null +++ b/db/migrate/20151223062932_create_org_subfield_messages.rb @@ -0,0 +1,10 @@ +class CreateOrgSubfieldMessages < ActiveRecord::Migration + def change + create_table :org_subfield_messages do |t| + t.integer :org_subfield_id + t.integer :message_id + t.string :message_type + t.timestamps + end + end +end diff --git a/spec/factories/org_subfield_messages.rb b/spec/factories/org_subfield_messages.rb new file mode 100644 index 000000000..a3d6b391b --- /dev/null +++ b/spec/factories/org_subfield_messages.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :org_subfield_message, :class => 'OrgSubfieldMessage' do + + end + +end diff --git a/spec/models/org_subfield_message_spec.rb b/spec/models/org_subfield_message_spec.rb new file mode 100644 index 000000000..806fa5ba9 --- /dev/null +++ b/spec/models/org_subfield_message_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgSubfieldMessage, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 9e0b88c186d84c1bce17e706e5f158394fd87daa Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 24 Dec 2015 09:46:18 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=A0=B7=E5=BC=8F=E6=94=B9=E6=88=90=E6=96=B9=E5=9D=97?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_project_new_topic.html.erb | 72 +++- app/views/boards/_project_show.html.erb | 232 ++----------- .../boards/_project_show_detail.html.erb | 70 ++++ app/views/layouts/base_projects.html.erb | 2 +- app/views/messages/_form_project.html.erb | 64 +++- app/views/messages/_project_show.html.erb | 309 ++++++++++++------ app/views/users/_project_message.html.erb | 4 +- 7 files changed, 424 insertions(+), 329 deletions(-) create mode 100644 app/views/boards/_project_show_detail.html.erb diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 00a3d2016..2259cc5bb 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -1,11 +1,65 @@ -<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> - <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %> -
  • -
    - <%= l(:button_cancel) %> +<%= error_messages_for 'message' %> +
    +
    +
    +
    + +

    +
    +
  • -<% end %> \ No newline at end of file + <%= f.kindeditor :content, :editor_id => 'message_content_editor', + :owner_id => topic.nil? ? 0: topic.id, + :owner_type => OwnerTypeHelper::MESSAGE, + :width => '100%', + :height => 300, + :minHeight=>300, + :class => 'talk_text fl', + :input_html => { :id => 'message_content', + :class => 'talk_text fl', + :maxlength => 5000 }, + at_id: topic.id, at_type: topic.class.to_s + %> +
    +

    + +
    +
    +
    + <%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %> +
    +
    +
    +
    + <%if !edit_mode %> + 确定 + + 取消 + <% else %> + 确定 + + <%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%> + <% end %> +
    +
    + + + + \ 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..8a11d2859 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -1,204 +1,44 @@ -
    -
    -

    - <% 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 %> -
    -
    + <% 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'} do |f| %> + <%#= render :partial => 'project_new_topic', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %> + <%= render :partial => 'project_new_topic', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %> <% 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 %> + <%= render :partial=> 'project_show_detail',:locals =>{:topics => @topics, :page => 0} %>
    -
    + + + + + + <% 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, :project_id => @board.project.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
    + <% end %> +<% end%> + + \ No newline at end of file diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index f7dcc40f5..433d30214 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -12,7 +12,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %> <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/messages/_form_project.html.erb b/app/views/messages/_form_project.html.erb index bf91b3517..57d8a27c2 100644 --- a/app/views/messages/_form_project.html.erb +++ b/app/views/messages/_form_project.html.erb @@ -1,16 +1,23 @@ + +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + <%= error_messages_for 'message' %> <% replying ||= false %> -<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %> +<% extra_option = replying ? { hidden: "hidden"} : { maxlength: 200 } %> +
  • - +
    <% if replying %> - <%= 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",:class=>"talk_input w585 fl" }.merge(extra_option) %>
    <% else %> <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> +

    <% end %> -

    +
  • -
  • +
  • <% unless replying %> <% if @message.safe_attribute? 'sticky' %> <%= f.check_box :sticky %> @@ -24,20 +31,45 @@
  • -
    - +
    + <%= text_area :quote,:quote,:style => 'display:none' %> - <%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <% if replying %> + <%= f.kindeditor :content, :editor_id => 'message_content_editor', + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'message_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> + <% else %> + <%= f.kindeditor :content, :editor_id => 'message_content_editor', + :owner_id => @message.nil? ? 0: @message.id, + :owner_type => OwnerTypeHelper::MESSAGE, + :width => '90%', + :height => 300, + :minHeight=>300, + :class => 'talk_text fl', + :input_html => { :id => 'message_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> + <% end %>
    -

    +

  • -
  • - -
    - <%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %> -
    -
  • +<% unless replying %> +
  • + +
    + <%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %> +
    +
  • +<% end %>
  • -
  • \ No newline at end of file + diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 28b9e28d5..b20a7c22d 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -1,104 +1,3 @@ -
    -

    <%= h @board.name %>

    -
    -
    -
    - <%=link_to image_tag(url_to_avatar(@topic.author), :width => "46", :height => "46"), user_path(@topic.author) %> -
    -
    -

    - <%= @topic.subject %>

    -
    -

    由<%= link_to_user_header @topic.author,false,:class=> 'problem_name c_orange' %> 添加于<%= format_time(@topic.created_on) %>

    -
    - - <%#= watcher_link(@topic, User.current) %> - <%= link_to( - l(:button_edit), - {:action => 'edit', :id => @topic}, - :class => 'talk_edit fr' - ) if @message.editable_by?(User.current) %> - <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => @topic}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr' - ) if @message.destroyable_by?(User.current) %> -
    -
    <%= textilizable(@topic, :content) %>
    -
    <%= link_to_attachment_project @topic, :author => false %>
    - -
    - <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply", :focus => 'message_content',:class => 'talk_edit fr' %> - <% else %> - <%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %> - <% end %> - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => @topic}, - :remote => true, - :method => 'get', - :class => 'talk_edit fr', - :remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %> -
    -
    -<% unless @replies.empty? %> - <% reply_count = 0 %> - <% @replies.each do |message| %> -
    "> -
    <%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %>
    -
    -
    - <%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %> - <%= format_time(message.created_on) %> -
    -

    <%= textAreailizable message,:content,:attachments => message.attachments %>

    - <%= link_to_attachments_course message, :author => false %> -
    -
    - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => message}, - :remote => true, - :method => 'get', - :title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %> - <%= link_to( - #image_tag('edit.png'), - l(:button_edit), - {:action => 'edit', :id => message}, - :title => l(:button_edit) - ) if message.course_editable_by?(User.current) %> - <%= link_to( - #image_tag('delete.png'), - l(:button_delete), - {:action => 'destroy', :id => message}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if message.course_destroyable_by?(User.current) %> -
    -
    -
    -
    -
    - <% end %> -<% end %> -<% if !@topic.locked? && authorize_for('messages', 'reply') %> - -<% end %> -
      - <%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false, :remote => false, :flag => true%> -
    -<% html_title @topic.subject %> \ No newline at end of file + + + + +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + + + + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> +
    +
    + <% if @topic.author.id == User.current.id%> + + <%end%> + +
    + +
    + <% if @topic.try(:author).try(:realname) == ' ' %> + <%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
    +
    <%= format_time( @topic.created_on)%>
    +
    +
    + <%= @topic.content.html_safe%> +
    +
    +
    + <%= link_to_attachments_course @topic, :author => false %> +
    +
    +
    +
    +
    +
    + <% unless @replies.empty? %> +
    +
    回复(<%=@reply_count %>)
    +
    + +
    +
    + <% @replies.each_with_index do |reply,i| %> + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
    +
    + <%= reply.content.html_safe%> +
    +
    + <%= format_time(reply.created_on) %> + +
    +

    +
    +
    +
    + <% end %> +
    + + <% end %> +
    + <% if !@topic.locked? && authorize_for('messages', 'reply') %> +
    + +
    +
    + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %> + <% end %> +
    +
    +
    + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 14c37096e..96d74d82f 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -16,10 +16,10 @@
    <% 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" + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :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" + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" %> <% end %>