<commit_before>App.Router.map(function(){
    this.resource('taskList', {path: '/tasks'}, function() {
        this.route('search');
    });

    // route disabled for now, let the backend handle the hours spent
    // this.resource('myTaskList', {path: '/my/tasks'});
    this.resource('task', {path: '/tasks/:task_id'}, function(){

    });
    this.resource('taskEdit', {path: '/tasks/:task_id/edit'});
    this.resource('projectTask', {path: '/:task_id'}, function(){});
    this.resource('taskNew', {path: '/tasks/new/:project_id'});

});



// Tasks

App.ProjectTasksIndexRoute = Em.Route.extend({
    model: function(params) {
        return Em.A();
    },

    setupController: function(controller, model) {
        this._super(controller, model);
        var project = this.modelFor('project');
        var tasks = App.Task.find({project: project.get('id')});
        tasks.addObserver('isLoaded', function() {
            tasks.forEach(function(record) {
                if (record.get('isLoaded')) {
                    controller.get('content').pushObject(record);
                }
            });
        });
    },
});


App.TaskRoute = Em.Route.extend(App.ScrollToTop, {
    model: function(params) {
        return App.Task.find(params.task_id);
    },

    actions: {
        applyForTask: function() {
            var route = this;
            var store = route.get('store');
            var taskMember = store.createRecord(App.TaskMember);
            var task = this.modelFor('task');
            var view = App.TaskMemberApplyView.create();

			if (!this.controllerFor('task').get('isMember')){
				Bootstrap.ModalPane.popup({
					heading: gettext('Apply for task'),
					bodyViewClass: view,
					primary: gettext('Apply'),
					secondary: gettext('Cancel'),
					callback: function(opts, e) {
						e.preventDefault();
						if (opts.primary) {
							taskMember.set('motivation', view.get('motivation'));
							taskMember.set('task', task);
							taskMember.set('created', new Date());
							taskMember.save();

                            if (this.get('tracker')) {
                                this.get('tracker').trackEvent("Apply for task", {task: task});
                            }

						}
						if (opts.secondary) {
							taskMember.deleteRecord();
						}
					}
				});<commit_msg>added task title instead of obj<commit_after>App.Router.map(function(){
    this.resource('taskList', {path: '/tasks'}, function() {
        this.route('search');
    });

    // route disabled for now, let the backend handle the hours spent
    // this.resource('myTaskList', {path: '/my/tasks'});
    this.resource('task', {path: '/tasks/:task_id'}, function(){

    });
    this.resource('taskEdit', {path: '/tasks/:task_id/edit'});
    this.resource('projectTask', {path: '/:task_id'}, function(){});
    this.resource('taskNew', {path: '/tasks/new/:project_id'});

});



// Tasks

App.ProjectTasksIndexRoute = Em.Route.extend({
    model: function(params) {
        return Em.A();
    },

    setupController: function(controller, model) {
        this._super(controller, model);
        var project = this.modelFor('project');
        var tasks = App.Task.find({project: project.get('id')});
        tasks.addObserver('isLoaded', function() {
            tasks.forEach(function(record) {
                if (record.get('isLoaded')) {
                    controller.get('content').pushObject(record);
                }
            });
        });
    },
});


App.TaskRoute = Em.Route.extend(App.ScrollToTop, {
    model: function(params) {
        return App.Task.find(params.task_id);
    },

    actions: {
        applyForTask: function() {
            var route = this;
            var store = route.get('store');
            var taskMember = store.createRecord(App.TaskMember);
            var task = this.modelFor('task');
            var view = App.TaskMemberApplyView.create();

			if (!this.controllerFor('task').get('isMember')){
				Bootstrap.ModalPane.popup({
					heading: gettext('Apply for task'),
					bodyViewClass: view,
					primary: gettext('Apply'),
					secondary: gettext('Cancel'),
					callback: function(opts, e) {
						e.preventDefault();
						if (opts.primary) {
							taskMember.set('motivation', view.get('motivation'));
							taskMember.set('task', task);
							taskMember.set('created', new Date());
							taskMember.save();

                            if (this.get('tracker')) {
                                this.get('tracker').trackEvent("Apply for task", {task: task.get('title')});
                            }

						}
						if (opts.secondary) {
							taskMember.deleteRecord();
						}
					}
				});
{'fraction_non_alphanumeric': 0.16840981856990395, 'fraction_numerical': 0.0, 'mean_word_length': 2.283812193412754, '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': '4738038', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1329, 'n_words': 245}