hotfix_form.hbs
4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">Hotfix</a></li>
<li>{{type}}</li>
</ul>
<h4>新增补丁信息</h4>
</div>
</div>
<!-- media -->
</div>
<!-- pageheader -->
<div class="panel panel-default">
<div class="panel-heading">
<p> </p>
</div>
<form id="hotfix-form" action="/hotfix/save/{{type}}" method="POST" enctype="multipart/form-data" data-pjax>
<input type="hidden" name="_id" value="{{_id}}">
<div class="panel-body">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="control-label">App名称</label>
<select id="appName" name="appName" data-placeholder="Choose a Host..." class="form-control" style="height: 40px;">
<option value="yohobuy">yohobuy</option>
</select>
</div>
<!-- form-group -->
</div>
<!-- col-sm-6 -->
<div class="col-sm-6">
<div class="form-group">
<label class="control-label">App版本</label>
<input type="text" name="appVersion" value="{{appVersion}}" class="form-control" placeholder="App version. (必填)">
</div>
<!-- form-group -->
</div>
<!-- col-sm-6 -->
</div>
<!-- row -->
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="control-label">补丁版本</label>
<input type="text" name="patchVersion" value="{{patchVersion}}" class="form-control" placeholder="patch version (可为空)">
</div>
<!-- form-group -->
</div>
<!-- col-sm-6 -->
<div class="col-sm-6">
<div class="form-group">
<label class="control-label">补丁文件</label>
<input type="file" name="batch" class="form-control" placeholder="upload the patch file (必填)">
</div>
<!-- form-group -->
</div>
</div>
<!-- row -->
</div>
<!-- panel-body -->
<div class="panel-footer">
<button type="submit" class="btn btn-primary">保存</button>
<button type="button" class="btn btn-default ml20 go-back">取消</button>
</div>
</form>
<!-- panel-footer -->
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">参数说明</h4>
</div><!-- panel-heading -->
<div class="panel-body">
<div class="alert alert-danger">App版本必须和调用接口时app_version一致</div>
</div>
</div>
<script>
$(document).on('ready pjax:success', function() {
// $('#hotfix-form').off().on('submit', function(event) {
// event.preventDefault(); // stop default submit behavior
// $.pjax.submit(event, '#pjax-container', {
// type: 'POST',
// dataType: 'json',
// push: false
// });
// }).on('pjax:success', function(e, data) {
// console.log(111)
// return false;
// });
// $('#appName').select2();
$('#hotfix-form').ajaxForm(function(d) {
if (d && d.code === 200) {
location.href = '/hotfix/{{type}}';
} else {
alert(d.message);
}
});
$('.go-back').click(function() {
window.history.go(-1);
});
});
</script>