Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">
  <h1 class="page-header">So, you want to hire a web person.</h1>
  <p class="lead">This is a nice form to help you accurately communicate the role you are hiring for, and to help you articulate the needs within your company.</p>

  <h3>Title Calculator</h3>

  <form action="" id="jobTitlesForm">
    <ol>
      <li id="generalistLogic">
        <h4>Are you hiring for a very specific role?</h4>
        <div class="help-block">e.g. for performance improvements (specific) vs. front-end developer (general)</div>
        <div class="radio">
          <label for="specialist">
            <input name="generalist" id="specialist" type="radio"> Yes, specific role
          </label>
        </div>
        <div class="radio">
          <label for="generalist">
            <input name="generalist" id="generalist" type="radio"> No, they will do lots of things
          </label>
        </div>
      </li>

      <li id="expLevel">
        <h4>What is the paygrade?</h4>
        <div class="radio">
          <label for="entryLevel">
            <input value="Junior" name="level" id="entryLevel" type="radio"> &lt; $50k
          </label>
        </div>
        <div class="radio">
          <label for="midLevel">
            <input value="Mid-Level" name="level" id="midLevel" type="radio"> $50k - $90k
          </label>
        </div>
        <div class="radio">
          <label for="seniorLevel">
            <input value="Senior" name="level" id="seniorLevel" type="radio"> $90k +
          </label>
        </div>
      </li>

      <li id="designerBool">
        <h4>What skills does this role mainly require?</h4>
        <div class="radio">
          <label for="designerTrue">
            <input name="designer" id="designerTrue" type="radio"> Design
          </label>
        </div>
        <!-- Should there be another option here? Hybrid? Strategist? -->
        <div class="radio">
          <label for="designerFalse">
            <input name="designer" id="designerFalse" type="radio"> Development
          </label>
        </div>
      </li>

      <li id="chooseSkillSet">
        <h4>Select the skill set that best describes the role.</h4>
        <select name="skillSetSelect" class="form-control" id="skillSetSelect">
          <!-- List generated based on above selections -->
        </select>
      </li>
    </ol>
  </form>
  <!-- /#jobTitleForm -->

  <div class="well">
    <small class="text-uppercase">Job Title</small>
    <h3>
          <span class="greyed" id="generalistResult"></span>
          <span id="expLevelResult"></span>
          <span id="skillsResult"></span>
          <span id="designerResult"></span>
     </h3>
  </div>

  <h3>Description Calculator</h3>

  <form action="" id="jobDescriptionForm">

    <h4>What's in your stack?</h4>
    <p>[some kind of picker here, options determined by above answers]</p>

    <h4>Describe three specific, example tasks the candidate is expected to do.</h4>
    <div class="help-block">
      <p><strong>Bad: </strong>Enhance our UI with JavaScript.</p>
      <p><strong>Good:</strong> Our site has a rotating feed of tweets from live events. We want it to be so that the most recent tweet shows as soon as it is posted rather than added to the end of the queue.</p>
    </div>

    <textarea type="text" rows="3" class="form-control" id="task"></textarea>

    <h4>Link to a file of code or a repo the new hire would be working with.</h4>
    <p class="help-block">This will give candidates a good idea of the desired level of skill in a specific language.</p>
    <input type="text" class="form-control">

    <h4>Company Information</h4>
    <p class="help-block">Describe what your company does, its culture, and work environment. Keep the corporate fluff to a minimum.</p>
    <textarea type="text" rows="3" class="form-control" id="companyInfo"></textarea>

  </form>
  <!-- /#jobDescriptionForm -->

  <div class="well">
    <small class="text-uppercase">Description</small>
  </div>

</div>
<!-- /container -->
            
          
!
            
              body {
	margin-bottom: 30px;
}

h4 {
	margin-top: 30px;
}

.container {
	max-width: 700px;
}

.greyed {
	color: #999;
}

form {
	margin-bottom: 30px;
}
            
          
!
            
              var skillSetArr = [];

// Storing some data
var skills = {
  designer: {
    general: ["Product", "Front-end", "Visual"],
    special: ["IA", "UX", "Graphic", "Content", "Animation"]
  },
  developer: {
    general: ["Front-end", "Back-end"],
    special: ["AngularJS", "WordPress", "Rails", "Django"]
  }
}

// Job Title Constructor Object Thing
// Designer/hybrid/dev needs to be consolidated into one value
var JobTitle = function(isDesigner, isHybrid, isDeveloper, expLevel, isGeneralist, skillSet) {
  this.isDesigner = isDesigner;
  this.isDesigner = isHybrid;
  this.isDeveloper = isDeveloper;
  this.expLevel = expLevel;
  this.isGeneralist = isGeneralist;
  this.skillSet = skillSet;
}

// Update the skills array with some spaghetti logic
// Ideally would only want this to run after the designer/dev question has been answered, I think.
JobTitle.prototype.updateSkills = function() {

  if (this.isDesigner) {
    if (this.isGeneralist) {
      updateSkillSet(skills.designer.general);
    } else {
      updateSkillSet(skills.designer.special);
    }
  } else if (this.isHybrid) {
    updateSkillSet(skills.hybrid);
  } else {
    if (this.isGeneralist) {
      updateSkillSet(skills.developer.general);
    } else {
      updateSkillSet(skills.developer.special);
    }
  }
}

// Function to run various callbacks when associated field changes
JobTitle.prototype.onFieldChange = function(fieldId, callback) {
  var field = document.getElementById(fieldId);

  // Update each field with the callback when it changes
  // Oh, wow, is this a closure IRL? Nice work, Larv.
  field.addEventListener('change', function(e) {
    return function() {
      callback.apply(); // Do I need apply here?
      title.updateSkills.apply();
    }
  }(this));
}

// Create the job title object   
var title = new JobTitle();

// Update each field when it changes
// Not great ID names, fwiw
// This could be more concise, probably
title.onFieldChange("designerBool", updateDesigner);
title.onFieldChange("generalistLogic", updateGeneralist);
title.onFieldChange("expLevel", updateExpLevel);

// --
// Updater Functions
// --

// Are they super spaghetti?

// Logic for designer
// Is there a way to not hardcode these form values?
function updateDesigner() {

  updateResult("skillsResult", "");

  // Update the job title text and set a variable	
  if (document.getElementById("designerTrue").checked) {

    this.isHybrid = false;
    this.isDesigner = true;
    this.isDeveloper = false;
    document.getElementById("designerResult").innerHTML = "Designer";

  } else if (document.getElementById("designerFalse").checked) {

    this.isHybrid = false;
    this.isDeveloper = true;
    this.isDesigner = false;
    document.getElementById("designerResult").innerHTML = "Developer";

  } else if (document.getElementById("designerHybrid").checked) {

    this.isDeveloper = true;
    this.isDesigner = false;
    this.isHybrid = true;
    document.getElementById("designerResult").innerHTML = "Hybrid";

  }
}

// Generalist Logic
function updateGeneralist() {

  updateResult("skillsResult", "");

  if (document.getElementById("generalist").checked) {

    // Update the job title
    this.isGeneralist = true;
    updateResult("generalistResult", "Generalist");

  } else if (document.getElementById("specialist").checked) {

    // Update the job title
    this.isGeneralist = false;
    updateResult("generalistResult", "Specialist");

  }
}

// Update the experience level
function updateExpLevel() {

  var container = document.getElementById("expLevel");
  var radios = container.querySelectorAll('input'); // Get all radios

  for (var i = 0; i < radios.length; i++) {
    if (radios[i].checked) {
      updateResult("expLevelResult", radios[i].value);
    }
  };

}

// Update the dropdown according to array of skills defined about
function updateSkillSet(skillSetArr) {

  // Clear the options - cleaner way to do this?
  var skillSelect = document.getElementById("skillSetSelect");
  skillSelect.innerHTML = '';

  // Add one blank option
  var defaultOption = document.createElement('option');
  defaultOption.text = defaultOption.value = "Select a Skill";
  skillSelect[skillSelect.options.length] = new Option("Select a Skill");

  // Create new options for each skill in array
  for (var i = 0; i < skillSetArr.length; i++) {
    var option = document.createElement('option');
    option.text = option.value = skillSetArr[i];
    skillSelect[skillSelect.options.length] = new Option(skillSetArr[i]);

    var val = skillSetArr[i];
    var opts = skillSelect.options;
  };

  // Update the job title text when the selection is made
  skillSelect.addEventListener('change', function() {
    var value = skillSelect[skillSelect.selectedIndex].value;
    updateResult("skillsResult", value);
  });
}

// Utility function to replace innerHTML of results
// Is this abstracting more than necessary?
function updateResult(id, text) {
  document.getElementById(id).innerHTML = text;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console