diff --git a/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/back_end/writing_books_controller.rb b/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/back_end/writing_books_controller.rb index 3e0dc5ea..48ebf333 100644 --- a/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/back_end/writing_books_controller.rb +++ b/vendor/built_in_modules/personal_book/app/controllers/panel/personal_book/back_end/writing_books_controller.rb @@ -179,12 +179,23 @@ class Panel::PersonalBook::BackEnd::WritingBooksController < OrbitBackendControl @writing_book = WritingBook.new(params[:writing_book]) - @writing_book.create_user_id = current_user.id - @writing_book.update_user_id = current_user.id + if params[:writing_book][:user_id] + @writing_book.create_user_id = params[:writing_book][:user_id] + @writing_book.update_user_id = params[:writing_book][:user_id] + else + @writing_book.create_user_id = current_user.id + @writing_book.update_user_id = current_user.id + end respond_to do |format| if @writing_book.save - format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } + + if params[:writing_book][:user_id] + format.html { redirect_to(admin_users_new_interface_url(:id=>params[:writing_book][:user_id],:show_plugin_profile=>'Book')) } + else + format.html { redirect_to(panel_personal_book_back_end_writing_books_url) } + end + format.xml { render :xml => @writing_book, :status => :created, :location => @writing_book } else format.html { render :action => "new" } diff --git a/vendor/built_in_modules/personal_book/app/models/writing_book.rb b/vendor/built_in_modules/personal_book/app/models/writing_book.rb index 7547d0db..bc5fbdb3 100644 --- a/vendor/built_in_modules/personal_book/app/models/writing_book.rb +++ b/vendor/built_in_modules/personal_book/app/models/writing_book.rb @@ -32,8 +32,8 @@ class WritingBook field :publication_date, :type => Date field :url field :note - field :create_user_id - field :update_user_id + field :create_user_id, :type => BSON::ObjectId + field :update_user_id, :type => BSON::ObjectId # field :is_top, :type => Boolean, :default => false # field :is_hot, :type => Boolean, :default => false diff --git a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_form.html.erb b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_form.html.erb index f6488330..40a7d02c 100644 --- a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_form.html.erb +++ b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/back_end/writing_books/_form.html.erb @@ -47,6 +47,15 @@