JSFiddle - React, Tailwind, and code Playground

by mcottingham

HTML

<script src="http://dev.songistry.com/scripts/jquery-ui-1.9.2.js"></script>
<link rel="stylesheet" href="http://dev.songistry.com/content/themes/songistry-theme/jquery-ui-1.9.2.custom.css">
<script src="http://dev.songistry.com/scripts/knockout-2.2.0.js"></script>
<script type="text/html" id="manage-song-template">
  <div class = "modal-form"><span data-bind="text: song.title"></span>
    </div>
</script>
<a href="#" id="add-song">Add Song</a>

JavaScript

var my = my || {};

$(function () {

  $("#add-song").click(function () {
    $("<div>")
      .attr("data-bind", "template: { name: 'manage-song-template' }")
      .dialog({
      resizable: false,
      modal: true,
      title: "Add Song",
      width: 960,
      height: 490,
      buttons: [{
        text: "Create Song",
          'data-bind': 'click: savechanges',
        click: function () {

        }
      }, {
        text: "Close",
        click: function () {
          $(this).dialog("close");
        }
      }],
      close: function () {
        $(this).dialog('destroy').remove();
      },
      open: function (event, ui) {
        var vm = new my.managesongviewmodel(),
          domNode = this;
        vm.loadfromserver().done(function () {
          ko.applyBindings(vm, domNode);
        });
      }
    });
  });

  my.managesongviewmodel = function () {
    var
    //Scalar Properties
    song = undefined,

      //Functions
      loadfromserver = function (Id) {
        return $.post("http://dev.songistry.com/song/getsong", "id=1", function (response) {
          if (response.Success) {
            var data = response.Data;
            var song = response.Data.Song;

            var songdata = {
              Song: {
                Id: song.Id,
                Title: song.Title,
                Description: song.Description,
                Lyrics: song.Lyrics,
                isMaster: song.isMaster,
                AudioFilePath: song.AudioFilePath,
                CoverImageFilePath: song.CoverImageFilePath,
                CreatedDate: song.CreatedDate
              },
              Genres: data.Genres,
              SongAlternateTitles: data.SongAlternateTitles,
              Exploitations: data.Exploitations,
              SongWriterSongs: data.SongWriterSongs
            };
            song = new my.song(songdata);
          }
        });
      },

      savechanges = function () {};

    //loadfromserver();
    return {
      song:...