<commit_before>/**
 * Created by: <NAME>
 * Date: Friday, 3rd February 2017
 *
 * Description: Separate JS for handling gallery submission on website.php
 **/

// event is only triggered when the input field values change
$('.add-gallery-pic').change(function(e) {
    var clickedElem = e.target;
    uploadGallery(clickedElem);
});


// listen for gallery clicks
var uploadGallery = function (element) {

    var galleryName = element.getAttribute('data-gallery-name');

    if (element.files.length > 0) {
        var file = element.files[0];
        var parseFile = new Parse.File(file.name, file); // name doesn't really matter

        var Gallery = Parse.Object.extend("Gallery");

        var galleryObject = new Gallery();
        galleryObject.set('image', parseFile);

        galleryObject.save().then(function(galleryObj) {
                var photoUrl = galleryObj.url();
                addPhotoUrl(galleryName, photoUrl);

            },
            function(err) {
                alert("Error saving file: " + err);
            });
    }
};<commit_msg>fixed photo url issue; complete gallery upload testing<commit_after>/**
 * Created by: <NAME>
 * Date: Friday, 3rd February 2017
 *
 * Description: Separate JS for handling gallery submission on website.php
 **/

// event is only triggered when the input field values change
$('.add-gallery-pic').change(function(e) {
    var clickedElem = e.target;
    uploadGallery(clickedElem);
});


// listen for gallery clicks
var uploadGallery = function (element) {

    var galleryName = element.getAttribute('data-gallery-name');

    if (element.files.length > 0) {
        var file = element.files[0];
        var parseFile = new Parse.File(file.name, file); // name doesn't really matter

        var Gallery = Parse.Object.extend("Gallery");

        var galleryObject = new Gallery();
        galleryObject.set('image', parseFile);

        galleryObject.save().then(function(galleryObj) {
                var photoUrl = galleryObj.attributes.image.url();
                addPhotoUrl(galleryName, photoUrl);

            },
            function(err) {
                alert("Error saving file: " + err);
            });
    }
};
{'fraction_non_alphanumeric': 0.12340619307832422, 'fraction_numerical': 0.006375227686703097, 'mean_word_length': 2.5898692810457518, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2004896', 'n_tokens_mistral': 623, 'n_tokens_neox': 578, 'n_words': 165}