public/beta.js
// PUT (edit) Project functions
PUT (edit) Project functions
PUT ( edit ) Project functions
function edit_project_title_toggle() {
    if ($(".client_options_container").css("grid-auto-flow") == "row" ) {
        $('.project_list').on( 'mousedown', ".unique_project_card > p", ( event => {
            event.preventDefault();
            timeoutId = setTimeout( () => {
                $(".unique_project_card > p").css("pointer-events", "none");
                selected_storage.selected_project_for_edit = $(event.currentTarget).text().trim();
                $('.project_options_container').css('display', 'none');
                $('.form_container').css('display', 'grid');
                $('.edit_submition').css('display', 'grid');
                $('.edit_submition').html(
                    `<label class="form_edit_label" for="new_project_title">New Room Title</label>
                    <input class="form_edit_text" type="text" id="new_project_title" name="new_project_title" required minlength="1">
                    <input type="button" value="Submit" class="project_submition_button edit_submition_button">
                    <input type="button" value="Back" class="project_back_button edit_submition_back">`
                );
                $('.project_toggle').css("pointer-events", "none");
                $('.profile_img').css("pointer-events", "none");
                $.getJSON(client_home_url)
                    .then(current_account_store => {
                        for (let i = 0; i < current_account_store.projects.length; i++) {
                            if (current_account_store.projects[i].projectTitle == selected_storage.selected_project_for_edit) {
                                console.log(`Editing ${selected_storage.selected_project_for_edit}...`);
                                client_edit_project_url = change_url(`client_pages/project/${current_account_store.projects[i]._id}`);
                            }
                        };
                    });
            }, 500)
        })).on('mouseup mouseleave', function() {
            clearTimeout(timeoutId);
        });
    } else {
        $('.project_list').on( 'touchstart', ".unique_project_card > p", ( event => {
            event.preventDefault();
            timeoutId = setTimeout( () => {
                held_toggle = true;
                $(".unique_project_card > p").css("pointer-events", "none");
                selected_storage.selected_project_for_edit = $(event.currentTarget).text().trim();
                $('.project_options_container').css('display', 'none');
                $('.edit_submition').css('display', 'grid');
                $('.form_container').css('display', 'grid');
                $('.form_container').css('grid-row', '1 / 3');
                $('.form_container').css('grid-column', '1 / 2');
                $('.client_options_container').css('display', 'none');
                $('.main_display').css('display', 'none');
                $('.project_options_container').css("display", "none");
                $('.edit_submition').html(
                    `<label class="form_edit_label" for="new_project_title">New Room Title</label>
                    <input class="form_edit_text" type="text" id="new_project_title" name="new_project_title" required minlength="1">
                    <input type="button" value="Submit" class="project_submition_button edit_submition_button">
                    <input type="button" value="Back" class="project_back_button edit_submition_back">`
                );
                $('.project_toggle').css("pointer-events", "none");
                $('.profile_img').css("pointer-events", "none");
                $.getJSON(client_home_url)
                    .then(current_account_store => {
                        for (let i = 0; i < current_account_store.projects.length; i++) {
                            if (current_account_store.projects[i].projectTitle == selected_storage.selected_project_for_edit) {
                                console.log(`Editing ${selected_storage.selected_project_for_edit}...`);
                                client_edit_project_url = change_url(`client_pages/project/${current_account_store.projects[i]._id}`);
                            }
                        };
                    });
            }, 500)
        })).on('touchend', function() {
            clearTimeout(timeoutId);
            held_toggle = false;
        });
    }
}
function edit_project_title_toggle ( ) { if ( $ ( ".client_options_container" ) . css ( "grid-auto-flow" ) == "row" ) { $ ( '.project_list' ) . on ( 'mousedown' , ".unique_project_card > p" , ( event => { event . preventDefault ( ) ; timeoutId = setTimeout ( ( ) => { $ ( ".unique_project_card > p" ) . css ( "pointer-events" , "none" ) ; selected_storage . selected_project_for_edit = $ ( event . currentTarget ) . text ( ) . trim ( ) ; $ ( '.project_options_container' ) . css ( 'display' , 'none' ) ; $ ( '.form_container' ) . css ( 'display' , 'grid' ) ; $ ( '.edit_submition' ) . css ( 'display' , 'grid' ) ; $ ( '.edit_submition' ) . html ( ` ` ) ; $ ( '.project_toggle' ) . css ( "pointer-events" , "none" ) ; $ ( '.profile_img' ) . css ( "pointer-events" , "none" ) ; $ . getJSON ( client_home_url ) . then ( current_account_store => { for ( let i = 0 ; i < current_account_store . projects . length ; i ++ ) { if ( current_account_store . projects [ i ] . projectTitle == selected_storage . selected_project_for_edit ) { console . log ( ` ${ selected_storage . selected_project_for_edit } ` ) ; client_edit_project_url = change_url ( ` ${ current_account_store . projects [ i ] . _id } ` ) ; } } ; } ) ; } , 500 ) } ) ) . on ( 'mouseup mouseleave' , function ( ) { clearTimeout ( timeoutId ) ; } ) ; } else { $ ( '.project_list' ) . on ( 'touchstart' , ".unique_project_card > p" , ( event => { event . preventDefault ( ) ; timeoutId = setTimeout ( ( ) => { held_toggle = true ; $ ( ".unique_project_card > p" ) . css ( "pointer-events" , "none" ) ; selected_storage . selected_project_for_edit = $ ( event . currentTarget ) . text ( ) . trim ( ) ; $ ( '.project_options_container' ) . css ( 'display' , 'none' ) ; $ ( '.edit_submition' ) . css ( 'display' , 'grid' ) ; $ ( '.form_container' ) . css ( 'display' , 'grid' ) ; $ ( '.form_container' ) . css ( 'grid-row' , '1 / 3' ) ; $ ( '.form_container' ) . css ( 'grid-column' , '1 / 2' ) ; $ ( '.client_options_container' ) . css ( 'display' , 'none' ) ; $ ( '.main_display' ) . css ( 'display' , 'none' ) ; $ ( '.project_options_container' ) . css ( "display" , "none" ) ; $ ( '.edit_submition' ) . html ( ` ` ) ; $ ( '.project_toggle' ) . css ( "pointer-events" , "none" ) ; $ ( '.profile_img' ) . css ( "pointer-events" , "none" ) ; $ . getJSON ( client_home_url ) . then ( current_account_store => { for ( let i = 0 ; i < current_account_store . projects . length ; i ++ ) { if ( current_account_store . projects [ i ] . projectTitle == selected_storage . selected_project_for_edit ) { console . log ( ` ${ selected_storage . selected_project_for_edit } ` ) ; client_edit_project_url = change_url ( ` ${ current_account_store . projects [ i ] . _id } ` ) ; } } ; } ) ; } , 500 ) } ) ) . on ( 'touchend' , function ( ) { clearTimeout ( timeoutId ) ; held_toggle = false ; } ) ; } }
PUT (edit) Project functions
PUT ( edit ) Project functions