Description:
announcement on top menu bar
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r804:b80b4e632bb0 - - 9 files changed: 169 inserted, 105 deleted
@@ -0,0 +1,25 | |||||
|
|
1 | + = simple_form_for(@announcement) do |f| | ||
|
|
2 | + - if @announcement.errors.any? | ||
|
|
3 | + .form-row | ||
|
|
4 | + .col-sm-12 | ||
|
|
5 | + #error_explanation.alert.alert-dismissable.alert-danger | ||
|
|
6 | + %button.close{type: "button", data: { dismiss: "alert"}, aria: {hidden: "true"}} × | ||
|
|
7 | + %h3= "เกิดปัญหาในการบันทึกข้อมูลเนื่องจาก" | ||
|
|
8 | + %ul | ||
|
|
9 | + - @announcement.errors.full_messages.each do |message| | ||
|
|
10 | + %li= message | ||
|
|
11 | + .form-row | ||
|
|
12 | + .col-md-6.col-12 | ||
|
|
13 | + -# = f.input :lock_version, as: :hidden | ||
|
|
14 | + = f.input :title | ||
|
|
15 | + = f.input :notes, label: 'Notes (shown internally, used to organize announcements)' | ||
|
|
16 | + = f.input :body | ||
|
|
17 | + = f.input :author | ||
|
|
18 | + = f.input :published | ||
|
|
19 | + = f.input :frontpage, label: 'Display in the front page only?' | ||
|
|
20 | + = f.input :on_nav_bar, label: 'Show on menu bar?', wrapper: :custom_boolean | ||
|
|
21 | + = f.input :contest_only, label: 'Display in contest only?' | ||
|
|
22 | + = f.submit "Create", class: 'btn btn-primary' | ||
|
|
23 | + -if content_for?(:form_buttons) | ||
|
|
24 | + = yield(:form_buttons) | ||
|
|
25 | + / = link_to 'Back', announcements_path, class: 'btn btn-default' |
@@ -0,0 +1,5 | |||||
|
|
1 | + class AddOnNavBarToAnnouncement < ActiveRecord::Migration[5.2] | ||
|
|
2 | + def change | ||
|
|
3 | + add_column :announcements, :on_nav_bar, :boolean, default: false | ||
|
|
4 | + end | ||
|
|
5 | + end |
@@ -111,6 +111,6 | |||||
|
111 | private |
|
111 | private |
|
112 |
|
112 | ||
|
113 | def announcement_params |
|
113 | def announcement_params |
|
114 | - params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only, :title) |
|
114 | + params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only, :title, :on_nav_bar) |
|
115 | end |
|
115 | end |
|
116 | end |
|
116 | end |
@@ -4,6 +4,7 | |||||
|
4 | protect_from_forgery |
|
4 | protect_from_forgery |
|
5 |
|
5 | ||
|
6 | before_action :current_user |
|
6 | before_action :current_user |
|
|
7 | + before_action :nav_announcement | ||
|
7 |
|
8 | ||
|
8 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
9 | SINGLE_USER_MODE_CONF_KEY = 'system.single_user_mode' |
|
9 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
|
10 | MULTIPLE_IP_LOGIN_CONF_KEY = 'right.multiple_ip_login' |
@@ -22,6 +23,10 | |||||
|
22 | @current_user ||= User.find(session[:user_id]) |
|
23 | @current_user ||= User.find(session[:user_id]) |
|
23 | end |
|
24 | end |
|
24 |
|
25 | ||
|
|
26 | + def nav_announcement | ||
|
|
27 | + @nav_announcement = Announcement.where(on_nav_bar: true) | ||
|
|
28 | + end | ||
|
|
29 | + | ||
|
25 | def admin_authorization |
|
30 | def admin_authorization |
|
26 | return false unless check_valid_login |
|
31 | return false unless check_valid_login |
|
27 | user = User.includes(:roles).find(session[:user_id]) |
|
32 | user = User.includes(:roles).find(session[:user_id]) |
@@ -1,34 +1,45 | |||||
|
1 | - .container-fluid |
|
1 | + %h1 Edit Announcement |
|
2 | - %h1 Editing announcement |
|
2 | + |
|
3 | - = error_messages_for :announcement |
|
3 | + -content_for(:form_buttons) do |
|
4 | - .row |
|
4 | + = link_to t(:back), announcements_path, class: 'card-link btn btn-secondary' |
|
5 | - .col-md-6 |
|
5 | + |
|
6 | - = form_for(@announcement) do |f| |
|
6 | + = render 'form' |
|
7 | - .form-group |
|
7 | + -# old style |
|
8 | - %label Title |
|
8 | + .container-fluid |
|
9 | - = f.text_field :title, class: 'form-control' |
|
9 | + %h1 Editing announcement |
|
10 | - .form-group |
|
10 | + = error_messages_for :announcement |
|
11 | - %label Notes |
|
11 | + .row |
|
12 | - (shown internally, used to organize announcements) |
|
12 | + .col-md-6 |
|
13 | - = f.text_field :notes, class: 'form-control' |
|
13 | + = form_for(@announcement) do |f| |
|
14 | - .form-group |
|
14 | + .form-group |
|
15 |
- %label |
|
15 | + %label Title |
|
16 |
- = f.text_ |
|
16 | + = f.text_field :title, class: 'form-control' |
|
17 | - .form-group |
|
17 | + .form-group |
|
18 |
- %label |
|
18 | + %label Notes |
|
19 | - = f.text_field :author, class: 'form-control' |
|
19 | + (shown internally, used to organize announcements) |
|
20 | - .checkbox |
|
20 | + = f.text_field :notes, class: 'form-control' |
|
21 | - %label |
|
21 | + .form-group |
|
22 | - = f.check_box :published |
|
22 | + %label Body |
|
23 | - Published |
|
23 | + = f.text_area :body, class: 'form-control', style: 'height: 200px;' |
|
24 | - .checkbox |
|
24 | + .form-group |
|
25 | - %label |
|
25 | + %label Author |
|
26 | - = f.check_box :frontpage |
|
26 | + = f.text_field :author, class: 'form-control' |
|
27 | - Show on front page? |
|
27 | + .checkbox |
|
28 | - .checkbox |
|
28 | + %label |
|
29 | - %label |
|
29 | + = f.check_box :published |
|
30 | - = f.check_box :contest_only |
|
30 | + Published |
|
31 | - Show only in contest? |
|
31 | + .checkbox |
|
32 | - = f.submit "Update", class: 'btn btn-primary' |
|
32 | + %label |
|
33 | - = link_to 'Show', @announcement, class: 'btn btn-default' |
|
33 | + = f.check_box :frontpage |
|
34 | - = link_to 'Back', announcements_path, class: 'btn btn-default' |
|
34 | + Show on front page? |
|
|
35 | + .checkbox | ||
|
|
36 | + %label | ||
|
|
37 | + = f.check_box :on_nav_bar | ||
|
|
38 | + Show on top menu bar? | ||
|
|
39 | + .checkbox | ||
|
|
40 | + %label | ||
|
|
41 | + = f.check_box :contest_only | ||
|
|
42 | + Show only in contest? | ||
|
|
43 | + = f.submit "Update", class: 'btn btn-primary' | ||
|
|
44 | + = link_to 'Show', @announcement, class: 'btn btn-default' | ||
|
|
45 | + = link_to 'Back', announcements_path, class: 'btn btn-default' |
@@ -1,14 +1,22 | |||||
|
1 | %h1 New announcement |
|
1 | %h1 New announcement |
|
2 | - = error_messages_for :announcement |
|
2 | + |
|
3 | - = simple_form_for(@announcement) do |f| |
|
3 | + -content_for(:form_buttons) do |
|
4 | - .row |
|
4 | + = link_to t(:back), announcements_path, class: 'card-link btn btn-secondary' |
|
5 | - .col-md-6 |
|
5 | + |
|
6 | - = f.input :title |
|
6 | + = render 'form' |
|
7 | - = f.input :notes, label: 'Notes (shown internally, used to organize announcements)' |
|
7 | + |
|
8 | - = f.input :body |
|
8 | + -# old style |
|
9 | - = f.input :author |
|
9 | + = error_messages_for :announcement |
|
10 | - = f.input :published |
|
10 | + = simple_form_for(@announcement) do |f| |
|
11 | - = f.input :frontpage, label: 'Display in the front page only?' |
|
11 | + .row |
|
12 | - = f.input :contest_only, label: 'Display in contest only?' |
|
12 | + .col-md-6 |
|
13 | - = f.button :submit, "Create", class: 'btn btn-primary' |
|
13 | + = f.input :title |
|
14 | - = link_to 'Back', announcements_path, class: 'btn btn-default' |
|
14 | + = f.input :notes, label: 'Notes (shown internally, used to organize announcements)' |
|
|
15 | + = f.input :body | ||
|
|
16 | + = f.input :author | ||
|
|
17 | + = f.input :published | ||
|
|
18 | + = f.input :frontpage, label: 'Display in the front page only?' | ||
|
|
19 | + = f.input :contest_only, label: 'Display in contest only?' | ||
|
|
20 | + = f.button :submit, "Create", class: 'btn btn-primary' | ||
|
|
21 | + = link_to 'Back', announcements_path, class: 'btn btn-default' | ||
|
|
22 | + |
@@ -17,6 +17,9 | |||||
|
17 | %b Show on front page: |
|
17 | %b Show on front page: |
|
18 | = h @announcement.frontpage |
|
18 | = h @announcement.frontpage |
|
19 | %p |
|
19 | %p |
|
|
20 | + %b Show on top menu bar: | ||
|
|
21 | + = h @announcement.on_nav_bar | ||
|
|
22 | + %p | ||
|
20 | %b Show only in contest: |
|
23 | %b Show only in contest: |
|
21 | = h @announcement.contest_only |
|
24 | = h @announcement.contest_only |
|
22 | = link_to 'Edit', edit_announcement_path(@announcement) |
|
25 | = link_to 'Edit', edit_announcement_path(@announcement) |
@@ -70,6 +70,12 | |||||
|
70 | =link_to "#{ungraded} backlogs!", |
|
70 | =link_to "#{ungraded} backlogs!", |
|
71 | graders_list_path, |
|
71 | graders_list_path, |
|
72 | class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission' |
|
72 | class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission' |
|
|
73 | + / announcement | ||
|
|
74 | + - @nav_announcement.each do |ann| | ||
|
|
75 | + %p.navbar-text | ||
|
|
76 | + = ann.body.html_safe | ||
|
|
77 | + | ||
|
|
78 | + | ||
|
73 |
|
79 | ||
|
74 | %ul.nav.navbar-nav.navbar-right |
|
80 | %ul.nav.navbar-nav.navbar-right |
|
75 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
|
81 | = add_menu("#{content_tag(:span,'',class: 'glyphicon glyphicon-question-sign')}".html_safe, 'main', 'help') |
@@ -10,71 +10,72 | |||||
|
10 | # |
|
10 | # |
|
11 | # It's strongly recommended that you check this file into your version control system. |
|
11 | # It's strongly recommended that you check this file into your version control system. |
|
12 |
|
12 | ||
|
13 |
- ActiveRecord::Schema.define(version: 202 |
|
13 | + ActiveRecord::Schema.define(version: 2021_01_24_101028) do |
|
14 |
|
14 | ||
|
15 |
- create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
15 | + create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
16 | t.string "author" |
|
16 | t.string "author" |
|
17 | t.text "body" |
|
17 | t.text "body" |
|
18 | t.boolean "published" |
|
18 | t.boolean "published" |
|
19 | - t.datetime "created_at" |
|
19 | + t.datetime "created_at", null: false |
|
20 | - t.datetime "updated_at" |
|
20 | + t.datetime "updated_at", null: false |
|
21 | t.boolean "frontpage", default: false |
|
21 | t.boolean "frontpage", default: false |
|
22 | t.boolean "contest_only", default: false |
|
22 | t.boolean "contest_only", default: false |
|
23 | t.string "title" |
|
23 | t.string "title" |
|
24 | t.string "notes" |
|
24 | t.string "notes" |
|
|
25 | + t.boolean "on_nav_bar", default: false | ||
|
25 | end |
|
26 | end |
|
26 |
|
27 | ||
|
27 |
- create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
28 | + create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
28 | t.string "title" |
|
29 | t.string "title" |
|
29 | t.boolean "enabled" |
|
30 | t.boolean "enabled" |
|
30 | - t.datetime "created_at" |
|
31 | + t.datetime "created_at", null: false |
|
31 | - t.datetime "updated_at" |
|
32 | + t.datetime "updated_at", null: false |
|
32 | t.string "name" |
|
33 | t.string "name" |
|
33 | end |
|
34 | end |
|
34 |
|
35 | ||
|
35 |
- create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
36 | + create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
36 | t.integer "contest_id" |
|
37 | t.integer "contest_id" |
|
37 | t.integer "problem_id" |
|
38 | t.integer "problem_id" |
|
38 | end |
|
39 | end |
|
39 |
|
40 | ||
|
40 |
- create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
41 | + create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
41 | t.integer "contest_id" |
|
42 | t.integer "contest_id" |
|
42 | t.integer "user_id" |
|
43 | t.integer "user_id" |
|
43 | end |
|
44 | end |
|
44 |
|
45 | ||
|
45 |
- create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
46 | + create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
46 | t.string "name" |
|
47 | t.string "name" |
|
47 | - t.datetime "created_at" |
|
48 | + t.datetime "created_at", null: false |
|
48 | - t.datetime "updated_at" |
|
49 | + t.datetime "updated_at", null: false |
|
49 | end |
|
50 | end |
|
50 |
|
51 | ||
|
51 |
- create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
52 | + create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
52 | t.text "body" |
|
53 | t.text "body" |
|
53 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
54 | - t.datetime "created_at" |
|
55 | + t.datetime "created_at", null: false |
|
55 | - t.datetime "updated_at" |
|
56 | + t.datetime "updated_at", null: false |
|
56 | end |
|
57 | end |
|
57 |
|
58 | ||
|
58 |
- create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
59 | + create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
59 | t.string "key" |
|
60 | t.string "key" |
|
60 | t.string "value_type" |
|
61 | t.string "value_type" |
|
61 | t.string "value" |
|
62 | t.string "value" |
|
62 | - t.datetime "created_at" |
|
63 | + t.datetime "created_at", null: false |
|
63 | - t.datetime "updated_at" |
|
64 | + t.datetime "updated_at", null: false |
|
64 | t.text "description" |
|
65 | t.text "description" |
|
65 | end |
|
66 | end |
|
66 |
|
67 | ||
|
67 |
- create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
68 | + create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
68 | t.string "host" |
|
69 | t.string "host" |
|
69 | t.integer "pid" |
|
70 | t.integer "pid" |
|
70 | t.string "mode" |
|
71 | t.string "mode" |
|
71 | t.boolean "active" |
|
72 | t.boolean "active" |
|
72 | - t.datetime "created_at" |
|
73 | + t.datetime "created_at", null: false |
|
73 | - t.datetime "updated_at" |
|
74 | + t.datetime "updated_at", null: false |
|
74 | t.integer "task_id" |
|
75 | t.integer "task_id" |
|
75 | t.string "task_type" |
|
76 | t.string "task_type" |
|
76 | t.boolean "terminated" |
|
77 | t.boolean "terminated" |
|
77 |
- t.index ["host", "pid"], name: "index_grader_processes_on_ |
|
78 | + t.index ["host", "pid"], name: "index_grader_processes_on_ip_and_pid" |
|
78 | end |
|
79 | end |
|
79 |
|
80 | ||
|
80 | create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
|
81 | create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| |
@@ -95,41 +96,41 | |||||
|
95 | t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id" |
|
96 | t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id" |
|
96 | end |
|
97 | end |
|
97 |
|
98 | ||
|
98 |
- create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
99 | + create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
99 | t.integer "user_id" |
|
100 | t.integer "user_id" |
|
100 | t.string "ip_address" |
|
101 | t.string "ip_address" |
|
101 | - t.datetime "created_at" |
|
102 | + t.datetime "created_at", null: false |
|
102 | - t.datetime "updated_at" |
|
103 | + t.datetime "updated_at", null: false |
|
103 | t.string "status" |
|
104 | t.string "status" |
|
104 | t.index ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
105 | t.index ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
105 | end |
|
106 | end |
|
106 |
|
107 | ||
|
107 |
- create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
108 | + create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
108 | t.string "name", limit: 10 |
|
109 | t.string "name", limit: 10 |
|
109 | t.string "pretty_name" |
|
110 | t.string "pretty_name" |
|
110 | t.string "ext", limit: 10 |
|
111 | t.string "ext", limit: 10 |
|
111 | t.string "common_ext" |
|
112 | t.string "common_ext" |
|
112 | end |
|
113 | end |
|
113 |
|
114 | ||
|
114 |
- create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
115 | + create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
115 | t.integer "user_id" |
|
116 | t.integer "user_id" |
|
116 | t.string "ip_address" |
|
117 | t.string "ip_address" |
|
117 | - t.datetime "created_at" |
|
118 | + t.datetime "created_at", null: false |
|
118 | - t.datetime "updated_at" |
|
119 | + t.datetime "updated_at", null: false |
|
119 | t.index ["user_id"], name: "index_logins_on_user_id" |
|
120 | t.index ["user_id"], name: "index_logins_on_user_id" |
|
120 | end |
|
121 | end |
|
121 |
|
122 | ||
|
122 |
- create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
123 | + create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
123 | t.integer "sender_id" |
|
124 | t.integer "sender_id" |
|
124 | t.integer "receiver_id" |
|
125 | t.integer "receiver_id" |
|
125 | t.integer "replying_message_id" |
|
126 | t.integer "replying_message_id" |
|
126 | t.text "body" |
|
127 | t.text "body" |
|
127 | t.boolean "replied" |
|
128 | t.boolean "replied" |
|
128 | - t.datetime "created_at" |
|
129 | + t.datetime "created_at", null: false |
|
129 | - t.datetime "updated_at" |
|
130 | + t.datetime "updated_at", null: false |
|
130 | end |
|
131 | end |
|
131 |
|
132 | ||
|
132 |
- create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
133 | + create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
133 | t.string "name", limit: 30 |
|
134 | t.string "name", limit: 30 |
|
134 | t.string "full_name" |
|
135 | t.string "full_name" |
|
135 | t.integer "full_score" |
|
136 | t.integer "full_score" |
@@ -151,29 +152,29 | |||||
|
151 | t.index ["tag_id"], name: "index_problems_tags_on_tag_id" |
|
152 | t.index ["tag_id"], name: "index_problems_tags_on_tag_id" |
|
152 | end |
|
153 | end |
|
153 |
|
154 | ||
|
154 |
- create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
155 | + create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
155 | t.string "name" |
|
156 | t.string "name" |
|
156 | t.string "controller" |
|
157 | t.string "controller" |
|
157 | t.string "action" |
|
158 | t.string "action" |
|
158 | end |
|
159 | end |
|
159 |
|
160 | ||
|
160 |
- create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
161 | + create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
161 | t.integer "right_id" |
|
162 | t.integer "right_id" |
|
162 | t.integer "role_id" |
|
163 | t.integer "role_id" |
|
163 | t.index ["role_id"], name: "index_rights_roles_on_role_id" |
|
164 | t.index ["role_id"], name: "index_rights_roles_on_role_id" |
|
164 | end |
|
165 | end |
|
165 |
|
166 | ||
|
166 |
- create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
167 | + create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
167 | t.string "name" |
|
168 | t.string "name" |
|
168 | end |
|
169 | end |
|
169 |
|
170 | ||
|
170 |
- create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
171 | + create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
171 | t.integer "role_id" |
|
172 | t.integer "role_id" |
|
172 | t.integer "user_id" |
|
173 | t.integer "user_id" |
|
173 | t.index ["user_id"], name: "index_roles_users_on_user_id" |
|
174 | t.index ["user_id"], name: "index_roles_users_on_user_id" |
|
174 | end |
|
175 | end |
|
175 |
|
176 | ||
|
176 |
- create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
177 | + create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
177 | t.string "session_id" |
|
178 | t.string "session_id" |
|
178 | t.text "data" |
|
179 | t.text "data" |
|
179 | t.datetime "updated_at" |
|
180 | t.datetime "updated_at" |
@@ -181,24 +182,24 | |||||
|
181 | t.index ["updated_at"], name: "index_sessions_on_updated_at" |
|
182 | t.index ["updated_at"], name: "index_sessions_on_updated_at" |
|
182 | end |
|
183 | end |
|
183 |
|
184 | ||
|
184 |
- create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
185 | + create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
185 | t.string "name" |
|
186 | t.string "name" |
|
186 | t.boolean "started" |
|
187 | t.boolean "started" |
|
187 | t.datetime "start_time" |
|
188 | t.datetime "start_time" |
|
188 | - t.datetime "created_at" |
|
189 | + t.datetime "created_at", null: false |
|
189 | - t.datetime "updated_at" |
|
190 | + t.datetime "updated_at", null: false |
|
190 | t.integer "country_id" |
|
191 | t.integer "country_id" |
|
191 | t.string "password" |
|
192 | t.string "password" |
|
192 | end |
|
193 | end |
|
193 |
|
194 | ||
|
194 |
- create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
195 | + create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
195 | t.integer "user_id" |
|
196 | t.integer "user_id" |
|
196 | t.integer "submission_id" |
|
197 | t.integer "submission_id" |
|
197 | - t.datetime "created_at" |
|
198 | + t.datetime "created_at", null: false |
|
198 | - t.datetime "updated_at" |
|
199 | + t.datetime "updated_at", null: false |
|
199 | end |
|
200 | end |
|
200 |
|
201 | ||
|
201 |
- create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
202 | + create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
202 | t.integer "user_id" |
|
203 | t.integer "user_id" |
|
203 | t.integer "problem_id" |
|
204 | t.integer "problem_id" |
|
204 | t.integer "language_id" |
|
205 | t.integer "language_id" |
@@ -229,7 +230,7 | |||||
|
229 | t.datetime "updated_at", null: false |
|
230 | t.datetime "updated_at", null: false |
|
230 | end |
|
231 | end |
|
231 |
|
232 | ||
|
232 |
- create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
233 | + create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
233 | t.integer "submission_id" |
|
234 | t.integer "submission_id" |
|
234 | t.datetime "created_at" |
|
235 | t.datetime "created_at" |
|
235 | t.integer "status" |
|
236 | t.integer "status" |
@@ -237,15 +238,15 | |||||
|
237 | t.index ["submission_id"], name: "index_tasks_on_submission_id" |
|
238 | t.index ["submission_id"], name: "index_tasks_on_submission_id" |
|
238 | end |
|
239 | end |
|
239 |
|
240 | ||
|
240 |
- create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
241 | + create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
241 | t.integer "problem_id" |
|
242 | t.integer "problem_id" |
|
242 | t.text "input", limit: 16777215 |
|
243 | t.text "input", limit: 16777215 |
|
243 | t.text "solution", limit: 16777215 |
|
244 | t.text "solution", limit: 16777215 |
|
244 | - t.datetime "created_at" |
|
245 | + t.datetime "created_at", null: false |
|
245 | - t.datetime "updated_at" |
|
246 | + t.datetime "updated_at", null: false |
|
246 | end |
|
247 | end |
|
247 |
|
248 | ||
|
248 |
- create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
249 | + create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
249 | t.integer "user_id" |
|
250 | t.integer "user_id" |
|
250 | t.integer "problem_id" |
|
251 | t.integer "problem_id" |
|
251 | t.integer "submission_id" |
|
252 | t.integer "submission_id" |
@@ -253,13 +254,13 | |||||
|
253 | t.string "output_file_name" |
|
254 | t.string "output_file_name" |
|
254 | t.string "running_stat" |
|
255 | t.string "running_stat" |
|
255 | t.integer "status" |
|
256 | t.integer "status" |
|
256 | - t.datetime "updated_at" |
|
257 | + t.datetime "updated_at", null: false |
|
257 | t.datetime "submitted_at" |
|
258 | t.datetime "submitted_at" |
|
258 | t.datetime "compiled_at" |
|
259 | t.datetime "compiled_at" |
|
259 | t.text "compiler_message" |
|
260 | t.text "compiler_message" |
|
260 | t.datetime "graded_at" |
|
261 | t.datetime "graded_at" |
|
261 | t.string "grader_comment" |
|
262 | t.string "grader_comment" |
|
262 | - t.datetime "created_at" |
|
263 | + t.datetime "created_at", null: false |
|
263 | t.float "running_time" |
|
264 | t.float "running_time" |
|
264 | t.string "exit_status" |
|
265 | t.string "exit_status" |
|
265 | t.integer "memory_usage" |
|
266 | t.integer "memory_usage" |
@@ -278,15 +279,15 | |||||
|
278 | t.index ["problem_id"], name: "index_testcases_on_problem_id" |
|
279 | t.index ["problem_id"], name: "index_testcases_on_problem_id" |
|
279 | end |
|
280 | end |
|
280 |
|
281 | ||
|
281 |
- create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
282 | + create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
282 | t.integer "user_id" |
|
283 | t.integer "user_id" |
|
283 | t.datetime "started_at" |
|
284 | t.datetime "started_at" |
|
284 | - t.datetime "created_at" |
|
285 | + t.datetime "created_at", null: false |
|
285 | - t.datetime "updated_at" |
|
286 | + t.datetime "updated_at", null: false |
|
286 | t.boolean "forced_logout" |
|
287 | t.boolean "forced_logout" |
|
287 | end |
|
288 | end |
|
288 |
|
289 | ||
|
289 |
- create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET= |
|
290 | + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| |
|
290 | t.string "login", limit: 50 |
|
291 | t.string "login", limit: 50 |
|
291 | t.string "full_name" |
|
292 | t.string "full_name" |
|
292 | t.string "hashed_password" |
|
293 | t.string "hashed_password" |
@@ -298,10 +299,10 | |||||
|
298 | t.boolean "activated", default: false |
|
299 | t.boolean "activated", default: false |
|
299 | t.datetime "created_at" |
|
300 | t.datetime "created_at" |
|
300 | t.datetime "updated_at" |
|
301 | t.datetime "updated_at" |
|
301 | - t.string "section" |
|
||
|
302 | t.boolean "enabled", default: true |
|
302 | t.boolean "enabled", default: true |
|
303 | t.string "remark" |
|
303 | t.string "remark" |
|
304 | t.string "last_ip" |
|
304 | t.string "last_ip" |
|
|
305 | + t.string "section" | ||
|
305 | t.index ["login"], name: "index_users_on_login", unique: true |
|
306 | t.index ["login"], name: "index_users_on_login", unique: true |
|
306 | end |
|
307 | end |
|
307 |
|
308 |
You need to be logged in to leave comments.
Login now