@@ -44,7 +44,22 @@ var swiper = new Swiper('.swiper-container', {
44
44
45
45
46
46
jQuery ( document ) . ready ( function ( $ ) {
47
-
47
+ var getUserPublicUrl = function ( userId , targetId ) {
48
+ $ . ajax ( {
49
+ url : Ajax . url ,
50
+ type : 'POST' ,
51
+ data : {
52
+ action : 'get_public_user_url' ,
53
+ user_id : userId
54
+ } ,
55
+ success : function ( data ) {
56
+ var target = $ ( '#' + targetId ) ,
57
+ link = '<a href="' + data + '" target="_blank" class="voucher_profile_link">View User profile</a>' ;
58
+ target . html ( '' ) ;
59
+ target . html ( link ) ;
60
+ }
61
+ } ) ;
62
+ }
48
63
49
64
$ ( "body.page-template-page-faqs .item-acordion h2" ) . toggleClickV2 ( function ( e ) {
50
65
@@ -113,22 +128,30 @@ jQuery(document).ready(function($){
113
128
*/
114
129
$ ( '#input_41_1' ) . on ( 'change' , function ( e ) {
115
130
var thisSelect = $ ( this ) ,
131
+ thisSelectId = thisSelect . attr ( 'id' ) ,
116
132
selectedValue = thisSelect . val ( ) ,
117
133
otherSelectId = '#input_41_2' ,
118
- otherSelect = $ ( otherSelectId ) ;
134
+ otherSelect = $ ( otherSelectId ) ,
135
+ profileUrlId = thisSelectId + '_profile_url' ;
119
136
137
+ $ ( '<span id="' + profileUrlId + '"></span>' ) . insertAfter ( '#' + thisSelectId + '_chosen' ) ;
120
138
$ ( otherSelectId + ' option[disabled="disabled"]' ) . removeAttr ( 'disabled' ) ;
121
139
$ ( otherSelectId + ' option[value="' + selectedValue + '"]' ) . attr ( 'disabled' , 'disabled' ) ;
122
140
otherSelect . trigger ( "chosen:updated" ) ;
141
+ getUserPublicUrl ( selectedValue , profileUrlId ) ;
123
142
} ) ;
124
143
$ ( '#input_41_2' ) . on ( 'change' , function ( e ) {
125
144
var thisSelect = $ ( this ) ,
145
+ thisSelectId = thisSelect . attr ( 'id' ) ,
126
146
selectedValue = thisSelect . val ( ) ,
127
147
otherSelectId = '#input_41_1' ,
128
- otherSelect = $ ( otherSelectId ) ;
148
+ otherSelect = $ ( otherSelectId ) ,
149
+ profileUrlId = thisSelectId + '_profile_url' ;
129
150
151
+ $ ( '<span id="' + profileUrlId + '"></span>' ) . insertAfter ( '#' + thisSelectId + '_chosen' ) ;
130
152
$ ( otherSelectId + ' option[disabled="disabled"]' ) . removeAttr ( 'disabled' ) ;
131
153
$ ( otherSelectId + ' option[value="' + selectedValue + '"]' ) . attr ( 'disabled' , 'disabled' ) ;
132
154
otherSelect . trigger ( "chosen:updated" ) ;
155
+ getUserPublicUrl ( selectedValue , profileUrlId ) ;
133
156
} ) ;
134
157
} ) ;
0 commit comments