Description:
## Bootstrapify * submit error message * bootstrap switch for announcement
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r555:964258440467 - - 8 files changed: 73 inserted, 10 deleted

@@ -50,12 +50,13
50
50
51 #syntax highlighter
51 #syntax highlighter
52 gem 'rouge'
52 gem 'rouge'
53
53
54 #add bootstrap
54 #add bootstrap
55 gem 'bootstrap-sass', '~> 3.2.0'
55 gem 'bootstrap-sass', '~> 3.2.0'
56 + gem 'bootstrap-switch-rails'
56 gem 'autoprefixer-rails'
57 gem 'autoprefixer-rails'
57
58
58
59
59 gem 'haml'
60 gem 'haml'
60 gem 'mail'
61 gem 'mail'
61 gem 'rdiscount'
62 gem 'rdiscount'
@@ -42,12 +42,13
42 json
42 json
43 best_in_place (3.0.3)
43 best_in_place (3.0.3)
44 actionpack (>= 3.2)
44 actionpack (>= 3.2)
45 railties (>= 3.2)
45 railties (>= 3.2)
46 bootstrap-sass (3.2.0.2)
46 bootstrap-sass (3.2.0.2)
47 sass (~> 3.2)
47 sass (~> 3.2)
48 + bootstrap-switch-rails (3.3.3)
48 builder (3.0.4)
49 builder (3.0.4)
49 coffee-rails (3.2.2)
50 coffee-rails (3.2.2)
50 coffee-script (>= 2.2.0)
51 coffee-script (>= 2.2.0)
51 railties (~> 3.2.0)
52 railties (~> 3.2.0)
52 coffee-script (2.3.0)
53 coffee-script (2.3.0)
53 coffee-script-source
54 coffee-script-source
@@ -159,12 +160,13
159 ruby
160 ruby
160
161
161 DEPENDENCIES
162 DEPENDENCIES
162 autoprefixer-rails
163 autoprefixer-rails
163 best_in_place (~> 3.0.1)
164 best_in_place (~> 3.0.1)
164 bootstrap-sass (~> 3.2.0)
165 bootstrap-sass (~> 3.2.0)
166 + bootstrap-switch-rails
165 coffee-rails (~> 3.2.2)
167 coffee-rails (~> 3.2.2)
166 dynamic_form
168 dynamic_form
167 haml
169 haml
168 in_place_editing
170 in_place_editing
169 jquery-rails
171 jquery-rails
170 jquery-tablesorter
172 jquery-tablesorter
@@ -11,14 +11,15
11 // GO AFTER THE REQUIRES BELOW.
11 // GO AFTER THE REQUIRES BELOW.
12 //
12 //
13 //= require jquery
13 //= require jquery
14 //= require jquery_ujs
14 //= require jquery_ujs
15 //= require jquery.ui.all
15 //= require jquery.ui.all
16 //= require bootstrap-sprockets
16 //= require bootstrap-sprockets
17 + //= require bootstrap-switch
18 + //= require select2
17 //= require custom
19 //= require custom
18 - //= require select2
19
20
20
21
21 // since this is after blank line, it is not downloaded
22 // since this is after blank line, it is not downloaded
22 //x= require prototype
23 //x= require prototype
23 //x= require prototype_ujs
24 //x= require prototype_ujs
24 //x= require effects
25 //x= require effects
@@ -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 $(".select2").select2()
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
@@ -22,20 +22,41
22 @import jquery.ui.datepicker
22 @import jquery.ui.datepicker
23 @import jquery.ui.slider
23 @import jquery.ui.slider
24 @import jquery-ui-timepicker-addon
24 @import jquery-ui-timepicker-addon
25 @import jquery-tablesorter/theme.metro-dark
25 @import jquery-tablesorter/theme.metro-dark
26 @import tablesorter-theme.cafe
26 @import tablesorter-theme.cafe
27
27
28 + //bootstrap
28 @import bootstrap-sprockets
29 @import bootstrap-sprockets
29 @import bootstrap
30 @import bootstrap
30 @import select2
31 @import select2
31 @import select2-bootstrap
32 @import select2-bootstrap
33 + @import bootstrap3-switch
32
34
33 .secondnavbar
35 .secondnavbar
34 top: 50px
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 body
57 body
37 background: white image-url("topbg.jpg") repeat-x top center
58 background: white image-url("topbg.jpg") repeat-x top center
38 //font-size: 13px
59 //font-size: 13px
39 //font-family: Tahoma, "sans-serif"
60 //font-family: Tahoma, "sans-serif"
40 margin: 10px
61 margin: 10px
41 padding: 10px
62 padding: 10px
@@ -24,13 +24,14
24 <% if !announcement.notes.blank? %>
24 <% if !announcement.notes.blank? %>
25 <b>Notes: <%=h announcement.notes %></b><br/>
25 <b>Notes: <%=h announcement.notes %></b><br/>
26 <% end %>
26 <% end %>
27 <%=h announcement.body %>
27 <%=h announcement.body %>
28 </td>
28 </td>
29 <td><%=h announcement.author %></td>
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 <td><%= link_to 'Show', announcement %></td>
32 <td><%= link_to 'Show', announcement %></td>
32 <td><%= link_to 'Edit', edit_announcement_path(announcement) %></td>
33 <td><%= link_to 'Edit', edit_announcement_path(announcement) %></td>
33 <td><%= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete %></td>
34 <td><%= link_to 'Destroy', announcement, :confirm => 'Are you sure?', :method => :delete %></td>
34 </tr>
35 </tr>
35 <% end %>
36 <% end %>
36 </table>
37 </table>
@@ -1,6 +1,20
1 - = form_tag({:action => 'submit'}, :multipart => true) do
1 + = form_tag({:action => 'submit'}, :multipart => true, class: 'form-inline') do
2 - %b Problem:
2 + - if @submission and @submission.errors.any?
3 - = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| [p.full_name, p.id]}, {:selected => '-1'}, { class: 'select2' }
3 + #error_explanation
4 - %b File:
4 + .alert.alert-danger
5 - = file_field_tag 'file'
5 + %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:"
6 - = submit_tag 'Submit'
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'
@@ -8,24 +8,23
8 Announcements
8 Announcements
9 #announcementbox-body
9 #announcementbox-body
10 = render :partial => 'announcement', :collection => @announcements
10 = render :partial => 'announcement', :collection => @announcements
11
11
12 - if GraderConfiguration.show_submitbox_to?(@user)
12 - if GraderConfiguration.show_submitbox_to?(@user)
13 .submitbox
13 .submitbox
14 - = error_messages_for 'submission'
15 = render :partial => 'submission_box'
14 = render :partial => 'submission_box'
16
15
17
16
18 %hr/
17 %hr/
19
18
20 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
19 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
21 %p=t 'main.start_soon'
20 %p=t 'main.start_soon'
22
21
23 - if GraderConfiguration.show_tasks_to?(@user)
22 - if GraderConfiguration.show_tasks_to?(@user)
24 - if not GraderConfiguration.multicontests?
23 - if not GraderConfiguration.multicontests?
25 - %table.table.table-striped
24 + %table.table.table-striped.table-condensed
26 %thead
25 %thead
27 %tr.info-head
26 %tr.info-head
28 %th #
27 %th #
29 %th Tasks name
28 %th Tasks name
30 %th Full name
29 %th Full name
31 %th # of sub(s)
30 %th # of sub(s)
You need to be logged in to leave comments. Login now