<% end %>
+
+
<% end %>
@@ -56,4 +60,4 @@
-
\ No newline at end of file
+
diff --git a/app/views/excel/parse.html.erb b/app/views/excel/parse.html.erb
new file mode 100644
index 0000000..8d5a688
--- /dev/null
+++ b/app/views/excel/parse.html.erb
@@ -0,0 +1,2 @@
+
+
<% if teacher_logged_in? %>
<%= form_for grade, url: grade_url(id: grade.id, course_id: grade.course.id), method: :patch do |f| %>
<%= f.text_field :grade %>
diff --git a/app/views/shared/_sidenav.html.erb b/app/views/shared/_sidenav.html.erb
index 87a1046..910f8db 100644
--- a/app/views/shared/_sidenav.html.erb
+++ b/app/views/shared/_sidenav.html.erb
@@ -59,6 +59,7 @@
<% if teacher_logged_in? %>
成绩管理
+
<% end %>
<% if student_logged_in? %>
@@ -72,6 +73,12 @@
<% if teacher_logged_in? %>
+
+ <%= link_to excel_courses_path do %>
+ excel
+ <% end %>
+
+
<% current_user.teaching_courses.each do |course| %>
<%= link_to grades_path(course_id: course.id), :method => :get do %>
diff --git a/config/routes.rb b/config/routes.rb
index e744eed..ecfe517 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,6 @@
Rails.application.routes.draw do
+ get 'excel/parse'
+
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
@@ -24,9 +26,12 @@ Rails.application.routes.draw do
get :detail
get :open
get :close
+ patch :excel_in
+ patch :excel_out
end
collection do
get :list
+ get :excel
end
end
diff --git a/db/migrate/20161228082748_add_excel_to_course.rb b/db/migrate/20161228082748_add_excel_to_course.rb
new file mode 100644
index 0000000..45fd8b8
--- /dev/null
+++ b/db/migrate/20161228082748_add_excel_to_course.rb
@@ -0,0 +1,5 @@
+class AddExcelToCourse < ActiveRecord::Migration
+ def change
+ add_column :courses, :excel, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 26d5883..11c70c4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20161108164630) do
+ActiveRecord::Schema.define(version: 20161228082748) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -29,10 +29,12 @@ ActiveRecord::Schema.define(version: 20161108164630) do
t.string "course_time"
t.string "course_week"
t.integer "teacher_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 "course_introduction"
t.string "avatar"
+ t.boolean "open", default: false
+ t.string "excel"
end
create_table "grades", force: :cascade do |t|
@@ -46,12 +48,6 @@ ActiveRecord::Schema.define(version: 20161108164630) do
add_index "grades", ["course_id"], name: "index_grades_on_course_id", using: :btree
add_index "grades", ["user_id"], name: "index_grades_on_user_id", using: :btree
- create_table "images", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "image"
- end
-
create_table "users", force: :cascade do |t|
t.string "name"
t.string "email"
diff --git a/public/uploads/course/excel/1/___.xlsx b/public/uploads/course/excel/1/___.xlsx
new file mode 100644
index 0000000..32e5f09
Binary files /dev/null and b/public/uploads/course/excel/1/___.xlsx differ
diff --git a/public/uploads/course/excel/3/___.xlsx b/public/uploads/course/excel/3/___.xlsx
new file mode 100644
index 0000000..32e5f09
Binary files /dev/null and b/public/uploads/course/excel/3/___.xlsx differ
diff --git a/public/uploads/tmp/1482915177-15750-0002-3592/2016-11-28_16-09-39____.png b/public/uploads/tmp/1482915177-15750-0002-3592/2016-11-28_16-09-39____.png
new file mode 100644
index 0000000..fc3552b
Binary files /dev/null and b/public/uploads/tmp/1482915177-15750-0002-3592/2016-11-28_16-09-39____.png differ
diff --git a/public/uploads/tmp/1482915623-15750-0003-8279/build.txt b/public/uploads/tmp/1482915623-15750-0003-8279/build.txt
new file mode 100644
index 0000000..33cb22d
--- /dev/null
+++ b/public/uploads/tmp/1482915623-15750-0003-8279/build.txt
@@ -0,0 +1 @@
+RM-162.2380.8
\ No newline at end of file
diff --git a/public/uploads/tmp/1482915720-16509-0002-9588/2016-11-28_16-12-02____.png b/public/uploads/tmp/1482915720-16509-0002-9588/2016-11-28_16-12-02____.png
new file mode 100644
index 0000000..86af168
Binary files /dev/null and b/public/uploads/tmp/1482915720-16509-0002-9588/2016-11-28_16-12-02____.png differ
diff --git a/public/uploads/tmp/1482915720-16509-0002-9588/thumb_2016-11-28_16-12-02____.png b/public/uploads/tmp/1482915720-16509-0002-9588/thumb_2016-11-28_16-12-02____.png
new file mode 100644
index 0000000..0287265
Binary files /dev/null and b/public/uploads/tmp/1482915720-16509-0002-9588/thumb_2016-11-28_16-12-02____.png differ
diff --git a/public/uploads/tmp/1482917457-4739-0001-1935/___.xlsx b/public/uploads/tmp/1482917457-4739-0001-1935/___.xlsx
new file mode 100644
index 0000000..32e5f09
Binary files /dev/null and b/public/uploads/tmp/1482917457-4739-0001-1935/___.xlsx differ
diff --git a/public/uploads/tmp/1482917587-4739-0003-2543/___.xlsx b/public/uploads/tmp/1482917587-4739-0003-2543/___.xlsx
new file mode 100644
index 0000000..32e5f09
Binary files /dev/null and b/public/uploads/tmp/1482917587-4739-0003-2543/___.xlsx differ
diff --git a/test/controllers/excel_controller_test.rb b/test/controllers/excel_controller_test.rb
new file mode 100644
index 0000000..dce5566
--- /dev/null
+++ b/test/controllers/excel_controller_test.rb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class ExcelControllerTest < ActionController::TestCase
+ test "should get parse" do
+ get :parse
+ assert_response :success
+ end
+
+end