<commit_before>﻿var addingIngredientStep = null;

function UpdateStepsAttributes() {
    $('.recipe-step').each(function (i, element) {
        $('.recipe-step-caption', element).text('Шаг ' + (i + 1));
        $('.recipe-step-discription', element).attr('name', 'RecipeStep[' + i + '].Discription');
        $('.recipe-step-time', element).attr('name', 'RecipeStep[' + i + '].Time');
        $('.ingredient-delete').click(DeleteIngredient);
        $('.ingredient', element).each(function (j, ingredient) {
            $('.ingredient-name', ingredient).attr('name', 'RecipeStep[' + i + '].Ingredients[' + j + '].IngredientType.Name');
            $('.ingredient-measure', ingredient).attr('name', 'RecipeStep[' + i + '].Ingredients[' + j + '].MeasureTypeId');
            $('.ingredient-amount', ingredient).attr('name', 'RecipeStep[' + i + '].Ingredients[' + j + '].Amount');
        });
    });
}

function OnAddRecipeStep() {
    $('.recipe-step-delete').click(DeleteRecipeStep);
    $('.add-ingredient').click(SaveAddingIngredientStep);
    UpdateStepsAttributes();
}

function OnAddIngredient(data) {
    $('.ingredients', $(addingIngredientStep)).append(data);
    addingIngredientStep = null;
    UpdateStepsAttributes();
}

function DeleteIngredient(e) {
    $(this).parents('.ingredient').remove();
    UpdateStepsAttributes();
}

function DeleteRecipeStep(e) {
    $(this).parents('.recipe-step').remove();
    UpdateStepsAttributes();
}

function SaveAddingIngredientStep(e) {
    addingIngredientStep = $(this).parents('.recipe-step');
}

$(document).ready(function() {
    $('.add-ingredient').click(SaveAddingIngredientStep);
    $('.recipe-step-delete').click(DeleteRecipeStep);<commit_msg>Так лучше.<commit_after>﻿var addingIngredientStep = null;

function UpdateStepsAttributes() {
    $('.recipe-step').each(function (i, element) {
        $('.recipe-step-caption', element).text('Шаг ' + (i + 1));
        $('.recipe-step-discription', element).attr('name', 'RecipeStep[' + i + '].Discription');
        $('.recipe-step-time', element).attr('name', 'RecipeStep[' + i + '].Time');       
        $('.ingredient', element).each(function (j, ingredient) {
            $('.ingredient-name', ingredient).attr('name', 'RecipeStep[' + i + '].Ingredients[' + j + '].IngredientType.Name');
            $('.ingredient-measure', ingredient).attr('name', 'RecipeStep[' + i + '].Ingredients[' + j + '].MeasureTypeId');
            $('.ingredient-amount', ingredient).attr('name', 'RecipeStep[' + i + '].Ingredients[' + j + '].Amount');
        });
    });
}

function OnAddRecipeStep() {
    $('.recipe-step-delete').click(DeleteRecipeStep);
    $('.add-ingredient').click(SaveAddingIngredientStep);
    UpdateStepsAttributes();
}

function OnAddIngredient(data) {
    $('.ingredients', $(addingIngredientStep)).append(data);
    $('.ingredient-delete').click(DeleteIngredient);
    addingIngredientStep = null;
    UpdateStepsAttributes();
}

function DeleteIngredient(e) {
    $(this).parents('.ingredient').remove();
    UpdateStepsAttributes();
}

function DeleteRecipeStep(e) {
    $(this).parents('.recipe-step').remove();
    UpdateStepsAttributes();
}

function SaveAddingIngredientStep(e) {
    addingIngredientStep = $(this).parents('.recipe-step');
}

$(document).ready(function() {
    $('.add-ingredient').click(SaveAddingIngredientStep);
    $('.recipe-step-delete').click(DeleteRecipeStep);
{'fraction_non_alphanumeric': 0.20955451348182885, 'fraction_numerical': 0.0005861664712778429, 'mean_word_length': 4.140060240963855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4138010', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1115, 'n_words': 150}