Description:
remove unnecessary gems
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r872:17032a7943cf - - 13 files changed: 33 inserted, 75 deleted

@@ -42,86 +42,83
42
42
43 gem "importmap-rails", "~> 1.1"
43 gem "importmap-rails", "~> 1.1"
44 # gem 'uglifier'
44 # gem 'uglifier'
45
45
46 gem 'haml'
46 gem 'haml'
47 gem 'haml-rails'
47 gem 'haml-rails'
48
48
49 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
49 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
50 #gem 'turbolinks', '~> 5'
50 #gem 'turbolinks', '~> 5'
51 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
51 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
52 gem 'jbuilder'
52 gem 'jbuilder'
53
53
54
54
55 #in-place editor
55 #in-place editor
56 gem 'best_in_place', git: "https://github.com/mmotherwell/best_in_place"
56 gem 'best_in_place', git: "https://github.com/mmotherwell/best_in_place"
57
57
58 # jquery addition
58 # jquery addition
59 gem 'jquery-rails'
59 gem 'jquery-rails'
60 #gem 'jquery-ui-rails'
60 #gem 'jquery-ui-rails'
61 #gem 'jquery-timepicker-addon-rails'
61 #gem 'jquery-timepicker-addon-rails'
62 #gem 'jquery-tablesorter'
62 #gem 'jquery-tablesorter'
63 #gem 'jquery-countdown-rails'
63 #gem 'jquery-countdown-rails'
64
64
65 #syntax highlighter
65 #syntax highlighter
66 gem 'rouge'
66 gem 'rouge'
67
67
68 #bootstrap add-ons
68 #bootstrap add-ons
69 #gem 'bootstrap-sass', '~> 3.4.1'
69 #gem 'bootstrap-sass', '~> 3.4.1'
70 gem 'bootstrap', '~> 5.2'
70 gem 'bootstrap', '~> 5.2'
71 #gem 'bootstrap-switch-rails'
71 #gem 'bootstrap-switch-rails'
72 #gem 'bootstrap-toggle-rails'
72 #gem 'bootstrap-toggle-rails'
73 #gem 'autoprefixer-rails'
73 #gem 'autoprefixer-rails'
74 gem 'momentjs-rails'
74 gem 'momentjs-rails'
75 #gem 'rails_bootstrap_sortable'
75 #gem 'rails_bootstrap_sortable'
76 #gem 'bootstrap-datepicker-rails'
76 #gem 'bootstrap-datepicker-rails'
77 #gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
77 #gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
78 #gem 'jquery-datatables-rails'
78 #gem 'jquery-datatables-rails'
79
79
80 #----------- user interface -----------------
80 #----------- user interface -----------------
81 gem 'simple_form'
81 gem 'simple_form'
82 #select 2
82 #select 2
83 #gem 'select2-rails'
83 #gem 'select2-rails'
84 #ace editor
84 #ace editor
85 gem 'ace-rails-ap'
85 gem 'ace-rails-ap'
86 #paginator
86 #paginator
87 #gem 'will_paginate', '~> 3.0.7'
87 #gem 'will_paginate', '~> 3.0.7'
88
88
89 gem 'mail'
89 gem 'mail'
90 - gem 'rdiscount'
90 + gem 'rdiscount' #markdown
91 - gem 'dynamic_form'
92 - gem 'in_place_editing'
93 - #gem 'verification', :git => 'https://github.com/sikachu/verification.git'
94
91
95
92
96 #---------------- testiing -----------------------
93 #---------------- testiing -----------------------
97 gem 'minitest-reporters'
94 gem 'minitest-reporters'
98
95
99 #---------------- for console --------------------
96 #---------------- for console --------------------
100 gem 'fuzzy-string-match'
97 gem 'fuzzy-string-match'
101
98
102
99
103 group :development, :test do
100 group :development, :test do
104 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
101 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
105 gem 'byebug'
102 gem 'byebug'
106 end
103 end
107
104
108 group :development do
105 group :development do
109 # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
106 # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
110 gem 'web-console', '>= 3.3.0'
107 gem 'web-console', '>= 3.3.0'
111 gem 'listen', '>= 3.0.5', '< 3.2'
108 gem 'listen', '>= 3.0.5', '< 3.2'
112 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
109 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
113 gem 'spring'
110 gem 'spring'
114 gem 'spring-watcher-listen', '~> 2.0.0'
111 gem 'spring-watcher-listen', '~> 2.0.0'
115
112
116 # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
113 # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
117 # gem "rack-mini-profiler"
114 # gem "rack-mini-profiler"
118 end
115 end
119
116
120 group :test do
117 group :test do
121 # Adds support for Capybara system testing and selenium driver
118 # Adds support for Capybara system testing and selenium driver
122 gem 'capybara'
119 gem 'capybara'
123 gem 'selenium-webdriver'
120 gem 'selenium-webdriver'
124 gem 'webdrivers'
121 gem 'webdrivers'
125 end
122 end
126
123
127
124
@@ -73,97 +73,96
73 rack (>= 2.0.8, < 3)
73 rack (>= 2.0.8, < 3)
74 railties (>= 5.2.4.1)
74 railties (>= 5.2.4.1)
75 activestorage (7.0.4)
75 activestorage (7.0.4)
76 actionpack (= 7.0.4)
76 actionpack (= 7.0.4)
77 activejob (= 7.0.4)
77 activejob (= 7.0.4)
78 activerecord (= 7.0.4)
78 activerecord (= 7.0.4)
79 activesupport (= 7.0.4)
79 activesupport (= 7.0.4)
80 marcel (~> 1.0)
80 marcel (~> 1.0)
81 mini_mime (>= 1.1.0)
81 mini_mime (>= 1.1.0)
82 activesupport (7.0.4)
82 activesupport (7.0.4)
83 concurrent-ruby (~> 1.0, >= 1.0.2)
83 concurrent-ruby (~> 1.0, >= 1.0.2)
84 i18n (>= 1.6, < 2)
84 i18n (>= 1.6, < 2)
85 minitest (>= 5.1)
85 minitest (>= 5.1)
86 tzinfo (~> 2.0)
86 tzinfo (~> 2.0)
87 addressable (2.8.1)
87 addressable (2.8.1)
88 public_suffix (>= 2.0.2, < 6.0)
88 public_suffix (>= 2.0.2, < 6.0)
89 ansi (1.5.0)
89 ansi (1.5.0)
90 autoprefixer-rails (10.4.7.0)
90 autoprefixer-rails (10.4.7.0)
91 execjs (~> 2)
91 execjs (~> 2)
92 bindex (0.8.1)
92 bindex (0.8.1)
93 bootsnap (1.13.0)
93 bootsnap (1.13.0)
94 msgpack (~> 1.2)
94 msgpack (~> 1.2)
95 bootstrap (5.2.1)
95 bootstrap (5.2.1)
96 autoprefixer-rails (>= 9.1.0)
96 autoprefixer-rails (>= 9.1.0)
97 popper_js (>= 2.11.6, < 3)
97 popper_js (>= 2.11.6, < 3)
98 sassc-rails (>= 2.0.0)
98 sassc-rails (>= 2.0.0)
99 builder (3.2.4)
99 builder (3.2.4)
100 byebug (11.1.3)
100 byebug (11.1.3)
101 capybara (3.37.1)
101 capybara (3.37.1)
102 addressable
102 addressable
103 matrix
103 matrix
104 mini_mime (>= 0.1.3)
104 mini_mime (>= 0.1.3)
105 nokogiri (~> 1.8)
105 nokogiri (~> 1.8)
106 rack (>= 1.6.0)
106 rack (>= 1.6.0)
107 rack-test (>= 0.6.3)
107 rack-test (>= 0.6.3)
108 regexp_parser (>= 1.5, < 3.0)
108 regexp_parser (>= 1.5, < 3.0)
109 xpath (~> 3.2)
109 xpath (~> 3.2)
110 childprocess (4.1.0)
110 childprocess (4.1.0)
111 coffee-rails (5.0.0)
111 coffee-rails (5.0.0)
112 coffee-script (>= 2.2.0)
112 coffee-script (>= 2.2.0)
113 railties (>= 5.2.0)
113 railties (>= 5.2.0)
114 coffee-script (2.4.1)
114 coffee-script (2.4.1)
115 coffee-script-source
115 coffee-script-source
116 execjs
116 execjs
117 coffee-script-source (1.12.2)
117 coffee-script-source (1.12.2)
118 concurrent-ruby (1.1.10)
118 concurrent-ruby (1.1.10)
119 crass (1.0.6)
119 crass (1.0.6)
120 digest (3.1.0)
120 digest (3.1.0)
121 - dynamic_form (1.1.4)
122 erubi (1.11.0)
121 erubi (1.11.0)
123 erubis (2.7.0)
122 erubis (2.7.0)
124 execjs (2.8.1)
123 execjs (2.8.1)
125 ffi (1.15.5)
124 ffi (1.15.5)
126 fuzzy-string-match (1.0.1)
125 fuzzy-string-match (1.0.1)
127 RubyInline (>= 3.8.6)
126 RubyInline (>= 3.8.6)
128 globalid (1.0.0)
127 globalid (1.0.0)
129 activesupport (>= 5.0)
128 activesupport (>= 5.0)
130 haml (5.2.2)
129 haml (5.2.2)
131 temple (>= 0.8.0)
130 temple (>= 0.8.0)
132 tilt
131 tilt
133 haml-rails (2.0.1)
132 haml-rails (2.0.1)
134 actionpack (>= 5.1)
133 actionpack (>= 5.1)
135 activesupport (>= 5.1)
134 activesupport (>= 5.1)
136 haml (>= 4.0.6, < 6.0)
135 haml (>= 4.0.6, < 6.0)
137 html2haml (>= 1.0.1)
136 html2haml (>= 1.0.1)
138 railties (>= 5.1)
137 railties (>= 5.1)
139 html2haml (2.2.0)
138 html2haml (2.2.0)
140 erubis (~> 2.7.0)
139 erubis (~> 2.7.0)
141 haml (>= 4.0, < 6)
140 haml (>= 4.0, < 6)
142 nokogiri (>= 1.6.0)
141 nokogiri (>= 1.6.0)
143 ruby_parser (~> 3.5)
142 ruby_parser (~> 3.5)
144 i18n (1.12.0)
143 i18n (1.12.0)
145 concurrent-ruby (~> 1.0)
144 concurrent-ruby (~> 1.0)
146 importmap-rails (1.1.5)
145 importmap-rails (1.1.5)
147 actionpack (>= 6.0.0)
146 actionpack (>= 6.0.0)
148 railties (>= 6.0.0)
147 railties (>= 6.0.0)
149 in_place_editing (1.2.0)
148 in_place_editing (1.2.0)
150 jbuilder (2.11.5)
149 jbuilder (2.11.5)
151 actionview (>= 5.0.0)
150 actionview (>= 5.0.0)
152 activesupport (>= 5.0.0)
151 activesupport (>= 5.0.0)
153 jquery-rails (4.5.0)
152 jquery-rails (4.5.0)
154 rails-dom-testing (>= 1, < 3)
153 rails-dom-testing (>= 1, < 3)
155 railties (>= 4.2.0)
154 railties (>= 4.2.0)
156 thor (>= 0.14, < 2.0)
155 thor (>= 0.14, < 2.0)
157 listen (3.0.8)
156 listen (3.0.8)
158 rb-fsevent (~> 0.9, >= 0.9.4)
157 rb-fsevent (~> 0.9, >= 0.9.4)
159 rb-inotify (~> 0.9, >= 0.9.7)
158 rb-inotify (~> 0.9, >= 0.9.7)
160 loofah (2.19.0)
159 loofah (2.19.0)
161 crass (~> 1.0.2)
160 crass (~> 1.0.2)
162 nokogiri (>= 1.5.9)
161 nokogiri (>= 1.5.9)
163 mail (2.7.1)
162 mail (2.7.1)
164 mini_mime (>= 0.1.1)
163 mini_mime (>= 0.1.1)
165 marcel (1.0.2)
164 marcel (1.0.2)
166 material_icons (2.2.1)
165 material_icons (2.2.1)
167 railties (>= 3.2)
166 railties (>= 3.2)
168 matrix (0.4.2)
167 matrix (0.4.2)
169 method_source (1.0.0)
168 method_source (1.0.0)
@@ -262,81 +261,80
262 spring (2.1.1)
261 spring (2.1.1)
263 spring-watcher-listen (2.0.1)
262 spring-watcher-listen (2.0.1)
264 listen (>= 2.7, < 4.0)
263 listen (>= 2.7, < 4.0)
265 spring (>= 1.2, < 3.0)
264 spring (>= 1.2, < 3.0)
266 sprockets (4.1.1)
265 sprockets (4.1.1)
267 concurrent-ruby (~> 1.0)
266 concurrent-ruby (~> 1.0)
268 rack (> 1, < 3)
267 rack (> 1, < 3)
269 sprockets-rails (3.4.2)
268 sprockets-rails (3.4.2)
270 actionpack (>= 5.2)
269 actionpack (>= 5.2)
271 activesupport (>= 5.2)
270 activesupport (>= 5.2)
272 sprockets (>= 3.0.0)
271 sprockets (>= 3.0.0)
273 sqlite3 (1.5.0-x86_64-linux)
272 sqlite3 (1.5.0-x86_64-linux)
274 strscan (3.0.4)
273 strscan (3.0.4)
275 temple (0.8.2)
274 temple (0.8.2)
276 thor (1.2.1)
275 thor (1.2.1)
277 tilt (2.0.11)
276 tilt (2.0.11)
278 timeout (0.3.0)
277 timeout (0.3.0)
279 tzinfo (2.0.5)
278 tzinfo (2.0.5)
280 concurrent-ruby (~> 1.0)
279 concurrent-ruby (~> 1.0)
281 web-console (4.2.0)
280 web-console (4.2.0)
282 actionview (>= 6.0.0)
281 actionview (>= 6.0.0)
283 activemodel (>= 6.0.0)
282 activemodel (>= 6.0.0)
284 bindex (>= 0.4.0)
283 bindex (>= 0.4.0)
285 railties (>= 6.0.0)
284 railties (>= 6.0.0)
286 webdrivers (5.1.0)
285 webdrivers (5.1.0)
287 nokogiri (~> 1.6)
286 nokogiri (~> 1.6)
288 rubyzip (>= 1.3.0)
287 rubyzip (>= 1.3.0)
289 selenium-webdriver (~> 4.0)
288 selenium-webdriver (~> 4.0)
290 websocket (1.2.9)
289 websocket (1.2.9)
291 websocket-driver (0.7.5)
290 websocket-driver (0.7.5)
292 websocket-extensions (>= 0.1.0)
291 websocket-extensions (>= 0.1.0)
293 websocket-extensions (0.1.5)
292 websocket-extensions (0.1.5)
294 xpath (3.2.0)
293 xpath (3.2.0)
295 nokogiri (~> 1.8)
294 nokogiri (~> 1.8)
296 zeitwerk (2.6.0)
295 zeitwerk (2.6.0)
297
296
298 PLATFORMS
297 PLATFORMS
299 x86_64-linux
298 x86_64-linux
300
299
301 DEPENDENCIES
300 DEPENDENCIES
302 ace-rails-ap
301 ace-rails-ap
303 activerecord-session_store
302 activerecord-session_store
304 best_in_place!
303 best_in_place!
305 bootsnap
304 bootsnap
306 bootstrap (~> 5.2)
305 bootstrap (~> 5.2)
307 byebug
306 byebug
308 capybara
307 capybara
309 coffee-rails
308 coffee-rails
310 - dynamic_form
311 fuzzy-string-match
309 fuzzy-string-match
312 haml
310 haml
313 haml-rails
311 haml-rails
314 importmap-rails (~> 1.1)
312 importmap-rails (~> 1.1)
315 in_place_editing
313 in_place_editing
316 jbuilder
314 jbuilder
317 jquery-rails
315 jquery-rails
318 listen (>= 3.0.5, < 3.2)
316 listen (>= 3.0.5, < 3.2)
319 mail
317 mail
320 material_icons
318 material_icons
321 minitest-reporters
319 minitest-reporters
322 momentjs-rails
320 momentjs-rails
323 mysql2
321 mysql2
324 puma
322 puma
325 rails (~> 7.0)
323 rails (~> 7.0)
326 rdiscount
324 rdiscount
327 rouge
325 rouge
328 sassc-rails
326 sassc-rails
329 selenium-webdriver
327 selenium-webdriver
330 simple_form
328 simple_form
331 spring
329 spring
332 spring-watcher-listen (~> 2.0.0)
330 spring-watcher-listen (~> 2.0.0)
333 sprockets-rails
331 sprockets-rails
334 sqlite3
332 sqlite3
335 web-console (>= 3.3.0)
333 web-console (>= 3.3.0)
336 webdrivers
334 webdrivers
337
335
338 RUBY VERSION
336 RUBY VERSION
339 ruby 3.1.2p20
337 ruby 3.1.2p20
340
338
341 BUNDLED WITH
339 BUNDLED WITH
342 2.3.22
340 2.3.22
@@ -1,53 +1,61
1
1
2 .secondnavbar {
2 .secondnavbar {
3 top: 50px;
3 top: 50px;
4 }
4 }
5
5
6 +
7 + //for google material design
8 + .mi-bs {
9 + vertical-align: middle;
10 + position: relative;
11 + top: -3px;
12 + }
13 +
6 // --------------- bootstrap file upload ----------------------
14 // --------------- bootstrap file upload ----------------------
7 .btn-file {
15 .btn-file {
8 position: relative;
16 position: relative;
9 overflow: hidden;
17 overflow: hidden;
10 }
18 }
11
19
12 .btn-file input[type=file] {
20 .btn-file input[type=file] {
13 position: absolute;
21 position: absolute;
14 top: 0;
22 top: 0;
15 right: 0;
23 right: 0;
16 min-width: 100%;
24 min-width: 100%;
17 min-height: 100%;
25 min-height: 100%;
18 font-size: 100px;
26 font-size: 100px;
19 text-align: right;
27 text-align: right;
20 filter: alpha(opacity = 0);
28 filter: alpha(opacity = 0);
21 opacity: 0;
29 opacity: 0;
22 outline: none;
30 outline: none;
23 background: white;
31 background: white;
24 cursor: inherit;
32 cursor: inherit;
25 display: block;
33 display: block;
26 }
34 }
27
35
28 body {
36 body {
29 //font-size: 13px
37 //font-size: 13px
30 font-family: 'Krub', Tahoma, "sans-serif";
38 font-family: 'Krub', Tahoma, "sans-serif";
31 margin: 10px;
39 margin: 10px;
32 padding: 10px;
40 padding: 10px;
33 padding-top: 60px;
41 padding-top: 60px;
34 }
42 }
35
43
36 // ------------------ bootstrap sortable --------------------
44 // ------------------ bootstrap sortable --------------------
37 table.sortable th {
45 table.sortable th {
38 padding-right: 20px !important;
46 padding-right: 20px !important;
39
47
40 span.sign {
48 span.sign {
41 right: (-15px) !important;
49 right: (-15px) !important;
42 }
50 }
43
51
44 &.text-right {
52 &.text-right {
45 padding-left: 20px !important;
53 padding-left: 20px !important;
46 padding-right: 8px !important;
54 padding-right: 8px !important;
47
55
48 &:after, span.sign {
56 &:after, span.sign {
49 left: (-15px) !important;
57 left: (-15px) !important;
50 }
58 }
51 }
59 }
52 }
60 }
53
61
@@ -1,116 +1,114
1 class AnnouncementsController < ApplicationController
1 class AnnouncementsController < ApplicationController
2
2
3 before_action :admin_authorization
3 before_action :admin_authorization
4
4
5 - in_place_edit_for :announcement, :published
6 -
7 # GET /announcements
5 # GET /announcements
8 # GET /announcements.xml
6 # GET /announcements.xml
9 def index
7 def index
10 @announcements = Announcement.order(created_at: :desc)
8 @announcements = Announcement.order(created_at: :desc)
11
9
12 respond_to do |format|
10 respond_to do |format|
13 format.html # index.html.erb
11 format.html # index.html.erb
14 format.xml { render :xml => @announcements }
12 format.xml { render :xml => @announcements }
15 end
13 end
16 end
14 end
17
15
18 # GET /announcements/1
16 # GET /announcements/1
19 # GET /announcements/1.xml
17 # GET /announcements/1.xml
20 def show
18 def show
21 @announcement = Announcement.find(params[:id])
19 @announcement = Announcement.find(params[:id])
22
20
23 respond_to do |format|
21 respond_to do |format|
24 format.html # show.html.erb
22 format.html # show.html.erb
25 format.xml { render :xml => @announcement }
23 format.xml { render :xml => @announcement }
26 end
24 end
27 end
25 end
28
26
29 # GET /announcements/new
27 # GET /announcements/new
30 # GET /announcements/new.xml
28 # GET /announcements/new.xml
31 def new
29 def new
32 @announcement = Announcement.new
30 @announcement = Announcement.new
33
31
34 respond_to do |format|
32 respond_to do |format|
35 format.html # new.html.erb
33 format.html # new.html.erb
36 format.xml { render :xml => @announcement }
34 format.xml { render :xml => @announcement }
37 end
35 end
38 end
36 end
39
37
40 # GET /announcements/1/edit
38 # GET /announcements/1/edit
41 def edit
39 def edit
42 @announcement = Announcement.find(params[:id])
40 @announcement = Announcement.find(params[:id])
43 end
41 end
44
42
45 # POST /announcements
43 # POST /announcements
46 # POST /announcements.xml
44 # POST /announcements.xml
47 def create
45 def create
48 @announcement = Announcement.new(announcement_params)
46 @announcement = Announcement.new(announcement_params)
49
47
50 respond_to do |format|
48 respond_to do |format|
51 if @announcement.save
49 if @announcement.save
52 flash[:notice] = 'Announcement was successfully created.'
50 flash[:notice] = 'Announcement was successfully created.'
53 format.html { redirect_to(@announcement) }
51 format.html { redirect_to(@announcement) }
54 format.xml { render :xml => @announcement, :status => :created, :location => @announcement }
52 format.xml { render :xml => @announcement, :status => :created, :location => @announcement }
55 else
53 else
56 format.html { render :action => "new" }
54 format.html { render :action => "new" }
57 format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }
55 format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }
58 end
56 end
59 end
57 end
60 end
58 end
61
59
62 # PUT /announcements/1
60 # PUT /announcements/1
63 # PUT /announcements/1.xml
61 # PUT /announcements/1.xml
64 def update
62 def update
65 @announcement = Announcement.find(params[:id])
63 @announcement = Announcement.find(params[:id])
66
64
67 respond_to do |format|
65 respond_to do |format|
68 if @announcement.update(announcement_params)
66 if @announcement.update(announcement_params)
69 flash[:notice] = 'Announcement was successfully updated.'
67 flash[:notice] = 'Announcement was successfully updated.'
70 format.html { redirect_to(@announcement) }
68 format.html { redirect_to(@announcement) }
71 format.js {}
69 format.js {}
72 format.xml { head :ok }
70 format.xml { head :ok }
73 else
71 else
74 format.html { render :action => "edit" }
72 format.html { render :action => "edit" }
75 format.js {}
73 format.js {}
76 format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }
74 format.xml { render :xml => @announcement.errors, :status => :unprocessable_entity }
77 end
75 end
78 end
76 end
79 end
77 end
80
78
81 def toggle
79 def toggle
82 @announcement = Announcement.find(params[:id])
80 @announcement = Announcement.find(params[:id])
83 @announcement.update( published: !@announcement.published? )
81 @announcement.update( published: !@announcement.published? )
84 respond_to do |format|
82 respond_to do |format|
85 format.js { render partial: 'toggle_button',
83 format.js { render partial: 'toggle_button',
86 locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } }
84 locals: {button_id: "#announcement_toggle_#{@announcement.id}",button_on: @announcement.published? } }
87 end
85 end
88 end
86 end
89
87
90 def toggle_front
88 def toggle_front
91 @announcement = Announcement.find(params[:id])
89 @announcement = Announcement.find(params[:id])
92 - @announcement.update_attributes( frontpage: !@announcement.frontpage? )
90 + @announcement.update( frontpage: !@announcement.frontpage? )
93 respond_to do |format|
91 respond_to do |format|
94 format.js { render partial: 'toggle_button',
92 format.js { render partial: 'toggle_button',
95 locals: {button_id: "#announcement_toggle_front_#{@announcement.id}",button_on: @announcement.frontpage? } }
93 locals: {button_id: "#announcement_toggle_front_#{@announcement.id}",button_on: @announcement.frontpage? } }
96 end
94 end
97 end
95 end
98
96
99 # DELETE /announcements/1
97 # DELETE /announcements/1
100 # DELETE /announcements/1.xml
98 # DELETE /announcements/1.xml
101 def destroy
99 def destroy
102 @announcement = Announcement.find(params[:id])
100 @announcement = Announcement.find(params[:id])
103 @announcement.destroy
101 @announcement.destroy
104
102
105 respond_to do |format|
103 respond_to do |format|
106 format.html { redirect_to(announcements_url) }
104 format.html { redirect_to(announcements_url) }
107 format.xml { head :ok }
105 format.xml { head :ok }
108 end
106 end
109 end
107 end
110
108
111 private
109 private
112
110
113 def announcement_params
111 def announcement_params
114 params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only, :title, :on_nav_bar)
112 params.require(:announcement).permit(:author, :body, :published, :frontpage, :contest_only, :title, :on_nav_bar)
115 end
113 end
116 end
114 end
@@ -1,59 +1,55
1 class ProblemsController < ApplicationController
1 class ProblemsController < ApplicationController
2
2
3 before_action :admin_authorization, except: [:stat]
3 before_action :admin_authorization, except: [:stat]
4 before_action only: [:stat] do
4 before_action only: [:stat] do
5 authorization_by_roles(['admin','ta'])
5 authorization_by_roles(['admin','ta'])
6 end
6 end
7
7
8 - in_place_edit_for :problem, :name
9 - in_place_edit_for :problem, :full_name
10 - in_place_edit_for :problem, :full_score
11 -
12 def index
8 def index
13 @problems = Problem.order(date_added: :desc)
9 @problems = Problem.order(date_added: :desc)
14 end
10 end
15
11
16
12
17 def show
13 def show
18 @problem = Problem.find(params[:id])
14 @problem = Problem.find(params[:id])
19 end
15 end
20
16
21 def new
17 def new
22 @problem = Problem.new
18 @problem = Problem.new
23 @description = nil
19 @description = nil
24 end
20 end
25
21
26 def create
22 def create
27 @problem = Problem.new(problem_params)
23 @problem = Problem.new(problem_params)
28 @description = Description.new(description_params)
24 @description = Description.new(description_params)
29 if @description.body!=''
25 if @description.body!=''
30 if !@description.save
26 if !@description.save
31 render :action => new and return
27 render :action => new and return
32 end
28 end
33 else
29 else
34 @description = nil
30 @description = nil
35 end
31 end
36 @problem.description = @description
32 @problem.description = @description
37 if @problem.save
33 if @problem.save
38 flash[:notice] = 'Problem was successfully created.'
34 flash[:notice] = 'Problem was successfully created.'
39 redirect_to action: :index
35 redirect_to action: :index
40 else
36 else
41 render :action => 'new'
37 render :action => 'new'
42 end
38 end
43 end
39 end
44
40
45 def quick_create
41 def quick_create
46 @problem = Problem.new(problem_params)
42 @problem = Problem.new(problem_params)
47 @problem.full_name = @problem.name if @problem.full_name == ''
43 @problem.full_name = @problem.name if @problem.full_name == ''
48 @problem.full_score = 100
44 @problem.full_score = 100
49 @problem.available = false
45 @problem.available = false
50 @problem.test_allowed = true
46 @problem.test_allowed = true
51 @problem.output_only = false
47 @problem.output_only = false
52 @problem.date_added = Time.new
48 @problem.date_added = Time.new
53 if @problem.save
49 if @problem.save
54 flash[:notice] = 'Problem was successfully created.'
50 flash[:notice] = 'Problem was successfully created.'
55 redirect_to action: :index
51 redirect_to action: :index
56 else
52 else
57 flash[:notice] = 'Error saving problem'
53 flash[:notice] = 'Error saving problem'
58 redirect_to action: :index
54 redirect_to action: :index
59 end
55 end
@@ -67,100 +67,100
67 if GraderConfiguration['right.user_hall_of_fame']
67 if GraderConfiguration['right.user_hall_of_fame']
68 append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof'
68 append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof'
69 end
69 end
70 append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help'
70 append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help'
71
71
72 if GraderConfiguration['system.user_setting_enabled']
72 if GraderConfiguration['system.user_setting_enabled']
73 append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index'
73 append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index'
74 end
74 end
75 append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login'
75 append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login'
76
76
77 menu_items.html_safe
77 menu_items.html_safe
78 end
78 end
79
79
80 def append_to(option,label, controller, action)
80 def append_to(option,label, controller, action)
81 option << ' ' if option!=''
81 option << ' ' if option!=''
82 option << link_to_unless_current(label,
82 option << link_to_unless_current(label,
83 :controller => controller,
83 :controller => controller,
84 :action => action)
84 :action => action)
85 end
85 end
86
86
87 def format_short_time(time)
87 def format_short_time(time)
88 now = Time.zone.now
88 now = Time.zone.now
89 st = ''
89 st = ''
90 if (time.yday != now.yday) or (time.year != now.year)
90 if (time.yday != now.yday) or (time.year != now.year)
91 st = time.strftime("%d/%m/%y ")
91 st = time.strftime("%d/%m/%y ")
92 end
92 end
93 st + time.strftime("%X")
93 st + time.strftime("%X")
94 end
94 end
95
95
96 def format_short_duration(duration)
96 def format_short_duration(duration)
97 return '' if duration==nil
97 return '' if duration==nil
98 d = duration.to_f
98 d = duration.to_f
99 return Time.at(d).gmtime.strftime("%X")
99 return Time.at(d).gmtime.strftime("%X")
100 end
100 end
101
101
102 def format_full_time_ago(time)
102 def format_full_time_ago(time)
103 st = time_ago_in_words(time) + ' ago (' + format_short_time(time) + ')'
103 st = time_ago_in_words(time) + ' ago (' + format_short_time(time) + ')'
104 end
104 end
105
105
106 def read_textfile(fname,max_size=2048)
106 def read_textfile(fname,max_size=2048)
107 begin
107 begin
108 File.open(fname).read(max_size)
108 File.open(fname).read(max_size)
109 rescue
109 rescue
110 nil
110 nil
111 end
111 end
112 end
112 end
113
113
114 def toggle_button(on,toggle_url,id, option={})
114 def toggle_button(on,toggle_url,id, option={})
115 - btn_size = option[:size] || 'btn-xs'
115 + btn_size = option[:size] || 'btn-sm'
116 btn_block = option[:block] || 'btn-block'
116 btn_block = option[:block] || 'btn-block'
117 link_to (on ? "Yes" : "No"), toggle_url,
117 link_to (on ? "Yes" : "No"), toggle_url,
118 - {class: "btn #{btn_block} #{btn_size} btn-#{on ? 'success' : 'default'} ajax-toggle",
118 + {class: "btn #{btn_block} #{btn_size} btn-#{on ? 'success' : 'outline-secondary'} ajax-toggle",
119 id: id,
119 id: id,
120 data: {remote: true, method: 'get'}}
120 data: {remote: true, method: 'get'}}
121 end
121 end
122
122
123 def get_ace_mode(language)
123 def get_ace_mode(language)
124 # return ace mode string from Language
124 # return ace mode string from Language
125
125
126 case language.pretty_name
126 case language.pretty_name
127 when 'Pascal'
127 when 'Pascal'
128 'ace/mode/pascal'
128 'ace/mode/pascal'
129 when 'C++','C'
129 when 'C++','C'
130 'ace/mode/c_cpp'
130 'ace/mode/c_cpp'
131 when 'Ruby'
131 when 'Ruby'
132 'ace/mode/ruby'
132 'ace/mode/ruby'
133 when 'Python'
133 when 'Python'
134 'ace/mode/python'
134 'ace/mode/python'
135 when 'Java'
135 when 'Java'
136 'ace/mode/java'
136 'ace/mode/java'
137 else
137 else
138 'ace/mode/c_cpp'
138 'ace/mode/c_cpp'
139 end
139 end
140 end
140 end
141
141
142
142
143 def user_title_bar(user)
143 def user_title_bar(user)
144 header = ''
144 header = ''
145 time_left = ''
145 time_left = ''
146
146
147 #
147 #
148 # if the contest is over
148 # if the contest is over
149 if GraderConfiguration.time_limit_mode?
149 if GraderConfiguration.time_limit_mode?
150 if user.contest_finished?
150 if user.contest_finished?
151 header = <<CONTEST_OVER
151 header = <<CONTEST_OVER
152 <tr><td colspan="2" align="center">
152 <tr><td colspan="2" align="center">
153 <span class="contest-over-msg">THE CONTEST IS OVER</span>
153 <span class="contest-over-msg">THE CONTEST IS OVER</span>
154 </td></tr>
154 </td></tr>
155 CONTEST_OVER
155 CONTEST_OVER
156 end
156 end
157 if !user.contest_started?
157 if !user.contest_started?
158 time_left = "&nbsp;&nbsp;" + (t 'title_bar.contest_not_started')
158 time_left = "&nbsp;&nbsp;" + (t 'title_bar.contest_not_started')
159 else
159 else
160 time_left = "&nbsp;&nbsp;" + (t 'title_bar.remaining_time') +
160 time_left = "&nbsp;&nbsp;" + (t 'title_bar.remaining_time') +
161 " #{format_short_duration(user.contest_time_left)}"
161 " #{format_short_duration(user.contest_time_left)}"
162 end
162 end
163 end
163 end
164
164
165 #
165 #
166 # if the contest is in the anaysis mode
166 # if the contest is in the anaysis mode
@@ -1,45 +1,6
1 %h1 Edit Announcement
1 %h1 Edit Announcement
2
2
3 -content_for(:form_buttons) do
3 -content_for(:form_buttons) do
4 = link_to t(:back), announcements_path, class: 'card-link btn btn-secondary'
4 = link_to t(:back), announcements_path, class: 'card-link btn btn-secondary'
5
5
6 = render 'form'
6 = render 'form'
7 - -# old style
8 - .container-fluid
9 - %h1 Editing announcement
10 - = error_messages_for :announcement
11 - .row
12 - .col-md-6
13 - = form_for(@announcement) do |f|
14 - .form-group
15 - %label Title
16 - = f.text_field :title, class: 'form-control'
17 - .form-group
18 - %label Notes
19 - (shown internally, used to organize announcements)
20 - = f.text_field :notes, class: 'form-control'
21 - .form-group
22 - %label Body
23 - = f.text_area :body, class: 'form-control', style: 'height: 200px;'
24 - .form-group
25 - %label Author
26 - = f.text_field :author, class: 'form-control'
27 - .checkbox
28 - %label
29 - = f.check_box :published
30 - Published
31 - .checkbox
32 - %label
33 - = f.check_box :frontpage
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,7 +1,7
1 :plain
1 :plain
2 var t = $("#{button_id}");
2 var t = $("#{button_id}");
3 - t.removeClass('btn-default');
3 + t.removeClass('btn-outline-secondary');
4 t.removeClass('btn-success');
4 t.removeClass('btn-success');
5 t.removeClass('btn-warning');
5 t.removeClass('btn-warning');
6 - t.addClass("btn-#{button_on ? 'success' : 'default'}");
6 + t.addClass("btn-#{button_on ? 'success' : 'outline-secondary'}");
7 t.text("#{button_on ? 'Yes' : 'No'}");
7 t.text("#{button_on ? 'Yes' : 'No'}");
@@ -1,87 +1,87
1 %header
1 %header
2 %nav.navbar.fixed-top.navbar-dark.bg-primary.navbar-expand-lg
2 %nav.navbar.fixed-top.navbar-dark.bg-primary.navbar-expand-lg
3 .container-fluid
3 .container-fluid
4 %a.navbar-brand{href: list_main_path}
4 %a.navbar-brand{href: list_main_path}
5 - %span.glyphicon.glyphicon-home
5 + %span.mi.mi-bs home
6 MAIN
6 MAIN
7 %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} }
7 %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} }
8 %span.navbar-toggler-icon
8 %span.navbar-toggler-icon
9 .collapse.navbar-collapse#navbar-collapse
9 .collapse.navbar-collapse#navbar-collapse
10 %ul.navbar-nav.me-auto.mb-2.mb-lg-0
10 %ul.navbar-nav.me-auto.mb-2.mb-lg-0
11 / submission
11 / submission
12 - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user))
12 - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user))
13 %li.nav-item.dropdown.mx-2
13 %li.nav-item.dropdown.mx-2
14 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"}
14 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"}
15 = "#{I18n.t 'menu.submissions'}"
15 = "#{I18n.t 'menu.submissions'}"
16 %ul.dropdown-menu
16 %ul.dropdown-menu
17 %li= link_to 'View', submissions_path, class:'dropdown-item'
17 %li= link_to 'View', submissions_path, class:'dropdown-item'
18 %li= link_to 'Self Test', test_index_path, class:'dropdown-item'
18 %li= link_to 'Self Test', test_index_path, class:'dropdown-item'
19 / hall of fame
19 / hall of fame
20 - if GraderConfiguration['right.user_hall_of_fame']
20 - if GraderConfiguration['right.user_hall_of_fame']
21 %li= link_to "#{I18n.t 'menu.hall_of_fame'}", problem_hof_report_path, class: 'nav-link mx-2'
21 %li= link_to "#{I18n.t 'menu.hall_of_fame'}", problem_hof_report_path, class: 'nav-link mx-2'
22 / display MODE button (with countdown in contest mode)
22 / display MODE button (with countdown in contest mode)
23 - if GraderConfiguration.analysis_mode?
23 - if GraderConfiguration.analysis_mode?
24 %div.btn.btn-success#countdown= "ANALYSIS MODE"
24 %div.btn.btn-success#countdown= "ANALYSIS MODE"
25 - elsif GraderConfiguration.time_limit_mode?
25 - elsif GraderConfiguration.time_limit_mode?
26 - if @current_user.contest_finished?
26 - if @current_user.contest_finished?
27 %div.btn.btn-danger#countdown= "Contest is over"
27 %div.btn.btn-danger#countdown= "Contest is over"
28 - elsif !@current_user.contest_started?
28 - elsif !@current_user.contest_started?
29 %div.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
29 %div.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
30 - else
30 - else
31 %div.btn.btn-primary#countdown asdf
31 %div.btn.btn-primary#countdown asdf
32 :javascript
32 :javascript
33 $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'});
33 $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'});
34 / admin section
34 / admin section
35 - if (@current_user!=nil) and (session[:admin])
35 - if (@current_user!=nil) and (session[:admin])
36 / management
36 / management
37 %li.nav-item.dropdown.mx-2
37 %li.nav-item.dropdown.mx-2
38 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
38 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
39 Manage
39 Manage
40 %ul.dropdown-menu
40 %ul.dropdown-menu
41 %li= link_to 'Announcements', announcements_path, class: 'dropdown-item'
41 %li= link_to 'Announcements', announcements_path, class: 'dropdown-item'
42 %li= link_to 'Problems', problems_path, class: 'dropdown-item'
42 %li= link_to 'Problems', problems_path, class: 'dropdown-item'
43 %li= link_to 'Tags', tags_path, class: 'dropdown-item'
43 %li= link_to 'Tags', tags_path, class: 'dropdown-item'
44 %li= link_to 'Users', user_admin_index_path, class: 'dropdown-item'
44 %li= link_to 'Users', user_admin_index_path, class: 'dropdown-item'
45 %li= link_to 'User Groups', groups_path, class: 'dropdown-item'
45 %li= link_to 'User Groups', groups_path, class: 'dropdown-item'
46 %li= link_to 'Graders', graders_list_path, class: 'dropdown-item'
46 %li= link_to 'Graders', graders_list_path, class: 'dropdown-item'
47 %li= link_to 'Message ', console_messages_path, class: 'dropdown-item'
47 %li= link_to 'Message ', console_messages_path, class: 'dropdown-item'
48 %li
48 %li
49 %hr.dropdown-divider
49 %hr.dropdown-divider
50 %li= link_to 'System config', grader_configuration_index_path, class: 'dropdown-item'
50 %li= link_to 'System config', grader_configuration_index_path, class: 'dropdown-item'
51 %li
51 %li
52 %hr.dropdown-divider
52 %hr.dropdown-divider
53 %li= link_to 'Sites', sites_path, class: 'dropdown-item'
53 %li= link_to 'Sites', sites_path, class: 'dropdown-item'
54 %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item'
54 %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item'
55 -#
55 -#
56 / report
56 / report
57 %li.nav-item.dropdown.mx-2
57 %li.nav-item.dropdown.mx-2
58 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
58 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
59 Report
59 Report
60 %ul.dropdown-menu
60 %ul.dropdown-menu
61 %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item'
61 %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item'
62 %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item'
62 %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item'
63 %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item'
63 %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item'
64 %li= link_to 'Login Report', login_report_path, class: 'dropdown-item'
64 %li= link_to 'Login Report', login_report_path, class: 'dropdown-item'
65 - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0
65 - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0
66 =link_to "#{ungraded} backlogs!",
66 =link_to "#{ungraded} backlogs!",
67 graders_list_path,
67 graders_list_path,
68 class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission'
68 class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission'
69 / announcement
69 / announcement
70 - @nav_announcement.each do |ann|
70 - @nav_announcement.each do |ann|
71 %p.navbar-text
71 %p.navbar-text
72 = ann.body.html_safe
72 = ann.body.html_safe
73 %ul.navbar-nav
73 %ul.navbar-nav
74 %li.nav-item
74 %li.nav-item
75 %a.nav-link{href: help_main_path}
75 %a.nav-link{href: help_main_path}
76 - %span.mi.md-18 help
76 + %span.mi.mi-bs.md-18 help
77 %li.nav-item
77 %li.nav-item
78 %a.nav-link{href: messages_path}
78 %a.nav-link{href: messages_path}
79 - %span.mi.md-18 chat
79 + %span.mi.mi-bs.md-18 chat
80 - if GraderConfiguration['system.user_setting_enabled']
80 - if GraderConfiguration['system.user_setting_enabled']
81 %li.nav-item
81 %li.nav-item
82 %a.nav-link{href: profile_users_path}
82 %a.nav-link{href: profile_users_path}
83 - %span.mi.md-18 settings
83 + %span.mi.mi-bs.md-18 settings
84 %li.nav-item
84 %li.nav-item
85 %a.nav-link{href: login_main_path}
85 %a.nav-link{href: login_main_path}
86 - %span.mi.md-18 exit_to_app
86 + %span.mi.mi-bs.md-18 exit_to_app
87 = @current_user.full_name
87 = @current_user.full_name
@@ -1,19 +1,19
1 = form_with url: submit_main_path, multipart: true, class: 'form' do |form|
1 = form_with url: submit_main_path, multipart: true, class: 'form' do |form|
2 - if @submission and @submission.errors.any?
2 - if @submission and @submission.errors.any?
3 #error_explanation
3 #error_explanation
4 .alert.alert-danger
4 .alert.alert-danger
5 %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:"
5 %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:"
6 %ul
6 %ul
7 - @submission.errors.full_messages.each do |msg|
7 - @submission.errors.full_messages.each do |msg|
8 %li= msg
8 %li= msg
9 .row.mb-2
9 .row.mb-2
10 .col-sm-2
10 .col-sm-2
11 - = form.label :submission, 'Problem:', class: 'form-label'
11 + = form.label :submission, 'Problem:', class: 'col-form-label'
12 .col-sm-10
12 .col-sm-10
13 = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control', style: "width: 100%" }
13 = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control', style: "width: 100%" }
14 .row.mb-2
14 .row.mb-2
15 .col-sm-2
15 .col-sm-2
16 - = form.label :file, 'File:', class: 'form-label'
16 + = form.label :file, 'File:', class: 'col-form-label'
17 .col-sm-10
17 .col-sm-10
18 = form.file_field :file, class: 'form-control'
18 = form.file_field :file, class: 'form-control'
19 = form.submit 'Submit', class: 'btn btn-primary'
19 = form.submit 'Submit', class: 'btn btn-primary'
@@ -1,65 +1,65
1 - content_for :head do
1 - content_for :head do
2 = stylesheet_link_tag 'problems'
2 = stylesheet_link_tag 'problems'
3 %h1 Problems
3 %h1 Problems
4 %p
4 %p
5 = link_to 'Import problems', {:action => 'import'}, class: 'btn btn-success btn-sm'
5 = link_to 'Import problems', {:action => 'import'}, class: 'btn btn-success btn-sm'
6 = link_to 'New problem', new_problem_path, class: 'btn btn-success btn-sm'
6 = link_to 'New problem', new_problem_path, class: 'btn btn-success btn-sm'
7 = link_to 'Bulk Manage', { action: 'manage'}, class: 'btn btn-info btn-sm'
7 = link_to 'Bulk Manage', { action: 'manage'}, class: 'btn btn-info btn-sm'
8 = link_to 'Turn off all problems', {:action => 'turn_all_off'}, class: 'btn btn-default btn-sm'
8 = link_to 'Turn off all problems', {:action => 'turn_all_off'}, class: 'btn btn-default btn-sm'
9 = link_to 'Turn on all problems', {:action => 'turn_all_on'}, class: 'btn btn-default btn-sm'
9 = link_to 'Turn on all problems', {:action => 'turn_all_on'}, class: 'btn btn-default btn-sm'
10 .submitbox
10 .submitbox
11 = form_tag action: 'quick_create', controller: 'problems' do
11 = form_tag action: 'quick_create', controller: 'problems' do
12 %b Quick New:
12 %b Quick New:
13 %label{:for => "problem_name"} Name
13 %label{:for => "problem_name"} Name
14 = text_field 'problem', 'name'
14 = text_field 'problem', 'name'
15 |
15 |
16 %label{:for => "problem_full_name"} Full name
16 %label{:for => "problem_full_name"} Full name
17 = text_field 'problem', 'full_name'
17 = text_field 'problem', 'full_name'
18 = submit_tag "Create"
18 = submit_tag "Create"
19 %table.table.table-condense.table-hover
19 %table.table.table-condense.table-hover
20 %thead
20 %thead
21 %th Name
21 %th Name
22 %th Full name
22 %th Full name
23 %th.text-right Full score
23 %th.text-right Full score
24 %th Tags
24 %th Tags
25 %th
25 %th
26 Submit
26 Submit
27 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Admin can always submit to any problem' } [?]
27 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Admin can always submit to any problem' } [?]
28 %th Date added
28 %th Date added
29 %th.text-center
29 %th.text-center
30 Avail?
30 Avail?
31 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user submits to this problem?' } [?]
31 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user submits to this problem?' } [?]
32 %th.text-center
32 %th.text-center
33 View Data?
33 View Data?
34 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user view the testcase of this problem?' } [?]
34 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user view the testcase of this problem?' } [?]
35 %th.text-center
35 %th.text-center
36 Test?
36 Test?
37 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user uses test interface on this problem?' } [?]
37 %sup{class: 'text-primary',data: {toggle: 'tooltip'}, title: 'Let user uses test interface on this problem?' } [?]
38 - if GraderConfiguration.multicontests?
38 - if GraderConfiguration.multicontests?
39 %th Contests
39 %th Contests
40 - for problem in @problems
40 - for problem in @problems
41 - %tr{:class => "#{(problem.available) ? "success" : "danger"}", :id => "prob-#{problem.id}", :name => "prob-#{problem.id}"}
41 + %tr{:class => "#{(problem.available) ? "bg-success bg-opacity-25" : "bg-opacity-25"}", :id => "prob-#{problem.id}", :name => "prob-#{problem.id}"}
42 - @problem=problem
42 - @problem=problem
43 %td= problem.name #in_place_editor_field :problem, :name, {}, :rows=>1
43 %td= problem.name #in_place_editor_field :problem, :name, {}, :rows=>1
44 %td
44 %td
45 = problem.full_name #in_place_editor_field :problem, :full_name, {}, :rows=>1
45 = problem.full_name #in_place_editor_field :problem, :full_name, {}, :rows=>1
46 = link_to_description_if_any "[#{t 'main.problem_desc'}] <span class='glyphicon glyphicon-file'></span>".html_safe, problem
46 = link_to_description_if_any "[#{t 'main.problem_desc'}] <span class='glyphicon glyphicon-file'></span>".html_safe, problem
47 %td.text-right= problem.full_score #in_place_editor_field :problem, :full_score, {}, :rows=>1
47 %td.text-right= problem.full_score #in_place_editor_field :problem, :full_score, {}, :rows=>1
48 %td
48 %td
49 - problem.tags.each do |t|
49 - problem.tags.each do |t|
50 - - #%button.btn.btn-default.btn-xs= t.name
50 + - #%button.btn.btn-default.btn-sm= t.name
51 %span.label.label-default= t.name
51 %span.label.label-default= t.name
52 - %td= link_to "Submit", direct_edit_problem_submissions_path(problem,@current_user.id), class: 'btn btn-xs btn-primary'
52 + %td= link_to "Submit", direct_edit_problem_submissions_path(problem,@current_user.id), class: 'btn btn-sm btn-primary'
53 %td= problem.date_added
53 %td= problem.date_added
54 %td= toggle_button(@problem.available?, toggle_problem_path(@problem), "problem-avail-#{@problem.id}")
54 %td= toggle_button(@problem.available?, toggle_problem_path(@problem), "problem-avail-#{@problem.id}")
55 %td= toggle_button(@problem.view_testcase?, toggle_view_testcase_problem_path(@problem), "problem-view-testcase-#{@problem.id}")
55 %td= toggle_button(@problem.view_testcase?, toggle_view_testcase_problem_path(@problem), "problem-view-testcase-#{@problem.id}")
56 %td= toggle_button(@problem.test_allowed?, toggle_test_problem_path(@problem), "problem-test-#{@problem.id}")
56 %td= toggle_button(@problem.test_allowed?, toggle_test_problem_path(@problem), "problem-test-#{@problem.id}")
57 - if GraderConfiguration.multicontests?
57 - if GraderConfiguration.multicontests?
58 %td
58 %td
59 = problem.contests.collect { |c| c.name }.join(', ')
59 = problem.contests.collect { |c| c.name }.join(', ')
60 - %td= link_to 'Stat', {:action => 'stat', :id => problem.id}, class: 'btn btn-info btn-xs btn-block'
60 + %td= link_to 'Stat', {:action => 'stat', :id => problem.id}, class: 'btn btn-info btn-sm btn-block'
61 - %td= link_to 'Show', {:action => 'show', :id => problem}, class: 'btn btn-info btn-xs btn-block'
61 + %td= link_to 'Show', {:action => 'show', :id => problem}, class: 'btn btn-info btn-sm btn-block'
62 - %td= link_to 'Edit', {:action => 'edit', :id => problem}, class: 'btn btn-info btn-xs btn-block'
62 + %td= link_to 'Edit', {:action => 'edit', :id => problem}, class: 'btn btn-info btn-sm btn-block'
63 - %td= link_to 'Destroy', { :action => 'destroy', :id => problem }, :confirm => 'Are you sure?', :method => :delete, class: 'btn btn-danger btn-xs btn-block'
63 + %td= link_to 'Destroy', { :action => 'destroy', :id => problem }, :confirm => 'Are you sure?', :method => :delete, class: 'btn btn-danger btn-sm btn-block'
64 %br/
64 %br/
65 = link_to '[New problem]', :action => 'new'
65 = link_to '[New problem]', :action => 'new'
@@ -1,8 +1,8
1 = render partial: 'toggle_button',
1 = render partial: 'toggle_button',
2 locals: {button_id: "#problem-avail-#{@problem.id}",button_on: @problem.available }
2 locals: {button_id: "#problem-avail-#{@problem.id}",button_on: @problem.available }
3 :plain
3 :plain
4 r = $("#prob-#{@problem.id}");
4 r = $("#prob-#{@problem.id}");
5 - r.removeClass('success');
5 + r.removeClass('bg-success');
6 - r.removeClass('danger');
6 + r.removeClass('bg-danger');
7 - r.addClass("#{@problem.available? ? 'success' : 'danger'}");
7 + r.addClass("#{@problem.available? ? 'bg-success' : 'bg-danger-'}");
8
8
@@ -1,25 +1,25
1 %h1 Test cases
1 %h1 Test cases
2 %h2= @problem.long_name
2 %h2= @problem.long_name
3
3
4 /navbar
4 /navbar
5 %ul.nav.nav-pills{role: :tablist}
5 %ul.nav.nav-pills{role: :tablist}
6 - @problem.testcases.each.with_index do |tc,id|
6 - @problem.testcases.each.with_index do |tc,id|
7 - %li{role: :presentation, class: ('active' if id == 0)}
7 + %li.nav-item{role: :presentation, class: ('active' if id == 0)}
8 - %a{href:"#tc#{tc.id}", role: 'tab', data: {toggle: 'tab'}}= tc.num
8 + %a.nav-link{href:"#tc#{tc.id}", role: 'tab', 'data-bs': {toggle: 'tab', target: "#tc#{tc.id}"}}= tc.num
9
9
10 /actual data
10 /actual data
11 .tab-content
11 .tab-content
12 - @problem.testcases.each.with_index do |tc,id|
12 - @problem.testcases.each.with_index do |tc,id|
13 .tab-pane{id: "tc#{tc.id}",class: ('active' if id == 0)}
13 .tab-pane{id: "tc#{tc.id}",class: ('active' if id == 0)}
14 .row
14 .row
15 .col-md-6
15 .col-md-6
16 %h3 Input
16 %h3 Input
17 = link_to "Download",download_input_testcase_path(tc),class: 'btn btn-info btn-sm'
17 = link_to "Download",download_input_testcase_path(tc),class: 'btn btn-info btn-sm'
18 .col-md-6
18 .col-md-6
19 %h3 Output
19 %h3 Output
20 = link_to "Download",download_sol_testcase_path(tc),class: 'btn btn-info btn-sm'
20 = link_to "Download",download_sol_testcase_path(tc),class: 'btn btn-info btn-sm'
21 .row
21 .row
22 .col-md-6
22 .col-md-6
23 %textarea{ rows: 25,readonly: true,style: "width:100%;resize=none;overflow-y: scroll;"}= tc.input
23 %textarea{ rows: 25,readonly: true,style: "width:100%;resize=none;overflow-y: scroll;"}= tc.input
24 .col-md-6
24 .col-md-6
25 %textarea{ rows: 25,readonly: true,style: "width:100%;resize=none;overflow-y: scroll;"}= tc.sol
25 %textarea{ rows: 25,readonly: true,style: "width:100%;resize=none;overflow-y: scroll;"}= tc.sol
You need to be logged in to leave comments. Login now