File tree Expand file tree Collapse file tree 3 files changed +17
-19
lines changed
lib/WeBWorK/ContentGenerator/Instructor
templates/ContentGenerator/Instructor/FileManager Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change 54
54
}
55
55
} ) ;
56
56
57
- // If on the confirmation page, then focus the "name" input.
58
- form . querySelector ( 'input[name="name"]' ) ?. focus ( ) ;
57
+ // If on the confirmation page (and not the edit page) , then focus the "name" input.
58
+ if ( ! form . getElementsByName ( 'data' ) [ 0 ] ) form . getElementsByName ( 'name' ) [ 0 ] ?. focus ( ) ;
59
59
}
60
60
61
61
// The bits for types from least to most significant digit are set in the directoryListing method of
Original file line number Diff line number Diff line change @@ -588,20 +588,11 @@ sub unpack_archive ($c, $archive) {
588
588
return $num_extracted == @members ;
589
589
}
590
590
591
- # Make a new file and edit it
591
+ # Open the edit page with no contents. This does not actually create a file.
592
+ # That is done when the user clicks save on the edit page.
592
593
sub NewFile ($c ) {
593
- if ($c -> param(' confirmed' )) {
594
- my $name = $c -> param(' name' );
595
- if (my $file = $c -> verifyName($name , ' file' )) {
596
- if (open (my $NEWFILE , ' >:encoding(UTF-8)' , $file )) {
597
- close $NEWFILE ;
598
- return $c -> RefreshEdit(' ' , $name );
599
- } else {
600
- $c -> addbadmessage($c -> maketext(q{ Can't create file: [_1]} , $! ));
601
- }
602
- }
603
- }
604
-
594
+ return $c -> RefreshEdit(' ' , $c -> param(' name' ))
595
+ if $c -> param(' confirmed' ) && $c -> verifyName($c -> param(' name' ), ' file' );
605
596
return $c -> Confirm($c -> maketext(' New file name:' ), ' ' , $c -> maketext(' New File' ));
606
597
}
607
598
Original file line number Diff line number Diff line change 12
12
</div>
13
13
</div>
14
14
<div class="row">
15
- <div class="col-md-2 col-4 my-2"><%= submit_button maketext('Cancel'), %button %></div>
16
- <div class="col-md-2 col-4 my-2"><%= submit_button maketext('Revert'), %button %></div>
17
- <div class="col-md-2 col-4 my-2"><%= submit_button maketext('Save'), %button %></div>
18
- <div class="col-md-6 col-12 my-2">
15
+ % my $canRevert = -f "$c->{courseRoot}/$c->{pwd}/$file";
16
+ <div class="col-md-2 <%= $canRevert ? 'col-4' : 'col-6' %> my-2">
17
+ <%= submit_button maketext('Cancel'), %button %>
18
+ </div>
19
+ % if ($canRevert) {
20
+ <div class="col-md-2 col-4 my-2"><%= submit_button maketext('Revert'), %button %></div>
21
+ % }
22
+ <div class="col-md-2 <%= $canRevert ? 'col-4' : 'col-6' %> my-2">
23
+ <%= submit_button maketext('Save'), %button %>
24
+ </div>
25
+ <div class="<%= $canRevert ? 'col-md-6' : 'col-md-8' %> col-12 my-2">
19
26
<div class="input-group">
20
27
<%= submit_button maketext('Save As'), name => 'action', class => 'btn btn-sm btn-secondary' =%>
21
28
<%= text_field name => '', size => 20, class => 'form-control form-control-sm' =%>
You can’t perform that action at this time.
0 commit comments