Description:
change datetime picker widget
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r692:57c9378ff75a - - 7 files changed: 62 inserted, 29 deleted
@@ -65,9 +65,11 | |||
|
65 | 65 | gem 'bootstrap-toggle-rails' |
|
66 | 66 | gem 'autoprefixer-rails' |
|
67 | 67 | |
|
68 | - #bootstrap sortable | |
|
68 | + #more bootstrp add-on | |
|
69 | 69 | gem 'momentjs-rails' |
|
70 | 70 | gem 'rails_bootstrap_sortable' |
|
71 | + gem 'bootstrap-datepicker-rails' | |
|
72 | + gem 'bootstrap3-datetimepicker-rails' | |
|
71 | 73 | |
|
72 | 74 | #----------- user interface ----------------- |
|
73 | 75 | #select 2 |
@@ -61,10 +61,14 | |||
|
61 | 61 | best_in_place (3.0.3) |
|
62 | 62 | actionpack (>= 3.2) |
|
63 | 63 | railties (>= 3.2) |
|
64 | + bootstrap-datepicker-rails (1.7.1.1) | |
|
65 | + railties (>= 3.0) | |
|
64 | 66 | bootstrap-sass (3.2.0.2) |
|
65 | 67 | sass (~> 3.2) |
|
66 | 68 | bootstrap-switch-rails (3.3.3) |
|
67 | 69 | bootstrap-toggle-rails (2.2.1.0) |
|
70 | + bootstrap3-datetimepicker-rails (4.17.47) | |
|
71 | + momentjs-rails (>= 2.8.1) | |
|
68 | 72 | builder (3.2.2) |
|
69 | 73 | coffee-rails (4.2.1) |
|
70 | 74 | coffee-script (>= 2.2.0) |
@@ -201,9 +205,11 | |||
|
201 | 205 | activerecord-session_store |
|
202 | 206 | autoprefixer-rails |
|
203 | 207 | best_in_place (~> 3.0.1) |
|
208 | + bootstrap-datepicker-rails | |
|
204 | 209 | bootstrap-sass (~> 3.2.0) |
|
205 | 210 | bootstrap-switch-rails |
|
206 | 211 | bootstrap-toggle-rails |
|
212 | + bootstrap3-datetimepicker-rails | |
|
207 | 213 | coffee-rails |
|
208 | 214 | dynamic_form |
|
209 | 215 | fuzzy-string-match |
@@ -32,6 +32,8 | |||
|
32 | 32 | //= require best_in_place |
|
33 | 33 | //= require best_in_place.jquery-ui |
|
34 | 34 | //= require brython |
|
35 | + //= require bootstrap-datepicker | |
|
36 | + //= require bootstrap-datetimepicker | |
|
35 | 37 | |
|
36 | 38 | // since this is after blank line, it is not downloaded |
|
37 | 39 | //x= require prototype |
@@ -33,6 +33,8 | |||
|
33 | 33 | //@import bootstrap3-switch |
|
34 | 34 | @import "bootstrap-toggle"; |
|
35 | 35 | @import "bootstrap-sortable"; |
|
36 | + @import "bootstrap-datepicker3"; | |
|
37 | + @import "bootstrap-datetimepicker"; | |
|
36 | 38 | |
|
37 | 39 | //bootstrap navbar color (from) |
|
38 | 40 | $bgDefault: #19197b; |
@@ -258,10 +258,7 | |||
|
258 | 258 | |
|
259 | 259 | def change_date_added |
|
260 | 260 | problems = get_problems_from_params |
|
261 |
- |
|
|
262 | - month = params[:date_added][:month].to_i | |
|
263 | - day = params[:date_added][:day].to_i | |
|
264 | - date = Date.new(year,month,day) | |
|
261 | + date = Date.parse(params[:date_added]) | |
|
265 | 262 | problems.each do |p| |
|
266 | 263 | p.date_added = date |
|
267 | 264 | p.save |
@@ -47,22 +47,26 | |||
|
47 | 47 | What do you want to do to the selected problem? |
|
48 | 48 | %br/ |
|
49 | 49 | (You can shift-click to select a range of problems) |
|
50 | - %ul | |
|
50 | + %ul.form-inline | |
|
51 | 51 | %li |
|
52 | 52 | Change date added to |
|
53 | - = select_date Date.current, :prefix => 'date_added' | |
|
53 | + .input-group.date | |
|
54 | + = text_field_tag :date_added, class: 'form-control' | |
|
55 | + %span.input-group-addon | |
|
56 | + %span.glyphicon.glyphicon-calendar | |
|
57 | + -# = select_date Date.current, :prefix => 'date_added' | |
|
54 | 58 | |
|
55 |
- = submit_tag 'Change', :name => 'change_date_added', class: 'btn btn- |
|
|
59 | + = submit_tag 'Change', :name => 'change_date_added', class: 'btn btn-primary btn-sm' | |
|
56 | 60 | %li |
|
57 | 61 | Set available to |
|
58 |
- = submit_tag 'True', :name => 'enable_problem', class: 'btn btn- |
|
|
59 |
- = submit_tag 'False', :name => 'disable_problem', class: 'btn btn- |
|
|
62 | + = submit_tag 'True', :name => 'enable_problem', class: 'btn btn-primary btn-sm' | |
|
63 | + = submit_tag 'False', :name => 'disable_problem', class: 'btn btn-primary btn-sm' | |
|
60 | 64 | |
|
61 | 65 | - if GraderConfiguration.multicontests? |
|
62 | 66 | %li |
|
63 | 67 | Add to |
|
64 | 68 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
65 |
- = submit_tag 'Add', :name => 'add_to_contest', class: 'btn btn- |
|
|
69 | + = submit_tag 'Add', :name => 'add_to_contest', class: 'btn btn-primary btn-sm' | |
|
66 | 70 | %li |
|
67 | 71 | Add problems to group |
|
68 | 72 | = select_tag "group_id", options_from_collection_for_select( Group.all, 'id','name',params[:group_name]), id: 'group_name',class: 'select2' |
@@ -92,3 +96,12 | |||
|
92 | 96 | %td |
|
93 | 97 | - problem.contests.each do |contest| |
|
94 | 98 | = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])" |
|
99 | + | |
|
100 | + :javascript | |
|
101 | + $('.input-group.date').datetimepicker({ | |
|
102 | + format: 'DD/MMM/YYYY', | |
|
103 | + showTodayButton: true, | |
|
104 | + widgetPositioning: {horizontal: 'auto', vertical: 'bottom'}, | |
|
105 | + | |
|
106 | + }); | |
|
107 | + |
@@ -1,24 +1,35 | |||
|
1 | 1 | %h1 Editing site |
|
2 | 2 | = error_messages_for :site |
|
3 | 3 | = form_for(@site) do |f| |
|
4 | - %p | |
|
5 | - %b Name | |
|
6 | - %br/ | |
|
7 | - = f.text_field :name | |
|
8 | - %p | |
|
9 | - %b Password | |
|
10 | - %br/ | |
|
11 | - = f.text_field :password | |
|
12 | - %p | |
|
13 | - %b Started | |
|
14 | - %br/ | |
|
15 | - = f.check_box :started | |
|
16 | - %p | |
|
17 | - %b Start time | |
|
18 | - %br/ | |
|
19 | - = f.datetime_select :start_time, :include_blank => true | |
|
20 | - %p | |
|
21 | - = f.submit "Update" | |
|
4 | + .row | |
|
5 | + .col-md-4 | |
|
6 | + .form-group.field | |
|
7 | + = f.label :name, "Name" | |
|
8 | + = f.text_field :name, class: 'form-control' | |
|
9 | + .form-group.field | |
|
10 | + = f.label :password, "Password" | |
|
11 | + = f.text_field :password, class: 'form-control' | |
|
12 | + .form-group.field | |
|
13 | + = f.label :started, "Started" | |
|
14 | + = f.check_box :started, class: 'form-control' | |
|
15 | + .form-group.field | |
|
16 | + = f.label :start_time, "Start time" | |
|
17 | + -# = f.datetime_select :start_time, :include_blank => true | |
|
18 | + .input-group.date | |
|
19 | + = f.text_field :start_time, class:'form-control' , value: (@site.start_time ? @site.start_time.strftime('%d/%b/%Y %H:%M') : '') | |
|
20 | + %span.input-group-addon | |
|
21 | + %span.glyphicon.glyphicon-calendar | |
|
22 | + .actions | |
|
23 | + = f.submit "Update", class: 'btn btn-primary' | |
|
24 | + .col-md-8 | |
|
25 | + | |
|
22 | 26 | = link_to 'Show', @site |
|
23 | 27 | | |
|
24 | 28 | = link_to 'Back', sites_path |
|
29 | + | |
|
30 | + | |
|
31 | + :javascript | |
|
32 | + $('.input-group.date').datetimepicker({ | |
|
33 | + format: 'DD/MMM/YYYY HH:mm', | |
|
34 | + }); | |
|
35 | + |
You need to be logged in to leave comments.
Login now