Skip to content

Commit 9c4993e

Browse files
committed
Spiced up the upload file feedback in the trace input form.
Now when you pick a file, the browse/drag widgetry is hidden and the filename display is more emphasized. You can remove the file by clicking the 'x' button (or by canceling the form)
1 parent 11de118 commit 9c4993e

File tree

4 files changed

+56
-19
lines changed

4 files changed

+56
-19
lines changed

codepulse/src/main/resources/toserve/common/common.css

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,35 @@ a.to-login:hover { border-bottom-style: solid; }
393393
}
394394

395395
/* unsupported browser alert */
396-
.unsupported-browser { margin-bottom: 0; }
396+
.unsupported-browser { margin-bottom: 0; }
397+
398+
/************\
399+
| Button Bar |
400+
\************/
401+
402+
.button-bar {
403+
font-size: 0;
404+
display: inline;
405+
}
406+
407+
.button-bar .item {
408+
font-size: small;
409+
display: inline-block;
410+
411+
padding: 4px 12px;
412+
color: #000;
413+
border: 1px solid #AAA;
414+
}
415+
416+
.button-bar .item:not(:first-child){
417+
border-left: none;
418+
}
419+
420+
.button-bar .item.button {
421+
cursor: pointer;
422+
background-color: #AAA;
423+
}
424+
425+
.button-bar .item.button:hover {
426+
background-color: #CCC;
427+
}

codepulse/src/main/resources/toserve/pages/TraceInputForm/TraceInputForm.css

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ trace-input-form .form-field {
5858
#trace-input-form ul.form-tabs-list {
5959
list-style: none;
6060
margin: 0 0 20px 0;
61-
border-bottom: 1px solid lightgray;
61+
border-bottom: 2px solid steelblue;
6262
}
6363

6464
#trace-input-form .form-tab {
@@ -84,15 +84,6 @@ trace-input-form .form-field {
8484
color: white;
8585
}
8686

87-
#trace-input-form .form-tab.active:after {
88-
content: '';
89-
position: absolute;
90-
top: 100%;
91-
left: calc(50% - 4px);
92-
border: 8px solid transparent;
93-
border-top-color: steelblue;
94-
}
95-
9687
/***************\
9788
| Feedback Area |
9889
\***************/
@@ -203,9 +194,8 @@ trace-input-form .form-field {
203194
color: gray;
204195
}
205196

206-
#trace-input-form .file-input-result span {
197+
#trace-input-form .file-input-result .file-input-name {
207198
font-weight: bold;
208-
color: darkgreen;
209199
}
210200

211201
.filetype {

codepulse/src/main/resources/toserve/pages/TraceInputForm/TraceInputForm.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ $(document).ready(function(){
3636
*/
3737
var fileInput = $form.find('[name=file-input]'),
3838
nameInput = $form.find('[name=name-input]'),
39+
fileInputArea = $form.find('.file-input-area'),
3940
fileChoiceLabel = $form.find('[name=file-input-choice-label]'),
4041
fileChoiceOriginalText = fileChoiceLabel.text(),
42+
fileClearButton = $form.find('.file-input-clear'),
4143
fileDropzone = $form.find('.file-dropzone'),
4244
cancelButton = $form.find('[name=cancel-button]'),
4345
submitButton = $form.find('[name=submit-button]'),
@@ -105,8 +107,12 @@ $(document).ready(function(){
105107

106108
traceFileName.onValue(function(filename){
107109
fileChoiceLabel.text(filename || fileChoiceOriginalText)
110+
fileClearButton[filename ? 'show' : 'hide']()
111+
fileInputArea[filename ? 'slideUp' : 'slideDown']('fast')
108112
})
109113

114+
fileClearButton.click(function(){ traceFile.set(null) })
115+
110116
traceFileName.onValue(function(filename){
111117
if(filename && !traceName.get() && !nameOptional){
112118
traceName.set(filename)

codepulse/src/main/webapp/templates-hidden/TraceInputForm.html

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@
5959

6060
<div class="file-input-result">
6161
The new analysis will be created from
62-
<span name="file-input-choice-label">
63-
the file you choose or drag
64-
</span>
62+
<div class="button-bar">
63+
<div class="file-input-name item" name="file-input-choice-label">
64+
the file you choose or drag
65+
</div>
66+
<div class="file-input-clear button item" title="Don't use this file">
67+
<i class="fa fa-times-circle"></i>
68+
</div>
69+
</div>
6570
</div>
6671

6772
<div class="input-help">
@@ -120,9 +125,14 @@
120125

121126
<div class="file-input-result">
122127
The trace will be imported from
123-
<span name="file-input-choice-label">
124-
the file you choose or drag
125-
</span>
128+
<div class="btn-group">
129+
<div class="file-input-name" name="file-input-choice-label">
130+
the file you choose or drag
131+
</div>
132+
<div class="file-input-clear" title="Don't use this file">
133+
<i class="fa fa-times-circle"></i>
134+
</div>
135+
</div>
126136
</div>
127137

128138
<div class="input-help">

0 commit comments

Comments
 (0)