<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
From da85c3efb8eae75f018a58938bd926a8267482aa Mon Sep 17 00:00:00 2001
From: alanlong9278 <547533434@qq.com>
Date: Wed, 7 Jan 2015 17:48:22 +0800
Subject: [PATCH 08/23] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E6=9F=90=E7=AB=9E?=
=?UTF-8?q?=E8=B5=9B=E4=B8=BB=E9=A1=B5=EF=BC=8C=E7=82=B9=E5=87=BB=E5=88=9B?=
=?UTF-8?q?=E6=96=B0=E7=AB=9E=E8=B5=9B=E9=93=BE=E6=8E=A5=E6=B2=A1=E5=8F=8D?=
=?UTF-8?q?=E5=BA=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/base_newcontest.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb
index 3bd03ed5d..61df29620 100644
--- a/app/views/layouts/base_newcontest.html.erb
+++ b/app/views/layouts/base_newcontest.html.erb
@@ -79,7 +79,7 @@
<%=link_to l(:field_homepage), home_path %> >
- <%= l(:label_contest_innovate) %>
+ <%=link_to l(:label_contest_innovate), home_path %>
>
<%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %>
From c9de30bd83b867bb80fa22ab769898ffb515db7f Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 8 Jan 2015 12:00:43 +0800
Subject: [PATCH 09/23] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=97=AE=E5=8D=B7?=
=?UTF-8?q?=E8=B0=83=E6=9F=A5=E7=9B=B8=E5=85=B3=E8=A1=A8=EF=BC=8C=E4=BB=A5?=
=?UTF-8?q?=E5=8F=8A=E5=AF=B9=E5=BA=94=E7=9A=84model=E3=80=81control?=
=?UTF-8?q?=E3=80=81view=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/poll_answers_controller.rb | 0
app/controllers/poll_controller.rb | 0
app/controllers/poll_user_controller.rb | 0
app/controllers/poll_votes_controller.rb | 0
app/controllers/polls_questions_controller.rb | 0
app/models/poll_answers.rb | 3 +++
app/models/poll_questions.rb | 3 +++
app/models/poll_user.rb | 3 +++
app/models/poll_votes.rb | 3 +++
app/models/polls.rb | 3 +++
db/migrate/20150108034148_create_polls.rb | 15 +++++++++++++++
.../20150108034253_create_poll_questions.rb | 12 ++++++++++++
db/migrate/20150108034414_create_poll_answers.rb | 11 +++++++++++
db/migrate/20150108035301_create_poll_votes.rb | 12 ++++++++++++
db/migrate/20150108035338_create_poll_users.rb | 10 ++++++++++
test/unit/poll_answers_test.rb | 7 +++++++
test/unit/poll_questions_test.rb | 7 +++++++
test/unit/poll_user_test.rb | 7 +++++++
test/unit/poll_votes_test.rb | 7 +++++++
test/unit/polls_test.rb | 7 +++++++
20 files changed, 110 insertions(+)
create mode 100644 app/controllers/poll_answers_controller.rb
create mode 100644 app/controllers/poll_controller.rb
create mode 100644 app/controllers/poll_user_controller.rb
create mode 100644 app/controllers/poll_votes_controller.rb
create mode 100644 app/controllers/polls_questions_controller.rb
create mode 100644 app/models/poll_answers.rb
create mode 100644 app/models/poll_questions.rb
create mode 100644 app/models/poll_user.rb
create mode 100644 app/models/poll_votes.rb
create mode 100644 app/models/polls.rb
create mode 100644 db/migrate/20150108034148_create_polls.rb
create mode 100644 db/migrate/20150108034253_create_poll_questions.rb
create mode 100644 db/migrate/20150108034414_create_poll_answers.rb
create mode 100644 db/migrate/20150108035301_create_poll_votes.rb
create mode 100644 db/migrate/20150108035338_create_poll_users.rb
create mode 100644 test/unit/poll_answers_test.rb
create mode 100644 test/unit/poll_questions_test.rb
create mode 100644 test/unit/poll_user_test.rb
create mode 100644 test/unit/poll_votes_test.rb
create mode 100644 test/unit/polls_test.rb
diff --git a/app/controllers/poll_answers_controller.rb b/app/controllers/poll_answers_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/controllers/poll_user_controller.rb b/app/controllers/poll_user_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/controllers/polls_questions_controller.rb b/app/controllers/polls_questions_controller.rb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/models/poll_answers.rb b/app/models/poll_answers.rb
new file mode 100644
index 000000000..b400ddf50
--- /dev/null
+++ b/app/models/poll_answers.rb
@@ -0,0 +1,3 @@
+class PollAnswers < ActiveRecord::Base
+ attr_accessible :answer_position, :answer_text, :poll_questions_id
+end
diff --git a/app/models/poll_questions.rb b/app/models/poll_questions.rb
new file mode 100644
index 000000000..42e376aee
--- /dev/null
+++ b/app/models/poll_questions.rb
@@ -0,0 +1,3 @@
+class PollQuestions < ActiveRecord::Base
+ attr_accessible :is_necessary, :polls_id, :question_title, :question_type
+end
diff --git a/app/models/poll_user.rb b/app/models/poll_user.rb
new file mode 100644
index 000000000..f77f2ed5c
--- /dev/null
+++ b/app/models/poll_user.rb
@@ -0,0 +1,3 @@
+class PollUser < ActiveRecord::Base
+ attr_accessible :poll_id, :user_id
+end
diff --git a/app/models/poll_votes.rb b/app/models/poll_votes.rb
new file mode 100644
index 000000000..961f0d896
--- /dev/null
+++ b/app/models/poll_votes.rb
@@ -0,0 +1,3 @@
+class PollVotes < ActiveRecord::Base
+ attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
+end
diff --git a/app/models/polls.rb b/app/models/polls.rb
new file mode 100644
index 000000000..f37c89fe2
--- /dev/null
+++ b/app/models/polls.rb
@@ -0,0 +1,3 @@
+class Polls < ActiveRecord::Base
+ attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
+end
diff --git a/db/migrate/20150108034148_create_polls.rb b/db/migrate/20150108034148_create_polls.rb
new file mode 100644
index 000000000..e074e08be
--- /dev/null
+++ b/db/migrate/20150108034148_create_polls.rb
@@ -0,0 +1,15 @@
+class CreatePolls < ActiveRecord::Migration
+ def change
+ create_table :polls do |t|
+ t.string :polls_name
+ t.string :polls_type
+ t.integer :polls_group_id
+ t.integer :polls_status
+ t.integer :user_id
+ t.datetime :published_at
+ t.datetime :closed_at
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20150108034253_create_poll_questions.rb b/db/migrate/20150108034253_create_poll_questions.rb
new file mode 100644
index 000000000..8e795deda
--- /dev/null
+++ b/db/migrate/20150108034253_create_poll_questions.rb
@@ -0,0 +1,12 @@
+class CreatePollQuestions < ActiveRecord::Migration
+ def change
+ create_table :poll_questions do |t|
+ t.string :question_title
+ t.integer :question_type
+ t.integer :is_necessary
+ t.integer :polls_id
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20150108034414_create_poll_answers.rb b/db/migrate/20150108034414_create_poll_answers.rb
new file mode 100644
index 000000000..bc9ac6d9f
--- /dev/null
+++ b/db/migrate/20150108034414_create_poll_answers.rb
@@ -0,0 +1,11 @@
+class CreatePollAnswers < ActiveRecord::Migration
+ def change
+ create_table :poll_answers do |t|
+ t.integer :poll_questions_id
+ t.text :answer_text
+ t.integer :answer_position
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20150108035301_create_poll_votes.rb b/db/migrate/20150108035301_create_poll_votes.rb
new file mode 100644
index 000000000..e22228dc2
--- /dev/null
+++ b/db/migrate/20150108035301_create_poll_votes.rb
@@ -0,0 +1,12 @@
+class CreatePollVotes < ActiveRecord::Migration
+ def change
+ create_table :poll_votes do |t|
+ t.integer :user_id
+ t.integer :poll_questions_id
+ t.integer :poll_answers_id
+ t.text :vote_text
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20150108035338_create_poll_users.rb b/db/migrate/20150108035338_create_poll_users.rb
new file mode 100644
index 000000000..158937ce0
--- /dev/null
+++ b/db/migrate/20150108035338_create_poll_users.rb
@@ -0,0 +1,10 @@
+class CreatePollUsers < ActiveRecord::Migration
+ def change
+ create_table :poll_users do |t|
+ t.integer :user_id
+ t.integer :poll_id
+
+ t.timestamps
+ end
+ end
+end
diff --git a/test/unit/poll_answers_test.rb b/test/unit/poll_answers_test.rb
new file mode 100644
index 000000000..ce8f558f4
--- /dev/null
+++ b/test/unit/poll_answers_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PollAnswersTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/poll_questions_test.rb b/test/unit/poll_questions_test.rb
new file mode 100644
index 000000000..bbe79ea40
--- /dev/null
+++ b/test/unit/poll_questions_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PollQuestionsTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/poll_user_test.rb b/test/unit/poll_user_test.rb
new file mode 100644
index 000000000..7dab4b63f
--- /dev/null
+++ b/test/unit/poll_user_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PollUserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/poll_votes_test.rb b/test/unit/poll_votes_test.rb
new file mode 100644
index 000000000..77ab9121e
--- /dev/null
+++ b/test/unit/poll_votes_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PollVotesTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/polls_test.rb b/test/unit/polls_test.rb
new file mode 100644
index 000000000..5217817bb
--- /dev/null
+++ b/test/unit/polls_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PollsTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
From 4c6ade4c08d222b9d3cf8c0d20e4cea805cc5683 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 8 Jan 2015 14:41:28 +0800
Subject: [PATCH 10/23] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=90=84model=E4=B9=8B?=
=?UTF-8?q?=E9=97=B4=E7=9A=84=E5=85=B3=E7=B3=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/poll_answers.rb | 2 ++
app/models/poll_questions.rb | 2 ++
app/models/poll_user.rb | 3 +++
app/models/poll_votes.rb | 4 +++
app/models/polls.rb | 2 ++
db/schema.rb | 47 +++++++++++++++++++++++++++++++++++-
6 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/app/models/poll_answers.rb b/app/models/poll_answers.rb
index b400ddf50..8a8c3169a 100644
--- a/app/models/poll_answers.rb
+++ b/app/models/poll_answers.rb
@@ -1,3 +1,5 @@
class PollAnswers < ActiveRecord::Base
attr_accessible :answer_position, :answer_text, :poll_questions_id
+
+ belongs_to :poll_questions
end
diff --git a/app/models/poll_questions.rb b/app/models/poll_questions.rb
index 42e376aee..ce272a218 100644
--- a/app/models/poll_questions.rb
+++ b/app/models/poll_questions.rb
@@ -1,3 +1,5 @@
class PollQuestions < ActiveRecord::Base
attr_accessible :is_necessary, :polls_id, :question_title, :question_type
+
+ belongs_to :polls
end
diff --git a/app/models/poll_user.rb b/app/models/poll_user.rb
index f77f2ed5c..a03f6b17d 100644
--- a/app/models/poll_user.rb
+++ b/app/models/poll_user.rb
@@ -1,3 +1,6 @@
class PollUser < ActiveRecord::Base
attr_accessible :poll_id, :user_id
+
+ belongs_to :polls
+ belongs_to :user
end
diff --git a/app/models/poll_votes.rb b/app/models/poll_votes.rb
index 961f0d896..fe52b4ac5 100644
--- a/app/models/poll_votes.rb
+++ b/app/models/poll_votes.rb
@@ -1,3 +1,7 @@
class PollVotes < ActiveRecord::Base
attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
+
+ belongs_to :poll_answers
+ belongs_to :poll_questions
+ belongs_to :user
end
diff --git a/app/models/polls.rb b/app/models/polls.rb
index f37c89fe2..02de95dce 100644
--- a/app/models/polls.rb
+++ b/app/models/polls.rb
@@ -1,3 +1,5 @@
class Polls < ActiveRecord::Base
attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
+
+ belongs_to :user
end
diff --git a/db/schema.rb b/db/schema.rb
index 04a2e54c8..e919d4118 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 => 20141231085350) do
+ActiveRecord::Schema.define(:version => 20150108035338) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -790,6 +790,51 @@ ActiveRecord::Schema.define(:version => 20141231085350) do
t.integer "project_id"
end
+ create_table "poll_answers", :force => true do |t|
+ t.integer "poll_questions_id"
+ t.text "answer_text"
+ t.integer "answer_position"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_questions", :force => true do |t|
+ t.string "question_title"
+ t.integer "question_type"
+ t.integer "is_necessary"
+ t.integer "polls_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_users", :force => true do |t|
+ t.integer "user_id"
+ t.integer "poll_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_votes", :force => true do |t|
+ t.integer "user_id"
+ t.integer "poll_questions_id"
+ t.integer "poll_answers_id"
+ t.text "vote_text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "polls", :force => true do |t|
+ t.string "polls_name"
+ t.string "polls_type"
+ t.integer "polls_group_id"
+ t.integer "polls_status"
+ t.integer "user_id"
+ t.datetime "published_at"
+ t.datetime "closed_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "praise_tread_caches", :force => true do |t|
t.integer "object_id", :null => false
t.string "object_type"
From 2262997c31ff34dc0d1543ba20ce0f86f1e7a9d8 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Thu, 8 Jan 2015 16:16:59 +0800
Subject: [PATCH 11/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E6=96=B0?=
=?UTF-8?q?=E5=BB=BA=E8=AF=BE=E7=A8=8B=E6=97=B6=EF=BC=9A=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E5=90=8D=E4=B8=AD=E6=9C=89=E7=A9=BA=E6=A0=BC=E6=88=96=E8=80=85?=
=?UTF-8?q?=E7=89=B9=E6=AE=8A=E7=AC=A6=E5=8F=B7=E4=BC=9A=E6=8F=90=E7=A4=BA?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=97=A0=E6=95=88,=E3=80=8B=20=20=20=20=20?=
=?UTF-8?q?=20=E3=80=8A=20=E7=BC=BA=E9=99=B7=20Trustie-Forge#1782=20(?=
=?UTF-8?q?=E5=B7=B2=E8=A7=A3=E5=86=B3):=20lable=E6=A0=87=E7=AD=BE?=
=?UTF-8?q?=E5=92=8C=E5=AF=B9=E5=BA=94=E7=9A=84=E6=98=BE=E7=A4=BA=E5=80=BC?=
=?UTF-8?q?=E4=B9=8B=E9=97=B4=E9=97=B4=E8=B7=9D=E8=BF=87=E5=A4=A7=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BE=8B=E5=A6=82=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=B7=A6=E4=BE=A7=E7=9A=84=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=EF=BC=8C=E5=85=B7=E4=BD=93=E5=A6=82=E5=9B=BE=E6=89=80=E7=A4=BA?=
=?UTF-8?q?=E3=80=8B=20=20=20=20=20=E3=80=8A=E6=9C=AC=E5=9C=B0=E7=89=88?=
=?UTF-8?q?=E4=B8=AD=E5=85=B3=E4=BA=8E=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E7=9A=84=E5=88=86=E7=BB=84=E5=87=BA=E7=8E=B0=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=EF=BC=9A=E5=BD=93=E5=89=8D=E5=B7=B2=E5=AD=98=E5=9C=A8?=
=?UTF-8?q?A=E7=BB=84=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=B7=BB=E5=8A=A0A?=
=?UTF-8?q?=E7=BB=84=E5=BA=94=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA=E2=80=9C?=
=?UTF-8?q?A=E7=BB=84=E5=B7=B2=E5=AD=98=E5=9C=A8=E2=80=9D=EF=BC=8C?=
=?UTF-8?q?=E8=AF=A5=E5=8A=9F=E8=83=BD=E7=9B=AE=E5=89=8D=E5=8F=AA=E6=9C=89?=
=?UTF-8?q?=E5=9C=A8=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8=E9=A6=96=E6=AC=A1?=
=?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=97=B6=E6=89=8D=E6=AD=A3=E5=B8=B8=E3=80=8B?=
=?UTF-8?q?=20=20=20=20=E3=80=8A=E6=89=98=E7=AE=A1=EF=BC=8C=E8=AF=BE?=
=?UTF-8?q?=E7=A8=8B=EF=BC=8C=E7=AB=9E=E8=B5=9B=E4=B8=BB=E9=A1=B5=E4=B8=AD?=
=?UTF-8?q?=E4=BB=BB=E6=84=8F=E7=82=B9=E5=87=BB=E6=9F=90=E4=B8=80=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=EF=BC=8C=E8=BF=9B=E5=85=A5=E8=AF=A5=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E4=B8=BB=E9=A1=B5=EF=BC=8C=E5=8F=B3=E4=B8=8A=E8=A7=92=E7=9A=84?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8C=89=E9=92=AE=E9=A3=8E=E6=A0=BC=E5=92=8C?=
=?UTF-8?q?=E5=A4=A7=E5=B0=8F=E4=B8=8D=E7=BB=9F=E4=B8=80=E3=80=82=E3=80=8B?=
=?UTF-8?q?=20=20=20=20=E3=80=8A=E8=BF=9B=E5=85=A5=E6=9F=90=E7=AB=9E?=
=?UTF-8?q?=E8=B5=9B=E4=B8=BB=E9=A1=B5=EF=BC=8C=E7=82=B9=E5=87=BB=E5=88=9B?=
=?UTF-8?q?=E6=96=B0=E7=AB=9E=E8=B5=9B=E9=93=BE=E6=8E=A5=E6=B2=A1=E5=8F=8D?=
=?UTF-8?q?=E5=BA=94=E3=80=8Bbug=20Signed-off-by:=20alan=20<547533434@qq.c?=
=?UTF-8?q?om>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 3 +-
app/helpers/courses_helper.rb | 2 +-
app/models/course.rb | 2 +-
app/views/courses/member.html.erb | 31 +++++++++----------
app/views/layouts/base_contest.html.erb | 7 +++--
app/views/layouts/base_courses.html.erb | 10 ++++--
app/views/layouts/base_newcontest.html.erb | 10 +++---
app/views/layouts/base_projects.html.erb | 4 +--
app/views/layouts/base_users.html.erb | 36 +++++++++++-----------
public/stylesheets/application.css | 2 +-
10 files changed, 57 insertions(+), 50 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 87ab7e683..e76fa31dc 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -500,7 +500,8 @@ class CoursesController < ApplicationController
end
end
- def course
+ def
+ course
@school_id = params[:school_id]
per_page_option = 10
if @school_id == "0" or @school_id.nil?
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 096ce7ad8..8547ef18f 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -114,7 +114,7 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
- searchStudent(course).count.to_s#course.student.count
+ course.student.count.to_s#course.student.count
end
#课程成员数计算
diff --git a/app/models/course.rb b/app/models/course.rb
index 196e7168d..c11f66d49 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -38,7 +38,7 @@ class Course < ActiveRecord::Base
validates_presence_of :password, :term,:name
validates_format_of :class_period, :with =>/^[1-9]\d*$/
- validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
+ validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_length_of :description, :maximum => 10000
before_save :self_validate
after_create :create_board_sync
diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb
index d199097be..81c469fd8 100644
--- a/app/views/courses/member.html.erb
+++ b/app/views/courses/member.html.erb
@@ -1,21 +1,19 @@
-
+
<%= form_tag({controller: 'contests', action: 'index'}, method: :get, :id => "contst_search_form") do %>
- <%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px" %>
+ <%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px", :style=>"float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
-
- <%= l(:label_search)%>
-
+
+ <%= l(:label_search)%>
+
<% end %>
diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb
index 835564a7b..3937c1822 100644
--- a/app/views/layouts/base_projects.html.erb
+++ b/app/views/layouts/base_projects.html.erb
@@ -64,10 +64,10 @@
}
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
- <%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();" %>
+ <%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
-
+
<%= l(:label_search)%>
diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb
index 5276bcd01..8b4e57024 100644
--- a/app/views/layouts/base_users.html.erb
+++ b/app/views/layouts/base_users.html.erb
@@ -221,16 +221,16 @@
-
- <%= l(:label_user_joinin) %>:
+ |
+ <%= l(:label_user_joinin) %>:
|
-
- <%= l(:label_user_login) %>:
+ |
+ <%= l(:label_user_login) %>:
|
-
- <%= l(:field_occupation) %>:
+ |
+ <%= l(:field_occupation) %>:
|
<% elsif @user.user_extensions.identity == 3 %>
-
- <%= l(:field_occupation) %>:
+ |
+ <%= l(:field_occupation) %>:
|
<% elsif @user.user_extensions.identity == 2 %>
-
- <%= l(:label_company_name) %>:
+ |
+ <%= l(:label_company_name) %>:
|
<% end %>
-
- <%= l(:label_location) %>:
+ |
+ <%= l(:label_location) %>:
|
<% if @user.user_extensions.identity == 0 %>
-
- <%= l(:label_technical_title) %>:
+ |
+ <%= l(:label_technical_title) %>:
|
-
- <%= l(:label_bidding_user_studentcode)%>:
+ |
+ <%= l(:label_bidding_user_studentcode)%>:
|
<% else %>
-
+ |
<%= l(:label_identity)%>:
|
-
+ |
<%= l(:label_identity)%>:
|
<% if User.current.member_of_course?(@course) %>
- <%= link_to "#{teacherCount(@course)}", course_member_path(@course, :role => 1), :course => '1' %>
+ <%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %>
<% else %>
- <%= teacherCount(@course)%>
+ <%= teacher_num %>
<% end%>
|
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %>
- <%= link_to "#{studentCount(@course)}", course_member_path(@course, :role => 2), :course => '1' %>
+ <%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %>
<% else %>
- <%= studentCount(@course)%>
+ <%= student_num %>
<% end %>
|
@@ -145,10 +147,10 @@
- <%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %>
+ <%= l(:label_x_base_courses_teacher, :count => teacher_num) %>
|
- <%= l(:label_x_base_courses_student, :count => studentCount(@course)) %>
+ <%= l(:label_x_base_courses_student, :count => student_num) %>
|
<%= l(:label_x_course_data, :count => files_count) %>
diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb
index 816f9ce58..6c3721fcf 100644
--- a/app/views/layouts/base_newcontest.html.erb
+++ b/app/views/layouts/base_newcontest.html.erb
@@ -78,8 +78,8 @@
|
<%=link_to l(:field_homepage), home_path %> >
-
- <%=link_to l(:label_contest_innovate), home_path %>
+
+ <%=l(:label_courses_management_platform)%>
>
<%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %>
From aae69417cd2271598ffef45ccc9ed6b8f0982723 Mon Sep 17 00:00:00 2001
From: zhuhao
Date: Thu, 8 Jan 2015 17:05:08 +0800
Subject: [PATCH 13/23] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=8C=89=E9=92=AE?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/tags/_tag.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb
index c08a3b553..21aefa511 100644
--- a/app/views/tags/_tag.html.erb
+++ b/app/views/tags/_tag.html.erb
@@ -77,10 +77,10 @@
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
-
+
<%= l(:button_project_tags_add)%>
- <%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10'%>
+ <%= link_to_function l(:button_cancel), '$("#put-tag-form").slideUp();',:class=>'ButtonColor m3p10' ,:style=>"padding:3px 6px"%>
<% end %>
<% end %>
From ee9d82bfc7304f1b6d5b6263e8dbd0646804cad9 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 8 Jan 2015 17:42:46 +0800
Subject: [PATCH 14/23] =?UTF-8?q?1.=E5=AE=9E=E7=8E=B0=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E8=B0=83=E6=9F=A5=E7=9A=84model=E3=80=81control=E3=80=81view?=
=?UTF-8?q?=E7=9A=84=E6=9E=B6=E6=9E=84=202.=E4=BF=AE=E6=AD=A3=E5=AE=8C?=
=?UTF-8?q?=E5=96=84=E6=96=B0=E5=A2=9E=E8=A1=A8=E4=B9=8B=E9=97=B4=E7=9A=84?=
=?UTF-8?q?=E5=85=B3=E7=B3=BB=203.=E4=BF=AE=E6=AD=A3=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E4=B8=AD=E5=8D=95=E5=A4=8D=E6=95=B0=E4=B8=8D=E6=AD=A3=E7=A1=AE?=
=?UTF-8?q?=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/controllers/poll_answer_controller.rb | 2 ++
app/controllers/poll_answers_controller.rb | 0
app/controllers/poll_controller.rb | 2 ++
app/controllers/poll_question_controller.rb | 2 ++
app/controllers/poll_user_controller.rb | 2 ++
app/controllers/poll_vote_controller.rb | 2 ++
app/controllers/poll_votes_controller.rb | 0
app/controllers/polls_questions_controller.rb | 0
app/models/poll.rb | 9 +++++++++
app/models/poll_answer.rb | 7 +++++++
app/models/poll_answers.rb | 5 -----
app/models/poll_question.rb | 8 ++++++++
app/models/poll_questions.rb | 5 -----
app/models/poll_user.rb | 5 +++--
app/models/poll_vote.rb | 8 ++++++++
app/models/poll_votes.rb | 7 -------
app/models/polls.rb | 5 -----
app/models/user.rb | 7 +++++++
db/migrate/20150108034148_create_polls.rb | 6 +++++-
.../20150108034253_create_poll_questions.rb | 8 ++++++--
db/migrate/20150108034414_create_poll_answers.rb | 8 ++++++--
db/migrate/20150108035301_create_poll_votes.rb | 10 +++++++---
db/migrate/20150108035338_create_poll_users.rb | 6 +++++-
db/schema.rb | 16 ++++++++--------
24 files changed, 89 insertions(+), 41 deletions(-)
create mode 100644 app/controllers/poll_answer_controller.rb
delete mode 100644 app/controllers/poll_answers_controller.rb
create mode 100644 app/controllers/poll_question_controller.rb
create mode 100644 app/controllers/poll_vote_controller.rb
delete mode 100644 app/controllers/poll_votes_controller.rb
delete mode 100644 app/controllers/polls_questions_controller.rb
create mode 100644 app/models/poll.rb
create mode 100644 app/models/poll_answer.rb
delete mode 100644 app/models/poll_answers.rb
create mode 100644 app/models/poll_question.rb
delete mode 100644 app/models/poll_questions.rb
create mode 100644 app/models/poll_vote.rb
delete mode 100644 app/models/poll_votes.rb
delete mode 100644 app/models/polls.rb
diff --git a/app/controllers/poll_answer_controller.rb b/app/controllers/poll_answer_controller.rb
new file mode 100644
index 000000000..521f7ed3f
--- /dev/null
+++ b/app/controllers/poll_answer_controller.rb
@@ -0,0 +1,2 @@
+class PollAnswerController < ApplicationController
+end
\ No newline at end of file
diff --git a/app/controllers/poll_answers_controller.rb b/app/controllers/poll_answers_controller.rb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb
index e69de29bb..a21fdb549 100644
--- a/app/controllers/poll_controller.rb
+++ b/app/controllers/poll_controller.rb
@@ -0,0 +1,2 @@
+class PollController < ApplicationController
+end
\ No newline at end of file
diff --git a/app/controllers/poll_question_controller.rb b/app/controllers/poll_question_controller.rb
new file mode 100644
index 000000000..46a75c0ab
--- /dev/null
+++ b/app/controllers/poll_question_controller.rb
@@ -0,0 +1,2 @@
+class PollQuestionController < ApplicationController
+end
\ No newline at end of file
diff --git a/app/controllers/poll_user_controller.rb b/app/controllers/poll_user_controller.rb
index e69de29bb..0373fe085 100644
--- a/app/controllers/poll_user_controller.rb
+++ b/app/controllers/poll_user_controller.rb
@@ -0,0 +1,2 @@
+class PollUserController < ApplicationController
+end
\ No newline at end of file
diff --git a/app/controllers/poll_vote_controller.rb b/app/controllers/poll_vote_controller.rb
new file mode 100644
index 000000000..e77bdc622
--- /dev/null
+++ b/app/controllers/poll_vote_controller.rb
@@ -0,0 +1,2 @@
+class PollVoteController < ApplicationController
+end
\ No newline at end of file
diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/app/controllers/polls_questions_controller.rb b/app/controllers/polls_questions_controller.rb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/app/models/poll.rb b/app/models/poll.rb
new file mode 100644
index 000000000..803ee6ac6
--- /dev/null
+++ b/app/models/poll.rb
@@ -0,0 +1,9 @@
+class Poll < ActiveRecord::Base
+ #attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
+ include Redmine::SafeAttributes
+
+ belongs_to :user
+ has_many :poll_questions, :dependent => :destroy
+ has_many :poll_users, :dependent => :destroy
+ has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
+end
diff --git a/app/models/poll_answer.rb b/app/models/poll_answer.rb
new file mode 100644
index 000000000..93c75da97
--- /dev/null
+++ b/app/models/poll_answer.rb
@@ -0,0 +1,7 @@
+class PollAnswer < ActiveRecord::Base
+ # attr_accessible :answer_position, :answer_text, :poll_questions_id
+ include Redmine::SafeAttributes
+
+ belongs_to :poll_question
+ has_many :poll_votes, :dependent => :destroy
+end
diff --git a/app/models/poll_answers.rb b/app/models/poll_answers.rb
deleted file mode 100644
index 8a8c3169a..000000000
--- a/app/models/poll_answers.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class PollAnswers < ActiveRecord::Base
- attr_accessible :answer_position, :answer_text, :poll_questions_id
-
- belongs_to :poll_questions
-end
diff --git a/app/models/poll_question.rb b/app/models/poll_question.rb
new file mode 100644
index 000000000..66dcea67e
--- /dev/null
+++ b/app/models/poll_question.rb
@@ -0,0 +1,8 @@
+class PollQuestion < ActiveRecord::Base
+ # attr_accessible :is_necessary, :polls_id, :question_title, :question_type
+ include Redmine::SafeAttributes
+
+ belongs_to :poll
+ has_many :poll_answers, :dependent => :destroy
+ has_many :poll_votes, :dependent => :destroy
+end
diff --git a/app/models/poll_questions.rb b/app/models/poll_questions.rb
deleted file mode 100644
index ce272a218..000000000
--- a/app/models/poll_questions.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class PollQuestions < ActiveRecord::Base
- attr_accessible :is_necessary, :polls_id, :question_title, :question_type
-
- belongs_to :polls
-end
diff --git a/app/models/poll_user.rb b/app/models/poll_user.rb
index a03f6b17d..e7a122da9 100644
--- a/app/models/poll_user.rb
+++ b/app/models/poll_user.rb
@@ -1,6 +1,7 @@
class PollUser < ActiveRecord::Base
- attr_accessible :poll_id, :user_id
+ # attr_accessible :poll_id, :user_id
+ include Redmine::SafeAttributes
- belongs_to :polls
+ belongs_to :poll
belongs_to :user
end
diff --git a/app/models/poll_vote.rb b/app/models/poll_vote.rb
new file mode 100644
index 000000000..550563e38
--- /dev/null
+++ b/app/models/poll_vote.rb
@@ -0,0 +1,8 @@
+class PollVote < ActiveRecord::Base
+ # attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
+ include Redmine::SafeAttributes
+
+ belongs_to :poll_answer
+ belongs_to :poll_question
+ belongs_to :user
+end
diff --git a/app/models/poll_votes.rb b/app/models/poll_votes.rb
deleted file mode 100644
index fe52b4ac5..000000000
--- a/app/models/poll_votes.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class PollVotes < ActiveRecord::Base
- attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
-
- belongs_to :poll_answers
- belongs_to :poll_questions
- belongs_to :user
-end
diff --git a/app/models/polls.rb b/app/models/polls.rb
deleted file mode 100644
index 02de95dce..000000000
--- a/app/models/polls.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class Polls < ActiveRecord::Base
- attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
-
- belongs_to :user
-end
diff --git a/app/models/user.rb b/app/models/user.rb
index e966742f1..735b80762 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -77,6 +77,13 @@ class User < Principal
has_many :homework_attaches, :through => :homework_users
has_many :homework_evaluations
+ #问卷相关关关系
+ has_many :poll_users, :dependent => :destroy
+ has_many :poll_votes, :dependent => :destroy
+ has_many :poll, :dependent => :destroy #用户创建的问卷
+ has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷
+ # end
+
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
:after_remove => Proc.new {|user, group| group.user_removed(user)}
has_many :changesets, :dependent => :nullify
diff --git a/db/migrate/20150108034148_create_polls.rb b/db/migrate/20150108034148_create_polls.rb
index e074e08be..454f73b21 100644
--- a/db/migrate/20150108034148_create_polls.rb
+++ b/db/migrate/20150108034148_create_polls.rb
@@ -1,5 +1,5 @@
class CreatePolls < ActiveRecord::Migration
- def change
+ def up
create_table :polls do |t|
t.string :polls_name
t.string :polls_type
@@ -12,4 +12,8 @@ class CreatePolls < ActiveRecord::Migration
t.timestamps
end
end
+
+ def down
+ drop_table :polls
+ end
end
diff --git a/db/migrate/20150108034253_create_poll_questions.rb b/db/migrate/20150108034253_create_poll_questions.rb
index 8e795deda..2fa586dd5 100644
--- a/db/migrate/20150108034253_create_poll_questions.rb
+++ b/db/migrate/20150108034253_create_poll_questions.rb
@@ -1,12 +1,16 @@
class CreatePollQuestions < ActiveRecord::Migration
- def change
+ def up
create_table :poll_questions do |t|
t.string :question_title
t.integer :question_type
t.integer :is_necessary
- t.integer :polls_id
+ t.integer :poll_id
t.timestamps
end
end
+
+ def down
+ drop_table :poll_questions
+ end
end
diff --git a/db/migrate/20150108034414_create_poll_answers.rb b/db/migrate/20150108034414_create_poll_answers.rb
index bc9ac6d9f..b6276fad0 100644
--- a/db/migrate/20150108034414_create_poll_answers.rb
+++ b/db/migrate/20150108034414_create_poll_answers.rb
@@ -1,11 +1,15 @@
class CreatePollAnswers < ActiveRecord::Migration
- def change
+ def up
create_table :poll_answers do |t|
- t.integer :poll_questions_id
+ t.integer :poll_question_id
t.text :answer_text
t.integer :answer_position
t.timestamps
end
end
+
+ def down
+ drop_table :poll_answers
+ end
end
diff --git a/db/migrate/20150108035301_create_poll_votes.rb b/db/migrate/20150108035301_create_poll_votes.rb
index e22228dc2..0b7192ab8 100644
--- a/db/migrate/20150108035301_create_poll_votes.rb
+++ b/db/migrate/20150108035301_create_poll_votes.rb
@@ -1,12 +1,16 @@
class CreatePollVotes < ActiveRecord::Migration
- def change
+ def up
create_table :poll_votes do |t|
t.integer :user_id
- t.integer :poll_questions_id
- t.integer :poll_answers_id
+ t.integer :poll_question_id
+ t.integer :poll_answer_id
t.text :vote_text
t.timestamps
end
end
+
+ def down
+ drop_table :poll_votes
+ end
end
diff --git a/db/migrate/20150108035338_create_poll_users.rb b/db/migrate/20150108035338_create_poll_users.rb
index 158937ce0..73d155890 100644
--- a/db/migrate/20150108035338_create_poll_users.rb
+++ b/db/migrate/20150108035338_create_poll_users.rb
@@ -1,5 +1,5 @@
class CreatePollUsers < ActiveRecord::Migration
- def change
+ def up
create_table :poll_users do |t|
t.integer :user_id
t.integer :poll_id
@@ -7,4 +7,8 @@ class CreatePollUsers < ActiveRecord::Migration
t.timestamps
end
end
+
+ def down
+ drop_table :poll_users
+ end
end
diff --git a/db/schema.rb b/db/schema.rb
index e919d4118..00d308293 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -791,18 +791,18 @@ ActiveRecord::Schema.define(:version => 20150108035338) do
end
create_table "poll_answers", :force => true do |t|
- t.integer "poll_questions_id"
+ t.integer "poll_question_id"
t.text "answer_text"
t.integer "answer_position"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "poll_questions", :force => true do |t|
t.string "question_title"
t.integer "question_type"
t.integer "is_necessary"
- t.integer "polls_id"
+ t.integer "poll_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
@@ -816,11 +816,11 @@ ActiveRecord::Schema.define(:version => 20150108035338) do
create_table "poll_votes", :force => true do |t|
t.integer "user_id"
- t.integer "poll_questions_id"
- t.integer "poll_answers_id"
+ t.integer "poll_question_id"
+ t.integer "poll_answer_id"
t.text "vote_text"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "polls", :force => true do |t|
From 2dc626b595e866bbd4750aa14b1a752a1d868c4e Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 9 Jan 2015 10:22:30 +0800
Subject: [PATCH 15/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E5=AD=A6?=
=?UTF-8?q?=E7=94=9F=E5=88=97=E8=A1=A8=E4=B8=AD=E9=87=8D=E5=90=8D=E7=9A=84?=
=?UTF-8?q?=E7=8F=AD=E5=90=8D=E6=8F=90=E7=A4=BA=E6=8A=A5=E9=94=99=E3=80=8B?=
=?UTF-8?q?=20Signed-off-by:=20alan=20<547533434@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/member.html.erb | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb
index 81c469fd8..2599760ad 100644
--- a/app/views/courses/member.html.erb
+++ b/app/views/courses/member.html.erb
@@ -2,15 +2,17 @@
function check_groupname() {
var $group_name = $('#group_name');
- $.get(
+
+ $.get(
'<%=valid_ajax_course_path%>',
{ valid: "name",
- value: this.value },
+ value: document.getElementById('group_name').value },
function (data) {
if (!data.valid) {
- alert('<%= l(:label_groupname_repeat) %>');
+ alert(data.message);
}
});
+
}
@@ -46,10 +48,9 @@
}
function validate_add_group() {
- value1 = document.getElementById('group_name').value;
+
check_groupname();
- validate_groupname(value1);
- validate_groupname_null(value1);
+
}
From 4b9bad0dc5a9c818c6ad2aac88eff98e51ff397c Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 9 Jan 2015 10:57:33 +0800
Subject: [PATCH 16/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E8=8B=A5?=
=?UTF-8?q?=E6=9C=89=E6=9F=90=E5=85=AC=E5=BC=80=E8=AF=BE=E7=A8=8BcourseA?=
=?UTF-8?q?=EF=BC=8C=E5=9C=A8=E8=AF=BE=E7=A8=8B=E4=B8=BB=E9=A1=B5=E4=B8=AD?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2courseA=E8=B7=B3=E8=BD=AC=E5=88=B0=E6=90=9C?=
=?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E7=95=8C=E9=9D=A2=EF=BC=8C=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E9=93=BE=E6=8E=A5=E6=B2=A1=E6=9C=89=E5=AF=B9=E9=BD=90?=
=?UTF-8?q?=E3=80=8Bbug=20Signed-off-by:=20alan=20<547533434@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/contests/index.html.erb | 2 +-
app/views/courses/search.html.erb | 2 +-
app/views/projects/search.html.erb | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb
index 75b892461..170f11037 100644
--- a/app/views/contests/index.html.erb
+++ b/app/views/contests/index.html.erb
@@ -10,7 +10,7 @@
<%= l(:label_user_location) %> :
|
-
+ |
<% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %>
diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb
index e2c701932..661feb3c9 100644
--- a/app/views/courses/search.html.erb
+++ b/app/views/courses/search.html.erb
@@ -13,7 +13,7 @@
|
<%= l(:label_user_location) %> :
|
-
+ |
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add') if User.current.allowed_to?(:add_course, nil, :global => true) %> |
diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb
index 8e810b087..7a91082ca 100644
--- a/app/views/projects/search.html.erb
+++ b/app/views/projects/search.html.erb
@@ -10,7 +10,7 @@
<%= l(:label_course_practice) %> |
<%= l(:label_user_location) %> : |
-
+ |
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> |
@@ -35,7 +35,7 @@
<%= l(:label_project_deposit) %> |
<%= l(:label_user_location) %> : |
-
+ |
<% if User.current.logged? %>
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<% end %>
From 53b57d4c53b9f341ad979bb5d9125da59b87f719 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 9 Jan 2015 12:29:49 +0800
Subject: [PATCH 17/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E4=B8=AA?=
=?UTF-8?q?=E4=BA=BA=E4=B8=BB=E9=A1=B5=E7=A7=AF=E5=88=86=E5=BC=B9=E6=A1=86?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E3=80=8Bbug=20Signed-off-b?=
=?UTF-8?q?y:=20alan=20<547533434@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 2 +-
app/views/layouts/users_base.html.erb | 10 +++++-----
public/stylesheets/css.css | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index fa0beb311..ab796c4e3 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -129,7 +129,7 @@ class UsersController < ApplicationController
end
def show_new_score
- render :layout => false
+ render :layout => 'users_base'
end
# end
diff --git a/app/views/layouts/users_base.html.erb b/app/views/layouts/users_base.html.erb
index d98ef3f46..b34609471 100644
--- a/app/views/layouts/users_base.html.erb
+++ b/app/views/layouts/users_base.html.erb
@@ -1,7 +1,7 @@
<% @nav_dispaly_home_path_label = 1
- @nav_dispaly_main_course_label = 1
- @nav_dispaly_main_project_label = 1
- @nav_dispaly_main_contest_label = 1 %>
+ @nav_dispaly_user_label = 1
+ @nav_dispaly_store_all_label = 1
+ %>
<% @nav_dispaly_forum_label = 1%>
@@ -39,12 +39,12 @@
- <%= l(:label_loading) %>
+ <%= l(:label_loading) %>
-
+<%= call_hook :view_layouts_base_body_bottom %>
diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css
index b6d61c865..444d0d383 100644
--- a/public/stylesheets/css.css
+++ b/public/stylesheets/css.css
@@ -149,7 +149,7 @@ a:hover.tijiao{ background:#0f99a9 !important;}
.ni_con p{ color:#808181;}
.ni_con a:hover{ text-decoration:none;}
-.ui-widget-header{display: none;}
+
From b88255acfc777a558b0056d3529cc1c4b05e706d Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 9 Jan 2015 12:34:52 +0800
Subject: [PATCH 18/23] delete no use file
---
0) | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 0)
diff --git a/0) b/0)
deleted file mode 100644
index 70d77d63e..000000000
--- a/0)
+++ /dev/null
@@ -1 +0,0 @@
-ֹ(Y/N)? ֹ(Y/N)? ֹ(Y/N)? ֹ(Y/N)?
\ No newline at end of file
From 3f354a019f1923358af37208d655416a8667c2c4 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 9 Jan 2015 14:14:15 +0800
Subject: [PATCH 19/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=88=E4=B8=AA?=
=?UTF-8?q?=E4=BA=BA=E4=B8=BB=E9=A1=B5=E4=B8=AA=E4=BA=BA=E7=AD=BE=E5=90=8D?=
=?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=B9=B1=E4=BA=86=EF=BC=89=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/views/layouts/base_users.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb
index 8b4e57024..f241875bd 100644
--- a/app/views/layouts/base_users.html.erb
+++ b/app/views/layouts/base_users.html.erb
@@ -205,7 +205,7 @@
|
<%#= submit_tag l(:button_submit), :name => nil ,
:class => "bid_btn" %>
-
+
<%= l(:label_submit)%>
|
From 82c2a659df3889fae196a2e96d5153932fb35f7f Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 9 Jan 2015 15:33:30 +0800
Subject: [PATCH 20/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E6=89=93=E5=8C=85=E4=B8=8B=E8=BD=BD=E6=97=B6=EF=BC=8C?=
=?UTF-8?q?=E6=9F=90=E4=B8=80=E6=96=87=E4=BB=B6=E4=B8=8D=E5=AD=98=E5=9C=A8?=
=?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=B7=B3=E8=BF=87=E8=AF=A5=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=B8=8B=E8=BD=BD=E5=85=B6=E4=BB=96=E7=9A=84?=
=?UTF-8?q?=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/zipdown_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb
index 3612bf7a4..982e43b7b 100644
--- a/app/controllers/zipdown_controller.rb
+++ b/app/controllers/zipdown_controller.rb
@@ -78,7 +78,7 @@ class ZipdownController < ApplicationController
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
homeattach.attachments.each do |attach|
- homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
+ homeworks_attach_path << attach.diskfile if File.exist?(attach.diskfile)
end
zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
end
From 9ef3849fe327d189858a15691fb9ad7fba4ad784 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 9 Jan 2015 15:59:42 +0800
Subject: [PATCH 21/23] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=BC=BA=E5=B0=91?=
=?UTF-8?q?=E6=9F=90=E4=B8=80=E9=99=84=E4=BB=B6=E3=80=82=E5=9C=A8=E4=B8=8B?=
=?UTF-8?q?=E8=BD=BD=E5=90=8E=E7=9A=84=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/zipdown_controller.rb | 21 ++++++++++++++-------
config/locales/zh.yml | 1 +
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb
index 982e43b7b..12637e2fb 100644
--- a/app/controllers/zipdown_controller.rb
+++ b/app/controllers/zipdown_controller.rb
@@ -75,16 +75,21 @@ class ZipdownController < ApplicationController
def zip_homework_by_user(homeattach)
homeworks_attach_path = []
+ not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
homeattach.attachments.each do |attach|
- homeworks_attach_path << attach.diskfile if File.exist?(attach.diskfile)
+ if File.exist?(attach.diskfile)
+ homeworks_attach_path << attach.diskfile
+ else
+ not_exist_file << attach.filename
+ end
end
- zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
+ zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
end
- def zipping(zip_name_refer, files_paths, output_path, is_attachment=false)
+ def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
# 输入待打包的文件列表,已经打包文件定位到ouput_path
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
input_filename = files_paths
@@ -101,9 +106,11 @@ class ZipdownController < ApplicationController
zipfile.add(rename_file, filename)
end
- #zipfile.get_output_stream('ReadMe') do |os|
- # os.write 'Homeworks'
- #end
+ unless not_exist_file.empty?
+ zipfile.get_output_stream('FILE_LOST.txt') do |os|
+ os.write l(:label_file_lost) + not_exist_file.join(',').to_s
+ end
+ end
end
zipfile_name
rescue Errno => e
@@ -119,4 +126,4 @@ class ZipdownController < ApplicationController
attach = Attachment.find_by_disk_filename(name)
attach.filename
end
-end
+end
\ No newline at end of file
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 62f0e0bc4..327cceda4 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2239,4 +2239,5 @@ zh:
label_course_prompt: 课程:
label_contain_resource: 已包含资源:
label_quote_resource_failed: ",此资源引用失败! "
+ label_file_lost: 以下文件在服务器丢失:
From a30cc9bea8b4a30347458c28b58ba30e5f94f9b9 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 9 Jan 2015 16:01:47 +0800
Subject: [PATCH 22/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E7=BC=BA=E5=B0=91=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/locales/zh.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 327cceda4..082cefe3f 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2239,5 +2239,5 @@ zh:
label_course_prompt: 课程:
label_contain_resource: 已包含资源:
label_quote_resource_failed: ",此资源引用失败! "
- label_file_lost: 以下文件在服务器丢失:
+ label_file_lost: 以下文件在服务器丢失,请联系相关人员重新上传:
From c9e23ec52fefa3e5e94c3a83e3f8e1259470aa09 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 9 Jan 2015 17:03:58 +0800
Subject: [PATCH 23/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E5=88=9B?=
=?UTF-8?q?=E5=BB=BA=E4=BD=9C=E4=B8=9A=E9=A1=B5=E9=9D=A2=E3=80=8Bbug=20Sig?=
=?UTF-8?q?ned-off-by:=20alan=20<547533434@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/homework_attach/new.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb
index 2ddd59266..661e15d5b 100644
--- a/app/views/homework_attach/new.html.erb
+++ b/app/views/homework_attach/new.html.erb
@@ -78,8 +78,8 @@
作品描述 :
- <%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%>
-
+ <%= f.text_area "description", :class => "w620", :style=>"width:432px;", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%>
+
| |