Commit ae41b070e74b2b02fb11503656c1a275c22b90c3
1 parent
4934aa87
Exists in
master
and in
5 other branches
Modal to add file #135
Showing
2 changed files
with
50 additions
and
61 deletions
Show diff stats
files/templates/create_file.html
... | ... | @@ -1,47 +0,0 @@ |
1 | -<!-- MODAL CREATE FILE --> | |
2 | -<div class="modal fade" id="createFileModal" tabindex="-1" role="dialog" aria-labelledby="createFileLabel" style="display: none;"> | |
3 | - <div class="modal-dialog" role="document"> | |
4 | - <div class="modal-content"> | |
5 | - <div class="modal-header"> | |
6 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
7 | - <h4 class="modal-title" id="createFileLabel">Add File</h4> | |
8 | - </div> | |
9 | - <div class="modal-body"> | |
10 | - <!-- Card --> | |
11 | - <form class="form-horizontal"> | |
12 | - <fieldset> | |
13 | - <div class="form-group is-empty"> | |
14 | - <label for="inputName" class="col-md-2 control-label">Name</label> | |
15 | - <div class="col-md-10"> | |
16 | - <input type="text" class="form-control" id="inputText" placeholder="Name"> | |
17 | - </div> | |
18 | - </div> | |
19 | - | |
20 | - <div class="form-group is-empty is-fileinput"> | |
21 | - <label for="inputFile" class="col-md-2 control-label">File</label> | |
22 | - <div class="col-md-10"> | |
23 | - <input type="text" readonly="" class="form-control" placeholder="Browse..."> | |
24 | - <input type="file" id="inputFile" multiple=""> | |
25 | - </div> | |
26 | - </div> | |
27 | - | |
28 | - <div class="form-group"> | |
29 | - <div class="col-md-12 text-center"> | |
30 | - <p><b>The file size shouldn't exceed 10MB</b></p> | |
31 | - </div> | |
32 | - </div> | |
33 | - | |
34 | - <div class="form-group"> | |
35 | - <div class="col-md-12"> | |
36 | - <a href="javascript:void(0)" class="btn btn-raised btn-default">Cancel<div class="ripple-container"></div></a> | |
37 | - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> | |
38 | - </div> | |
39 | - </div> | |
40 | - </fieldset> | |
41 | - </form> | |
42 | - <!-- .end Card --> | |
43 | - </div> | |
44 | - </div> | |
45 | - </div> | |
46 | -</div> | |
47 | -<!-- EndModal --> | |
48 | 0 | \ No newline at end of file |
files/templates/files/create_file.html
1 | +{% load widget_tweaks i18n %} | |
1 | 2 | <!-- MODAL CREATE FILE --> |
2 | 3 | <div class="modal fade" id="createFileModal" tabindex="-1" role="dialog" aria-labelledby="createFileLabel" style="display: none;"> |
3 | 4 | <div class="modal-dialog" role="document"> |
4 | 5 | <div class="modal-content"> |
5 | 6 | <div class="modal-header"> |
6 | 7 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
7 | - <h4 class="modal-title" id="createFileLabel">Add File</h4> | |
8 | + <h4 class="modal-title" id="createFileLabel">{% trans 'Add File' %}</h4> | |
8 | 9 | </div> |
9 | 10 | <div class="modal-body"> |
10 | 11 | <!-- Card --> |
11 | 12 | <form class="form-horizontal"> |
12 | - <fieldset> | |
13 | - <div class="form-group is-empty"> | |
14 | - <label for="inputName" class="col-md-2 control-label">Name</label> | |
15 | - <div class="col-md-10"> | |
16 | - <input type="text" class="form-control" id="inputText" placeholder="Name"> | |
13 | + {% csrf_token %} | |
14 | + {% if messages %} | |
15 | + {% for message in messages %} | |
16 | + <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert"> | |
17 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
18 | + <span aria-hidden="true">×</span> | |
19 | + </button> | |
20 | + <p>{{ message }}</p> | |
17 | 21 | </div> |
18 | - </div> | |
19 | - | |
20 | - <div class="form-group is-empty is-fileinput"> | |
21 | - <label for="inputFile" class="col-md-2 control-label">File</label> | |
22 | - <div class="col-md-10"> | |
23 | - <input type="text" readonly="" class="form-control" placeholder="Browse..."> | |
24 | - <input type="file" id="inputFile" multiple=""> | |
22 | + {% endfor %} | |
23 | + {% endif %} | |
24 | + <fieldset> | |
25 | + {% for field in form_file %} | |
26 | + <div class="form-group is-empy{% if form.has_error %} has-error {% endif %} is-fileinput"> | |
27 | + <div class="col-md-12"> | |
28 | + {% if field.field.required %} | |
29 | + <label for="{{ field.auto_id }}" class="control-label">{{ field.label }}<span>*</span></label> | |
30 | + {% else %} | |
31 | + <label for="{{ field.auto_id }}" class=" control-label">{{ field.label }}</label> | |
32 | + {% endif %} | |
33 | + {% if field.auto_id == 'id_file_url' %} | |
34 | + {% render_field field class='form-control input-sm' %} | |
35 | + <div class="input-group"> | |
36 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose your file...' %}"> | |
37 | + <span class="input-group-btn input-group-sm"> | |
38 | + <button type="button" class="btn btn-fab btn-fab-mini"> | |
39 | + <i class="material-icons">attach_file</i> | |
40 | + </button> | |
41 | + </span> | |
42 | + </div> | |
43 | + {% else %} | |
44 | + {% render_field field class='form-control input-sm' %} | |
45 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
46 | + {% endif %} | |
47 | + </div> | |
48 | + | |
49 | + {% if field.errors %} | |
50 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
51 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
52 | + <span aria-hidden="true">×</span> | |
53 | + </button> | |
54 | + <ul> | |
55 | + {% for error in field.errors %} | |
56 | + <li>{{ error }}</li> | |
57 | + {% endfor %} | |
58 | + </ul> | |
59 | + </div> | |
60 | + {% endif %} | |
25 | 61 | </div> |
26 | - </div> | |
62 | + {% endfor %} | |
27 | 63 | |
28 | 64 | <div class="form-group"> |
29 | 65 | <div class="col-md-12 text-center"> | ... | ... |