PluginProbe
Property Hive / 1.4.6
Property Hive v1.4.6
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / assets / js / admin / meta-boxes.js

meta-boxes.js in Property Hive 1.4.6, at assets/js/admin/meta-boxes.js

99 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery( function($){
2
3 $('.propertyhive_meta_box #property_rooms').sortable({
4 opacity: 0.8,
5 revert: true,
6 handle: 'h3'
7 });
8
9 $('.propertyhive_meta_box #property_features').sortable({
10 opacity: 0.8,
11 revert: true,
12 handle: 'label'
13 });
14
15 $('.propertyhive_meta_box #property_virtual_tours').sortable({
16 opacity: 0.8,
17 revert: true,
18 handle: 'label'
19 });
20
21 initialise_datepicker();
22
23 // TABS
24 $('ul.ph-tabs').show();
25 $('div.panel-wrap').each(function(){
26 $(this).find('div.panel:not(:first)').hide();
27 });
28 $('ul.ph-tabs a').click(function(){
29 var panel_wrap = $(this).closest('div.panel-wrap');
30 $('ul.ph-tabs li', panel_wrap).removeClass('active');
31 $(this).parent().addClass('active');
32 $('div.panel', panel_wrap).hide();
33 $( $(this).attr('href') ).show();
34 return false;
35 });
36 $('ul.ph-tabs li:visible').eq(0).find('a').click();
37
38 // Notes
39 $('#propertyhive-property-notes, #propertyhive-contact-notes, #propertyhive-enquiry-notes, #propertyhive-viewing-notes, #propertyhive-offer-notes, #propertyhive-sale-notes').on( 'click', 'a.add_note', function() {
40 if ( ! $('textarea#add_note').val() ) return;
41
42 var data = {
43 action: 'propertyhive_add_note',
44 post_id: propertyhive_admin_meta_boxes.post_id,
45 note: $('textarea#add_note').val(),
46 note_type: 'propertyhive_note',
47 security: propertyhive_admin_meta_boxes.add_note_nonce,
48 };
49
50 $.post( propertyhive_admin_meta_boxes.ajax_url, data, function(response) {
51 $('ul.record_notes').prepend( response );
52 $('li#no_notes').hide();
53 $('#add_note').val('');
54 });
55
56 return false;
57
58 });
59
60 $('#propertyhive-property-notes, #propertyhive-contact-notes, #propertyhive-enquiry-notes, #propertyhive-viewing-notes, #propertyhive-offer-notes, #propertyhive-sale-notes').on( 'click', 'a.delete_note', function() {
61
62 var confirm_box = confirm('Are you sure you wish to delete this note?');
63 if (!confirm_box)
64 {
65 return false;
66 }
67
68 var note = $(this).closest('li.note');
69
70 var data = {
71 action: 'propertyhive_delete_note',
72 note_id: $(note).attr('rel'),
73 security: propertyhive_admin_meta_boxes.delete_note_nonce,
74 };
75
76 $.post( propertyhive_admin_meta_boxes.ajax_url, data, function(response) {
77 $(note).remove();
78
79 if ($('ul.record_notes li').length <= 1)
80 {
81 $('li#no_notes').show();
82 }
83 });
84
85 return false;
86 });
87
88 // Multiselect
89 $(".propertyhive_meta_box select.multiselect").chosen();
90
91 });
92
93 function initialise_datepicker() {
94 jQuery( ".date-picker" ).datepicker({
95 dateFormat: "yy-mm-dd",
96 numberOfMonths: 1,
97 showButtonPanel: true
98 });
99 }