Add codeview
This commit is contained in:
@@ -1,17 +1,69 @@
|
||||
// Generated by CoffeeScript 1.6.1
|
||||
var Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PAGE_CONTROL, WSF_PAGINATION_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, build_control, cache, controls, lazy_load, loaded, show_alert, start_modal, template, tmpl,
|
||||
var Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CODEVIEW_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PAGE_CONTROL, WSF_PAGINATION_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, build_control, cache, controls, lazy_load, loaded, show_alert, start_modal, start_modal_big, template, tmpl,
|
||||
__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; };
|
||||
|
||||
cache = {};
|
||||
|
||||
jQuery.cachedScript = function(url, options) {
|
||||
options = $.extend(options || {}, {
|
||||
dataType: "script",
|
||||
cache: true,
|
||||
url: url
|
||||
});
|
||||
return jQuery.ajax(options);
|
||||
jQuery.cachedAsset = function(url, options) {
|
||||
var head, onload, script, success, successful, timeoutHandle;
|
||||
if (/\.css$/.test(url)) {
|
||||
$("<link/>", {
|
||||
rel: "stylesheet",
|
||||
type: "text/css",
|
||||
href: url
|
||||
}).appendTo("head");
|
||||
return {
|
||||
done: function(fn) {
|
||||
return fn();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
success = [];
|
||||
head = document.head || document.getElementsByTagName('head')[0] || document.documentElement;
|
||||
script = document.createElement('script');
|
||||
script.async = 'async';
|
||||
script.src = url;
|
||||
successful = false;
|
||||
onload = function(_, aborted) {
|
||||
var s, _i, _len;
|
||||
if (aborted == null) {
|
||||
aborted = false;
|
||||
}
|
||||
if (!(aborted || !script.readyState || script.readyState === 'complete')) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(timeoutHandle);
|
||||
script.onload = script.onreadystatechange = script.onerror = null;
|
||||
if (head && script.parentNode) {
|
||||
head.removeChild(script);
|
||||
}
|
||||
script = void 0;
|
||||
if (success && !aborted) {
|
||||
successful = true;
|
||||
for (_i = 0, _len = success.length; _i < _len; _i++) {
|
||||
s = success[_i];
|
||||
s();
|
||||
}
|
||||
return success = [];
|
||||
}
|
||||
};
|
||||
script.onload = script.onreadystatechange = onload;
|
||||
script.onerror = function() {
|
||||
return onload(null, true);
|
||||
};
|
||||
timeoutHandle = setTimeout(script.onerror, 7500);
|
||||
head.insertBefore(script, head.firstChild);
|
||||
return {
|
||||
done: function(fn) {
|
||||
if (!successful) {
|
||||
success.push(fn);
|
||||
} else {
|
||||
fn();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.unparam = function(value) {
|
||||
@@ -52,6 +104,13 @@ Mini = {
|
||||
loaded = {};
|
||||
|
||||
lazy_load = function(requirements, fn, that) {
|
||||
if (requirements.length === 0) {
|
||||
return function() {
|
||||
var a;
|
||||
a = arguments;
|
||||
return fn.apply(that, a);
|
||||
};
|
||||
}
|
||||
if (that == null) {
|
||||
that = window;
|
||||
}
|
||||
@@ -71,14 +130,10 @@ lazy_load = function(requirements, fn, that) {
|
||||
};
|
||||
for (_i = 0, _len = requirements.length; _i < _len; _i++) {
|
||||
r = requirements[_i];
|
||||
if (loaded[r] != null) {
|
||||
done();
|
||||
} else {
|
||||
$.cachedScript(r).done(function() {
|
||||
done();
|
||||
return loaded[r] = true;
|
||||
});
|
||||
if (loaded[r] == null) {
|
||||
loaded[r] = $.cachedAsset(r);
|
||||
}
|
||||
loaded[r].done(done);
|
||||
}
|
||||
return done();
|
||||
};
|
||||
@@ -463,6 +518,36 @@ WSF_TEXTAREA_CONTROL = (function(_super) {
|
||||
|
||||
})(WSF_INPUT_CONTROL);
|
||||
|
||||
WSF_CODEVIEW_CONTROL = (function(_super) {
|
||||
|
||||
__extends(WSF_CODEVIEW_CONTROL, _super);
|
||||
|
||||
function WSF_CODEVIEW_CONTROL() {
|
||||
WSF_CODEVIEW_CONTROL.__super__.constructor.apply(this, arguments);
|
||||
this.initialize = lazy_load(['assets/codemirror/codemirror.js', 'assets/codemirror/codemirror.css', 'assets/codemirror/estudio.css'], lazy_load(['assets/codemirror/eiffel.js'], this.attach_events, this), this);
|
||||
}
|
||||
|
||||
WSF_CODEVIEW_CONTROL.prototype.attach_events = function() {
|
||||
WSF_CODEVIEW_CONTROL.__super__.attach_events.apply(this, arguments);
|
||||
this.editor = CodeMirror.fromTextArea(this.$el[0], {
|
||||
mode: "eiffel",
|
||||
tabMode: "indent",
|
||||
indentUnit: 4,
|
||||
lineNumbers: true,
|
||||
theme: 'estudio'
|
||||
});
|
||||
return this.editor.setSize("100%", 700);
|
||||
};
|
||||
|
||||
WSF_CODEVIEW_CONTROL.prototype.remove = function() {
|
||||
this.editor.toTextArea();
|
||||
return WSF_CODEVIEW_CONTROL.__super__.remove.apply(this, arguments);
|
||||
};
|
||||
|
||||
return WSF_CODEVIEW_CONTROL;
|
||||
|
||||
})(WSF_INPUT_CONTROL);
|
||||
|
||||
WSF_AUTOCOMPLETE_CONTROL = (function(_super) {
|
||||
|
||||
__extends(WSF_AUTOCOMPLETE_CONTROL, _super);
|
||||
@@ -822,8 +907,12 @@ show_alert = function(action) {
|
||||
};
|
||||
|
||||
start_modal = lazy_load(['assets/bootstrap.min.js'], function(action) {
|
||||
var modal;
|
||||
modal = $("<div class=\"modal fade\">\n<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h4 class=\"modal-title\">" + action.title + "</h4>\n </div>\n <div class=\"modal-body\">\n \n </div>\n </div>\n</div>\n</div>");
|
||||
var cssclass, modal;
|
||||
cssclass = "";
|
||||
if (action.type === "start_modal_big") {
|
||||
cssclass = " big";
|
||||
}
|
||||
modal = $("<div class=\"modal fade\">\n<div class=\"modal-dialog" + cssclass + "\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h4 class=\"modal-title\">" + action.title + "</h4>\n </div>\n <div class=\"modal-body\">\n \n </div>\n </div>\n</div>\n</div>");
|
||||
modal.appendTo('body');
|
||||
modal.modal('show');
|
||||
modal.on('hidden.bs.modal', function() {
|
||||
@@ -837,3 +926,5 @@ start_modal = lazy_load(['assets/bootstrap.min.js'], function(action) {
|
||||
return modal.find('.modal-body').append(data);
|
||||
});
|
||||
});
|
||||
|
||||
start_modal_big = start_modal;
|
||||
|
||||
Reference in New Issue
Block a user