Description:
## Bootstrapify
* submit error message
* bootstrap switch for announcement
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r555:964258440467 - - 8 files changed: 73 inserted, 10 deleted
@@ -53,6 +53,7 | |||
|
53 | 53 | |
|
54 | 54 | #add bootstrap |
|
55 | 55 | gem 'bootstrap-sass', '~> 3.2.0' |
|
56 | + gem 'bootstrap-switch-rails' | |
|
56 | 57 | gem 'autoprefixer-rails' |
|
57 | 58 | |
|
58 | 59 |
@@ -45,6 +45,7 | |||
|
45 | 45 | railties (>= 3.2) |
|
46 | 46 | bootstrap-sass (3.2.0.2) |
|
47 | 47 | sass (~> 3.2) |
|
48 | + bootstrap-switch-rails (3.3.3) | |
|
48 | 49 | builder (3.0.4) |
|
49 | 50 | coffee-rails (3.2.2) |
|
50 | 51 | coffee-script (>= 2.2.0) |
@@ -162,6 +163,7 | |||
|
162 | 163 | autoprefixer-rails |
|
163 | 164 | best_in_place (~> 3.0.1) |
|
164 | 165 | bootstrap-sass (~> 3.2.0) |
|
166 | + bootstrap-switch-rails | |
|
165 | 167 | coffee-rails (~> 3.2.2) |
|
166 | 168 | dynamic_form |
|
167 | 169 | haml |
@@ -14,8 +14,9 | |||
|
14 | 14 | //= require jquery_ujs |
|
15 | 15 | //= require jquery.ui.all |
|
16 | 16 | //= require bootstrap-sprockets |
|
17 | + //= require bootstrap-switch | |
|
18 | + //= require select2 | |
|
17 | 19 | //= require custom |
|
18 | - //= require select2 | |
|
19 | 20 | |
|
20 | 21 | |
|
21 | 22 | // since this is after blank line, it is not downloaded |
@@ -1,2 +1,26 | |||
|
1 | + $(document).on 'change', '.btn-file :file', -> | |
|
2 | + input = $(this) | |
|
3 | + numFiles = if input.get(0).files then input.get(0).files.length else 1 | |
|
4 | + label = input.val().replace(/\\/g, '/').replace(/.*\//, '') | |
|
5 | + input.trigger 'fileselect', [ | |
|
6 | + numFiles | |
|
7 | + label | |
|
8 | + ] | |
|
9 | + return | |
|
10 | + | |
|
11 | + | |
|
12 | + # document ready | |
|
13 | + | |
|
1 | 14 | $ -> |
|
2 | 15 | $(".select2").select2() |
|
16 | + $(".bootstrap-switch").bootstrapSwitch() | |
|
17 | + $('.btn-file :file').on 'fileselect', (event, numFiles, label) -> | |
|
18 | + input = $(this).parents('.input-group').find(':text') | |
|
19 | + log = if numFiles > 1 then numFiles + ' files selected' else label | |
|
20 | + if input.length | |
|
21 | + input.val log | |
|
22 | + else | |
|
23 | + if log | |
|
24 | + alert log | |
|
25 | + return | |
|
26 | + return |
@@ -25,14 +25,35 | |||
|
25 | 25 | @import jquery-tablesorter/theme.metro-dark |
|
26 | 26 | @import tablesorter-theme.cafe |
|
27 | 27 | |
|
28 | + //bootstrap | |
|
28 | 29 | @import bootstrap-sprockets |
|
29 | 30 | @import bootstrap |
|
30 | 31 | @import select2 |
|
31 | 32 | @import select2-bootstrap |
|
33 | + @import bootstrap3-switch | |
|
32 | 34 | |
|
33 | 35 | .secondnavbar |
|
34 | 36 | top: 50px |
|
35 | 37 | |
|
38 | + .btn-file | |
|
39 | + position: relative | |
|
40 | + overflow: hidden | |
|
41 | + | |
|
42 | + .btn-file input[type=file] | |
|
43 | + position: absolute | |
|
44 | + top: 0 | |
|
45 | + right: 0 | |
|
46 | + min-width: 100% | |
|
47 | + min-height: 100% | |
|
48 | + font-size: 100px | |
|
49 | + text-align: right | |
|
50 | + filter: alpha(opacity=0) | |
|
51 | + opacity: 0 | |
|
52 | + outline: none | |
|
53 | + background: white | |
|
54 | + cursor: inherit | |
|
55 | + display: block | |
|
56 | + | |
|
36 | 57 | body |
|
37 | 58 | background: white image-url("topbg.jpg") repeat-x top center |
|
38 | 59 | //font-size: 13px |
@@ -27,7 +27,8 | |||
|
27 | 27 | <%=h announcement.body %> |
|
28 | 28 | </td> |
|
29 | 29 | <td><%=h announcement.author %></td> |
|
30 | - <td><%= in_place_editor_field :announcement, :published, {}, :rows => 1 %></td> | |
|
30 | + <td><%= check_box_tag :published, 1, announcement.published, class: 'bootstrap-switch', data: {size: 'small'} %></td> | |
|
31 | + <!-- <td><%= in_place_editor_field :announcement, :published, {}, :rows => 1 %></td> --> | |
|
31 | 32 | <td><%= link_to 'Show', announcement %></td> |
|
32 | 33 | <td><%= link_to 'Edit', edit_announcement_path(announcement) %></td> |
|
33 | 34 | <td><%= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete %></td> |
@@ -1,6 +1,20 | |||
|
1 | - = form_tag({:action => 'submit'}, :multipart => true) do | |
|
2 | - %b Problem: | |
|
3 | - = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| [p.full_name, p.id]}, {:selected => '-1'}, { class: 'select2' } | |
|
4 | - %b File: | |
|
5 | - = file_field_tag 'file' | |
|
6 | - = submit_tag 'Submit' | |
|
1 | + = form_tag({:action => 'submit'}, :multipart => true, class: 'form-inline') do | |
|
2 | + - if @submission and @submission.errors.any? | |
|
3 | + #error_explanation | |
|
4 | + .alert.alert-danger | |
|
5 | + %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:" | |
|
6 | + %ul | |
|
7 | + - @submission.errors.full_messages.each do |msg| | |
|
8 | + %li= msg | |
|
9 | + .form-group | |
|
10 | + = label_tag :submission, 'Problem:' | |
|
11 | + = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| [p.full_name, p.id]}, {:selected => '-1'}, { class: 'select2 form-control' } | |
|
12 | + .form-group | |
|
13 | + = label_tag :file, 'File:' | |
|
14 | + .input-group | |
|
15 | + %span.input-group-btn | |
|
16 | + %span.btn.btn-default.btn-file | |
|
17 | + Browse | |
|
18 | + = file_field_tag 'file' | |
|
19 | + = text_field_tag '' , nil, {readonly: true, class: 'form-control'} | |
|
20 | + = submit_tag 'Submit', class: 'btn btn-default' |
@@ -11,7 +11,6 | |||
|
11 | 11 | |
|
12 | 12 | - if GraderConfiguration.show_submitbox_to?(@user) |
|
13 | 13 | .submitbox |
|
14 | - = error_messages_for 'submission' | |
|
15 | 14 | = render :partial => 'submission_box' |
|
16 | 15 | |
|
17 | 16 | |
@@ -22,7 +21,7 | |||
|
22 | 21 | |
|
23 | 22 | - if GraderConfiguration.show_tasks_to?(@user) |
|
24 | 23 | - if not GraderConfiguration.multicontests? |
|
25 | - %table.table.table-striped | |
|
24 | + %table.table.table-striped.table-condensed | |
|
26 | 25 | %thead |
|
27 | 26 | %tr.info-head |
|
28 | 27 | %th # |
You need to be logged in to leave comments.
Login now