<commit_before>'use strict';

class CampaignsController extends BaseController {
  constructor() {
    super();
    console.log('From Campaign Controller');
  }

  /** Shows a list of campaigns */
  index() {
    // Generate the HTML, passing in an array of campaign objects
    let html = app.campaignView.getIndex([
      {'id' : '1', 'name': 'Campaign 1'},{'id':'2', 'name': 'Campaign 2'}
    ]);

    this.updateShell(html);
  }

  /** Shows an indevidual campaign */
  show(id) {
    let html = app.campaignView.show({'id' : id, 'name': 'Campaign 1'});
    this.updateShell(html);
  }

  /** Shows the new campaign screen */
  new() {
    let html = app.campaignView.new();
    this.updateShell(html);
  }

  /** Creates and saves a new campaign */
  create() {
    let form = document.querySelector('form');
    let campaign = Campaign.createFromForm(form);
    app.db.publish('/campaigns', campaign);
    console.log(campaign);
  }

  /** Updates an existing campaign */
  update() {

  }

  /** Deletes an existing campaign */
  delete() {

  }
}
<commit_msg>Disables save button after press<commit_after>'use strict';

class CampaignsController extends BaseController {
  constructor() {
    super();
    console.log('From Campaign Controller');
  }

  /** Shows a list of campaigns */
  index() {
    // Generate the HTML, passing in an array of campaign objects
    let html = app.campaignView.getIndex([
      {'id' : '1', 'name': 'Campaign 1'},{'id':'2', 'name': 'Campaign 2'}
    ]);

    this.updateShell(html);
  }

  /** Shows an indevidual campaign */
  show(id) {
    let html = app.campaignView.show({'id' : id, 'name': 'Campaign 1'});
    this.updateShell(html);
  }

  /** Shows the new campaign screen */
  new() {
    let html = app.campaignView.new();
    this.updateShell(html);
  }

  /** Creates and saves a new campaign */
  create() {
    // disable the save button to prevent duplicate submissions
    document.getElementById('campaign_save').disabled = true;

    let form = document.querySelector('form');
    let campaign = Campaign.createFromForm(form);
    app.db.publish('/campaigns', campaign);

    window.location = '?campaigns';
    console.log(campaign);
  }

  /** Updates an existing campaign */
  update() {

  }

  /** Deletes an existing campaign */
  delete() {

  }
}

{'fraction_non_alphanumeric': 0.156236512731981, 'fraction_numerical': 0.0043159257660768235, 'mean_word_length': 3.0453752181500873, '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': '5700941', 'n_tokens_mistral': 739, 'n_tokens_neox': 699, 'n_words': 192}