Changeset 2432417
- Timestamp:
- 12/06/2020 03:27:01 AM (5 years ago)
- Location:
- artistpress/trunk
- Files:
-
- 3 edited
-
admin/includes/metaboxes/js/scripts.js (modified) (8 diffs)
-
artist-press.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
artistpress/trunk/admin/includes/metaboxes/js/scripts.js
r1776588 r2432417 2 2 3 3 4 // the upload image button, saves the id and outputs a preview of the image 5 var imageFrame; 6 $('.meta_box_upload_image_button').live('click',function(e) { 7 e.preventDefault(); 8 9 var options, attachment; 10 11 $self = $(event.target); 12 $div = $self.closest('div.meta_box_image'); 13 14 // if the frame already exists, open it 15 if ( imageFrame ) { 4 // Sets image preview and id of image when for saving. 5 function setImage(button) { 6 7 var mediaFrame, 8 addMediaButton = button, 9 imgContainer = addMediaButton.parent('.meta_box_image'), 10 imgPreview = addMediaButton.siblings('.meta_box_preview_image'), 11 imgInput = addMediaButton.siblings('.meta_box_upload_image'); 12 13 if ( mediaFrame ) { 16 14 imageFrame.open(); 17 15 return; 18 16 } 19 20 // set oursettings21 imageFrame = wp.media({17 18 // Set our inmage frame settings 19 mediaFrame = wp.media({ 22 20 title: 'Choose Image', 23 21 multiple: false, … … 29 27 } 30 28 }); 31 32 // set up our select handler 33 imageFrame.on( 'select', function() { 34 selection = imageFrame.state().get('selection'); 35 36 if ( ! selection ) 37 return; 38 39 // loop through the selected files 40 selection.each( function( attachment ) { 41 console.log(attachment); 42 var src = attachment.attributes.sizes.full.url; 43 var id = attachment.id; 44 45 $div.find('.meta_box_preview_image').attr('src', src); 46 $div.find('.meta_box_upload_image').val(id); 47 } ); 29 30 //When an image is selected in the media frame... 31 mediaFrame.on( 'select', function() { 32 33 // Get media attachment details from the frame state 34 let selection = mediaFrame.state().get('selection').first().toJSON(); 35 36 if (!selection){ 37 return; 38 } 39 40 imgPreview.css('display','block').attr('src', selection.url ); 41 imgInput.val(selection.id); 48 42 }); 49 50 // open the frame 51 imageFrame.open(); 52 }); 53 54 // the remove image link, removes the image id from the hidden field and replaces the image preview 55 $('.meta_box_clear_image_button').live('click',function(e) { 43 44 // Finally, open the modal on click 45 mediaFrame.open(); 46 }; 47 48 /* 49 * Runs setImage function when Upload Image button is clicked. 50 */ 51 $('.meta_box_repeatable').on('click', '.meta_box_upload_image_button', (e) => { 56 52 e.preventDefault(); 53 setImage($(e.target)); 54 }); 55 56 /* 57 * Maintains the remove buttons after save 58 */ 59 $('.form-row:not(:first) .meta_box_clear_image_button.button').css({"display": "inline-block"}); 60 //$('.form-row:not(:first) .meta_box_clear_audio_button.button').css({"display": "inline-block"}); 61 62 63 /* 64 * Replaces Above code. 65 * Removes a row when the clear image or clear song button is clicked. 66 */ 67 $('.meta_box_repeatable').on('click', '.meta_box_clear_image_button', (e) => { 68 e.preventDefault(); 69 $(e.target).closest('tr').remove(); 70 }) 71 // $('.meta_box_repeatable').on('click', '.meta_box_clear_audio_button', (e) => { 72 // e.preventDefault(); 73 // $(e.target).closest('tr').remove(); 74 // }) 75 76 77 78 79 80 81 82 83 84 85 86 57 87 58 var defaultImage = $(this).parent().siblings('.meta_box_default_image').text();59 $(this).parent().siblings('.meta_box_upload_image').val('');60 $(this).parent().siblings('.meta_box_preview_image').attr('src', defaultImage);61 62 // $('.meta_box_upload_image_button').show();63 // $('.meta_box_clear_image_button').hide();64 65 //return false;66 67 });68 69 // maintains the remove buttons after save70 $('.form-row:not(:first) .meta_box_clear_image_button.button').css({"display": "inline-block"});71 $('.form-row:not(:first) .meta_box_clear_audio_button.button').css({"display": "inline-block"});72 73 74 75 76 77 88 78 89 … … 82 93 83 94 // the file image button, saves the id and outputs the file name 84 var fileFrame;85 $('.meta_box_upload_file_button').click(function(e) {86 e.preventDefault();87 88 var options, attachment;89 90 $self = $(event.target);91 $div = $self.closest('div.meta_box_file_stuff');92 93 // if the frame already exists, open it94 if ( fileFrame ) {95 fileFrame.open();96 return;97 }98 99 // set our settings100 fileFrame = wp.media({101 title: 'Choose File',102 multiple: false,103 library: {104 type: 'file'105 },106 button: {107 text: 'Use This File'108 }109 });110 111 // set up our select handler112 fileFrame.on( 'select', function() {113 selection = fileFrame.state().get('selection');114 115 if ( ! selection )116 return;117 118 // loop through the selected files119 selection.each( function( attachment ) {120 console.log(attachment);121 var src = attachment.attributes.url;122 var id = attachment.id;123 124 $div.find('.meta_box_filename').text(src);125 $div.find('.meta_box_upload_file').val(src);126 $div.find('.meta_box_file').addClass('checked');127 } );128 });129 130 // open the frame131 fileFrame.open();132 });133 134 // the remove image link, removes the image id from the hidden field and replaces the image preview135 $('.meta_box_clear_file_button').click(function() {136 $(this).parent().siblings('.meta_box_upload_file').val('');137 $(this).parent().siblings('.meta_box_filename').text('');138 $(this).parent().siblings('.meta_box_file').removeClass('checked');139 return false;140 });95 // var fileFrame; 96 // $('.meta_box_upload_file_button').click(function(e) { 97 // e.preventDefault(); 98 99 // var options, attachment; 100 101 // $self = $(event.target); 102 // $div = $self.closest('div.meta_box_file_stuff'); 103 104 // // if the frame already exists, open it 105 // if ( fileFrame ) { 106 // fileFrame.open(); 107 // return; 108 // } 109 110 // // set our settings 111 // fileFrame = wp.media({ 112 // title: 'Choose File', 113 // multiple: false, 114 // library: { 115 // type: 'file' 116 // }, 117 // button: { 118 // text: 'Use This File' 119 // } 120 // }); 121 122 // // set up our select handler 123 // fileFrame.on( 'select', function() { 124 // selection = fileFrame.state().get('selection'); 125 126 // if ( ! selection ) 127 // return; 128 129 // // loop through the selected files 130 // selection.each( function( attachment ) { 131 // console.log(attachment); 132 // var src = attachment.attributes.url; 133 // var id = attachment.id; 134 135 // $div.find('.meta_box_filename').text(src); 136 // $div.find('.meta_box_upload_file').val(src); 137 // $div.find('.meta_box_file').addClass('checked'); 138 // } ); 139 // }); 140 141 // // open the frame 142 // fileFrame.open(); 143 // }); 144 145 // // the remove image link, removes the image id from the hidden field and replaces the image preview 146 // $('.meta_box_clear_file_button').click(function() { 147 // $(this).parent().siblings('.meta_box_upload_file').val(''); 148 // $(this).parent().siblings('.meta_box_filename').text(''); 149 // $(this).parent().siblings('.meta_box_file').removeClass('checked'); 150 // return false; 151 // }); 141 152 142 153 … … 154 165 155 166 // the upload image button, saves the id and outputs a preview of the image 156 var audioFrame;157 $('.meta_box_upload_audio_button').live('click',function(e) {158 e.preventDefault();159 160 //$('.meta_box_upload_audio_button').hide();161 //$('.meta_box_clear_audio_button').show();162 163 var options, attachment;164 165 $self = $(event.target);166 $div = $self.closest('div.meta_box_audio');167 168 // if the frame already exists, open it169 if ( audioFrame ) {170 audioFrame.open();171 return;172 }173 174 // set our settings175 audioFrame = wp.media({176 title: 'Choose Audio File',177 multiple: false,178 library: {179 type: 'audio'180 },181 button: {182 text: 'Use This Audio File'183 }184 });185 186 // set up our select handler187 audioFrame.on( 'select', function() {188 selection = audioFrame.state().get('selection');189 190 if ( ! selection )191 return;192 193 // loop through the selected files194 selection.each( function( attachment ) {195 console.log(attachment);167 // var audioFrame; 168 // $('.meta_box_upload_audio_button').live('click',function(e) { 169 // e.preventDefault(); 170 171 // //$('.meta_box_upload_audio_button').hide(); 172 // //$('.meta_box_clear_audio_button').show(); 173 174 // var options, attachment; 175 176 // $self = $(event.target); 177 // $div = $self.closest('div.meta_box_audio'); 178 179 // // if the frame already exists, open it 180 // if ( audioFrame ) { 181 // audioFrame.open(); 182 // return; 183 // } 184 185 // // set our settings 186 // audioFrame = wp.media({ 187 // title: 'Choose Audio File', 188 // multiple: false, 189 // library: { 190 // type: 'audio' 191 // }, 192 // button: { 193 // text: 'Use This Audio File' 194 // } 195 // }); 196 197 // // set up our select handler 198 // audioFrame.on( 'select', function() { 199 // selection = audioFrame.state().get('selection'); 200 201 // if ( ! selection ) 202 // return; 203 204 // // loop through the selected files 205 // selection.each( function( attachment ) { 206 // console.log(attachment); 196 207 197 var title = attachment.attributes.title;198 var src = attachment.attributes.url;199 var id = attachment.attributes.id;200 201 202 $div.find('.meta_box_preview_audio').html(title);203 //$div.find('.meta_box_upload_audio_file_name').attr('value', name);208 // var title = attachment.attributes.title; 209 // var src = attachment.attributes.url; 210 // var id = attachment.attributes.id; 211 212 213 // $div.find('.meta_box_preview_audio').html(title); 214 // //$div.find('.meta_box_upload_audio_file_name').attr('value', name); 204 215 205 //$div.find('.meta_box_upload_audio_file').attr('value', src);206 $div.find('.meta_box_upload_audio_file').val(id);216 // //$div.find('.meta_box_upload_audio_file').attr('value', src); 217 // $div.find('.meta_box_upload_audio_file').val(id); 207 218 208 $div.find('.meta_box_file').addClass('checked');209 210 //$div.find('.meta_box_preview_image').attr('src', src);211 //$div.find('.meta_box_upload_image').val(id);212 213 } );214 });215 216 // open the frame217 audioFrame.open();218 });219 // $div.find('.meta_box_file').addClass('checked'); 220 221 // //$div.find('.meta_box_preview_image').attr('src', src); 222 // //$div.find('.meta_box_upload_image').val(id); 223 224 // } ); 225 // }); 226 227 // // open the frame 228 // audioFrame.open(); 229 // }); 219 230 220 231 221 232 // the remove image link, removes the image id from the hidden field and replaces the image preview 222 233 //$('.meta_box_clear_audio_button').click(function(e) { 223 $('.meta_box_clear_audio_button').live('click',function(e) {224 e.preventDefault();234 // $('.meta_box_clear_audio_button').live('click',function(e) { 235 // e.preventDefault(); 225 236 226 var parentDiv = $(this).closest('div');227 var songTitle = $(parentDiv).find('.meta_box_preview_audio');228 var songID = $(parentDiv).find('.meta_box_upload_audio_file');229 230 $(parentDiv).remove;231 232 $(songTitle).html('');233 $(songID).val('');234 235 return false;236 });237 // var parentDiv = $(this).closest('div'); 238 // var songTitle = $(parentDiv).find('.meta_box_preview_audio'); 239 // var songID = $(parentDiv).find('.meta_box_upload_audio_file'); 240 241 // $(parentDiv).remove; 242 243 // $(songTitle).html(''); 244 // $(songID).val(''); 245 246 // return false; 247 // }); 237 248 238 249 … … 268 279 269 280 e.preventDefault(); 270 console.log('clicked');271 281 // clone 272 282 var row = $('table.meta_box_repeatable').find('tbody tr:last-child'); … … 275 285 //var defaultImage = clone.closest('.meta_box_default_image').text(); 276 286 //console.log(defaultImage); 277 console.log(clone);287 //console.log(clone); 278 288 279 289 clone.find('.meta_box_upload_image').val(''); … … 320 330 321 331 322 //removes to row when the clear image or clear song button is clicked 323 $("a.meta_box_clear_image_button").live('click', function(e){ 324 e.preventDefault(); 325 //console.log('removed'); 326 $(this).closest('tr').remove(); 327 }); 328 $("a.meta_box_clear_audio_button").live('click', function(e){ 329 e.preventDefault(); 330 //console.log('removed'); 331 $(this).closest('tr').remove(); 332 }); 333 332 334 333 335 334 … … 375 374 if (!!$.prototype.chosen) 376 375 $('.chosen').chosen({ allow_single_deselect: true }); 376 377 var show_artist_field = $('#artistpress_show_artist'); 378 var show_artist_name_field = $('#artistpress_show_artist_name'); 379 var show_artist_name_field = $('#artistpress_show_artist_name'); 380 381 show_artist_field.change( function() { 382 show_artist_name_field.val( $(this).find(':selected').data('name') ); 383 }); 384 385 var show_venue_field = $('#artistpress_show_venue'); 386 var show_venue_name_field = $('#artistpress_show_venue_name'); 387 388 show_venue_field.change( function() { 389 show_venue_name_field.val( $(this).find(':selected').data('name') ); 390 }); 377 391 }); -
artistpress/trunk/artist-press.php
r2376827 r2432417 6 6 * Author: Tim Scheman 7 7 * Author URI: http;//timscheman.com 8 * Version: 1.2. 38 * Version: 1.2.4 9 9 * License: GPLv2 //look into this to make sure you have ther right license listed. 10 10 * -
artistpress/trunk/readme.txt
r2376827 r2432417 3 3 Tags: band, artist, artists, shows, venues, gallery, events, event, event listing, custom post types 4 4 Requires at least: 4.8 5 Tested up to: 5.5. 15 Tested up to: 5.5.3 6 6 Requires PHP: 7.0 7 Stable tag: 1.2. 37 Stable tag: 1.2.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 83 83 == Changelog == 84 84 85 = 1.0.0 = 86 * ArtistPress Launched. 85 = 1.2.4 = 86 * Ensured that ArtistPress is functional with WordPress 5.5.3 87 * Fixed bug causing "ArtistPress Show" data to not save properly. 88 * Updated gallery administration interface to account for deprecated jQuery "live" method. 89 * Continued preparation for upcoming release of Version 2.0 in the next couple of months. 90 * Reordered change log to be in descending order. 91 92 = 1.2.3 = 93 * Ensured that ArtistPress is functional with WordPress 5.5.1 94 * All shortcodes work using the Classic and Shortcode editor blocks. 95 * All shortcodes will also work with the Classic Editor plugin installed. 96 * Preparing for upcoming release of Version 2.0 in the next couple of months. 97 98 = 1.2.2 = 99 * Changed ArtistPress Show meta data to save the venue name in addition to venue ID. 100 * Added setting to order show archive in Descending or Ascending order. This setting still defaults to ascending order. 101 * Added Upgrader class to update meta on all shows. Upgrader runs once in the background when the plugin is updated. 102 103 = 1.2.1 = 104 * Conditionally enqueued jQuery for gallery lightboxes as it was not available in new "Twenty Nineteen" theme. 105 106 = 1.2 = 107 * Ensured that ArtistPress is functional with WordPress 5.0 108 * All shortcodes work using the Classic and Shortcode editor blocks. 109 * Currently gallery lightboxes DO NOT function when using "Twenty Nineteen" theme. This will be reconciled in the next maintenance release. 110 111 = 1.1.2 = 112 * Corrected link to ArtistPress website. Now points to http://www.artistpress-plugin.com/. 113 * Corrected link to documentation. Now points to http://www.artistpress-plugin.com/documentation/. 114 * Corrected link to download page for Pro and Community versions of ArtistPress. Now points to http://www.artistpress-plugin.com/download/. 87 115 88 116 = 1.1.0 = … … 93 121 * Made adjustments to the field descriptions on the settings page, specifically on the Show List Settings tab and the Individual Show Settings tab. 94 122 95 = 1.1.2 = 96 * Corrected link to ArtistPress website. Now points to http://www.artistpress-plugin.com/. 97 * Corrected link to documentation. Now points to http://www.artistpress-plugin.com/documentation/. 98 * Corrected link to download page for Pro and Community versions of ArtistPress. Now points to http://www.artistpress-plugin.com/download/. 99 100 = 1.2 = 101 * Ensured that ArtistPress is functional with WordPress 5.0 102 * All shortcodes work using the Classic and Shortcode editor blocks. 103 * Currently gallery lightboxes DO NOT function when using "Twenty Nineteen" theme. This will be reconciled in the next maintenance release. 104 105 = 1.2.1 = 106 * Conditionally enqueued jQuery for gallery lightboxes as it was not available in new "Twenty Nineteen" theme. 107 108 = 1.2.2 = 109 * Changed ArtistPress Show meta data to save the venue name in addition to venue ID. 110 * Added setting to order show archive in Descending or Ascending order. This setting still defaults to ascending order. 111 * Added Upgrader class to update meta on all shows. Upgrader runs once in the background when the plugin is updated. 112 113 = 1.2.3 = 114 * Ensured that ArtistPress is functional with WordPress 5.5.1 115 * All shortcodes work using the Classic and Shortcode editor blocks. 116 * All shortcodes will also work with the Classic Editor plugin installed. 117 * Preparing for upcoming release of Version 2.0 in the next couple of months. 123 = 1.0.0 = 124 * ArtistPress Launched.
Note: See TracChangeset
for help on using the changeset viewer.