+
<%= submit_tag l(:button_create), :onclick => "cancel();" %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index b14d23ae..be132dd6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -16,6 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
+ resources :homework_users
+
+
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'
diff --git a/db/migrate/20140519054846_create_homework_users.rb b/db/migrate/20140519054846_create_homework_users.rb
new file mode 100644
index 00000000..46f03343
--- /dev/null
+++ b/db/migrate/20140519054846_create_homework_users.rb
@@ -0,0 +1,10 @@
+class CreateHomeworkUsers < ActiveRecord::Migration
+ def change
+ create_table :homework_users do |t|
+ t.string :homework_attach_id
+ t.string :user_id
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20140519070751_add_name_to_homework_attach.rb b/db/migrate/20140519070751_add_name_to_homework_attach.rb
new file mode 100644
index 00000000..f819b51d
--- /dev/null
+++ b/db/migrate/20140519070751_add_name_to_homework_attach.rb
@@ -0,0 +1,7 @@
+class AddNameToHomeworkAttach < ActiveRecord::Migration
+ def change
+ add_column :homework_attaches, :name, :string
+ add_column :homework_attaches, :description, :string
+ add_column :homework_attaches, :state, :int
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 74310a94..4c60942a 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 => 20140509020307) do
+ActiveRecord::Schema.define(:version => 20140519070751) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -52,14 +52,11 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
- create_table "attachmentstypes", :id => false, :force => true do |t|
- t.integer "id", :null => false
- t.integer "typeId"
+ create_table "attachmentstypes", :force => true do |t|
+ t.integer "typeId", :null => false
t.string "typeName", :limit => 50
end
- add_index "attachmentstypes", ["id"], :name => "id"
-
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@@ -325,9 +322,12 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "reward"
+ t.string "name"
+ t.string "description"
+ t.integer "state"
end
create_table "homework_for_courses", :force => true do |t|
@@ -335,6 +335,13 @@ ActiveRecord::Schema.define(:version => 20140509020307) do
t.integer "bid_id"
end
+ create_table "homework_users", :force => true do |t|
+ t.string "homework_attach_id"
+ t.string "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false
diff --git a/test/fixtures/homework_users.yml b/test/fixtures/homework_users.yml
new file mode 100644
index 00000000..bec69e59
--- /dev/null
+++ b/test/fixtures/homework_users.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ homework_attach_id: MyString
+ user_id: MyString
+
+two:
+ homework_attach_id: MyString
+ user_id: MyString
From 9a62fe22c62f21b251673d194eac70ea4aec2e8e Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 20 May 2014 08:48:42 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E7=95=99=E8=A8=80=E6=A8=A1=E5=9D=97=E5=85=88=E5=9B=9E=E5=A4=8D?=
=?UTF-8?q?=E7=95=99=E8=A8=80=E7=84=B6=E5=90=8E=E5=88=A0=E9=99=A4=E5=9B=9E?=
=?UTF-8?q?=E5=A4=8D=E7=95=99=E8=A8=80=E7=95=8C=E9=9D=A2=E4=B8=8D=E4=BC=9A?=
=?UTF-8?q?=E5=8F=8A=E6=97=B6=E5=88=B7=E6=96=B0=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_attach_controller.rb | 24 +++++++++----------
app/views/homework_attach/addjours.js.erb | 2 +-
app/views/homework_attach/destroy.js.erb | 12 ++++------
config/routes.rb | 6 ++---
4 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index 8dc5d80a..2a0f9761 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -26,13 +26,13 @@ class HomeworkAttachController < ApplicationController
#删除留言
def destroy
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
- @homework = HomeworkAttach.find(params[:id])
- @jours = @homework.journals_for_messages.order("created_on DESC")
- @limit = 10
- @feedback_count = @jours.count
- @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
- @offset ||= @feedback_pages.offset
- @jour = @jours[@offset, @limit]
+ #@homework = HomeworkAttach.find(params[:id])
+ #@jours = @homework.journals_for_messages.order("created_on DESC")
+ #@limit = 10
+ #@feedback_count = @jours.count
+ #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
+ #@offset ||= @feedback_pages.offset
+ #@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end
@@ -43,11 +43,11 @@ class HomeworkAttachController < ApplicationController
@homework = HomeworkAttach.find(params[:jour_id])
@homework.addjours User.current.id, params[:new_form][:user_message],0
@jours = @homework.journals_for_messages.order("created_on DESC")
- @limit = 10
- @feedback_count = @jours.count
- @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
- @offset ||= @feedback_pages.offset
- @jour = @jours[@offset, @limit]
+ #@limit = 10
+ #@feedback_count = @jours.count
+ #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
+ #@offset ||= @feedback_pages.offset
+ #@jour = @jours[@offset, @limit]
respond_to do |format|
format.js
end
diff --git a/app/views/homework_attach/addjours.js.erb b/app/views/homework_attach/addjours.js.erb
index e463237e..e0f32581 100644
--- a/app/views/homework_attach/addjours.js.erb
+++ b/app/views/homework_attach/addjours.js.erb
@@ -1,4 +1,4 @@
-$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>');
+$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jours, :state => false} )) %>');
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");
\ No newline at end of file
diff --git a/app/views/homework_attach/destroy.js.erb b/app/views/homework_attach/destroy.js.erb
index 9691a6ae..22f7fc04 100644
--- a/app/views/homework_attach/destroy.js.erb
+++ b/app/views/homework_attach/destroy.js.erb
@@ -1,12 +1,8 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
-<% elsif (['Principal','Project', 'Bid', 'Contest', 'Softapplication','HomeworkAttach'].include? @journal_destroyed.jour_type)%>
- var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
- destroyedItem.fadeOut(600,function(){
- destroyedItem.remove();
- });
<% else %>
-
- $('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour => @jours, :state => false})) %>');
- $('#new_form_reference_user_id').val("");
+ var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
+ destroyedItem.fadeOut(600,function(){
+ destroyedItem.remove();
+ });
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index be132dd6..f6717583 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -16,9 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do
- resources :homework_users
-
-
+ resources :homework_users
+
+
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'