Przeglądaj źródła

[style] added fancy loading effect NProgress

version-14
Rushabh Mehta 12 lat temu
rodzic
commit
1df8e7147b
17 zmienionych plików z 326 dodań i 2397 usunięć
  1. +5
    -3
      public/build.json
  2. +0
    -0
      public/css/common.css
  3. +0
    -0
      public/css/forms.css
  4. +0
    -87
      public/css/legacy/body.css
  5. +0
    -13
      public/css/legacy/fields.css
  6. +0
    -116
      public/css/legacy/grid.css
  7. +0
    -179
      public/css/legacy/report.css
  8. +0
    -54
      public/css/legacy/tabs.css
  9. +85
    -0
      public/css/nprogress.css
  10. +0
    -0
      public/css/tree_grid.css
  11. +0
    -105
      public/css/ui/ribbons.css
  12. +0
    -536
      public/js/lib/mustache.js
  13. +220
    -0
      public/js/lib/nprogress.js
  14. +0
    -1296
      public/js/lib/showdown.js
  15. +0
    -1
      public/js/lib/showdown.min.js
  16. +6
    -2
      public/js/wn/dom.js
  17. +10
    -5
      webnotes/model/doc.py

+ 5
- 3
public/build.json Wyświetl plik

@@ -16,9 +16,10 @@
"lib/public/css/bootstrap.css",
"lib/public/css/bootstrap-responsive.css",
"lib/public/css/font-awesome.css",
"lib/public/css/legacy/forms.css",
"lib/public/css/ui/common.css",
"lib/public/css/views/tree_grid.css",
"lib/public/css/forms.css",
"lib/public/css/common.css",
"lib/public/css/tree_grid.css",
"lib/public/css/nprogress.css",
]
},

@@ -35,6 +36,7 @@
"lib/public/js/lib/jquery/jquery.hotkeys.js",
"lib/public/js/lib/center_image.js",
"lib/public/js/lib/bootstrap.min.js",
"lib/public/js/lib/nprogress.js",
"lib/public/js/wn/provide.js",
"lib/public/js/wn/class.js",


public/css/ui/common.css → public/css/common.css Wyświetl plik


public/css/legacy/forms.css → public/css/forms.css Wyświetl plik


+ 0
- 87
public/css/legacy/body.css Wyświetl plik

@@ -1,87 +0,0 @@
html {
margin: 0px;
padding: 0px;
}

footer {
color: inherit;
padding: 10px;
font-size: 12px;
line-height: 1.7;
}

label {
padding-top: 15px;
color: #404040;
}

.link_type {
padding:2px;
color: #0088cc;
cursor: pointer;
}

.link_type:hover {
color: #005580;
text-decoration: underline;
}

:focus { -moz-outline-style:none; }

table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }

div.fix_ff_cursor { overflow: auto; }

/* --- Layout --- */

div.comment { color: #444; }

.help {
margin-bottom: 3px;
color: #999;
}

div#body_div {
padding-right: 7px;
min-height: 400px;
}

.background-fade-in {
-webkit-transition: background 1s ease-in; /* property duration timing-function delay */
-moz-transition: background 1s ease-in;
-o-transition: background 1s ease-in;
transition: background 1s ease-in;
}

div.no_script {
display: none;
}

div.loading_div {
background-color: #FFFFCC;
z-index: 1999;
right: 5px;
width: 90px;
display: none;
text-align: center;
padding: 2px;
border: 1px solid #FF4;
}


.shadow {
-moz-box-shadow: 0px 2px 2px #888;
-webkit-box-shadow: 0px 2px 2px #888;
box-shadow: 0px 2px 2px #888;
}

.round {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}

.clear {
clear: both;
}

+ 0
- 13
public/css/legacy/fields.css Wyświetl plik

@@ -1,13 +0,0 @@

/*
* lib/public/css/legacy/fields.css
*/
/* Documents */




.link-field .btn {
padding-left: 6px;
padding-right: 6px;
}

+ 0
- 116
public/css/legacy/grid.css Wyświetl plik

@@ -1,116 +0,0 @@

.grid_wrapper {
position: relative;
overflow: auto;
border: 1px solid #AAA;
width: 100%;
margin-bottom: 8px;
background-color: #f8f8f8;
}

div.grid_tbarlinks {
border-bottom: 0px;
padding: 4px 4px 2px 4px;
width: 190px;
float: right;
margin-right: 12px;

-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;

background: #dddddd; /* Old browsers */
background: -moz-linear-gradient(top, #dddddd 0%, #bbbbbb 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dddddd), color-stop(100%,#bbbbbb)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* IE10+ */
background: linear-gradient(to bottom, #dddddd 0%,#bbbbbb 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dddddd', endColorstr='#bbbbbb',GradientType=0 ); /* IE6-9 */

}

.grid_tab_wrapper {
position: absolute;
top: 40px;
border-bottom: 1px solid #DDD;
}

.grid_table, .grid_head_table {
table-layout: fixed;
border-collapse: collapse;
/*width: 100%;*/
}

.grid_cell {
border-right: 1px solid #ddd;
padding: 0px;
background-color: #fff;
}

.grid_head_wrapper {
position: absolute;
z-index: 1;
height: 40px;
padding: 0px;
overflow: hidden;
/*background-color: #fff;*/
}

.grid_head_table td {
border-right: 1px solid #AAA;
border-bottom: 1px solid #AAA;
height: 40px;
padding: 0px;
vertical-align: middle;
font-weight: bold;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}

.grid_selector {
padding: 1px;
border-right: 1px solid #DDD;
width: 20px;
background-color: #fff;
}

.grid_cell_div {
padding: 2px;
cursor: pointer;
overflow: hidden;
border: 2px solid #FFF;
}

.grid_cell_div_selected {
border: 2px solid #88f;
}

.grid_cell_div input, .grid_cell_div select, .grid_cell_div div input {
margin: 0px;
width: 90%;
}

.grid_cell_div textarea {
border: 3px solid #abf;
height:200px;
width: 300px;
z-index: 1;
position:absolute;
}

.gridDivSelected option { border: 0px; }

+ 0
- 179
public/css/legacy/report.css Wyświetl plik

@@ -1,179 +0,0 @@

/* Reports */

div.report_grid_area {
position: relative;
padding: 8px;
}


div.report_tab {
border: 1px solid #AAA;
position: relative;
overflow: auto;
}

div.report_no_data {
padding: 8px;
background-color: #EEE;
border: 1px solid #DDD;
position: absolute;
margin-left: 40%;
margin-top: 50px;
display: none;
}

div.report_htitle {
float: left;
padding: 2px;
font-size: 14px;
font-weight: bold;
margin-left: 4px;
color: #665;
/*font-weight: bold;*/
}

div.report_tbar {
background-color: #EEF;
border: 1px solid #CCF;
border-bottom: 0px;
height: 28px;
}

div.report_tbar table{
width: 100%;
}
div.report_tbar table td {
}
div.report_tbar table td div {
position: relative;
}
div.report_tbar button, div.report_tbar select, div.report_tbar img {
font-size: 11px;
margin: 0px;
}

div.report_head_wrapper {
position: absolute;
height: 24px;
top: 0px;
z-index: 1;
}

div.report_tab_wrapper {
position: absolute;
border-bottom: 1px solid #AAA;
border-top: 1px solid #AAA;
}

div.report_tab_wrapper table, div.report_head_wrapper table {
table-layout: fixed;
border-collapse: collapse;
/*width: 100%;*/
}

div.report_tab_wrapper table td, div.report_head_wrapper table td {
border-left: 1px solid #AAA;
border-right: 1px solid #AAA;
border-bottom: 1px solid #AAA;
overflow: hidden;
padding: 0px;
}

div.report_tab_wrapper table td div, div.report_head_wrapper table td div {
padding: 3px;
overflow: hidden;
}

.report_head_cell {
background-color: #EEE;
border-bottom: 1px solid #AA9;
text-align: center;
font-weight: bold;
}
.report_head_cell div {
color:#222;
height: 18px;
}


/* FINDER */

div.finder_wrapper {
}

div.finder_body_area {
margin: 16px;
}

div.finder_body {
display: none;
}

div.finder_advanced_area table {
width: 80%;
}

div.finder_advanced_area textarea {
width: 80%;
}

div.finder_filter_area {
position: relative;
}

div.filter_head {
font-size: 14px;
margin-bottom: 2px;
}
div.filter_dt_head {
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
table.filter_tab {
width: 96%;
border-collapse: collapse;
}

table.filter_tab td {
width: 50%;
}

div.finder_picker_area {
}
div.builder_field {
margin: 0px;
}
div.builder_dt_head {
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}

div.builder_field table {
width: 90%;
border-collapse: collapse;
}

div.builder_label {
height: 20px;
}

div.builder_head {
font-size: 16px;
font-weight: bold;
color: #AB6;
}

table.builder_tab {
width: 96%;
border-collapse: collapse;
}

table.builder_tab td {
width: 33%;
padding: 2px;
}

+ 0
- 54
public/css/legacy/tabs.css Wyświetl plik

@@ -1,54 +0,0 @@

/******* TABS ********/

div.box_label_wrapper {
border-bottom: 6px solid #777;
}

div.box_label_body {
height: 22px;
}

ul.box_tabs {
margin: 0px;
padding: 0px;
list-style: none;
}

ul.box_tabs li {
height: 22px;
float:left;
font-size: 12px;
text-decoration: underline;
background-color: #DDD;
margin:0;
margin-left: 4px;
padding:0 0 0 9px;
cursor: pointer;
}

ul.box_tabs li a {
display:block;
padding:3px 15px 3px 6px;
text-decoration: none;
}

ul.box_tabs li.box_tab_mouseover {
background-color: #BBB;
}

ul.box_tabs li.box_tab_selected {
background-color: #777;
background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#777));
background: -moz-linear-gradient(top, #999, #777);
color: #FFF;
font-weight:bold;
}
ul.box_tabs li.box_tab_selected a {
color: #fff;
}

+ 85
- 0
public/css/nprogress.css Wyświetl plik

@@ -0,0 +1,85 @@
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
-webkit-pointer-events: none;
}

/* Make the entire page show a busy cursor */
.nprogress-busy body {
cursor: wait;
}

#nprogress .bar {
background: #2ecc71;

position: fixed;
z-index: 1050;
top: 0;
left: 0;

width: 100%;
height: 2px;
}

/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #2ecc71, 0 0 5px #2ecc71;
opacity: 1.0;

-webkit-transform: rotate(3deg) translate(0px, -4px);
-moz-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
-o-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}

/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1050;
top: 15px;
right: 15px;
}

#nprogress .spinner-icon {
width: 14px;
height: 14px;

border: solid 2px transparent;
border-top-color: #fff;
border-left-color: #fff;
border-radius: 10px;

-webkit-animation: nprogress-spinner 400ms linear infinite;
-moz-animation: nprogress-spinner 400ms linear infinite;
-ms-animation: nprogress-spinner 400ms linear infinite;
-o-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}

@-webkit-keyframes nprogress-spinner {
0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@-moz-keyframes nprogress-spinner {
0% { -moz-transform: rotate(0deg); transform: rotate(0deg); }
100% { -moz-transform: rotate(360deg); transform: rotate(360deg); }
}
@-o-keyframes nprogress-spinner {
0% { -o-transform: rotate(0deg); transform: rotate(0deg); }
100% { -o-transform: rotate(360deg); transform: rotate(360deg); }
}
@-ms-keyframes nprogress-spinner {
0% { -ms-transform: rotate(0deg); transform: rotate(0deg); }
100% { -ms-transform: rotate(360deg); transform: rotate(360deg); }
}
@keyframes nprogress-spinner {
0% { transform: rotate(0deg); transform: rotate(0deg); }
100% { transform: rotate(360deg); transform: rotate(360deg); }
}

public/css/views/tree_grid.css → public/css/tree_grid.css Wyświetl plik


+ 0
- 105
public/css/ui/ribbons.css Wyświetl plik

@@ -1,105 +0,0 @@
/* ribbons */

.ribbon-holder {
position: relative;
top: 0;
overflow: hidden;
height: 10em;
float: right;
}

.ribbon,
.ribbon:hover {
text-decoration: none;
}

.ribbon {
font-family: Arial, sans-serif;
letter-spacing: -.1px;
opacity: 0.95;

padding: 0.25em 0;
position: relative;
top: 2.5em;

/* Defaults friendly for white pages. */
-moz-box-shadow: 0 0 13px #888;
-webkit-box-shadow: 0 0 13px #888;
color: #FFF;
display: block;
line-height: 1.35em;
}

.ribbon .text {
padding: 0.1em 3em;
}

.ribbon-right .ribbon {
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
right: -2.6em;
}

.ribbon-left .ribbon {
-moz-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
left: -2.6em;
}

.white.ribbon {
color: #111;
background-color: #F5F5F5;
background: -webkit-gradient(linear, left bottom, left top, from(#f3f3f3), to(#fff));
-moz-box-shadow: 0 0 13px #999;
-webkit-box-shadow: 0 0 13px #999;
text-shadow: 0 0 .05em;
}

.white.ribbon .text {
border: 1px solid #cecece;
}

.red.ribbon {
background-color: #9a0000;
background: -webkit-gradient(linear, left bottom, left top, from(#9a0000), to(#a90000));
}

.red.ribbon .text {
border: 1px solid #bf6060;
}

.green.ribbon {
background-color: #006e00;
background: -webkit-gradient(linear, left bottom, left top, from(#006e00), to(#007200));
}

.green.ribbon .text {
border: 1px solid #6bac6b;
}

.darkblue.ribbon {
background-color: #121621;
color: #ecedee;
}

.darkblue.ribbon .text {
border: 1px solid #53565e;
}

.orange.ribbon {
background-color: #E57504;
background: -webkit-gradient(linear, left bottom, left top, from(#dc7202), to(#ee7906));
}

.orange.ribbon .text {
border: 1px solid #ebaa65;
}

.gray.ribbon {
background-color: #6d6d6d;
background: -webkit-gradient(linear, left bottom, left top, from(#6a6a6a) to(#6d6d6d));
}

.gray.ribbon .text {
border: 1px solid #a4a4a4;
}

+ 0
- 536
public/js/lib/mustache.js Wyświetl plik

@@ -1,536 +0,0 @@
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
var Mustache = (typeof module !== "undefined" && module.exports) || {};

(function (exports) {

exports.name = "mustache.js";
exports.version = "0.5.0-dev";
exports.tags = ["{{", "}}"];
exports.parse = parse;
exports.compile = compile;
exports.render = render;
exports.clearCache = clearCache;

// This is here for backwards compatibility with 0.4.x.
exports.to_html = function (template, view, partials, send) {
var result = render(template, view, partials);

if (typeof send === "function") {
send(result);
} else {
return result;
}
};

var _toString = Object.prototype.toString;
var _isArray = Array.isArray;
var _forEach = Array.prototype.forEach;
var _trim = String.prototype.trim;

var isArray;
if (_isArray) {
isArray = _isArray;
} else {
isArray = function (obj) {
return _toString.call(obj) === "[object Array]";
};
}

var forEach;
if (_forEach) {
forEach = function (obj, callback, scope) {
return _forEach.call(obj, callback, scope);
};
} else {
forEach = function (obj, callback, scope) {
for (var i = 0, len = obj.length; i < len; ++i) {
callback.call(scope, obj[i], i, obj);
}
};
}

var spaceRe = /^\s*$/;

function isWhitespace(string) {
return spaceRe.test(string);
}

var trim;
if (_trim) {
trim = function (string) {
return string == null ? "" : _trim.call(string);
};
} else {
var trimLeft, trimRight;

if (isWhitespace("\xA0")) {
trimLeft = /^\s+/;
trimRight = /\s+$/;
} else {
// IE doesn't match non-breaking spaces with \s, thanks jQuery.
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}

trim = function (string) {
return string == null ? "" :
String(string).replace(trimLeft, "").replace(trimRight, "");
};
}

var escapeMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;'
};

function escapeHTML(string) {
return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) {
return escapeMap[s] || s;
});
}

/**
* Adds the `template`, `line`, and `file` properties to the given error
* object and alters the message to provide more useful debugging information.
*/
function debug(e, template, line, file) {
file = file || "<template>";

var lines = template.split("\n"),
start = Math.max(line - 3, 0),
end = Math.min(lines.length, line + 3),
context = lines.slice(start, end);

var c;
for (var i = 0, len = context.length; i < len; ++i) {
c = i + start + 1;
context[i] = (c === line ? " >> " : " ") + context[i];
}

e.template = template;
e.line = line;
e.file = file;
e.message = [file + ":" + line, context.join("\n"), "", e.message].join("\n");

return e;
}

/**
* Looks up the value of the given `name` in the given context `stack`.
*/
function lookup(name, stack, defaultValue) {
if (name === ".") {
return stack[stack.length - 1];
}

var names = name.split(".");
var lastIndex = names.length - 1;
var target = names[lastIndex];

var value, context, i = stack.length, j, localStack;
while (i) {
localStack = stack.slice(0);
context = stack[--i];

j = 0;
while (j < lastIndex) {
context = context[names[j++]];

if (context == null) {
break;
}

localStack.push(context);
}

if (context && typeof context === "object" && target in context) {
value = context[target];
break;
}
}

// If the value is a function, call it in the current context.
if (typeof value === "function") {
value = value.call(localStack[localStack.length - 1]);
}

if (value == null) {
return defaultValue;
}

return value;
}

function renderSection(name, stack, callback, inverted) {
var buffer = "";
var value = lookup(name, stack);

if (inverted) {
// From the spec: inverted sections may render text once based on the
// inverse value of the key. That is, they will be rendered if the key
// doesn't exist, is false, or is an empty list.
if (value == null || value === false || (isArray(value) && value.length === 0)) {
buffer += callback();
}
} else if (isArray(value)) {
forEach(value, function (value) {
stack.push(value);
buffer += callback();
stack.pop();
});
} else if (typeof value === "object") {
stack.push(value);
buffer += callback();
stack.pop();
} else if (typeof value === "function") {
var scope = stack[stack.length - 1];
var scopedRender = function (template) {
return render(template, scope);
};
buffer += value.call(scope, callback(), scopedRender) || "";
} else if (value) {
buffer += callback();
}

return buffer;
}

/**
* Parses the given `template` and returns the source of a function that,
* with the proper arguments, will render the template. Recognized options
* include the following:
*
* - file The name of the file the template comes from (displayed in
* error messages)
* - tags An array of open and close tags the `template` uses. Defaults
* to the value of Mustache.tags
* - debug Set `true` to log the body of the generated function to the
* console
* - space Set `true` to preserve whitespace from lines that otherwise
* contain only a {{tag}}. Defaults to `false`
*/
function parse(template, options) {
options = options || {};

var tags = options.tags || exports.tags,
openTag = tags[0],
closeTag = tags[tags.length - 1];

var code = [
'var buffer = "";', // output buffer
"\nvar line = 1;", // keep track of source line number
"\ntry {",
'\nbuffer += "'
];

var spaces = [], // indices of whitespace in code on the current line
hasTag = false, // is there a {{tag}} on the current line?
nonSpace = false; // is there a non-space char on the current line?

// Strips all space characters from the code array for the current line
// if there was a {{tag}} on it and otherwise only spaces.
var stripSpace = function () {
if (hasTag && !nonSpace && !options.space) {
while (spaces.length) {
code.splice(spaces.pop(), 1);
}
} else {
spaces = [];
}

hasTag = false;
nonSpace = false;
};

var sectionStack = [], updateLine, nextOpenTag, nextCloseTag;

var setTags = function (source) {
tags = trim(source).split(/\s+/);
nextOpenTag = tags[0];
nextCloseTag = tags[tags.length - 1];
};

var includePartial = function (source) {
code.push(
'";',
updateLine,
'\nvar partial = partials["' + trim(source) + '"];',
'\nif (partial) {',
'\n buffer += render(partial,stack[stack.length - 1],partials);',
'\n}',
'\nbuffer += "'
);
};

var openSection = function (source, inverted) {
var name = trim(source);

if (name === "") {
throw debug(new Error("Section name may not be empty"), template, line, options.file);
}

sectionStack.push({name: name, inverted: inverted});

code.push(
'";',
updateLine,
'\nvar name = "' + name + '";',
'\nvar callback = (function () {',
'\n return function () {',
'\n var buffer = "";',
'\nbuffer += "'
);
};

var openInvertedSection = function (source) {
openSection(source, true);
};

var closeSection = function (source) {
var name = trim(source);
var openName = sectionStack.length != 0 && sectionStack[sectionStack.length - 1].name;

if (!openName || name != openName) {
throw debug(new Error('Section named "' + name + '" was never opened'), template, line, options.file);
}

var section = sectionStack.pop();

code.push(
'";',
'\n return buffer;',
'\n };',
'\n})();'
);

if (section.inverted) {
code.push("\nbuffer += renderSection(name,stack,callback,true);");
} else {
code.push("\nbuffer += renderSection(name,stack,callback);");
}

code.push('\nbuffer += "');
};

var sendPlain = function (source) {
code.push(
'";',
updateLine,
'\nbuffer += lookup("' + trim(source) + '",stack,"");',
'\nbuffer += "'
);
};

var sendEscaped = function (source) {
code.push(
'";',
updateLine,
'\nbuffer += escapeHTML(lookup("' + trim(source) + '",stack,""));',
'\nbuffer += "'
);
};

var line = 1, c, callback;
for (var i = 0, len = template.length; i < len; ++i) {
if (template.slice(i, i + openTag.length) === openTag) {
i += openTag.length;
c = template.substr(i, 1);
updateLine = '\nline = ' + line + ';';
nextOpenTag = openTag;
nextCloseTag = closeTag;
hasTag = true;

switch (c) {
case "!": // comment
i++;
callback = null;
break;
case "=": // change open/close tags, e.g. {{=<% %>=}}
i++;
closeTag = "=" + closeTag;
callback = setTags;
break;
case ">": // include partial
i++;
callback = includePartial;
break;
case "#": // start section
i++;
callback = openSection;
break;
case "^": // start inverted section
i++;
callback = openInvertedSection;
break;
case "/": // end section
i++;
callback = closeSection;
break;
case "{": // plain variable
closeTag = "}" + closeTag;
// fall through
case "&": // plain variable
i++;
nonSpace = true;
callback = sendPlain;
break;
default: // escaped variable
nonSpace = true;
callback = sendEscaped;
}

var end = template.indexOf(closeTag, i);

if (end === -1) {
throw debug(new Error('Tag "' + openTag + '" was not closed properly'), template, line, options.file);
}

var source = template.substring(i, end);

if (callback) {
callback(source);
}

// Maintain line count for \n in source.
var n = 0;
while (~(n = source.indexOf("\n", n))) {
line++;
n++;
}

i = end + closeTag.length - 1;
openTag = nextOpenTag;
closeTag = nextCloseTag;
} else {
c = template.substr(i, 1);

switch (c) {
case '"':
case "\\":
nonSpace = true;
code.push("\\" + c);
break;
case "\r":
// Ignore carriage returns.
break;
case "\n":
spaces.push(code.length);
code.push("\\n");
stripSpace(); // Check for whitespace on the current line.
line++;
break;
default:
if (isWhitespace(c)) {
spaces.push(code.length);
} else {
nonSpace = true;
}

code.push(c);
}
}
}

if (sectionStack.length != 0) {
throw debug(new Error('Section "' + sectionStack[sectionStack.length - 1].name + '" was not closed properly'), template, line, options.file);
}

// Clean up any whitespace from a closing {{tag}} that was at the end
// of the template without a trailing \n.
stripSpace();

code.push(
'";',
"\nreturn buffer;",
"\n} catch (e) { throw {error: e, line: line}; }"
);

// Ignore `buffer += "";` statements.
var body = code.join("").replace(/buffer \+= "";\n/g, "");

if (options.debug) {
if (typeof console != "undefined" && console.log) {
console.log(body);
} else if (typeof print === "function") {
print(body);
}
}

return body;
}

/**
* Used by `compile` to generate a reusable function for the given `template`.
*/
function _compile(template, options) {
var args = "view,partials,stack,lookup,escapeHTML,renderSection,render";
var body = parse(template, options);
var fn = new Function(args, body);

// This anonymous function wraps the generated function so we can do
// argument coercion, setup some variables, and handle any errors
// encountered while executing it.
return function (view, partials) {
partials = partials || {};

var stack = [view]; // context stack

try {
return fn(view, partials, stack, lookup, escapeHTML, renderSection, render);
} catch (e) {
throw debug(e.error, template, e.line, options.file);
}
};
}

// Cache of pre-compiled templates.
var _cache = {};

/**
* Clear the cache of compiled templates.
*/
function clearCache() {
_cache = {};
}

/**
* Compiles the given `template` into a reusable function using the given
* `options`. In addition to the options accepted by Mustache.parse,
* recognized options include the following:
*
* - cache Set `false` to bypass any pre-compiled version of the given
* template. Otherwise, a given `template` string will be cached
* the first time it is parsed
*/
function compile(template, options) {
options = options || {};

// Use a pre-compiled version from the cache if we have one.
if (options.cache !== false) {
if (!_cache[template]) {
_cache[template] = _compile(template, options);
}

return _cache[template];
}

return _compile(template, options);
}

/**
* High-level function that renders the given `template` using the given
* `view` and `partials`. If you need to use any of the template options (see
* `compile` above), you must compile in a separate step, and then call that
* compiled function.
*/
function render(template, view, partials) {
return compile(template)(view, partials);
}

})(Mustache);

+ 220
- 0
public/js/lib/nprogress.js Wyświetl plik

@@ -0,0 +1,220 @@
/*! NProgress (c) 2013, Rico Sta. Cruz
* http://ricostacruz.com/nprogress */

;(function(factory) {

if (typeof module === 'object') {
module.exports = factory(this.jQuery || require('dom'));
} else {
this.NProgress = factory(this.jQuery);
}

})(function($) {
var NProgress = {};

NProgress.version = '0.1.0';

var Settings = NProgress.settings = {
minimum: 0.08,
easing: 'ease',
speed: 200,
trickle: true,
trickleRate: 0.02,
trickleSpeed: 800,
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner"><div class="spinner-icon"></div></div>'
};

/**
* Updates configuration.
*
* NProgress.configure({
* minimum: 0.1
* });
*/
NProgress.configure = function(options) {
$.extend(Settings, options);
return this;
};

/**
* Last number.
*/

NProgress.status = null;

/**
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
*
* NProgress.set(0.4);
* NProgress.set(1.0);
*/

NProgress.set = function(n) {
var started = NProgress.isStarted();

n = clamp(n, Settings.minimum, 1);
NProgress.status = (n === 1 ? null : n);

var $progress = NProgress.render(!started),
$bar = $progress.find('[role="bar"]'),
speed = Settings.speed,
ease = Settings.easing;

$progress[0].offsetWidth; /* Repaint */

$progress.queue(function(next) {
$bar.css({
transition: 'all '+speed+'ms '+ease,
transform: 'translate3d('+toBarPerc(n)+'%,0,0)'
});

if (n === 1) {
// Fade out
$progress.css({ transition: 'none', opacity: 1 });
$progress[0].offsetWidth; /* Repaint */

setTimeout(function() {
$progress.css({ transition: 'all '+speed+'ms linear', opacity: 0 });
setTimeout(function() {
NProgress.remove();
next();
}, speed);
}, speed);
} else {
setTimeout(next, speed);
}
});

return this;
};

NProgress.isStarted = function() {
return typeof NProgress.status === 'number';
};

/**
* Shows the progress bar.
* This is the same as setting the status to 0%, except that it doesn't go backwards.
*
* NProgress.start();
*
*/
NProgress.start = function() {
if (!NProgress.status) NProgress.set(0);

var work = function() {
setTimeout(function() {
if (!NProgress.status) return;
NProgress.trickle();
work();
}, Settings.trickleSpeed);
};

if (Settings.trickle) work();

return this;
};

/**
* Hides the progress bar.
* This is the *sort of* the same as setting the status to 100%, with the
* difference being `done()` makes some placebo effect of some realistic motion.
*
* NProgress.done();
*
* If `true` is passed, it will show the progress bar even if its hidden.
*
* NProgress.done(true);
*/

NProgress.done = function(force) {
if (!force && !NProgress.status) return this;

return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
};

/**
* Increments by a random amount.
*/

NProgress.inc = function(amount) {
var n = NProgress.status;

if (!n) {
return NProgress.start();
} else {
if (typeof amount !== 'number') {
amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
}

n = clamp(n + amount, 0, 0.994);
return NProgress.set(n);
}
};

NProgress.trickle = function() {
return NProgress.inc(Math.random() * Settings.trickleRate);
};

/**
* (Internal) renders the progress bar markup based on the `template`
* setting.
*/

NProgress.render = function(fromStart) {
if (NProgress.isRendered()) return $("#nprogress");
$('html').addClass('nprogress-busy');

var $el = $("<div id='nprogress'>")
.html(Settings.template);

var perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0);

$el.find('[role="bar"]').css({
transition: 'all 0 linear',
transform: 'translate3d('+perc+'%,0,0)'
});

$el.appendTo(document.body);

return $el;
};

/**
* (Internal) Removes the element. Opposite of render().
*/

NProgress.remove = function() {
$('html').removeClass('nprogress-busy');
$('#nprogress').remove();
};

/**
* Checks if the progress bar is rendered.
*/

NProgress.isRendered = function() {
return ($("#nprogress").length > 0);
};

/**
* Helpers
*/

function clamp(n, min, max) {
if (n < min) return min;
if (n > max) return max;
return n;
}

/**
* (Internal) converts a percentage (`0..1`) to a bar translateX
* percentage (`-100%..0%`).
*/

function toBarPerc(n) {
return (-1 + n) * 100;
}

return NProgress;
});

+ 0
- 1296
public/js/lib/showdown.js
Plik diff jest za duży
Wyświetl plik


+ 0
- 1
public/js/lib/showdown.min.js
Plik diff jest za duży
Wyświetl plik


+ 6
- 2
public/js/wn/dom.js Wyświetl plik

@@ -108,15 +108,19 @@ wn.dom = {
var pending_req = 0
wn.set_loading = function() {
pending_req++;
$('#spinner').css('visibility', 'visible');
//$('#spinner').css('visibility', 'visible');
$('body').css('cursor', 'progress');
NProgress.start();
}

wn.done_loading = function() {
pending_req--;
if(!pending_req){
$('body').css('cursor', 'default');
$('#spinner').css('visibility', 'hidden');
//$('#spinner').css('visibility', 'hidden');
NProgress.done();
} else {
NProgress.inc();
}
}



+ 10
- 5
webnotes/model/doc.py Wyświetl plik

@@ -273,7 +273,7 @@ class Document:

# validate links
if link_list and link_list.get(f):
self.fields[f] = self._validate_link(link_list[f][0], self.fields[f])
self.fields[f] = self._validate_link(link_list, f)

if self.fields[f]==None:
update_str.append("(%s,%s,NULL)")
@@ -292,7 +292,7 @@ class Document:
# validate links
old_val = self.fields[f]
if link_list and link_list.get(f):
self.fields[f] = self._validate_link(link_list[f][0], self.fields[f])
self.fields[f] = self._validate_link(link_list, f)

if old_val and not self.fields[f]:
s = link_list[f][1] + ': ' + old_val
@@ -307,7 +307,13 @@ class Document:
for i in res: link_list[i[0]] = (i[1], i[2]) # options, label
return link_list
def _validate_link(self, dt, dn):
def _validate_link(self, link_list, f):
dt = link_list[f][0]
dn = self.fields.get(f)
if not dt:
webnotes.throw("Options not set for link field: " + f)
if not dt: return dn
if not dn: return None
if dt=="[Select]": return dn
@@ -338,8 +344,7 @@ class Document:
# validate links
if link_list and link_list.get(f):
self.fields[f] = self._validate_link(link_list[f][0],
self.fields.get(f))
self.fields[f] = self._validate_link(link_list, f)

if self.fields.get(f) is None or self.fields.get(f)=='':
update_str.append("`%s`=NULL" % f)


Ładowanie…
Anuluj
Zapisz