<commit_before>/*
 This file is part of the CampaignChain package.

 (c) CampaignChain, Inc. <<EMAIL>>

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 */

/*
 Definition of global vars.
 */
var today = campaignchainGetUserDateTime(moment());

/*
 Configuration of DHTMLXGantt properties.
 */
gantt.config.work_time = false;
gantt.config.correct_work_time = false;
gantt.config.duration_unit = 'minute'; // 5 minutes
gantt.config.duration_step = window.campaignchainSchedulerInterval;
// Allow to resize tasks?
gantt.config.drag_resize = false;
// Allow to create dependency links?
gantt.config.drag_links = false;
// Define task type for activity
gantt.config.types["activity"] = "type_id";
gantt.locale.labels['type_' + "activity"] = "Activity";
// Define task type for milestone
gantt.config.types["milestone"] = "type_id";
gantt.locale.labels['type_' + "milestone"] = "Milestone";
// TODO: Make left column collapsible.
gantt.config.progress = false;
gantt.config.grid_width = 240;
gantt.config.row_height = 40;
//gantt.config.autosize = true;

if(window.campaignchainGanttShowButtons == true) {
    gantt.config.columns = [
        {name: "text", label: "Campaigns", tree: true, width: 200},
        {
            name: "buttons",
            label: "",
            tree: false,
            width: 80,
            template: campaignchainGanttColButtons
        }
    ];
} else {
    gantt.config.columns = [
        {name: "text", label: "Campaigns", tree: true, width: 200}
    ];
}

function campaignchainGanttColButtons(task){
    if(task.type == 'campaign' && gantt.getChildren(gantt.getParent(task)).length > 1) {
        return '<a href="' + Routing.generate(task.route_plan_detail, { id: task.campaignchain_id }) + '" class="btn btn-primary btn-xs">'
            + '<span class="fa fa-pencil"></span>'
            + '</a>';
    }

    return "";
};

gantt.config.touch =  true;
// Disable that dragged task snaps to grid.
gantt.config.round_dnd_dates = false;
gantt.config.time_step = 5;
// Tooltip config.
// Important to ensure smooth movement during onTaskDrag event.
gantt.config.tooltip_timeout = 0;

gantt.attachEvent("onTaskOpened", function(id){
    $("#campaignchain_gantt_today").css("height", $(".gantt_task_bg").innerHeight());
    return true;
});

gantt.attachEvent("onTaskClosed", function(id){
    if($(".gantt_task_bg").innerHeight() > $(".gantt_data_area").innerHeight()){
        var height = $(".gantt_task_bg").innerHeight();
    } else {
        var height = $(".gantt_data_area").innerHeight();<commit_msg>CampaignChain/campaignchain#304 First new campaign is missing edit button in timeline<commit_after>/*
 This file is part of the CampaignChain package.

 (c) CampaignChain, Inc. <<EMAIL>>

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.
 */

/*
 Definition of global vars.
 */
var today = campaignchainGetUserDateTime(moment());

/*
 Configuration of DHTMLXGantt properties.
 */
gantt.config.work_time = false;
gantt.config.correct_work_time = false;
gantt.config.duration_unit = 'minute'; // 5 minutes
gantt.config.duration_step = window.campaignchainSchedulerInterval;
// Allow to resize tasks?
gantt.config.drag_resize = false;
// Allow to create dependency links?
gantt.config.drag_links = false;
// Define task type for activity
gantt.config.types["activity"] = "type_id";
gantt.locale.labels['type_' + "activity"] = "Activity";
// Define task type for milestone
gantt.config.types["milestone"] = "type_id";
gantt.locale.labels['type_' + "milestone"] = "Milestone";
// TODO: Make left column collapsible.
gantt.config.progress = false;
gantt.config.grid_width = 240;
gantt.config.row_height = 40;
//gantt.config.autosize = true;

if(window.campaignchainGanttShowButtons == true) {
    gantt.config.columns = [
        {name: "text", label: "Campaigns", tree: true, width: 200},
        {
            name: "buttons",
            label: "",
            tree: false,
            width: 80,
            template: campaignchainGanttColButtons
        }
    ];
} else {
    gantt.config.columns = [
        {name: "text", label: "Campaigns", tree: true, width: 200}
    ];
}

function campaignchainGanttColButtons(task){
    if(task.type == 'campaign') {
        return '<a href="' + Routing.generate(task.route_plan_detail, { id: task.campaignchain_id }) + '" class="btn btn-primary btn-xs">'
            + '<span class="fa fa-pencil"></span>'
            + '</a>';
    }

    return "";
};

gantt.config.touch =  true;
// Disable that dragged task snaps to grid.
gantt.config.round_dnd_dates = false;
gantt.config.time_step = 5;
// Tooltip config.
// Important to ensure smooth movement during onTaskDrag event.
gantt.config.tooltip_timeout = 0;

gantt.attachEvent("onTaskOpened", function(id){
    $("#campaignchain_gantt_today").css("height", $(".gantt_task_bg").innerHeight());
    return true;
});

gantt.attachEvent("onTaskClosed", function(id){
    if($(".gantt_task_bg").innerHeight() > $(".gantt_data_area").innerHeight()){
        var height = $(".gantt_task_bg").innerHeight();
    } else {
        var height = $(".gantt_data_area").innerHeight();
{'fraction_non_alphanumeric': 0.1462578556465435, 'fraction_numerical': 0.006855836983431727, 'mean_word_length': 3.631393298059965, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 18, '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': '3227194', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1685, 'n_words': 388}