Skip to content

Commit 9532418

Browse files
author
Devin Walker
committed
Tags now working as expected, refreshing, plugin ready for release
1 parent 7ee3a1d commit 9532418

File tree

3 files changed

+235
-96
lines changed

3 files changed

+235
-96
lines changed

assets/css/admin-forms.css

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,35 @@
33
*/
44

55
.give-convertkit-list-wrap, .give-convertkit-tag-wrap {
6-
border: 1px solid #ccc;
7-
background: #FDFDFD;
8-
width: auto;
9-
height: 200px;
10-
overflow-y: scroll;
11-
padding: 7px 10px;
6+
border: 1px solid #ccc;
7+
background: #FDFDFD;
8+
width: auto;
9+
height: 200px;
10+
overflow-y: scroll;
11+
padding: 7px 10px;
12+
margin: 0;
13+
clear: both;
1214
}
1315

1416
.give-convertkit-list-wrap label, .give-convertkit-tag-wrap label {
15-
display: block;
16-
margin-bottom: 3px;
17+
display: block;
18+
margin-bottom: 3px;
1719
}
1820

1921
.give-convertkit-list-wrap label.group, .give-convertkit-tag-wrap label.group {
20-
margin-left: 30px;
21-
font-size: 13px;
22-
font-style: italic;
22+
margin-left: 30px;
23+
font-size: 13px;
24+
font-style: italic;
2325
}
26+
27+
.give-convertkit-tag-label-wrap {
28+
margin: 10px 0 0;
29+
}
30+
31+
.give-convertkit-select-wrap {
32+
margin: 0 0 20px;
33+
}
34+
35+
.give_forms_page_give-settings .give-convertkit-tag-wrap {
36+
max-width:350px;
37+
}

assets/js/admin-ajax.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,43 @@ jQuery(document).ready(function ($) {
5252
});
5353
});
5454

55+
/**
56+
* Refresh Tags Button click.
57+
*/
58+
$('.give-reset-tags-convertkit-button').on('click', function (e) {
59+
e.preventDefault();
60+
61+
var field_type = $(this).data('field_type');
62+
63+
var data = {
64+
action: $(this).data('action'),
65+
field_type: field_type,
66+
post_id: give_vars.post_id
67+
},
68+
refresh_button = $(this),
69+
spinner = $(this).next();
70+
71+
$.ajax({
72+
method: 'POST',
73+
url: ajaxurl,
74+
data: data,
75+
beforeSend: function () {
76+
spinner.addClass('is-active');
77+
},
78+
success: function (res) {
79+
if (true == res.success) {
80+
//Replace select options.
81+
if (field_type == 'select') {
82+
$('.give-convertkit-tag-select').empty().append(res.data.lists);
83+
} else {
84+
$('.give-convertkit-tag-wrap').empty().append(res.data.lists);
85+
}
86+
87+
refresh_button.hide();
88+
spinner.removeClass('is-active');
89+
}
90+
}
91+
});
92+
});
93+
5594
});

0 commit comments

Comments
 (0)