test/dummy/tmp/cache/assets/development/sprockets/50dd5048cba4d140a7e7bc341b7f5fb8 in ledge-0.2.1 vs test/dummy/tmp/cache/assets/development/sprockets/50dd5048cba4d140a7e7bc341b7f5fb8 in ledge-0.2.2

- old
+ new

@@ -1,8 +1,8 @@ {I" class:ETI"BundledAsset;FI"logical_path;TI"ledge/index.js;TI" pathname;TI"GD:/Documents/Rails/ledge/app/assets/javascripts/ledge/index.coffee;TI"content_type;TI"application/javascript;TI" -mtime;Tl+ªkÖTI" length;Ti(I" digest;TI"%c782d95ba591370dbe0fafc9483c3b8d;FI" source;TI"((function() { +mtime;Tl+elãTI" length;Ti0I" digest;TI"%0f632865a08a4b1188c2fe3a23c5d8ea;FI" source;TI"0(function() { var Row; Row = (function() { function Row() {} @@ -25,12 +25,12 @@ window.Row = Row; }).call(this); (function() { var Heading, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __hasProp = {}.hasOwnProperty; Heading = (function(_super) { __extends(Heading, _super); function Heading() { @@ -44,16 +44,16 @@ Heading.prototype.initial_content = "<h1>Heading</h1>"; Heading.prototype.options = ["H1", "H2", "H3", "H4", "H5", "H6"]; Heading.prototype.icons = { - "H1": "https://cdn1.iconfinder.com/data/icons/silk2/text_heading_1.png", - "H2": "https://cdn1.iconfinder.com/data/icons/silk2/text_heading_2.png", - "H3": "https://cdn1.iconfinder.com/data/icons/silk2/text_heading_3.png", - "H4": "https://cdn1.iconfinder.com/data/icons/silk2/text_heading_4.png", - "H5": "https://cdn1.iconfinder.com/data/icons/silk2/text_heading_5.png", - "H6": "https://cdn1.iconfinder.com/data/icons/silk2/text_heading_6.png" + "H1": "/assets/text_heading_1.png", + "H2": "/assets/text_heading_2.png", + "H3": "/assets/text_heading_3.png", + "H4": "/assets/text_heading_4.png", + "H5": "/assets/text_heading_5.png", + "H6": "/assets/text_heading_6.png" }; Heading.prototype.on_option = function(row, option) { var text; text = $(row).find(".__ledge_row_content").children().text(); @@ -71,12 +71,12 @@ window.Heading = Heading; }).call(this); (function() { var Text, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __hasProp = {}.hasOwnProperty; Text = (function(_super) { __extends(Text, _super); function Text() { @@ -87,10 +87,54 @@ Text.prototype.name = "Text"; Text.prototype.initial_content = "<p>Your text here..</p>"; + Text.prototype.options = ["bold", "italic", "underline", "strikeThrough", "createLink", "unlink", "insertImage", "floatLeft", "floatRight", "insertOrderedList", "insertUnorderedList", "indent", "outdent", "justifyLeft", "justifyCenter", "justifyRight", "justifyFull", "subscript", "superscript"]; + + Text.prototype.icons = { + "bold": "/assets/text_bold.png", + "italic": "/assets/text_italic.png", + "underline": "/assets/text_underline.png", + "strikeThrough": "/assets/text_strikethrough.png", + "createLink": "/assets/link_add.png", + "unlink": "/assets/link_delete.png", + "insertOrderedList": "/assets/text_list_numbers.png", + "insertUnorderedList": "/assets/text_list_bullets.png", + "indent": "/assets/text_indent.png", + "outdent": "/assets/text_indent_remove.png", + "justifyLeft": "/assets/text_align_left.png", + "justifyCenter": "/assets/text_align_center.png", + "justifyRight": "/assets/text_align_right.png", + "justifyFull": "/assets/text_align_justify.png", + "subscript": "/assets/text_subscript.png", + "superscript": "/assets/text_superscript.png", + "insertImage": "/assets/image_add.png", + "floatLeft": "/assets/shape_align_left.png", + "floatRight": "/assets/shape_align_right.png" + }; + + Text.prototype.on_option = function(row, option) { + var args; + args = null; + switch (option) { + case "createLink": + args = prompt("Where should the link take you? (Link URL)"); + break; + case "insertImage": + args = prompt("What is the image URL?"); + break; + case "floatRight": + $(window.getSelection().focusNode).addClass("pull-right"); + return; + case "floatLeft": + $(window.getSelection().focusNode).addClass("pull-left"); + return; + } + return document.execCommand(option, false, args); + }; + return Text; })(Row); window.Text = Text; @@ -156,45 +200,41 @@ }); return JSON.stringify(json); }; Ledge.prototype.setup = function() { - var column, column_div, data, index, row, type, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2; - _ref = Ledge.prototype.ROW_TYPES; - for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { - type = _ref[index]; - Ledge.prototype.ROW_ADD_HTML += "<div class='__ledge_add_item' data-ledge-type='" + type.prototype.type + "' data-ledge-type-index='" + index + "'>" + type.prototype.name + "</div>"; - Ledge.prototype.ROW_TYPE_PAIR[type.prototype.type] = index; - } - $("textarea#ledge").hide(); - $("textarea#ledge").before("<div class='__ledge_edit'></div>"); - data = JSON.parse($("textarea#ledge").text()); - _ref1 = data["columns"]; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - column = _ref1[_j]; - column_div = Ledge.prototype.create_column(function(col) { - return $("div.__ledge_edit").append(col); - }); - Ledge.prototype.click_delete_column(column_div.find(".__ledge_delete")); - _ref2 = column["rows"]; - for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { - row = _ref2[_k]; - Ledge.prototype.create_row(row["type"], Ledge.prototype.html_for(row["type"], row["content"])).appendTo(column_div); + var column, column_div, data, row, _i, _j, _len, _len1, _ref, _ref1; + if ($("textarea#ledge").length) { + $("textarea#ledge").hide(); + $("textarea#ledge").before("<div class='__ledge_edit'></div>"); + data = JSON.parse($("textarea#ledge").text()); + _ref = data["columns"]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + column = _ref[_i]; + column_div = Ledge.prototype.create_column(function(col) { + return $("div.__ledge_edit").append(col); + }); + Ledge.prototype.click_delete_column(column_div.find(".__ledge_delete")); + _ref1 = column["rows"]; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + row = _ref1[_j]; + Ledge.prototype.create_row(row["type"], Ledge.prototype.html_for(row["type"], row["content"])).appendTo(column_div); + } } + Ledge.prototype.refresh_row_adders(); + Ledge.prototype.refresh_column_adders(); + return Ledge.prototype.update_textarea(); } - Ledge.prototype.refresh_row_adders(); - Ledge.prototype.refresh_column_adders(); - return Ledge.prototype.update_textarea(); }; Ledge.prototype.update_textarea = function() { return $("textarea#ledge").text(Ledge.prototype.jsonify($("div.__ledge_edit"))); }; Ledge.prototype.create_row = function(type, content) { var row; - row = $("<div class='__ledge_row __ledge_row_" + type + "' data-ledge-type='" + type + "' contenteditable><div class='__ledge_options'></div><div class='__ledge_row_content'>" + content + "</div></div>"); + row = $("<div class='__ledge_row __ledge_row_" + type + "' data-ledge-type='" + type + "'><div class='__ledge_options'></div><div class='__ledge_row_content' contenteditable>" + content + "</div></div>"); row.on("input", function() { return Ledge.prototype.update_textarea(); }); if (Ledge.prototype.ROW_TYPE_PAIR[type] !== void 0) { Ledge.prototype.add_options(Ledge.prototype.ROW_TYPE_PAIR[type], row.find(".__ledge_options")); @@ -234,19 +274,20 @@ $(".__ledge_row").after("<div class='__ledge_add'>+</div>"); $(".__ledge_column").prepend("<div class='__ledge_add'>+</div>"); return $(".__ledge_column .__ledge_add").click(function() { var row; row = Ledge.prototype.create_row("new", Ledge.prototype.ROW_ADD_HTML); - row.attr("contenteditable", false); + row.find(".__ledge_row_content").attr("contenteditable", false); $(this).after(row); Ledge.prototype.refresh_row_adders(); return row.find(".__ledge_add_item").click(function() { var index, type; type = $(this).attr("data-ledge-type"); index = $(this).attr("data-ledge-type-index"); Ledge.prototype.add_options(index, $(this).parent().parent().find(".__ledge_options")); - return $(this).parent().parent().removeClass("__ledge_row_new").attr("contenteditable", true).addClass("__ledge_row_" + type).attr("data-ledge-type", type).find(".__ledge_row_content").html(Ledge.prototype.ROW_TYPES[index].prototype.initial_content); + $(this).parent().parent().removeClass("__ledge_row_new").addClass("__ledge_row_" + type).attr("data-ledge-type", type).find(".__ledge_row_content").attr("contenteditable", true).html(Ledge.prototype.ROW_TYPES[index].prototype.initial_content); + return Ledge.prototype.update_textarea(); }); }); }; Ledge.prototype.click_delete_column = function(del) { @@ -273,10 +314,13 @@ option = _ref[_i]; $("<div>" + option + "</div>").attr("data-ledge-option", option).attr("data-ledge-type-index", index).css("background-image", "url(" + Ledge.prototype.ROW_TYPES[index].prototype.icons[option] + ")").click(function() { var cindex; cindex = $(this).attr("data-ledge-type-index"); return Ledge.prototype.ROW_TYPES[index].prototype.on_option($(this).parent().parent(), $(this).attr("data-ledge-option")); + }).mousedown(function(event) { + event.preventDefault(); + return false; }).appendTo(options); } options.append("<div class='__ledge_delete'>Delete</div>"); return Ledge.prototype.click_delete_row(options.find(".__ledge_delete")); }; @@ -284,12 +328,23 @@ return Ledge; })(); $(document).ready(function() { + var index, type, _i, _len, _ref; + _ref = Ledge.prototype.ROW_TYPES; + for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { + type = _ref[index]; + Ledge.prototype.ROW_ADD_HTML += "<div class='__ledge_add_item' data-ledge-type='" + type.prototype.type + "' data-ledge-type-index='" + index + "'>" + type.prototype.name + "</div>"; + Ledge.prototype.ROW_TYPE_PAIR[type.prototype.type] = index; + } return Ledge.prototype.setup(); }); + $(document).on('page:load', function() { + return Ledge.prototype.setup(); + }); + window.Ledge = Ledge; }).call(this); -;TI"required_assets_digest;TI"%5fc79fcc1761b0ef70d33f5912541e87;FI" _version;TI"%069e88c06b889877799890854d7f4c40;F +;TI"required_assets_digest;TI"%2b6a7d89256538ac6d9250dadc9b61b4;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F \ No newline at end of file