nodebb-plugin-simple-contact 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/templates/contact.tpl +22 -23
package/package.json
CHANGED
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
<input type="text" class="form-control" id="fullName" name="fullName" required style="border-radius:10px; padding:10px;">
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
<div class="form-group" style="margin-bottom:16px;">
|
|
18
|
+
<div class="form-group" id="username-group" style="margin-bottom:16px;">
|
|
19
19
|
<label for="username" style="font-weight:600; display:block; margin-bottom:6px;">שם משתמש בפורום</label>
|
|
20
20
|
<input type="text" class="form-control" id="username" name="username" style="border-radius:10px; padding:10px;">
|
|
21
21
|
</div>
|
|
22
|
+
|
|
22
23
|
<div class="form-group" style="margin-bottom:16px;">
|
|
23
24
|
<label for="email" style="font-weight:600; display:block; margin-bottom:6px;">כתובת מייל *</label>
|
|
24
25
|
<input type="email" class="form-control" id="email" name="email" required style="border-radius:10px; padding:10px;">
|
|
@@ -44,22 +45,25 @@
|
|
|
44
45
|
|
|
45
46
|
<script>
|
|
46
47
|
(function() {
|
|
47
|
-
function
|
|
48
|
+
var init = function() {
|
|
48
49
|
var form = $('#contact-form');
|
|
49
50
|
var btn = $('#submit-btn');
|
|
50
51
|
var alertBox = $('#contact-alert');
|
|
51
52
|
|
|
53
|
+
if (window.app && app.user && app.user.uid > 0) {
|
|
54
|
+
$('#username-group').hide();
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
form.off('submit').on('submit', function(e) {
|
|
53
58
|
e.preventDefault();
|
|
54
|
-
|
|
55
59
|
btn.prop('disabled', true).text('שולח...');
|
|
56
60
|
alertBox.hide().removeClass('alert-success alert-danger');
|
|
57
61
|
|
|
58
62
|
var formData = {
|
|
59
|
-
fullName:
|
|
60
|
-
username: (app.user && app.user.uid > 0) ? app.user.username :
|
|
61
|
-
email:
|
|
62
|
-
content:
|
|
63
|
+
fullName: $('#fullName').val(),
|
|
64
|
+
username: (app.user && app.user.uid > 0) ? app.user.username : $('#username').val(),
|
|
65
|
+
email: $('#email').val(),
|
|
66
|
+
content: $('#content').val(),
|
|
63
67
|
_csrf: config.csrf_token
|
|
64
68
|
};
|
|
65
69
|
|
|
@@ -70,7 +74,6 @@
|
|
|
70
74
|
success: function(response) {
|
|
71
75
|
alertBox.addClass('alert-success').text(response.message || 'הפנייה נשלחה בהצלחה').fadeIn();
|
|
72
76
|
form[0].reset();
|
|
73
|
-
btn.text('שלח פנייה');
|
|
74
77
|
},
|
|
75
78
|
error: function(xhr) {
|
|
76
79
|
var msg = (xhr.responseJSON && xhr.responseJSON.error) ? xhr.responseJSON.error : 'אירעה שגיאה בשליחה';
|
|
@@ -81,22 +84,18 @@
|
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
86
|
});
|
|
84
|
-
}
|
|
87
|
+
};
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
var $ = jQuery;
|
|
92
|
-
initContactForm($);
|
|
93
|
-
$(window).off('action:ajaxify.end.contact').on('action:ajaxify.end.contact', function(ev, data) {
|
|
94
|
-
if (data.url === 'contact') {
|
|
95
|
-
initContactForm($);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
89
|
+
if (typeof jQuery !== 'undefined') {
|
|
90
|
+
init();
|
|
91
|
+
} else {
|
|
92
|
+
window.addEventListener('DOMContentLoaded', init);
|
|
98
93
|
}
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
|
|
95
|
+
$(window).on('action:ajaxify.end', function(ev, data) {
|
|
96
|
+
if (data.url === 'contact' || data.url === 'forum/contact') {
|
|
97
|
+
init();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
101
100
|
})();
|
|
102
101
|
</script>
|