Description:
DRY problem select
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r874:8ff5fd21c79c - - 12 files changed: 185 inserted, 160 deleted
@@ -0,0 +1,23 | |||||
|
|
1 | + .card.border-info.mb-2 | ||
|
|
2 | + .card-header.text-bg-info.border-info | ||
|
|
3 | + Select a Task | ||
|
|
4 | + .card-body | ||
|
|
5 | + .row | ||
|
|
6 | + .col-6 | ||
|
|
7 | + = select 'submission', | ||
|
|
8 | + 'problem_id', | ||
|
|
9 | + problems.collect {|p| ["[#{p.name}] #{p.full_name}", send(target_url_method,p.id)]}, | ||
|
|
10 | + { selected: (selected_problem ? problem_submissions_url(selected_problem) : -1) }, | ||
|
|
11 | + { class: 'select2 form-control'} | ||
|
|
12 | + .col-6 | ||
|
|
13 | + %a.btn.btn-primary.go-button#problem_go{data: {source: '#submission_problem_id'}} Go | ||
|
|
14 | + :javascript | ||
|
|
15 | + $(".go-button").on('click', function(event) { | ||
|
|
16 | + var link, url; | ||
|
|
17 | + link = $(this).attr("data-source"); | ||
|
|
18 | + url = $(link).val(); | ||
|
|
19 | + if (url) { | ||
|
|
20 | + window.location.href = url; | ||
|
|
21 | + } | ||
|
|
22 | + }); | ||
|
|
23 | + |
@@ -9,7 +9,6 | |||||
|
9 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] |
|
9 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] |
|
10 | gem "sprockets-rails" |
|
10 | gem "sprockets-rails" |
|
11 |
|
11 | ||
|
12 | - gem 'activerecord-session_store' |
|
||
|
13 | gem 'puma' |
|
12 | gem 'puma' |
|
14 |
|
13 | ||
|
15 | # Reduces boot times through caching; required in config/boot.rb |
|
14 | # Reduces boot times through caching; required in config/boot.rb |
@@ -66,12 +66,6 | |||||
|
66 | activerecord (7.0.4) |
|
66 | activerecord (7.0.4) |
|
67 | activemodel (= 7.0.4) |
|
67 | activemodel (= 7.0.4) |
|
68 | activesupport (= 7.0.4) |
|
68 | activesupport (= 7.0.4) |
|
69 | - activerecord-session_store (2.0.0) |
|
||
|
70 | - actionpack (>= 5.2.4.1) |
|
||
|
71 | - activerecord (>= 5.2.4.1) |
|
||
|
72 | - multi_json (~> 1.11, >= 1.11.2) |
|
||
|
73 | - rack (>= 2.0.8, < 3) |
|
||
|
74 | - railties (>= 5.2.4.1) |
|
||
|
75 | activestorage (7.0.4) |
|
69 | activestorage (7.0.4) |
|
76 | actionpack (= 7.0.4) |
|
70 | actionpack (= 7.0.4) |
|
77 | activejob (= 7.0.4) |
|
71 | activejob (= 7.0.4) |
@@ -145,7 +139,6 | |||||
|
145 | importmap-rails (1.1.5) |
|
139 | importmap-rails (1.1.5) |
|
146 | actionpack (>= 6.0.0) |
|
140 | actionpack (>= 6.0.0) |
|
147 | railties (>= 6.0.0) |
|
141 | railties (>= 6.0.0) |
|
148 | - in_place_editing (1.2.0) |
|
||
|
149 | jbuilder (2.11.5) |
|
142 | jbuilder (2.11.5) |
|
150 | actionview (>= 5.0.0) |
|
143 | actionview (>= 5.0.0) |
|
151 | activesupport (>= 5.0.0) |
|
144 | activesupport (>= 5.0.0) |
@@ -176,7 +169,6 | |||||
|
176 | momentjs-rails (2.29.4.1) |
|
169 | momentjs-rails (2.29.4.1) |
|
177 | railties (>= 3.1) |
|
170 | railties (>= 3.1) |
|
178 | msgpack (1.5.6) |
|
171 | msgpack (1.5.6) |
|
179 | - multi_json (1.15.0) |
|
||
|
180 | mysql2 (0.5.4) |
|
172 | mysql2 (0.5.4) |
|
181 | net-imap (0.2.3) |
|
173 | net-imap (0.2.3) |
|
182 | digest |
|
174 | digest |
@@ -299,7 +291,6 | |||||
|
299 |
|
291 | ||
|
300 | DEPENDENCIES |
|
292 | DEPENDENCIES |
|
301 | ace-rails-ap |
|
293 | ace-rails-ap |
|
302 | - activerecord-session_store |
|
||
|
303 | best_in_place! |
|
294 | best_in_place! |
|
304 | bootsnap |
|
295 | bootsnap |
|
305 | bootstrap (~> 5.2) |
|
296 | bootstrap (~> 5.2) |
@@ -310,7 +301,6 | |||||
|
310 | haml |
|
301 | haml |
|
311 | haml-rails |
|
302 | haml-rails |
|
312 | importmap-rails (~> 1.1) |
|
303 | importmap-rails (~> 1.1) |
|
313 | - in_place_editing |
|
||
|
314 | jbuilder |
|
304 | jbuilder |
|
315 | jquery-rails |
|
305 | jquery-rails |
|
316 | listen (>= 3.0.5, < 3.2) |
|
306 | listen (>= 3.0.5, < 3.2) |
@@ -26,14 +26,6 | |||||
|
26 | } |
|
26 | } |
|
27 | } |
|
27 | } |
|
28 | }); |
|
28 | }); |
|
29 | - $(".go-button").on('click', function(event) { |
|
||
|
30 | - var link, url; |
|
||
|
31 | - link = $(this).attr("data-source"); |
|
||
|
32 | - url = $(link).val(); |
|
||
|
33 | - if (url) { |
|
||
|
34 | - window.location.href = url; |
|
||
|
35 | - } |
|
||
|
36 | - }); |
|
||
|
37 | $('.ajax-toggle').on('click', function(event) { |
|
29 | $('.ajax-toggle').on('click', function(event) { |
|
38 | var target; |
|
30 | var target; |
|
39 | target = $(event.target); |
|
31 | target = $(event.target); |
@@ -29,5 +29,6 | |||||
|
29 | = render 'layouts/header' |
|
29 | = render 'layouts/header' |
|
30 |
|
30 | ||
|
31 | /= content_tag(:p,flash[:notice],class: 'alert alert-success') if flash[:notice]!=nil |
|
31 | /= content_tag(:p,flash[:notice],class: 'alert alert-success') if flash[:notice]!=nil |
|
32 | - = flash_messages |
|
32 | + .container-fluid |
|
33 | - = yield |
|
33 | + = flash_messages |
|
|
34 | + = yield |
@@ -1,43 +1,88 | |||||
|
1 | - %b= GraderConfiguration['ui.front.welcome_message'] |
|
1 | + |
|
2 | - %br/ |
|
2 | + .card |
|
|
3 | + .card-body | ||
|
|
4 | + .card-title | ||
|
|
5 | + %h3= GraderConfiguration['ui.front.welcome_message'] | ||
|
|
6 | + - if !@hidelogin | ||
|
|
7 | + .card-subtitle=t 'login.message' | ||
|
|
8 | + | ||
|
|
9 | + - if flash[:notice] | ||
|
|
10 | + %hr/ | ||
|
|
11 | + %b= flash[:notice] | ||
|
|
12 | + %hr/ | ||
|
3 |
|
13 | ||
|
4 | - - if !@hidelogin |
|
14 | + .card |
|
5 | - =t 'login.message' |
|
15 | + .card-body{ style: "background: #eeeeff;"} |
|
6 | - %br/ |
|
16 | + = form_with url: login_login_path do |f| |
|
|
17 | + .mb-3 | ||
|
|
18 | + = f.label :login, "Login", class: 'form-label' | ||
|
|
19 | + = f.text_field :login, class: 'form-control' | ||
|
|
20 | + .mb-3 | ||
|
|
21 | + = f.label :password, "Password", class: 'form-label' | ||
|
|
22 | + = f.password_field :password, class: 'form-control' | ||
|
|
23 | + - unless GraderConfiguration['right.bypass_agreement'] | ||
|
|
24 | + .col-sm-offset-3.col-sm-9 | ||
|
|
25 | + .checkbox | ||
|
|
26 | + %label | ||
|
|
27 | + = check_box_tag 'accept_agree' | ||
|
|
28 | + ΰΈ’ΰΈΰΈ‘ΰΈ£ΰΈ±ΰΈΰΈΰΉΰΈΰΈΰΈΰΈ₯ΰΈΰΈΰΈ²ΰΈ£ΰΉΰΈΰΉΰΈΰΈ²ΰΈ | ||
|
|
29 | + .mb-3 | ||
|
|
30 | + .col-sm-offset-3.col-sm-9 | ||
|
|
31 | + = submit_tag t('login.login_submit'), class: 'btn btn-primary' | ||
|
|
32 | + - else | ||
|
|
33 | + Login is not possible right now | ||
|
|
34 | + | ||
|
|
35 | + %br/ | ||
|
|
36 | + | ||
|
|
37 | + - if GraderConfiguration['system.online_registration'] | ||
|
|
38 | + =t 'login.participation' | ||
|
|
39 | + %b | ||
|
|
40 | + = "#{t 'login.please'} " | ||
|
|
41 | + = link_to "#{t 'login.register'}", :controller => :users, :action => :new | ||
|
|
42 | + %br/ | ||
|
|
43 | + = link_to "#{t 'login.forget_password'}", :controller => :users, :action => :forget | ||
|
|
44 | + -# | ||
|
7 | %br/ |
|
45 | %br/ |
|
8 |
|
46 | ||
|
9 | - - if flash[:notice] |
|
47 | + - if !@hidelogin |
|
10 | - %hr/ |
|
48 | + =t 'login.message' |
|
11 | - %b= flash[:notice] |
|
49 | + %br/ |
|
12 |
- % |
|
50 | + %br/ |
|
|
51 | + | ||
|
|
52 | + - if flash[:notice] | ||
|
|
53 | + %hr/ | ||
|
|
54 | + %b= flash[:notice] | ||
|
|
55 | + %hr/ | ||
|
13 |
|
56 | ||
|
14 | - %div{ :style => "border: solid 1px gray; padding: 4px; background: #eeeeff;"} |
|
57 | + %div{ :style => "border: solid 1px gray; padding: 4px; background: #eeeeff;"} |
|
15 | - = form_tag login_login_path, {class: 'form-horizontal'} do |
|
58 | + = form_tag login_login_path, {class: 'form-horizontal'} do |
|
16 | - .form-group |
|
59 | + .form-group |
|
17 | - =label_tag :login, "Login",class: 'col-sm-3 control-label' |
|
60 | + =label_tag :login, "Login",class: 'col-sm-3 control-label' |
|
18 | - .col-sm-9 |
|
61 | + .col-sm-9 |
|
19 | - =text_field_tag :login, nil, class: 'form-control' |
|
62 | + =text_field_tag :login, nil, class: 'form-control' |
|
20 | - .form-group |
|
63 | + .form-group |
|
21 | - =label_tag :password, "Password", class: 'col-sm-3 control-label' |
|
64 | + =label_tag :password, "Password", class: 'col-sm-3 control-label' |
|
22 | - .col-sm-9 |
|
65 | + .col-sm-9 |
|
23 | - =password_field_tag :password, nil, class: 'form-control' |
|
66 | + =password_field_tag :password, nil, class: 'form-control' |
|
24 | - - unless GraderConfiguration['right.bypass_agreement'] |
|
67 | + - unless GraderConfiguration['right.bypass_agreement'] |
|
|
68 | + .form-group | ||
|
|
69 | + .col-sm-offset-3.col-sm-9 | ||
|
|
70 | + .checkbox | ||
|
|
71 | + %label | ||
|
|
72 | + = check_box_tag 'accept_agree' | ||
|
|
73 | + ΰΈ’ΰΈΰΈ‘ΰΈ£ΰΈ±ΰΈΰΈΰΉΰΈΰΈΰΈΰΈ₯ΰΈΰΈΰΈ²ΰΈ£ΰΉΰΈΰΉΰΈΰΈ²ΰΈ | ||
|
|
74 | + | ||
|
25 | .form-group |
|
75 | .form-group |
|
26 | .col-sm-offset-3.col-sm-9 |
|
76 | .col-sm-offset-3.col-sm-9 |
|
27 | - .checkbox |
|
77 | + = submit_tag t('login.login_submit'), class: 'btn btn-primary' |
|
28 | - %label |
|
78 | + - else |
|
29 | - = check_box_tag 'accept_agree' |
|
79 | + |
|
30 | - ΰΈ’ΰΈΰΈ‘ΰΈ£ΰΈ±ΰΈΰΈΰΉΰΈΰΈΰΈΰΈ₯ΰΈΰΈΰΈ²ΰΈ£ΰΉΰΈΰΉΰΈΰΈ²ΰΈ |
|
80 | + %br/ |
|
31 |
|
81 | ||
|
32 | - .form-group |
|
82 | + - if GraderConfiguration['system.online_registration'] |
|
33 | - .col-sm-offset-3.col-sm-9 |
|
83 | + =t 'login.participation' |
|
34 | - = submit_tag t('login.login_submit'), class: 'btn btn-primary' |
|
84 | + %b |
|
35 | - %br/ |
|
85 | + = "#{t 'login.please'} " |
|
36 | - |
|
86 | + = link_to "#{t 'login.register'}", :controller => :users, :action => :new |
|
37 | - - if GraderConfiguration['system.online_registration'] |
|
87 | + %br/ |
|
38 | - =t 'login.participation' |
|
88 | + = link_to "#{t 'login.forget_password'}", :controller => :users, :action => :forget |
|
39 | - %b |
|
||
|
40 | - = "#{t 'login.please'} " |
|
||
|
41 | - = link_to "#{t 'login.register'}", :controller => :users, :action => :new |
|
||
|
42 | - %br/ |
|
||
|
43 | - = link_to "#{t 'login.forget_password'}", :controller => :users, :action => :forget |
|
@@ -24,33 +24,32 | |||||
|
24 | } |
|
24 | } |
|
25 |
|
25 | ||
|
26 |
|
26 | ||
|
27 | - .container-fluid |
|
27 | + .row.mb-3 |
|
28 | - .row |
|
28 | + .col-md-8 |
|
29 |
- .c |
|
29 | + .card |
|
30 | - .card |
|
30 | + .card-body |
|
31 | - .card-body |
|
31 | + %h2.card-title Submission History |
|
32 | - %h2.card-title Submission History |
|
32 | + %canvas#chart{height: '50px'} |
|
33 | - %canvas#chart{height: '50px'} |
|
||
|
34 |
|
33 | ||
|
35 |
- |
|
34 | + .col-md-4 |
|
36 |
- |
|
35 | + .card |
|
37 |
- |
|
36 | + .card-body |
|
38 |
- |
|
37 | + %h2.card-title General Info |
|
39 |
- |
|
38 | + .row |
|
40 |
- |
|
39 | + .col-sm-6 |
|
41 |
- |
|
40 | + Subs |
|
42 |
- |
|
41 | + .col-sm-6 |
|
43 |
- |
|
42 | + = @summary[:count] |
|
44 |
- |
|
43 | + .row |
|
45 |
- |
|
44 | + .col-sm-6 |
|
46 |
- |
|
45 | + Solved/Attempted User |
|
47 |
- |
|
46 | + .col-sm-6 |
|
48 |
- |
|
47 | + #{@summary[:solve]}/#{@summary[:attempt]} (#{(@summary[:solve]*100.0/@summary[:attempt]).round(1)}%) |
|
49 | - .row |
|
48 | + .row.mb-3 |
|
50 |
- |
|
49 | + .col-md-4 |
|
51 |
- |
|
50 | + .card |
|
52 |
- |
|
51 | + .card-body |
|
53 |
- |
|
52 | + %h2.card-title Model submission |
|
54 | %table.table.table-hover |
|
53 | %table.table.table-hover |
|
55 | %thead |
|
54 | %thead |
|
56 | %tr |
|
55 | %tr |
@@ -63,11 +62,11 | |||||
|
63 | = link_to "##{sub.id}", submission_path(sub) |
|
62 | = link_to "##{sub.id}", submission_path(sub) |
|
64 | = "(#{sub.language.pretty_name})" |
|
63 | = "(#{sub.language.pretty_name})" |
|
65 | %td= sub.user.full_name |
|
64 | %td= sub.user.full_name |
|
66 |
- |
|
65 | + .col-md-8 |
|
67 |
- |
|
66 | + - if @best |
|
68 |
- |
|
67 | + .card |
|
69 |
- |
|
68 | + .card-body |
|
70 |
- |
|
69 | + %h2.card-title Top Submissions |
|
71 | %table.table.table-hover |
|
70 | %table.table.table-hover |
|
72 | %thead |
|
71 | %thead |
|
73 | %tr |
|
72 | %tr |
@@ -5,24 +5,14 | |||||
|
5 | /- else |
|
5 | /- else |
|
6 | / %h1 All-Time Hall of Fame |
|
6 | / %h1 All-Time Hall of Fame |
|
7 |
|
7 | ||
|
8 | - .panel.panel-info |
|
8 | + .row.mb-5 |
|
9 | - .panel-heading |
|
9 | + .col-md-6 |
|
10 | - Select Task |
|
10 | + = render 'problem_chooser', {problems: @problems, selected_problem: @problem, target_url_method: :problem_hof_report_path} |
|
11 | - .panel-body |
|
||
|
12 | - .form-inline |
|
||
|
13 | - = select 'report', |
|
||
|
14 | - 'problem_id', |
|
||
|
15 | - @problems.collect {|p| ["[#{p.name}] #{p.full_name}", problem_hof_report_path(p)]}, |
|
||
|
16 | - {:selected => problem_hof_report_path(@problem)}, |
|
||
|
17 | - { class: 'select2 form-control' } |
|
||
|
18 | - %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: "#report_problem_id"}} Go |
|
||
|
19 | - |
|
||
|
20 |
|
11 | ||
|
21 | - unless params[:id] |
|
12 | - unless params[:id] |
|
22 | - /=render partial: 'all_time_hof' |
|
||
|
23 | Please select a problem. |
|
13 | Please select a problem. |
|
24 | - else |
|
14 | - else |
|
25 | - %h1 |
|
15 | + %h1.mt-3 |
|
26 | [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name} |
|
16 | [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name} |
|
27 | - if @current_user.has_role?('ta') |
|
17 | - if @current_user.has_role?('ta') |
|
28 | %a{href:stat_problem_path(@problem)} (stat) |
|
18 | %a{href:stat_problem_path(@problem)} (stat) |
@@ -1,16 +1,4 | |||||
|
1 | - .card.border-info.mb-2 |
|
1 | + = render 'problem_chooser', {problems: @problems, selected_problem: @problem, target_url_method: :problem_submissions_path} |
|
2 | - .card-header.text-bg-info.border-info |
|
||
|
3 | - Select Problems |
|
||
|
4 | - .card-body |
|
||
|
5 | - .row |
|
||
|
6 | - .col-6 |
|
||
|
7 | - = select 'submission', |
|
||
|
8 | - 'problem_id', |
|
||
|
9 | - @problems.collect {|p| ["[#{p.name}] #{p.full_name}", problem_submissions_url(p.id)]}, |
|
||
|
10 | - { selected: (@problem ? problem_submissions_url(@problem) : -1) }, |
|
||
|
11 | - { class: 'select2 form-control'} |
|
||
|
12 | - .col-6 |
|
||
|
13 | - %a.btn.btn-primary.go-button#problem_go{data: {source: '#submission_problem_id'}} Go |
|
||
|
14 |
|
2 | ||
|
15 | - if @problem!=nil |
|
3 | - if @problem!=nil |
|
16 | %h2= "Task: #{@problem.full_name} (#{@problem.name})" |
|
4 | %h2= "Task: #{@problem.full_name} (#{@problem.name})" |
@@ -1,26 +1,26 | |||||
|
1 | %h1 Users |
|
1 | %h1 Users |
|
2 |
|
2 | ||
|
3 | - .panel.panel-primary |
|
3 | + .card.border-primary |
|
4 | - .panel-title.panel-heading |
|
4 | + .card-header.text-bg-primary.border-primary |
|
5 | Quick Add |
|
5 | Quick Add |
|
6 |
- . |
|
6 | + .card-body |
|
7 | - = form_tag( {method: 'post'}, {class: 'form-inline'}) do |
|
7 | + = form_with url: 'asd', class: 'row row-cols-lg-auto g-3 align-items-center' do |f| |
|
8 |
- . |
|
8 | + .col-12 |
|
9 |
- = label |
|
9 | + = f.label 'user_login', 'Login' |
|
10 |
- = text_field |
|
10 | + = f.text_field 'login', :size => 10,class: 'form-control' |
|
11 | .form-group |
|
11 | .form-group |
|
12 |
- = label |
|
12 | + = f.label 'user_full_name', 'Full Name' |
|
13 |
- = text_field |
|
13 | + = f.text_field 'full_name', :size => 10,class: 'form-control' |
|
14 | .form-group |
|
14 | .form-group |
|
15 |
- = label |
|
15 | + = f.label 'user_password', 'Password' |
|
16 |
- = text_field |
|
16 | + = f.text_field 'password', :size => 10,class: 'form-control' |
|
17 | .form-group |
|
17 | .form-group |
|
18 |
- = label |
|
18 | + = f.label 'user_password_confirmation', 'Confirm' |
|
19 |
- = text_field |
|
19 | + = f.text_field 'password_confirmation', :size => 10,class: 'form-control' |
|
20 | .form-group |
|
20 | .form-group |
|
21 |
- = label |
|
21 | + = f.label 'user_email', 'email' |
|
22 |
- = text_field |
|
22 | + = f.text_field 'email', :size => 10,class: 'form-control' |
|
23 | - =submit_tag "Create", class: 'btn btn-primary' |
|
23 | + =submit_tag "Create", class: 'btn btn-primary align-items-bottom' |
|
24 |
|
24 | ||
|
25 | .panel.panel-primary |
|
25 | .panel.panel-primary |
|
26 | .panel-title.panel-heading |
|
26 | .panel-title.panel-heading |
@@ -2,7 +2,7 | |||||
|
2 | # |
|
2 | # |
|
3 | # Uncomment this and change the path if necessary to include your own |
|
3 | # Uncomment this and change the path if necessary to include your own |
|
4 | # components. |
|
4 | # components. |
|
5 |
- # See https://github.com/ |
|
5 | + # See https://github.com/heartcombo/simple_form#custom-components to know |
|
6 | # more about custom components. |
|
6 | # more about custom components. |
|
7 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } |
|
7 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } |
|
8 | # |
|
8 | # |
@@ -129,9 +129,6 | |||||
|
129 | # change this configuration to true. |
|
129 | # change this configuration to true. |
|
130 | config.browser_validations = false |
|
130 | config.browser_validations = false |
|
131 |
|
131 | ||
|
132 | - # Collection of methods to detect if a file type was given. |
|
||
|
133 | - # config.file_methods = [ :mounted_as, :file?, :public_filename, :attached? ] |
|
||
|
134 | - |
|
||
|
135 | # Custom mappings for input types. This should be a hash containing a regexp |
|
132 | # Custom mappings for input types. This should be a hash containing a regexp |
|
136 | # to match as key, and the input type that will be used when the field name |
|
133 | # to match as key, and the input type that will be used when the field name |
|
137 | # matches the regexp as value. |
|
134 | # matches the regexp as value. |
@@ -4,11 +4,11 | |||||
|
4 | # This generator is maintained by the community around simple_form-bootstrap: |
|
4 | # This generator is maintained by the community around simple_form-bootstrap: |
|
5 | # https://github.com/rafaelfranca/simple_form-bootstrap |
|
5 | # https://github.com/rafaelfranca/simple_form-bootstrap |
|
6 | # All future development, tests, and organization should happen there. |
|
6 | # All future development, tests, and organization should happen there. |
|
7 |
- # Background history: https://github.com/ |
|
7 | + # Background history: https://github.com/heartcombo/simple_form/issues/1561 |
|
8 |
|
8 | ||
|
9 | # Uncomment this and change the path if necessary to include your own |
|
9 | # Uncomment this and change the path if necessary to include your own |
|
10 | # components. |
|
10 | # components. |
|
11 |
- # See https://github.com/ |
|
11 | + # See https://github.com/heartcombo/simple_form#custom-components |
|
12 | # to know more about custom components. |
|
12 | # to know more about custom components. |
|
13 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } |
|
13 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } |
|
14 |
|
14 | ||
@@ -57,7 +57,7 | |||||
|
57 | b.optional :pattern |
|
57 | b.optional :pattern |
|
58 | b.optional :min_max |
|
58 | b.optional :min_max |
|
59 | b.optional :readonly |
|
59 | b.optional :readonly |
|
60 | - b.use :label, class: 'form-control-label' |
|
60 | + b.use :label |
|
61 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' |
|
61 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' |
|
62 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
62 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
63 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
63 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
@@ -76,7 +76,7 | |||||
|
76 | end |
|
76 | end |
|
77 |
|
77 | ||
|
78 | # vertical input for radio buttons and check boxes |
|
78 | # vertical input for radio buttons and check boxes |
|
79 | - config.wrappers :vertical_collection, item_wrapper_class: 'form-check', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
79 | + config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
80 | b.use :html5 |
|
80 | b.use :html5 |
|
81 | b.optional :readonly |
|
81 | b.optional :readonly |
|
82 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
|
82 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
@@ -88,7 +88,7 | |||||
|
88 | end |
|
88 | end |
|
89 |
|
89 | ||
|
90 | # vertical input for inline radio buttons and check boxes |
|
90 | # vertical input for inline radio buttons and check boxes |
|
91 | - config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
91 | + config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
92 | b.use :html5 |
|
92 | b.use :html5 |
|
93 | b.optional :readonly |
|
93 | b.optional :readonly |
|
94 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
|
94 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
@@ -108,7 +108,7 | |||||
|
108 | b.optional :readonly |
|
108 | b.optional :readonly |
|
109 | b.use :label |
|
109 | b.use :label |
|
110 | b.use :input, class: 'form-control-file', error_class: 'is-invalid', valid_class: 'is-valid' |
|
110 | b.use :input, class: 'form-control-file', error_class: 'is-invalid', valid_class: 'is-valid' |
|
111 |
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback |
|
111 | + b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
112 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
112 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
113 | end |
|
113 | end |
|
114 |
|
114 | ||
@@ -116,7 +116,7 | |||||
|
116 | config.wrappers :vertical_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
116 | config.wrappers :vertical_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
117 | b.use :html5 |
|
117 | b.use :html5 |
|
118 | b.optional :readonly |
|
118 | b.optional :readonly |
|
119 | - b.use :label, class: 'form-control-label' |
|
119 | + b.use :label |
|
120 | b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba| |
|
120 | b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba| |
|
121 | ba.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid' |
|
121 | ba.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid' |
|
122 | end |
|
122 | end |
@@ -174,10 +174,10 | |||||
|
174 | end |
|
174 | end |
|
175 |
|
175 | ||
|
176 | # horizontal input for radio buttons and check boxes |
|
176 | # horizontal input for radio buttons and check boxes |
|
177 | - config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
177 | + config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
178 | b.use :html5 |
|
178 | b.use :html5 |
|
179 | b.optional :readonly |
|
179 | b.optional :readonly |
|
180 |
- b.use :label, class: 'col-sm-3 form- |
|
180 | + b.use :label, class: 'col-sm-3 col-form-label pt-0' |
|
181 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
181 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
182 | ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
182 | ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
183 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
|
183 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
@@ -186,10 +186,10 | |||||
|
186 | end |
|
186 | end |
|
187 |
|
187 | ||
|
188 | # horizontal input for inline radio buttons and check boxes |
|
188 | # horizontal input for inline radio buttons and check boxes |
|
189 | - config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
189 | + config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
190 | b.use :html5 |
|
190 | b.use :html5 |
|
191 | b.optional :readonly |
|
191 | b.optional :readonly |
|
192 |
- b.use :label, class: 'col-sm-3 form- |
|
192 | + b.use :label, class: 'col-sm-3 col-form-label pt-0' |
|
193 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
193 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
194 | ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
194 | ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
195 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
|
195 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
@@ -204,7 +204,7 | |||||
|
204 | b.optional :maxlength |
|
204 | b.optional :maxlength |
|
205 | b.optional :minlength |
|
205 | b.optional :minlength |
|
206 | b.optional :readonly |
|
206 | b.optional :readonly |
|
207 |
- b.use :label, class: 'col-sm-3 |
|
207 | + b.use :label, class: 'col-sm-3 col-form-label' |
|
208 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
208 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
209 | ba.use :input, error_class: 'is-invalid', valid_class: 'is-valid' |
|
209 | ba.use :input, error_class: 'is-invalid', valid_class: 'is-valid' |
|
210 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
|
210 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
@@ -216,7 +216,7 | |||||
|
216 | config.wrappers :horizontal_multi_select, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
216 | config.wrappers :horizontal_multi_select, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
217 | b.use :html5 |
|
217 | b.use :html5 |
|
218 | b.optional :readonly |
|
218 | b.optional :readonly |
|
219 |
- b.use :label, class: 'col-sm-3 co |
|
219 | + b.use :label, class: 'col-sm-3 col-form-label' |
|
220 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
220 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
221 | ba.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |bb| |
|
221 | ba.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |bb| |
|
222 | bb.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid' |
|
222 | bb.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid' |
@@ -232,7 +232,7 | |||||
|
232 | b.use :placeholder |
|
232 | b.use :placeholder |
|
233 | b.optional :readonly |
|
233 | b.optional :readonly |
|
234 | b.optional :step |
|
234 | b.optional :step |
|
235 |
- b.use :label, class: 'col-sm-3 |
|
235 | + b.use :label, class: 'col-sm-3 col-form-label' |
|
236 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
236 | b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba| |
|
237 | ba.use :input, class: 'form-control-range', error_class: 'is-invalid', valid_class: 'is-valid' |
|
237 | ba.use :input, class: 'form-control-range', error_class: 'is-invalid', valid_class: 'is-valid' |
|
238 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
|
238 | ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
@@ -260,7 +260,7 | |||||
|
260 | end |
|
260 | end |
|
261 |
|
261 | ||
|
262 | # inline input for boolean |
|
262 | # inline input for boolean |
|
263 |
- config.wrappers :inline_boolean, tag: 'span', class: 'form-check |
|
263 | + config.wrappers :inline_boolean, tag: 'span', class: 'form-check mb-2 mr-sm-2', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
264 | b.use :html5 |
|
264 | b.use :html5 |
|
265 | b.optional :readonly |
|
265 | b.optional :readonly |
|
266 | b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
266 | b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' |
@@ -284,10 +284,11 | |||||
|
284 | end |
|
284 | end |
|
285 | end |
|
285 | end |
|
286 |
|
286 | ||
|
|
287 | + # custom input switch for boolean | ||
|
287 | config.wrappers :custom_boolean_switch, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
288 | config.wrappers :custom_boolean_switch, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
288 | b.use :html5 |
|
289 | b.use :html5 |
|
289 | b.optional :readonly |
|
290 | b.optional :readonly |
|
290 |
- b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom- |
|
291 | + b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom-switch' do |bb| |
|
291 | bb.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
292 | bb.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
292 | bb.use :label, class: 'custom-control-label' |
|
293 | bb.use :label, class: 'custom-control-label' |
|
293 | bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
294 | bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
@@ -296,7 +297,7 | |||||
|
296 | end |
|
297 | end |
|
297 |
|
298 | ||
|
298 | # custom input for radio buttons and check boxes |
|
299 | # custom input for radio buttons and check boxes |
|
299 | - config.wrappers :custom_collection, item_wrapper_class: 'custom-control', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
300 | + config.wrappers :custom_collection, item_wrapper_class: 'custom-control', item_label_class: 'custom-control-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
300 | b.use :html5 |
|
301 | b.use :html5 |
|
301 | b.optional :readonly |
|
302 | b.optional :readonly |
|
302 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
|
303 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
@@ -308,7 +309,7 | |||||
|
308 | end |
|
309 | end |
|
309 |
|
310 | ||
|
310 | # custom input for inline radio buttons and check boxes |
|
311 | # custom input for inline radio buttons and check boxes |
|
311 | - config.wrappers :custom_collection_inline, item_wrapper_class: 'custom-control custom-control-inline', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
312 | + config.wrappers :custom_collection_inline, item_wrapper_class: 'custom-control custom-control-inline', item_label_class: 'custom-control-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
312 | b.use :html5 |
|
313 | b.use :html5 |
|
313 | b.optional :readonly |
|
314 | b.optional :readonly |
|
314 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
|
315 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
@@ -326,7 +327,7 | |||||
|
326 | b.optional :maxlength |
|
327 | b.optional :maxlength |
|
327 | b.optional :minlength |
|
328 | b.optional :minlength |
|
328 | b.optional :readonly |
|
329 | b.optional :readonly |
|
329 | - b.use :label, class: 'form-control-label' |
|
330 | + b.use :label |
|
330 | b.wrapper :custom_file_wrapper, tag: 'div', class: 'custom-file' do |ba| |
|
331 | b.wrapper :custom_file_wrapper, tag: 'div', class: 'custom-file' do |ba| |
|
331 | ba.use :input, class: 'custom-file-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
332 | ba.use :input, class: 'custom-file-input', error_class: 'is-invalid', valid_class: 'is-valid' |
|
332 | ba.use :label, class: 'custom-file-label' |
|
333 | ba.use :label, class: 'custom-file-label' |
@@ -339,7 +340,7 | |||||
|
339 | config.wrappers :custom_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
340 | config.wrappers :custom_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
340 | b.use :html5 |
|
341 | b.use :html5 |
|
341 | b.optional :readonly |
|
342 | b.optional :readonly |
|
342 | - b.use :label, class: 'form-control-label' |
|
343 | + b.use :label |
|
343 | b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba| |
|
344 | b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba| |
|
344 | ba.use :input, class: 'custom-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid' |
|
345 | ba.use :input, class: 'custom-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid' |
|
345 | end |
|
346 | end |
@@ -353,7 +354,7 | |||||
|
353 | b.use :placeholder |
|
354 | b.use :placeholder |
|
354 | b.optional :readonly |
|
355 | b.optional :readonly |
|
355 | b.optional :step |
|
356 | b.optional :step |
|
356 | - b.use :label, class: 'form-control-label' |
|
357 | + b.use :label |
|
357 | b.use :input, class: 'custom-range', error_class: 'is-invalid', valid_class: 'is-valid' |
|
358 | b.use :input, class: 'custom-range', error_class: 'is-invalid', valid_class: 'is-valid' |
|
358 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
|
359 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' } |
|
359 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
360 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
@@ -370,7 +371,7 | |||||
|
370 | # b.optional :pattern |
|
371 | # b.optional :pattern |
|
371 | # b.optional :min_max |
|
372 | # b.optional :min_max |
|
372 | # b.optional :readonly |
|
373 | # b.optional :readonly |
|
373 | - # b.use :label, class: 'form-control-label' |
|
374 | + # b.use :label |
|
374 | # b.wrapper :input_group_tag, tag: 'div', class: 'input-group' do |ba| |
|
375 | # b.wrapper :input_group_tag, tag: 'div', class: 'input-group' do |ba| |
|
375 | # ba.optional :prepend |
|
376 | # ba.optional :prepend |
|
376 | # ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' |
|
377 | # ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' |
@@ -393,7 +394,7 | |||||
|
393 | b.optional :min_max |
|
394 | b.optional :min_max |
|
394 | b.optional :readonly |
|
395 | b.optional :readonly |
|
395 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' |
|
396 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' |
|
396 | - b.use :label, class: 'form-control-label' |
|
397 | + b.use :label |
|
397 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
398 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
398 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
399 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
399 | end |
|
400 | end |
@@ -402,8 +403,8 | |||||
|
402 | config.wrappers :floating_labels_select, tag: 'div', class: 'form-label-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
403 | config.wrappers :floating_labels_select, tag: 'div', class: 'form-label-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| |
|
403 | b.use :html5 |
|
404 | b.use :html5 |
|
404 | b.optional :readonly |
|
405 | b.optional :readonly |
|
405 |
- b.use :input, class: 'custom-select |
|
406 | + b.use :input, class: 'custom-select', error_class: 'is-invalid', valid_class: 'is-valid' |
|
406 | - b.use :label, class: 'form-control-label' |
|
407 | + b.use :label |
|
407 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
408 | b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } |
|
408 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
409 | b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' } |
|
409 | end |
|
410 | end |
You need to be logged in to leave comments.
Login now