text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
function Bar(cls, orientation, scroll) {
this.orientation = orientation;
this.scroll = scroll;
this.screen = this.total = this.size = 1;
this.pos = 0;
this.node = document.createElement("div");
this.node.className = cls + "-" + orientation;
this.inner = this.node.appendChild(document.createElement("div"));
var self = this;
CodeMirror.on(this.inner, "mousedown", function(e) {
if (e.which != 1) return;
CodeMirror.e_preventDefault(e);
var axis = self.orientation == "horizontal" ? "pageX" : "pageY";
var start = e[axis], startpos = self.pos;
function done() {
CodeMirror.off(document, "mousemove", move);
CodeMirror.off(document, "mouseup", done);
}
function move(e) {
if (e.which != 1) return done();
self.moveTo(startpos + (e[axis] - start) * (self.total / self.size));
}
CodeMirror.on(document, "mousemove", move);
CodeMirror.on(document, "mouseup", done);
});
CodeMirror.on(this.node, "click", function(e) {
CodeMirror.e_preventDefault(e);
var innerBox = self.inner.getBoundingClientRect(), where;
if (self.orientation == "horizontal")
where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0;
else
where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0;
self.moveTo(self.pos + where * self.screen);
});
function onWheel(e) {
var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"];
var oldPos = self.pos;
self.moveTo(self.pos + moved);
if (self.pos != oldPos) CodeMirror.e_preventDefault(e);
}
CodeMirror.on(this.node, "mousewheel", onWheel);
CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
}
Bar.prototype.moveTo = function(pos, update) {
if (pos < 0) pos = 0;
if (pos > this.total - this.screen) pos = this.total - this.screen;
if (pos == this.pos) return;
this.pos = pos;
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
(pos * (this.size / this.total)) + "px";
if (update !== false) this.scroll(pos, this.orientation);
};
Bar.prototype.update = function(scrollSize, clientSize, barSize) {
this.screen = clientSize;
this.total = scrollSize;
this.size = barSize;
// FIXME clip to min size?
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
this.screen * (this.size / this.total) + "px";
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
this.pos * (this.size / this.total) + "px";
};
function SimpleScrollbars(cls, place, scroll) {
this.addClass = cls;
this.horiz = new Bar(cls, "horizontal", scroll);
place(this.horiz.node);
this.vert = new Bar(cls, "vertical", scroll);
place(this.vert.node);
this.width = null;
}
SimpleScrollbars.prototype.update = function(measure) {
if (this.width == null) {
var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle;
if (style) this.width = parseInt(style.height);
}
var width = this.width || 0;
var needsH = measure.scrollWidth > measure.clientWidth + 1;
var needsV = measure.scrollHeight > measure.clientHeight + 1;
this.vert.node.style.display = needsV ? "block" : "none";
this.horiz.node.style.display = needsH ? "block" : "none";
if (needsV) {
this.vert.update(measure.scrollHeight, measure.clientHeight,
measure.viewHeight - (needsH ? width : 0));
this.vert.node.style.display = "block";
this.vert.node.style.bottom = needsH ? width + "px" : "0";
}
if (needsH) {
this.horiz.update(measure.scrollWidth, measure.clientWidth,
measure.viewWidth - (needsV ? width : 0) - measure.barLeft);
this.horiz.node.style.right = needsV ? width + "px" : "0";
this.horiz.node.style.left = measure.barLeft + "px";
}
return {right: needsV ? width : 0, bottom: needsH ? width : 0};
};
SimpleScrollbars.prototype.setScrollTop = function(pos) {
this.vert.moveTo(pos, false);
};
SimpleScrollbars.prototype.setScrollLeft = function(pos) {
this.horiz.moveTo(pos, false);
};
SimpleScrollbars.prototype.clear = function() {
var parent = this.horiz.node.parentNode;
parent.removeChild(this.horiz.node);
parent.removeChild(this.vert.node);
};
CodeMirror.scrollbarModel.simple = function(place, scroll) {
return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll);
};
CodeMirror.scrollbarModel.overlay = function(place, scroll) {
return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll);
};
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/scroll/simplescrollbars.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/scroll/simplescrollbars.js",
"repo_id": "Humsen",
"token_count": 2056
} | 38 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../clike/clike"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../clike/clike"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
var keywords = ("this super static final const abstract class extends external factory " +
"implements get native operator set typedef with enum throw rethrow " +
"assert break case continue default in return new deferred async await " +
"try catch finally do else for if switch while import library export " +
"part of show hide is").split(" ");
var blockKeywords = "try catch finally do else for if switch while".split(" ");
var atoms = "true false null".split(" ");
var builtins = "void bool num int double dynamic var String".split(" ");
function set(words) {
var obj = {};
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
CodeMirror.defineMIME("application/dart", {
name: "clike",
keywords: set(keywords),
multiLineStrings: true,
blockKeywords: set(blockKeywords),
builtin: set(builtins),
atoms: set(atoms),
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
}
}
});
CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins));
// This is needed to make loading through meta.js work.
CodeMirror.defineMode("dart", function(conf) {
return CodeMirror.getMode(conf, "application/dart");
}, "clike");
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/dart/dart.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/dart/dart.js",
"repo_id": "Humsen",
"token_count": 627
} | 39 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("go", function(config) {
var indentUnit = config.indentUnit;
var keywords = {
"break":true, "case":true, "chan":true, "const":true, "continue":true,
"default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
"func":true, "go":true, "goto":true, "if":true, "import":true,
"interface":true, "map":true, "package":true, "range":true, "return":true,
"select":true, "struct":true, "switch":true, "type":true, "var":true,
"bool":true, "byte":true, "complex64":true, "complex128":true,
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
"uint64":true, "int":true, "uint":true, "uintptr":true
};
var atoms = {
"true":true, "false":true, "iota":true, "nil":true, "append":true,
"cap":true, "close":true, "complex":true, "copy":true, "imag":true,
"len":true, "make":true, "new":true, "panic":true, "print":true,
"println":true, "real":true, "recover":true
};
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
var curPunc;
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'" || ch == "`") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
if (/[\d\.]/.test(ch)) {
if (ch == ".") {
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
} else if (ch == "0") {
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
} else {
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
}
return "number";
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
return null;
}
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize = tokenComment;
return tokenComment(stream, state);
}
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
}
if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return "operator";
}
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
var cur = stream.current();
if (keywords.propertyIsEnumerable(cur)) {
if (cur == "case" || cur == "default") curPunc = "case";
return "keyword";
}
if (atoms.propertyIsEnumerable(cur)) return "atom";
return "variable";
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || quote == "`"))
state.tokenize = tokenBase;
return "string";
};
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
if (!state.context.prev) return;
var t = state.context.type;
if (t == ")" || t == "]" || t == "}")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: null,
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
indented: 0,
startOfLine: true
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
if (ctx.type == "case") ctx.type = "}";
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = (state.tokenize || tokenBase)(stream, state);
if (style == "comment") return style;
if (ctx.align == null) ctx.align = true;
if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "case") ctx.type = "case";
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
else if (curPunc == ctx.type) popContext(state);
state.startOfLine = false;
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
state.context.type = "}";
return ctx.indented;
}
var closing = firstChar == ctx.type;
if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : indentUnit);
},
electricChars: "{}):",
fold: "brace",
blockCommentStart: "/*",
blockCommentEnd: "*/",
lineComment: "//"
};
});
CodeMirror.defineMIME("text/x-go", "go");
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/go/go.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/go/go.js",
"repo_id": "Humsen",
"token_count": 2522
} | 40 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
/**
* Link to the project's GitHub page:
* https://github.com/duralog/CodeMirror
*/
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode('livescript', function(){
var tokenBase = function(stream, state) {
var next_rule = state.next || "start";
if (next_rule) {
state.next = state.next;
var nr = Rules[next_rule];
if (nr.splice) {
for (var i$ = 0; i$ < nr.length; ++i$) {
var r = nr[i$], m;
if (r.regex && (m = stream.match(r.regex))) {
state.next = r.next || state.next;
return r.token;
}
}
stream.next();
return 'error';
}
if (stream.match(r = Rules[next_rule])) {
if (r.regex && stream.match(r.regex)) {
state.next = r.next;
return r.token;
} else {
stream.next();
return 'error';
}
}
}
stream.next();
return 'error';
};
var external = {
startState: function(){
return {
next: 'start',
lastToken: null
};
},
token: function(stream, state){
while (stream.pos == stream.start)
var style = tokenBase(stream, state);
state.lastToken = {
style: style,
indent: stream.indentation(),
content: stream.current()
};
return style.replace(/\./g, ' ');
},
indent: function(state){
var indentation = state.lastToken.indent;
if (state.lastToken.content.match(indenter)) {
indentation += 2;
}
return indentation;
}
};
return external;
});
var identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
var indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
var keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
var stringfill = {
token: 'string',
regex: '.+'
};
var Rules = {
start: [
{
token: 'comment.doc',
regex: '/\\*',
next: 'comment'
}, {
token: 'comment',
regex: '#.*'
}, {
token: 'keyword',
regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
}, {
token: 'constant.language',
regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
}, {
token: 'invalid.illegal',
regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
}, {
token: 'language.support.class',
regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
}, {
token: 'language.support.function',
regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
}, {
token: 'variable.language',
regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
}, {
token: 'identifier',
regex: identifier + '\\s*:(?![:=])'
}, {
token: 'variable',
regex: identifier
}, {
token: 'keyword.operator',
regex: '(?:\\.{3}|\\s+\\?)'
}, {
token: 'keyword.variable',
regex: '(?:@+|::|\\.\\.)',
next: 'key'
}, {
token: 'keyword.operator',
regex: '\\.\\s*',
next: 'key'
}, {
token: 'string',
regex: '\\\\\\S[^\\s,;)}\\]]*'
}, {
token: 'string.doc',
regex: '\'\'\'',
next: 'qdoc'
}, {
token: 'string.doc',
regex: '"""',
next: 'qqdoc'
}, {
token: 'string',
regex: '\'',
next: 'qstring'
}, {
token: 'string',
regex: '"',
next: 'qqstring'
}, {
token: 'string',
regex: '`',
next: 'js'
}, {
token: 'string',
regex: '<\\[',
next: 'words'
}, {
token: 'string.regex',
regex: '//',
next: 'heregex'
}, {
token: 'string.regex',
regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
next: 'key'
}, {
token: 'constant.numeric',
regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
}, {
token: 'lparen',
regex: '[({[]'
}, {
token: 'rparen',
regex: '[)}\\]]',
next: 'key'
}, {
token: 'keyword.operator',
regex: '\\S+'
}, {
token: 'text',
regex: '\\s+'
}
],
heregex: [
{
token: 'string.regex',
regex: '.*?//[gimy$?]{0,4}',
next: 'start'
}, {
token: 'string.regex',
regex: '\\s*#{'
}, {
token: 'comment.regex',
regex: '\\s+(?:#.*)?'
}, {
token: 'string.regex',
regex: '\\S+'
}
],
key: [
{
token: 'keyword.operator',
regex: '[.?@!]+'
}, {
token: 'identifier',
regex: identifier,
next: 'start'
}, {
token: 'text',
regex: '',
next: 'start'
}
],
comment: [
{
token: 'comment.doc',
regex: '.*?\\*/',
next: 'start'
}, {
token: 'comment.doc',
regex: '.+'
}
],
qdoc: [
{
token: 'string',
regex: ".*?'''",
next: 'key'
}, stringfill
],
qqdoc: [
{
token: 'string',
regex: '.*?"""',
next: 'key'
}, stringfill
],
qstring: [
{
token: 'string',
regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
next: 'key'
}, stringfill
],
qqstring: [
{
token: 'string',
regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
next: 'key'
}, stringfill
],
js: [
{
token: 'string',
regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
next: 'key'
}, stringfill
],
words: [
{
token: 'string',
regex: '.*?\\]>',
next: 'key'
}, stringfill
]
};
for (var idx in Rules) {
var r = Rules[idx];
if (r.splice) {
for (var i = 0, len = r.length; i < len; ++i) {
var rr = r[i];
if (typeof rr.regex === 'string') {
Rules[idx][i].regex = new RegExp('^' + rr.regex);
}
}
} else if (typeof rr.regex === 'string') {
Rules[idx].regex = new RegExp('^' + r.regex);
}
}
CodeMirror.defineMIME('text/x-livescript', 'livescript');
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/livescript/livescript.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/livescript/livescript.js",
"repo_id": "Humsen",
"token_count": 4114
} | 41 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
/*
* Pig Latin Mode for CodeMirror 2
* @author Prasanth Jayachandran
* @link https://github.com/prasanthj/pig-codemirror-2
* This implementation is adapted from PL/SQL mode in CodeMirror 2.
*/
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("pig", function(_config, parserConfig) {
var keywords = parserConfig.keywords,
builtins = parserConfig.builtins,
types = parserConfig.types,
multiLineStrings = parserConfig.multiLineStrings;
var isOperatorChar = /[*+\-%<>=&?:\/!|]/;
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
}
var type;
function ret(tp, style) {
type = tp;
return style;
}
function tokenComment(stream, state) {
var isEnd = false;
var ch;
while(ch = stream.next()) {
if(ch == "/" && isEnd) {
state.tokenize = tokenBase;
break;
}
isEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, next, end = false;
while((next = stream.next()) != null) {
if (next == quote && !escaped) {
end = true; break;
}
escaped = !escaped && next == "\\";
}
if (end || !(escaped || multiLineStrings))
state.tokenize = tokenBase;
return ret("string", "error");
};
}
function tokenBase(stream, state) {
var ch = stream.next();
// is a start of string?
if (ch == '"' || ch == "'")
return chain(stream, state, tokenString(ch));
// is it one of the special chars
else if(/[\[\]{}\(\),;\.]/.test(ch))
return ret(ch);
// is it a number?
else if(/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return ret("number", "number");
}
// multi line comment or operator
else if (ch == "/") {
if (stream.eat("*")) {
return chain(stream, state, tokenComment);
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
}
// single line comment or operator
else if (ch=="-") {
if(stream.eat("-")){
stream.skipToEnd();
return ret("comment", "comment");
}
else {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
}
// is it an operator
else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator");
}
else {
// get the while word
stream.eatWhile(/[\w\$_]/);
// is it one of the listed keywords?
if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
if (stream.eat(")") || stream.eat(".")) {
//keywords can be used as variables like flatten(group), group.$0 etc..
}
else {
return ("keyword", "keyword");
}
}
// is it one of the builtin functions?
if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase()))
{
return ("keyword", "variable-2");
}
// is it one of the listed types?
if (types && types.propertyIsEnumerable(stream.current().toUpperCase()))
return ("keyword", "variable-3");
// default is a 'variable'
return ret("variable", "pig-word");
}
}
// Interface
return {
startState: function() {
return {
tokenize: tokenBase,
startOfLine: true
};
},
token: function(stream, state) {
if(stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
return style;
}
};
});
(function() {
function keywords(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
// builtin funcs taken from trunk revision 1303237
var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
+ "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
+ "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
+ "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
+ "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
+ "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
+ "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
+ "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
+ "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
+ "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER ";
// taken from QueryLexer.g
var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
+ "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
+ "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
+ "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
+ "NEQ MATCHES TRUE FALSE DUMP";
// data types
var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP ";
CodeMirror.defineMIME("text/x-pig", {
name: "pig",
builtins: keywords(pBuiltins),
keywords: keywords(pKeywords),
types: keywords(pTypes)
});
CodeMirror.registerHelper("hintWords", "pig", (pBuiltins + pTypes + pKeywords).split(" "));
}());
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/pig/pig.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/pig/pig.js",
"repo_id": "Humsen",
"token_count": 2518
} | 42 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../ruby/ruby"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("slim", function(config) {
var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
var rubyMode = CodeMirror.getMode(config, "ruby");
var modes = { html: htmlMode, ruby: rubyMode };
var embedded = {
ruby: "ruby",
javascript: "javascript",
css: "text/css",
sass: "text/x-sass",
scss: "text/x-scss",
less: "text/x-less",
styl: "text/x-styl", // no highlighting so far
coffee: "coffeescript",
asciidoc: "text/x-asciidoc",
markdown: "text/x-markdown",
textile: "text/x-textile", // no highlighting so far
creole: "text/x-creole", // no highlighting so far
wiki: "text/x-wiki", // no highlighting so far
mediawiki: "text/x-mediawiki", // no highlighting so far
rdoc: "text/x-rdoc", // no highlighting so far
builder: "text/x-builder", // no highlighting so far
nokogiri: "text/x-nokogiri", // no highlighting so far
erb: "application/x-erb"
};
var embeddedRegexp = function(map){
var arr = [];
for(var key in map) arr.push(key);
return new RegExp("^("+arr.join('|')+"):");
}(embedded);
var styleMap = {
"commentLine": "comment",
"slimSwitch": "operator special",
"slimTag": "tag",
"slimId": "attribute def",
"slimClass": "attribute qualifier",
"slimAttribute": "attribute",
"slimSubmode": "keyword special",
"closeAttributeTag": null,
"slimDoctype": null,
"lineContinuation": null
};
var closing = {
"{": "}",
"[": "]",
"(": ")"
};
var nameStartChar = "_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
var nameChar = nameStartChar + "\\-0-9\xB7\u0300-\u036F\u203F-\u2040";
var nameRegexp = new RegExp("^[:"+nameStartChar+"](?::["+nameChar+"]|["+nameChar+"]*)");
var attributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*(?=\\s*=)");
var wrappedAttributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*");
var classNameRegexp = /^\.-?[_a-zA-Z]+[\w\-]*/;
var classIdRegexp = /^#[_a-zA-Z]+[\w\-]*/;
function backup(pos, tokenize, style) {
var restore = function(stream, state) {
state.tokenize = tokenize;
if (stream.pos < pos) {
stream.pos = pos;
return style;
}
return state.tokenize(stream, state);
};
return function(stream, state) {
state.tokenize = restore;
return tokenize(stream, state);
};
}
function maybeBackup(stream, state, pat, offset, style) {
var cur = stream.current();
var idx = cur.search(pat);
if (idx > -1) {
state.tokenize = backup(stream.pos, state.tokenize, style);
stream.backUp(cur.length - idx - offset);
}
return style;
}
function continueLine(state, column) {
state.stack = {
parent: state.stack,
style: "continuation",
indented: column,
tokenize: state.line
};
state.line = state.tokenize;
}
function finishContinue(state) {
if (state.line == state.tokenize) {
state.line = state.stack.tokenize;
state.stack = state.stack.parent;
}
}
function lineContinuable(column, tokenize) {
return function(stream, state) {
finishContinue(state);
if (stream.match(/^\\$/)) {
continueLine(state, column);
return "lineContinuation";
}
var style = tokenize(stream, state);
if (stream.eol() && stream.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)) {
stream.backUp(1);
}
return style;
};
}
function commaContinuable(column, tokenize) {
return function(stream, state) {
finishContinue(state);
var style = tokenize(stream, state);
if (stream.eol() && stream.current().match(/,$/)) {
continueLine(state, column);
}
return style;
};
}
function rubyInQuote(endQuote, tokenize) {
// TODO: add multi line support
return function(stream, state) {
var ch = stream.peek();
if (ch == endQuote && state.rubyState.tokenize.length == 1) {
// step out of ruby context as it seems to complete processing all the braces
stream.next();
state.tokenize = tokenize;
return "closeAttributeTag";
} else {
return ruby(stream, state);
}
};
}
function startRubySplat(tokenize) {
var rubyState;
var runSplat = function(stream, state) {
if (state.rubyState.tokenize.length == 1 && !state.rubyState.context.prev) {
stream.backUp(1);
if (stream.eatSpace()) {
state.rubyState = rubyState;
state.tokenize = tokenize;
return tokenize(stream, state);
}
stream.next();
}
return ruby(stream, state);
};
return function(stream, state) {
rubyState = state.rubyState;
state.rubyState = rubyMode.startState();
state.tokenize = runSplat;
return ruby(stream, state);
};
}
function ruby(stream, state) {
return rubyMode.token(stream, state.rubyState);
}
function htmlLine(stream, state) {
if (stream.match(/^\\$/)) {
return "lineContinuation";
}
return html(stream, state);
}
function html(stream, state) {
if (stream.match(/^#\{/)) {
state.tokenize = rubyInQuote("}", state.tokenize);
return null;
}
return maybeBackup(stream, state, /[^\\]#\{/, 1, htmlMode.token(stream, state.htmlState));
}
function startHtmlLine(lastTokenize) {
return function(stream, state) {
var style = htmlLine(stream, state);
if (stream.eol()) state.tokenize = lastTokenize;
return style;
};
}
function startHtmlMode(stream, state, offset) {
state.stack = {
parent: state.stack,
style: "html",
indented: stream.column() + offset, // pipe + space
tokenize: state.line
};
state.line = state.tokenize = html;
return null;
}
function comment(stream, state) {
stream.skipToEnd();
return state.stack.style;
}
function commentMode(stream, state) {
state.stack = {
parent: state.stack,
style: "comment",
indented: state.indented + 1,
tokenize: state.line
};
state.line = comment;
return comment(stream, state);
}
function attributeWrapper(stream, state) {
if (stream.eat(state.stack.endQuote)) {
state.line = state.stack.line;
state.tokenize = state.stack.tokenize;
state.stack = state.stack.parent;
return null;
}
if (stream.match(wrappedAttributeNameRegexp)) {
state.tokenize = attributeWrapperAssign;
return "slimAttribute";
}
stream.next();
return null;
}
function attributeWrapperAssign(stream, state) {
if (stream.match(/^==?/)) {
state.tokenize = attributeWrapperValue;
return null;
}
return attributeWrapper(stream, state);
}
function attributeWrapperValue(stream, state) {
var ch = stream.peek();
if (ch == '"' || ch == "\'") {
state.tokenize = readQuoted(ch, "string", true, false, attributeWrapper);
stream.next();
return state.tokenize(stream, state);
}
if (ch == '[') {
return startRubySplat(attributeWrapper)(stream, state);
}
if (stream.match(/^(true|false|nil)\b/)) {
state.tokenize = attributeWrapper;
return "keyword";
}
return startRubySplat(attributeWrapper)(stream, state);
}
function startAttributeWrapperMode(state, endQuote, tokenize) {
state.stack = {
parent: state.stack,
style: "wrapper",
indented: state.indented + 1,
tokenize: tokenize,
line: state.line,
endQuote: endQuote
};
state.line = state.tokenize = attributeWrapper;
return null;
}
function sub(stream, state) {
if (stream.match(/^#\{/)) {
state.tokenize = rubyInQuote("}", state.tokenize);
return null;
}
var subStream = new CodeMirror.StringStream(stream.string.slice(state.stack.indented), stream.tabSize);
subStream.pos = stream.pos - state.stack.indented;
subStream.start = stream.start - state.stack.indented;
subStream.lastColumnPos = stream.lastColumnPos - state.stack.indented;
subStream.lastColumnValue = stream.lastColumnValue - state.stack.indented;
var style = state.subMode.token(subStream, state.subState);
stream.pos = subStream.pos + state.stack.indented;
return style;
}
function firstSub(stream, state) {
state.stack.indented = stream.column();
state.line = state.tokenize = sub;
return state.tokenize(stream, state);
}
function createMode(mode) {
var query = embedded[mode];
var spec = CodeMirror.mimeModes[query];
if (spec) {
return CodeMirror.getMode(config, spec);
}
var factory = CodeMirror.modes[query];
if (factory) {
return factory(config, {name: query});
}
return CodeMirror.getMode(config, "null");
}
function getMode(mode) {
if (!modes.hasOwnProperty(mode)) {
return modes[mode] = createMode(mode);
}
return modes[mode];
}
function startSubMode(mode, state) {
var subMode = getMode(mode);
var subState = subMode.startState && subMode.startState();
state.subMode = subMode;
state.subState = subState;
state.stack = {
parent: state.stack,
style: "sub",
indented: state.indented + 1,
tokenize: state.line
};
state.line = state.tokenize = firstSub;
return "slimSubmode";
}
function doctypeLine(stream, _state) {
stream.skipToEnd();
return "slimDoctype";
}
function startLine(stream, state) {
var ch = stream.peek();
if (ch == '<') {
return (state.tokenize = startHtmlLine(state.tokenize))(stream, state);
}
if (stream.match(/^[|']/)) {
return startHtmlMode(stream, state, 1);
}
if (stream.match(/^\/(!|\[\w+])?/)) {
return commentMode(stream, state);
}
if (stream.match(/^(-|==?[<>]?)/)) {
state.tokenize = lineContinuable(stream.column(), commaContinuable(stream.column(), ruby));
return "slimSwitch";
}
if (stream.match(/^doctype\b/)) {
state.tokenize = doctypeLine;
return "keyword";
}
var m = stream.match(embeddedRegexp);
if (m) {
return startSubMode(m[1], state);
}
return slimTag(stream, state);
}
function slim(stream, state) {
if (state.startOfLine) {
return startLine(stream, state);
}
return slimTag(stream, state);
}
function slimTag(stream, state) {
if (stream.eat('*')) {
state.tokenize = startRubySplat(slimTagExtras);
return null;
}
if (stream.match(nameRegexp)) {
state.tokenize = slimTagExtras;
return "slimTag";
}
return slimClass(stream, state);
}
function slimTagExtras(stream, state) {
if (stream.match(/^(<>?|><?)/)) {
state.tokenize = slimClass;
return null;
}
return slimClass(stream, state);
}
function slimClass(stream, state) {
if (stream.match(classIdRegexp)) {
state.tokenize = slimClass;
return "slimId";
}
if (stream.match(classNameRegexp)) {
state.tokenize = slimClass;
return "slimClass";
}
return slimAttribute(stream, state);
}
function slimAttribute(stream, state) {
if (stream.match(/^([\[\{\(])/)) {
return startAttributeWrapperMode(state, closing[RegExp.$1], slimAttribute);
}
if (stream.match(attributeNameRegexp)) {
state.tokenize = slimAttributeAssign;
return "slimAttribute";
}
if (stream.peek() == '*') {
stream.next();
state.tokenize = startRubySplat(slimContent);
return null;
}
return slimContent(stream, state);
}
function slimAttributeAssign(stream, state) {
if (stream.match(/^==?/)) {
state.tokenize = slimAttributeValue;
return null;
}
// should never happen, because of forward lookup
return slimAttribute(stream, state);
}
function slimAttributeValue(stream, state) {
var ch = stream.peek();
if (ch == '"' || ch == "\'") {
state.tokenize = readQuoted(ch, "string", true, false, slimAttribute);
stream.next();
return state.tokenize(stream, state);
}
if (ch == '[') {
return startRubySplat(slimAttribute)(stream, state);
}
if (ch == ':') {
return startRubySplat(slimAttributeSymbols)(stream, state);
}
if (stream.match(/^(true|false|nil)\b/)) {
state.tokenize = slimAttribute;
return "keyword";
}
return startRubySplat(slimAttribute)(stream, state);
}
function slimAttributeSymbols(stream, state) {
stream.backUp(1);
if (stream.match(/^[^\s],(?=:)/)) {
state.tokenize = startRubySplat(slimAttributeSymbols);
return null;
}
stream.next();
return slimAttribute(stream, state);
}
function readQuoted(quote, style, embed, unescaped, nextTokenize) {
return function(stream, state) {
finishContinue(state);
var fresh = stream.current().length == 0;
if (stream.match(/^\\$/, fresh)) {
if (!fresh) return style;
continueLine(state, state.indented);
return "lineContinuation";
}
if (stream.match(/^#\{/, fresh)) {
if (!fresh) return style;
state.tokenize = rubyInQuote("}", state.tokenize);
return null;
}
var escaped = false, ch;
while ((ch = stream.next()) != null) {
if (ch == quote && (unescaped || !escaped)) {
state.tokenize = nextTokenize;
break;
}
if (embed && ch == "#" && !escaped) {
if (stream.eat("{")) {
stream.backUp(2);
break;
}
}
escaped = !escaped && ch == "\\";
}
if (stream.eol() && escaped) {
stream.backUp(1);
}
return style;
};
}
function slimContent(stream, state) {
if (stream.match(/^==?/)) {
state.tokenize = ruby;
return "slimSwitch";
}
if (stream.match(/^\/$/)) { // tag close hint
state.tokenize = slim;
return null;
}
if (stream.match(/^:/)) { // inline tag
state.tokenize = slimTag;
return "slimSwitch";
}
startHtmlMode(stream, state, 0);
return state.tokenize(stream, state);
}
var mode = {
// default to html mode
startState: function() {
var htmlState = htmlMode.startState();
var rubyState = rubyMode.startState();
return {
htmlState: htmlState,
rubyState: rubyState,
stack: null,
last: null,
tokenize: slim,
line: slim,
indented: 0
};
},
copyState: function(state) {
return {
htmlState : CodeMirror.copyState(htmlMode, state.htmlState),
rubyState: CodeMirror.copyState(rubyMode, state.rubyState),
subMode: state.subMode,
subState: state.subMode && CodeMirror.copyState(state.subMode, state.subState),
stack: state.stack,
last: state.last,
tokenize: state.tokenize,
line: state.line
};
},
token: function(stream, state) {
if (stream.sol()) {
state.indented = stream.indentation();
state.startOfLine = true;
state.tokenize = state.line;
while (state.stack && state.stack.indented > state.indented && state.last != "slimSubmode") {
state.line = state.tokenize = state.stack.tokenize;
state.stack = state.stack.parent;
state.subMode = null;
state.subState = null;
}
}
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
state.startOfLine = false;
if (style) state.last = style;
return styleMap.hasOwnProperty(style) ? styleMap[style] : style;
},
blankLine: function(state) {
if (state.subMode && state.subMode.blankLine) {
return state.subMode.blankLine(state.subState);
}
},
innerMode: function(state) {
if (state.subMode) return {state: state.subState, mode: state.subMode};
return {state: state, mode: mode};
}
//indent: function(state) {
// return state.indented;
//}
};
return mode;
}, "htmlmixed", "ruby");
CodeMirror.defineMIME("text/x-slim", "slim");
CodeMirror.defineMIME("application/x-slim", "slim");
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/slim/slim.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/slim/slim.js",
"repo_id": "Humsen",
"token_count": 8080
} | 43 |
span.cm-underlined {
text-decoration: underline;
}
span.cm-strikethrough {
text-decoration: line-through;
}
span.cm-brace {
color: #170;
font-weight: bold;
}
span.cm-table {
color: blue;
font-weight: bold;
}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/tiddlywiki/tiddlywiki.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/tiddlywiki/tiddlywiki.css",
"repo_id": "Humsen",
"token_count": 90
} | 44 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("yaml", function() {
var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
return {
token: function(stream, state) {
var ch = stream.peek();
var esc = state.escaped;
state.escaped = false;
/* comments */
if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
stream.skipToEnd();
return "comment";
}
if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
return "string";
if (state.literal && stream.indentation() > state.keyCol) {
stream.skipToEnd(); return "string";
} else if (state.literal) { state.literal = false; }
if (stream.sol()) {
state.keyCol = 0;
state.pair = false;
state.pairStart = false;
/* document start */
if(stream.match(/---/)) { return "def"; }
/* document end */
if (stream.match(/\.\.\./)) { return "def"; }
/* array list item */
if (stream.match(/\s*-\s+/)) { return 'meta'; }
}
/* inline pairs/lists */
if (stream.match(/^(\{|\}|\[|\])/)) {
if (ch == '{')
state.inlinePairs++;
else if (ch == '}')
state.inlinePairs--;
else if (ch == '[')
state.inlineList++;
else
state.inlineList--;
return 'meta';
}
/* list seperator */
if (state.inlineList > 0 && !esc && ch == ',') {
stream.next();
return 'meta';
}
/* pairs seperator */
if (state.inlinePairs > 0 && !esc && ch == ',') {
state.keyCol = 0;
state.pair = false;
state.pairStart = false;
stream.next();
return 'meta';
}
/* start of value of a pair */
if (state.pairStart) {
/* block literals */
if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
/* references */
if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
/* numbers */
if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
/* keywords */
if (stream.match(keywordRegex)) { return 'keyword'; }
}
/* pairs (associative arrays) -> key */
if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) {
state.pair = true;
state.keyCol = stream.indentation();
return "atom";
}
if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
/* nothing found, continue */
state.pairStart = false;
state.escaped = (ch == '\\');
stream.next();
return null;
},
startState: function() {
return {
pair: false,
pairStart: false,
keyCol: 0,
inlinePairs: 0,
inlineList: 0,
literal: false,
escaped: false
};
}
};
});
CodeMirror.defineMIME("text/x-yaml", "yaml");
});
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/yaml/yaml.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/yaml/yaml.js",
"repo_id": "Humsen",
"token_count": 1725
} | 45 |
/*
http://lesscss.org/ dark theme
Ported to CodeMirror by Peter Kroon
*/
.cm-s-lesser-dark {
line-height: 1.3em;
}
.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
.cm-s-lesser-dark.CodeMirror ::selection { background: rgba(69, 68, 59, .99); }
.cm-s-lesser-dark.CodeMirror ::-moz-selection { background: rgba(69, 68, 59, .99); }
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
.cm-s-lesser-dark .CodeMirror-guttermarker { color: #599eff; }
.cm-s-lesser-dark .CodeMirror-guttermarker-subtle { color: #777; }
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
.cm-s-lesser-dark span.cm-def {color: white;}
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
.cm-s-lesser-dark span.cm-property {color: #92A75C;}
.cm-s-lesser-dark span.cm-operator {color: #92A75C;}
.cm-s-lesser-dark span.cm-comment { color: #666; }
.cm-s-lesser-dark span.cm-string { color: #BCD279; }
.cm-s-lesser-dark span.cm-string-2 {color: #f50;}
.cm-s-lesser-dark span.cm-meta { color: #738C73; }
.cm-s-lesser-dark span.cm-qualifier {color: #555;}
.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
.cm-s-lesser-dark span.cm-tag { color: #669199; }
.cm-s-lesser-dark span.cm-attribute {color: #00c;}
.cm-s-lesser-dark span.cm-header {color: #a0a;}
.cm-s-lesser-dark span.cm-quote {color: #090;}
.cm-s-lesser-dark span.cm-hr {color: #999;}
.cm-s-lesser-dark span.cm-link {color: #00c;}
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
.cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A !important;}
.cm-s-lesser-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/lesser-dark.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/lesser-dark.css",
"repo_id": "Humsen",
"token_count": 1020
} | 46 |
.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
.cm-s-twilight.CodeMirror ::selection { background: rgba(50, 50, 50, 0.99); }
.cm-s-twilight.CodeMirror ::-moz-selection { background: rgba(50, 50, 50, 0.99); }
.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
.cm-s-twilight .CodeMirror-guttermarker { color: white; }
.cm-s-twilight .CodeMirror-guttermarker-subtle { color: #aaa; }
.cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
.cm-s-twilight .cm-atom { color: #FC0; }
.cm-s-twilight .cm-number { color: #ca7841; } /**/
.cm-s-twilight .cm-def { color: #8DA6CE; }
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
.cm-s-twilight .cm-operator { color: #cda869; } /**/
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
.cm-s-twilight .cm-tag { color: #997643; } /**/
.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
.cm-s-twilight .cm-header { color: #FF6400; }
.cm-s-twilight .cm-hr { color: #AEAEAE; }
.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/
.cm-s-twilight .cm-error { border-bottom: 1px solid red; }
.cm-s-twilight .CodeMirror-activeline-background {background: #27282E !important;}
.cm-s-twilight .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
| Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/twilight.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/twilight.css",
"repo_id": "Humsen",
"token_count": 813
} | 47 |
;(function () {
'use strict';
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
var fullHeight = function() {
if ( !isMobile.any() ) {
$('.js-fullheight').css('height', $(window).height());
$(window).resize(function(){
$('.js-fullheight').css('height', $(window).height());
});
}
};
// Animations
var contentWayPoint = function() {
var i = 0;
$('.animate-box').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('animated') ) {
i++;
$(this.element).addClass('item-animate');
setTimeout(function(){
$('body .animate-box.item-animate').each(function(k){
var el = $(this);
setTimeout( function () {
var effect = el.data('animate-effect');
if ( effect === 'fadeIn') {
el.addClass('fadeIn animated');
} else if ( effect === 'fadeInLeft') {
el.addClass('fadeInLeft animated');
} else if ( effect === 'fadeInRight') {
el.addClass('fadeInRight animated');
} else {
el.addClass('fadeInUp animated');
}
el.removeClass('item-animate');
}, k * 200, 'easeInOutExpo' );
});
}, 100);
}
} , { offset: '85%' } );
};
var burgerMenu = function() {
$('.js-fh5co-nav-toggle').on('click', function(event){
event.preventDefault();
var $this = $(this);
if ($('body').hasClass('offcanvas')) {
$this.removeClass('active');
$('body').removeClass('offcanvas');
} else {
$this.addClass('active');
$('body').addClass('offcanvas');
}
});
};
// Click outside of offcanvass
var mobileMenuOutsideClick = function() {
$(document).click(function (e) {
var container = $("#fh5co-aside, .js-fh5co-nav-toggle");
if (!container.is(e.target) && container.has(e.target).length === 0) {
if ( $('body').hasClass('offcanvas') ) {
$('body').removeClass('offcanvas');
$('.js-fh5co-nav-toggle').removeClass('active');
}
}
});
$(window).scroll(function(){
if ( $('body').hasClass('offcanvas') ) {
$('body').removeClass('offcanvas');
$('.js-fh5co-nav-toggle').removeClass('active');
}
});
};
var sliderMain = function() {
$('#fh5co-hero .flexslider').flexslider({
animation: "fade",
slideshowSpeed: 5000,
directionNav: true,
start: function(){
setTimeout(function(){
$('.slider-text').removeClass('animated fadeInUp');
$('.flex-active-slide').find('.slider-text').addClass('animated fadeInUp');
}, 500);
},
before: function(){
setTimeout(function(){
$('.slider-text').removeClass('animated fadeInUp');
$('.flex-active-slide').find('.slider-text').addClass('animated fadeInUp');
}, 500);
}
});
};
// Document on load.
$(function(){
fullHeight();
contentWayPoint();
burgerMenu();
mobileMenuOutsideClick();
sliderMain();
});
}()); | Humsen/web/web-mobile/WebContent/plugins/template/js/main.js/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/plugins/template/js/main.js",
"repo_id": "Humsen",
"token_count": 1498
} | 48 |
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>分享</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="欢迎来到何明胜的个人网站.本站主要用于记录和分享本人的学习心得和编程经验,并分享常见可复用代码、推荐书籍以及软件等资源.本站源码已托管github,欢迎访问:https://github.com/HelloHusen/web" />
<meta name="keywords" content="何明胜,何明胜的个人网站,何明胜的博客,一格的程序人生" />
<meta name="author" content="何明胜,一格">
<!-- 网站图标 -->
<link rel="shortcut icon" href="/images/favicon.ico">
<!-- jQuery -->
<script src="/plugins/jquery/js/jquery-3.2.1.min.js"></script>
<!-- 自定义css -->
<link rel="stylesheet" href="/css/download/download.css">
<!-- 自定义脚本 -->
<script src="/js/download/download.js"></script>
<script src="/js/pagination.js"></script>
</head>
<body>
<input id="menuBarNo" type="hidden" value="4" />
<div id="fh5co-page">
<a href="#" class="js-fh5co-nav-toggle fh5co-nav-toggle"><i></i></a>
<input id="menuBarNo" type="hidden" value="4"/>
<!-- 左侧导航 -->
<!-- 中间内容 -->
<div id="fh5co-main">
<div class="fh5co-narrow-content download-div">
<h2 class="fh5co-heading" data-animate-effect="fadeInLeft">下载分享区</h2>
<input type="hidden" id="num_downloadPageSize" value="10">
<div id="list_file" class="row"></div>
</div>
</div>
<!-- 右侧导航 -->
</div>
</body>
</html> | Humsen/web/web-mobile/WebContent/topic/download/download.html/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/topic/download/download.html",
"repo_id": "Humsen",
"token_count": 783
} | 49 |
/**
* @author 何明胜
*
* 2017年12月26日
*/
/** 显示所有用户 * */
$(document).ready(function() {
$('#tbl_showUsers').DataTable({
serverSide : true,
autoWidth : false,
ordering : true,
processing : true,
ajax : {
url : '/users/query.hms',
type : 'POST'
},
/*
* "columnDefs" : [ { "width" : "200px", "targets" : 0 } ],
*/
columns : [ {
"title" : "用户id",
data : 'userId',
'class' : 'user-id-width'
}, {
"title" : "用户名",
data : 'userName',
}, {
"title" : "用户昵称",
data : 'userNickName',
'class' : 'user-nick-name-width'
}, {
"title" : "用户密码",
data : 'userPassword',
'class' : 'user-nick-name-width'
}, {
"title" : "邮箱",
data : 'userEmail',
}, {
"title" : "手机号",
data : 'userPhone',
'class' : 'user-nick-name-width'
}, {
"title" : "年龄",
data : 'userAge',
'class' : 'user-common-width'
}, {
"title" : "性别",
data : 'userSex',
'class' : 'user-common-width'
}, {
"title" : "地址",
data : 'userAddress',
'class' : 'user-common-width'
}, {
"title" : "头像链接",
data : 'userHeadUrl',
"class" : "center",
'class' : 'user-nick-name-width'
} ]
});
}); | Humsen/web/web-pc/WebContent/js/personal_center/show-users.js/0 | {
"file_path": "Humsen/web/web-pc/WebContent/js/personal_center/show-users.js",
"repo_id": "Humsen",
"token_count": 641
} | 50 |
/*! DataTables jQuery UI integration
* ©2011-2014 SpryMedia Ltd - datatables.net/license
*/
/**
* DataTables integration for jQuery UI. This requires jQuery UI and
* DataTables 1.10 or newer.
*
* This file sets the defaults and adds options to DataTables to style its
* controls using jQuery UI. See http://datatables.net/manual/styling/jqueryui
* for further information.
*/
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = function (root, $) {
if ( ! root ) {
root = window;
}
if ( ! $ || ! $.fn.dataTable ) {
$ = require('datatables.net')(root, $).$;
}
return factory( $, root, root.document );
};
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
var sort_prefix = 'css_right ui-icon ui-icon-';
var toolbar_prefix = 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-';
/* Set the defaults for DataTables initialisation */
$.extend( true, DataTable.defaults, {
dom:
'<"'+toolbar_prefix+'tl ui-corner-tr"lfr>'+
't'+
'<"'+toolbar_prefix+'bl ui-corner-br"ip>',
renderer: 'jqueryui'
} );
$.extend( DataTable.ext.classes, {
"sWrapper": "dataTables_wrapper dt-jqueryui",
/* Full numbers paging buttons */
"sPageButton": "fg-button ui-button ui-state-default",
"sPageButtonActive": "ui-state-disabled",
"sPageButtonDisabled": "ui-state-disabled",
/* Features */
"sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+
"ui-buttonset-multi paging_", /* Note that the type is postfixed */
/* Sorting */
"sSortAsc": "ui-state-default sorting_asc",
"sSortDesc": "ui-state-default sorting_desc",
"sSortable": "ui-state-default sorting",
"sSortableAsc": "ui-state-default sorting_asc_disabled",
"sSortableDesc": "ui-state-default sorting_desc_disabled",
"sSortableNone": "ui-state-default sorting_disabled",
"sSortIcon": "DataTables_sort_icon",
/* Scrolling */
"sScrollHead": "dataTables_scrollHead "+"ui-state-default",
"sScrollFoot": "dataTables_scrollFoot "+"ui-state-default",
/* Misc */
"sHeaderTH": "ui-state-default",
"sFooterTH": "ui-state-default"
} );
DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, classes ) {
// Calculate what the unsorted class should be
var noSortAppliedClass = sort_prefix+'carat-2-n-s';
var asc = $.inArray('asc', column.asSorting) !== -1;
var desc = $.inArray('desc', column.asSorting) !== -1;
if ( !column.bSortable || (!asc && !desc) ) {
noSortAppliedClass = '';
}
else if ( asc && !desc ) {
noSortAppliedClass = sort_prefix+'carat-1-n';
}
else if ( !asc && desc ) {
noSortAppliedClass = sort_prefix+'carat-1-s';
}
// Setup the DOM structure
$('<div/>')
.addClass( 'DataTables_sort_wrapper' )
.append( cell.contents() )
.append( $('<span/>')
.addClass( classes.sSortIcon+' '+noSortAppliedClass )
)
.appendTo( cell );
// Attach a sort listener to update on sort
$(settings.nTable).on( 'order.dt', function ( e, ctx, sorting, columns ) {
if ( settings !== ctx ) {
return;
}
var colIdx = column.idx;
cell
.removeClass( classes.sSortAsc +" "+classes.sSortDesc )
.addClass( columns[ colIdx ] == 'asc' ?
classes.sSortAsc : columns[ colIdx ] == 'desc' ?
classes.sSortDesc :
column.sSortingClass
);
cell
.find( 'span.'+classes.sSortIcon )
.removeClass(
sort_prefix+'triangle-1-n' +" "+
sort_prefix+'triangle-1-s' +" "+
sort_prefix+'carat-2-n-s' +" "+
sort_prefix+'carat-1-n' +" "+
sort_prefix+'carat-1-s'
)
.addClass( columns[ colIdx ] == 'asc' ?
sort_prefix+'triangle-1-n' : columns[ colIdx ] == 'desc' ?
sort_prefix+'triangle-1-s' :
noSortAppliedClass
);
} );
};
/*
* TableTools jQuery UI compatibility
* Required TableTools 2.1+
*/
if ( DataTable.TableTools ) {
$.extend( true, DataTable.TableTools.classes, {
"container": "DTTT_container ui-buttonset ui-buttonset-multi",
"buttons": {
"normal": "DTTT_button ui-button ui-state-default"
},
"collection": {
"container": "DTTT_collection ui-buttonset ui-buttonset-multi"
}
} );
}
return DataTable;
}));
| Humsen/web/web-pc/WebContent/plugins/DataTables/js/dataTables.jqueryui.js/0 | {
"file_path": "Humsen/web/web-pc/WebContent/plugins/DataTables/js/dataTables.jqueryui.js",
"repo_id": "Humsen",
"token_count": 1848
} | 51 |
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.17.2
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
generate_requirements_txt: true
github_check_license: true
github_ci_extra_env: {}
github_enable_codecov: true
github_enable_makepot: true
github_enable_stale_action: true
github_enforce_dev_status_compatibility: true
include_wkhtmltopdf: false
odoo_test_flavor: Both
odoo_version: 16.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
repo_description: 'TODO: add repo description.'
repo_name: web
repo_slug: web
repo_website: https://github.com/OCA/web
| OCA/web/.copier-answers.yml/0 | {
"file_path": "OCA/web/.copier-answers.yml",
"repo_id": "OCA",
"token_count": 226
} | 52 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_advanced_search
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/js/utils.esm.js:0
#, python-format
msgid " and "
msgstr ""
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/js/utils.esm.js:0
#, python-format
msgid " is not "
msgstr ""
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/js/utils.esm.js:0
#, python-format
msgid " or "
msgstr ""
#. module: web_advanced_search
#. odoo-javascript
#: code:addons/web_advanced_search/static/src/search/filter_menu/advanced_filter_item.xml:0
#, python-format
msgid "Add Advanced Filter"
msgstr ""
| OCA/web/web_advanced_search/i18n/web_advanced_search.pot/0 | {
"file_path": "OCA/web/web_advanced_search/i18n/web_advanced_search.pot",
"repo_id": "OCA",
"token_count": 405
} | 53 |
Override _get_field_styles() with a dict of fields list per model
.. code-block:: python
class Base(models.AbstractModel):
_inherit = "base"
def _get_field_styles(self):
res = super()._get_field_styles()
res["product.product"] = {
"my-css-class1": ["field1", "field2"],
"my-css-class2": ["field3"],
}
return res
| OCA/web/web_apply_field_style/readme/CONFIGURE.rst/0 | {
"file_path": "OCA/web/web_apply_field_style/readme/CONFIGURE.rst",
"repo_id": "OCA",
"token_count": 201
} | 54 |
* `Tecnativa <https://www.tecnativa.com>`_:
* Jairo Llopis
* Stefan Ungureanu
| OCA/web/web_calendar_slot_duration/readme/CONTRIBUTORS.rst/0 | {
"file_path": "OCA/web/web_calendar_slot_duration/readme/CONTRIBUTORS.rst",
"repo_id": "OCA",
"token_count": 37
} | 55 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_chatter_position
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-27 11:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__bottom
msgid "Bottom"
msgstr "In basso"
#. module: web_chatter_position
#: model:ir.model.fields,field_description:web_chatter_position.field_res_users__chatter_position
msgid "Chatter Position"
msgstr "Posizione conversazione"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__auto
msgid "Responsive"
msgstr "Responsive"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__sided
msgid "Sided"
msgstr "Laterale"
#. module: web_chatter_position
#: model:ir.model,name:web_chatter_position.model_res_users
msgid "User"
msgstr "Utente"
| OCA/web/web_chatter_position/i18n/it.po/0 | {
"file_path": "OCA/web/web_chatter_position/i18n/it.po",
"repo_id": "OCA",
"token_count": 517
} | 56 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
from .hooks import post_init_hook, uninstall_hook
from . import utils
| OCA/web/web_company_color/__init__.py/0 | {
"file_path": "OCA/web/web_company_color/__init__.py",
"repo_id": "OCA",
"token_count": 53
} | 57 |
# Copyright 2019 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import base64
from colorsys import hls_to_rgb, rgb_to_hls
from odoo import api, fields, models
from ..utils import convert_to_image, image_to_rgb, n_rgb_to_hex
URL_BASE = "/web_company_color/static/src/scss/"
URL_SCSS_GEN_TEMPLATE = URL_BASE + "custom_colors.%d.gen.scss"
class ResCompany(models.Model):
_inherit = "res.company"
SCSS_TEMPLATE = """
.o_main_navbar {
background: %(color_navbar_bg)s !important;
background-color: %(color_navbar_bg)s !important;
color: %(color_navbar_text)s !important;
> .o_menu_brand {
color: %(color_navbar_text)s !important;
&:hover, &:focus, &:active, &:focus:active {
background-color: %(color_navbar_bg_hover)s !important;
}
}
.show {
.dropdown-toggle {
background-color: %(color_navbar_bg_hover)s !important;
}
}
> ul {
> li {
> a, > label {
color: %(color_navbar_text)s !important;
&:hover, &:focus, &:active, &:focus:active {
background-color: %(color_navbar_bg_hover)s !important;
}
}
}
}
}
a[href],
a[tabindex],
.btn-link,
.o_external_button {
color: %(color_link_text)s !important;
}
a:hover,
.btn-link:hover {
color: %(color_link_text_hover)s !important;
}
.btn-primary:not(.disabled),
.ui-autocomplete .ui-menu-item > a.ui-state-active {
color: %(color_button_text)s !important;
background-color: %(color_button_bg)s !important;
border-color: %(color_button_bg)s !important;
}
.btn-primary:hover:not(.disabled),
.ui-autocomplete .ui-menu-item > a.ui-state-active:hover {
color: %(color_button_text)s !important;
background-color: %(color_button_bg_hover)s !important;
border-color: %(color_button_bg_hover)s !important;
}
.o_searchview .o_searchview_facet .o_searchview_facet_label {
color: %(color_button_text)s !important;
background-color: %(color_button_bg)s !important;
}
.o_form_view .o_horizontal_separator {
color: %(color_link_text)s !important;
}
.o_form_view .oe_button_box .oe_stat_button .o_button_icon,
.o_form_view .oe_button_box .oe_stat_button .o_stat_info .o_stat_value,
.o_form_view .oe_button_box .oe_stat_button > span .o_stat_value {
color: %(color_link_text)s !important;
}
.o_form_view .o_form_statusbar > .o_statusbar_status >
.o_arrow_button.btn-primary.disabled {
color: %(color_link_text)s !important;
}
.o_required_modifier.o_input, .o_required_modifier .o_input {
background-color: lighten(%(color_button_bg)s, 10%%) !important;
}
"""
company_colors = fields.Serialized()
color_navbar_bg = fields.Char("Navbar Background Color", sparse="company_colors")
color_navbar_bg_hover = fields.Char(
"Navbar Background Color Hover", sparse="company_colors"
)
color_navbar_text = fields.Char("Navbar Text Color", sparse="company_colors")
color_button_text = fields.Char("Button Text Color", sparse="company_colors")
color_button_bg = fields.Char("Button Background Color", sparse="company_colors")
color_button_bg_hover = fields.Char(
"Button Background Color Hover", sparse="company_colors"
)
color_link_text = fields.Char("Link Text Color", sparse="company_colors")
color_link_text_hover = fields.Char(
"Link Text Color Hover", sparse="company_colors"
)
scss_modif_timestamp = fields.Char("SCSS Modif. Timestamp")
@api.model_create_multi
def create(self, vals_list):
records = super().create(vals_list)
records.scss_create_or_update_attachment()
return records
def unlink(self):
IrAttachmentObj = self.env["ir.attachment"]
for record in self:
IrAttachmentObj.sudo().search(
[("url", "=", record.scss_get_url()), ("company_id", "=", record.id)]
).sudo().unlink()
return super().unlink()
def write(self, values):
if not self.env.context.get("ignore_company_color", False):
fields_to_check = (
"color_navbar_bg",
"color_navbar_bg_hover",
"color_navbar_text",
"color_button_bg",
"color_button_bg_hover",
"color_button_text",
"color_link_text",
"color_link_text_hover",
)
result = super().write(values)
if any([field in values for field in fields_to_check]):
self.scss_create_or_update_attachment()
else:
result = super().write(values)
return result
def button_compute_color(self):
self.ensure_one()
values = self.default_get(
["color_navbar_bg", "color_navbar_bg_hover", "color_navbar_text"]
)
if self.logo:
_r, _g, _b = image_to_rgb(convert_to_image(self.logo))
# Make color 10% darker
_h, _l, _s = rgb_to_hls(_r, _g, _b)
_l = max(0, _l - 0.1)
_rd, _gd, _bd = hls_to_rgb(_h, _l, _s)
# Calc. optimal text color (b/w)
# Grayscale human vision perception (Rec. 709 values)
_a = 1 - (0.2126 * _r + 0.7152 * _g + 0.0722 * _b)
values.update(
{
"color_navbar_bg": n_rgb_to_hex(_r, _g, _b),
"color_navbar_bg_hover": n_rgb_to_hex(_rd, _gd, _bd),
"color_navbar_text": "#000" if _a < 0.5 else "#fff",
}
)
self.write(values)
def _scss_get_sanitized_values(self):
self.ensure_one()
# Clone company_color as dictionary to avoid ORM operations
# This allow extend company_colors and only sanitize selected fields
# or add custom values
values = dict(self.company_colors or {})
values.update(
{
"color_navbar_bg": (values.get("color_navbar_bg") or "$o-brand-odoo"),
"color_navbar_bg_hover": (values.get("color_navbar_bg_hover")),
"color_navbar_text": (values.get("color_navbar_text") or "#FFF"),
"color_button_bg": values.get("color_button_bg") or "$primary",
"color_button_bg_hover": values.get("color_button_bg_hover")
or 'darken(theme-color("primary"), 10%)',
"color_button_text": values.get("color_button_text") or "#FFF",
"color_link_text": values.get("color_link_text")
or 'theme-color("primary")',
"color_link_text_hover": values.get("color_link_text_hover")
or 'darken(theme-color("primary"), 10%)',
}
)
return values
def _scss_generate_content(self):
self.ensure_one()
# ir.attachment need files with content to work
if not self.company_colors:
return "// No Web Company Color SCSS Content\n"
return self.SCSS_TEMPLATE % self._scss_get_sanitized_values()
def scss_get_url(self):
self.ensure_one()
return URL_SCSS_GEN_TEMPLATE % self.id
def scss_create_or_update_attachment(self):
IrAttachmentObj = self.env["ir.attachment"]
for record in self:
datas = base64.b64encode(record._scss_generate_content().encode("utf-8"))
custom_url = record.scss_get_url()
custom_attachment = IrAttachmentObj.sudo().search(
[("url", "=", custom_url), ("company_id", "=", record.id)]
)
values = {
"datas": datas,
"db_datas": datas,
"url": custom_url,
"name": custom_url,
"company_id": record.id,
}
if custom_attachment:
custom_attachment.sudo().write(values)
else:
values.update({"type": "binary", "mimetype": "text/scss"})
IrAttachmentObj.sudo().create(values)
self.env["ir.qweb"].sudo().clear_caches()
| OCA/web/web_company_color/models/res_company.py/0 | {
"file_path": "OCA/web/web_company_color/models/res_company.py",
"repo_id": "OCA",
"token_count": 4282
} | 58 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_copy_confirm
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-12 13:36+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_copy_confirm
#. odoo-javascript
#: code:addons/web_copy_confirm/static/src/js/web_copy_confirm.esm.js:0
#, python-format
msgid "Are you sure that you would like to copy this record?"
msgstr "Si è sicuri di voler copiare questo record?"
#. module: web_copy_confirm
#. odoo-javascript
#: code:addons/web_copy_confirm/static/src/js/web_copy_confirm.esm.js:0
#, python-format
msgid "Duplicate"
msgstr "Duplica"
| OCA/web/web_copy_confirm/i18n/it.po/0 | {
"file_path": "OCA/web/web_copy_confirm/i18n/it.po",
"repo_id": "OCA",
"token_count": 389
} | 59 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_dark_mode
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-27 11:34+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_dark_mode
#. odoo-javascript
#: code:addons/web_dark_mode/static/src/js/switch_item.esm.js:0
#: model:ir.model.fields,field_description:web_dark_mode.field_res_users__dark_mode
#, python-format
msgid "Dark Mode"
msgstr "Dark mode"
#. module: web_dark_mode
#: model:ir.model.fields,field_description:web_dark_mode.field_res_users__dark_mode_device_dependent
msgid "Device Dependent Dark Mode"
msgstr "Dark mode dipendente dal dispositivo"
#. module: web_dark_mode
#: model:ir.model,name:web_dark_mode.model_ir_http
msgid "HTTP Routing"
msgstr "Instradamento HTTP"
#. module: web_dark_mode
#: model:ir.model,name:web_dark_mode.model_res_users
msgid "User"
msgstr "Utente"
| OCA/web/web_dark_mode/i18n/it.po/0 | {
"file_path": "OCA/web/web_dark_mode/i18n/it.po",
"repo_id": "OCA",
"token_count": 487
} | 60 |
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif" />
<field name="arch" type="xml">
<group name="preferences" position="inside">
<group>
<field name="dark_mode_device_dependent" />
</group>
</group>
</field>
</record>
</odoo>
| OCA/web/web_dark_mode/views/res_users_views.xml/0 | {
"file_path": "OCA/web/web_dark_mode/views/res_users_views.xml",
"repo_id": "OCA",
"token_count": 254
} | 61 |
* Go to "Dashboard > Overview" and select a category
* The tile configured is displayed with the up to date count and average values of the selected domain.
.. image:: ../static/description/tile_tile_kanban.png
* By clicking on the item, you'll navigate to the tree view of the according model.
.. image:: ../static/description/tile_tile_2_tree_view.png
| OCA/web/web_dashboard_tile/readme/USAGE.rst/0 | {
"file_path": "OCA/web/web_dashboard_tile/readme/USAGE.rst",
"repo_id": "OCA",
"token_count": 98
} | 62 |
===============
Web Dialog Size
===============
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:12e664b8d9a56a20606514048d61cfecbade928aa7878d88fb6530eec6c732f1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/16.0/web_dialog_size
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_dialog_size
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
A module that lets the user expand/restore the dialog box size through a button
in the upper right corner (imitating most windows managers).
It also adds draggable support to the dialogs.
**Table of contents**
.. contents::
:local:
Configuration
=============
By default, the module respects the caller's ``dialog_size`` option.
If you want to set dialog boxes maximized by default, you need to:
#. Go to *Settings -> Technical -> Parameters -> System Parameters*
#. Add a new record with the text *web_dialog_size.default_maximize* in
the *Key* field and the text *True* in the *Value* field
Known issues / Roadmap
======================
* Allow setting default dialog size per user.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_dialog_size%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* ACSONE SA/NV
* Therp BV
* Siddharth Bhalgami
* Tecnativa
* Amaris
Contributors
~~~~~~~~~~~~
* Anthony Muschang <anthony.muschang@acsone.eu>
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
* Holger Brunn <hbrunn@therp.nl>
* Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
* Wolfgang Pichler <wpichler@callino.at>
* David Vidal <david.vidal@tecnativa.com>
* Quentin Theuret <quentin.theuret@amaris.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro M. Baeza
* Jairo Llopis
* Ernesto Tejeda
* Sudhir Arya <sudhir@erpharbor.com>
* Pierre Pizzetta <pierre@devreaction.com>
* Mantas Šniukas <mantas@vialaurea.lt>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_dialog_size>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
| OCA/web/web_dialog_size/README.rst/0 | {
"file_path": "OCA/web/web_dialog_size/README.rst",
"repo_id": "OCA",
"token_count": 1388
} | 63 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_disable_export_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-05 14:40+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_disable_export_group
#: model:ir.model,name:web_disable_export_group.model_base
msgid "Base"
msgstr "Base"
#. module: web_disable_export_group
#: model:res.groups,name:web_disable_export_group.group_export_xlsx_data
msgid "Direct Export (xlsx)"
msgstr "Esportazione diretta (xlsx)"
#. module: web_disable_export_group
#: model:ir.model,name:web_disable_export_group.model_ir_http
msgid "HTTP Routing"
msgstr "Instradamento HTTP"
| OCA/web/web_disable_export_group/i18n/it.po/0 | {
"file_path": "OCA/web/web_disable_export_group/i18n/it.po",
"repo_id": "OCA",
"token_count": 394
} | 64 |
/** @odoo-module **/
/* Copyright 2018 Tecnativa - David Vidal
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
import {ListController} from "@web/views/list/list_controller";
import {onWillStart} from "@odoo/owl";
import {patch} from "@web/core/utils/patch";
patch(ListController.prototype, "disable_export_group", {
setup() {
this._super(...arguments);
onWillStart(async () => {
this.isExportEnable = await this.userService.hasGroup(
"base.group_allow_export"
);
this.isExportXlsEnable = await this.userService.hasGroup(
"web_disable_export_group.group_export_xlsx_data"
);
});
},
});
| OCA/web/web_disable_export_group/static/src/js/list_controller.esm.js/0 | {
"file_path": "OCA/web/web_disable_export_group/static/src/js/list_controller.esm.js",
"repo_id": "OCA",
"token_count": 311
} | 65 |
odoo.define("web_domain_field.tests", function (require) {
"use strict";
const FormView = require("web.FormView");
const testUtils = require("web.test_utils");
const {createView} = testUtils;
const {QUnit} = window;
QUnit.module(
"web_domain_field",
{
beforeEach: function () {
this.data = {
"res.partner": {
fields: {
name: {
string: "Name",
type: "char",
searchable: true,
},
type: {
string: "Type",
type: "selection",
selection: [
["person", "Person"],
["company", "Company"],
],
searchable: true,
},
parent_id: {
string: "Parent",
type: "many2one",
relation: "res.partner",
},
parent_domain: {
string: "Parent Domain",
type: "char",
},
},
records: [
{
id: 1,
name: "John Doe",
type: "person",
parent_id: 2,
parent_domain: "[]",
},
{
id: 2,
name: "ACME inc.",
type: "company",
parent_id: false,
parent_domain: `[["type", "=", "company"]]`,
},
],
onchanges: {},
},
};
},
},
function () {
QUnit.test(
"one2many: field as domain attribute value",
async function (assert) {
assert.expect(2);
async function testPartnerFormDomain(data, resId, expectedDomain) {
const form = await createView({
View: FormView,
model: "res.partner",
data: data,
arch: `
<form>
<field name="parent_domain" invisible="1" />
<field name="parent_id" domain="parent_domain" />
</form>
`,
mockRPC: function (route, args) {
if (args.method === "name_search") {
assert.deepEqual(args.kwargs.args, expectedDomain);
}
return this._super.apply(this, arguments);
},
res_id: resId,
viewOptions: {mode: "edit"},
});
form.$el.find(".o_field_widget[name=parent_id] input").click();
form.destroy();
}
await testPartnerFormDomain(this.data, 1, []);
await testPartnerFormDomain(this.data, 2, [
["type", "=", "company"],
]);
}
);
QUnit.test(
"one2many: field with default behaviour",
async function (assert) {
assert.expect(1);
const form = await createView({
View: FormView,
model: "res.partner",
data: this.data,
arch: `
<form>
<field name="parent_domain" invisible="1" />
<field name="parent_id" domain="[('name', '=', 'John')]" />
</form>
`,
mockRPC: function (route, args) {
if (args.method === "name_search") {
assert.deepEqual(args.kwargs.args, [
["name", "=", "John"],
]);
}
return this._super.apply(this, arguments);
},
res_id: 1,
viewOptions: {mode: "edit"},
});
form.$el.find(".o_field_widget[name=parent_id] input").click();
form.destroy();
}
);
}
);
});
| OCA/web/web_domain_field/static/tests/test_qunit.js/0 | {
"file_path": "OCA/web/web_domain_field/static/tests/test_qunit.js",
"repo_id": "OCA",
"token_count": 3694
} | 66 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
# Translators:
# Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-13 16:06+0000\n"
"PO-Revision-Date: 2018-08-03 12:34+0000\n"
"Last-Translator: Rodrigo Macedo <rmsolucoeseminformatic4@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/"
"teams/23907/pt_BR/)\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.1.1\n"
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr "Back-end da fita do ambiente da Web"
#~ msgid "Display Name"
#~ msgstr "Exibir Nome"
#~ msgid "ID"
#~ msgstr "Identificação"
#~ msgid "Last Modified on"
#~ msgstr "Última Modificação em"
| OCA/web/web_environment_ribbon/i18n/pt_BR.po/0 | {
"file_path": "OCA/web/web_environment_ribbon/i18n/pt_BR.po",
"repo_id": "OCA",
"token_count": 453
} | 67 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_environment_ribbon_data
| OCA/web/web_environment_ribbon/tests/__init__.py/0 | {
"file_path": "OCA/web/web_environment_ribbon/tests/__init__.py",
"repo_id": "OCA",
"token_count": 41
} | 68 |
/** @odoo-module **/
import LegacyControlPanel from "web.ControlPanel";
import {ControlPanel} from "@web/search/control_panel/control_panel";
import {findTrip} from "@web_help/helpers.esm";
import {Component, onWillStart, useState} from "@odoo/owl";
import {ActionDialog} from "@web/webclient/actions/action_dialog";
export class HelpButton extends Component {
setup() {
this.state = useState({
TripClass: null,
});
onWillStart(async () => {
const foundTrip = await findTrip(this.props.resModel, this.props.viewType);
this.state.TripClass = foundTrip;
});
}
async onClick() {
const TripClass = this.state.TripClass;
const trip = new TripClass(this.env);
await trip.setup();
trip.start();
}
}
HelpButton.template = "web_help.HelpButton";
Object.assign(ControlPanel.components, {HelpButton});
Object.assign(LegacyControlPanel.components, {HelpButton});
Object.assign(ActionDialog.components, {HelpButton});
| OCA/web/web_help/static/src/components/help_button/help_button.esm.js/0 | {
"file_path": "OCA/web/web_help/static/src/components/help_button/help_button.esm.js",
"repo_id": "OCA",
"token_count": 394
} | 69 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
# Pedro Castro Silva <pedrocs@exo.pt>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 03:50+0000\n"
"PO-Revision-Date: 2018-01-03 03:50+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>, 2017\n"
"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: web_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:0
#, python-format
msgid "Close"
msgstr "Fechar"
| OCA/web/web_ir_actions_act_window_message/i18n/pt.po/0 | {
"file_path": "OCA/web/web_ir_actions_act_window_message/i18n/pt.po",
"repo_id": "OCA",
"token_count": 358
} | 70 |
<templates>
<div t-name="web_ir_actions_act_window_message">
<div>
<t t-esc="action.message" />
</div>
</div>
</templates>
| OCA/web/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml/0 | {
"file_path": "OCA/web/web_ir_actions_act_window_message/static/src/xml/web_ir_actions_act_window_message.xml",
"repo_id": "OCA",
"token_count": 84
} | 71 |
/** @odoo-module **/
// (c) 2013-2015 Therp BV (<http://therp.nl>)
// (c) 2023 Hunki Enterprises BV (<https://hunki-enterprises.com>)
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import {Pager} from "@web/core/pager/pager";
import {patch} from "@web/core/utils/patch";
import {registry} from "@web/core/registry";
import {useBus} from "@web/core/utils/hooks";
const actionHandlersRegistry = registry.category("action_handlers");
async function executeWindowActionPage({env}, direction) {
return env.bus.trigger("pager:navigate", {direction});
}
async function executeWindowActionList({env}) {
return env.services.action.switchView("list");
}
actionHandlersRegistry.add("ir.actions.act_window.page.prev", async (params) =>
executeWindowActionPage(params, -1)
);
actionHandlersRegistry.add("ir.actions.act_window.page.next", async (params) =>
executeWindowActionPage(params, 1)
);
actionHandlersRegistry.add("ir.actions.act_window.page.list", async (params) =>
executeWindowActionList(params)
);
patch(Pager.prototype, "navigate event listener", {
setup() {
this._super.apply();
const handleNavigate = (ev) => this._handleNavigate(ev);
useBus(this.env.bus, "pager:navigate", handleNavigate);
},
_handleNavigate(ev) {
return this.navigate(ev.detail.direction);
},
});
| OCA/web/web_ir_actions_act_window_page/static/src/web_ir_actions_act_window_page.esm.js/0 | {
"file_path": "OCA/web/web_ir_actions_act_window_page/static/src/web_ir_actions_act_window_page.esm.js",
"repo_id": "OCA",
"token_count": 491
} | 72 |
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension">
<xpath expr="//tr[@class='o_data_row']/td/CheckBox" position="attributes">
<attribute
name="t-on-click.capture"
>(ev) => this._onClickSelectRecord(record,ev)</attribute>
</xpath>
</t>
</templates>
| OCA/web/web_listview_range_select/static/src/xml/web_listview_range_select.xml/0 | {
"file_path": "OCA/web/web_listview_range_select/static/src/xml/web_listview_range_select.xml",
"repo_id": "OCA",
"token_count": 196
} | 73 |
# Copyright 2020 initOS GmbH.
from . import test_ir_config_parameter
| OCA/web/web_m2x_options/tests/__init__.py/0 | {
"file_path": "OCA/web/web_m2x_options/tests/__init__.py",
"repo_id": "OCA",
"token_count": 22
} | 74 |
==========
Web Notify
==========
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4517d4a854a8c5b84197dc9510ae75ac0fa82ce2a37a3a0d4078ea51a65c073f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/16.0/web_notify
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_notify
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
Send instant notification messages to the user in live.
This technical module allows you to send instant notification messages from the server to the user in live.
Two kinds of notification are supported.
* Success: Displayed in a `success` theme color flying popup div
* Danger: Displayed in a `danger` theme color flying popup div
* Warning: Displayed in a `warning` theme color flying popup div
* Information: Displayed in a `info` theme color flying popup div
* Default: Displayed in a `default` theme color flying popup div
**Table of contents**
.. contents::
:local:
Installation
============
This module is based on the Instant Messaging Bus. To work properly, the server must be launched in gevent mode.
Usage
=====
To send a notification to the user you just need to call one of the new methods defined on res.users:
.. code-block:: python
self.env.user.notify_success(message='My success message')
or
.. code-block:: python
self.env.user.notify_danger(message='My danger message')
or
.. code-block:: python
self.env.user.notify_warning(message='My warning message')
or
.. code-block:: python
self.env.user.notify_info(message='My information message')
or
.. code-block:: python
self.env.user.notify_default(message='My default message')
.. figure:: https://raw.githubusercontent.com/OCA/web/16.0/web_notify/static/description/notifications_screenshot.gif
:scale: 80 %
:alt: Sample notifications
You can test the behaviour of the notifications by installing this module in a demo database.
Access the users form through Settings -> Users & Companies. You'll see a tab called "Test web notify", here you'll find two buttons that'll allow you test the module.
.. figure:: https://raw.githubusercontent.com/OCA/web/16.0/web_notify/static/description/test_notifications_demo.png
:scale: 80 %
:alt: Sample notifications
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_notify%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* ACSONE SA/NV
* AdaptiveCity
Contributors
~~~~~~~~~~~~
* Laurent Mignon <laurent.mignon@acsone.eu>
* Serpent Consulting Services Pvt. Ltd.<jay.vora@serpentcs.com>
* Aitor Bouzas <aitor.bouzas@adaptivecity.com>
* Shepilov Vladislav <shepilov.v@protonmail.com>
* Kevin Khao <kevin.khao@akretion.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_notify>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
| OCA/web/web_notify/README.rst/0 | {
"file_path": "OCA/web/web_notify/README.rst",
"repo_id": "OCA",
"token_count": 1600
} | 75 |
Send instant notification messages to the user in live.
This technical module allows you to send instant notification messages from the server to the user in live.
Two kinds of notification are supported.
* Success: Displayed in a `success` theme color flying popup div
* Danger: Displayed in a `danger` theme color flying popup div
* Warning: Displayed in a `warning` theme color flying popup div
* Information: Displayed in a `info` theme color flying popup div
* Default: Displayed in a `default` theme color flying popup div
| OCA/web/web_notify/readme/DESCRIPTION.rst/0 | {
"file_path": "OCA/web/web_notify/readme/DESCRIPTION.rst",
"repo_id": "OCA",
"token_count": 121
} | 76 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_notify_channel_message
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-11 00:11+0000\n"
"Last-Translator: Claude R Perrin <claude@alpis.fr>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_notify_channel_message
#: model:ir.model,name:web_notify_channel_message.model_mail_channel
msgid "Discussion Channel"
msgstr "Canal de discussion"
#. module: web_notify_channel_message
#. odoo-python
#: code:addons/web_notify_channel_message/models/mail_channel.py:0
#, python-format
msgid "You have a new message in channel %s"
msgstr "Vous avez un nouveau message dans le canal %s"
#~ msgid "Display Name"
#~ msgstr "Nom affiché"
#~ msgid "ID"
#~ msgstr "ID"
#~ msgid "Last Modified on"
#~ msgstr "Dernière modification le"
| OCA/web/web_notify_channel_message/i18n/fr.po/0 | {
"file_path": "OCA/web/web_notify_channel_message/i18n/fr.po",
"repo_id": "OCA",
"token_count": 430
} | 77 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_pivot_computed_measure
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-05 14:40+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Add"
msgstr "Aggiungi"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Can be empty"
msgstr "Può essere sufficiente"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Computed Measure"
msgstr "Misura calcolata"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Custom"
msgstr "Personalizzato"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Div (m1 / m2)"
msgstr "Div. (m1 / m2)"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Float"
msgstr "Float"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Format"
msgstr "Formato"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Formula"
msgstr "Formula"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Integer"
msgstr "Intero"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Measure 1"
msgstr "Misura 1"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Measure 2"
msgstr "Misura 2"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Mult (m1 * m2)"
msgstr "Molt. (m1 * m2)"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Name"
msgstr "Nome"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Operation"
msgstr "Operazione"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Perc (m1 * 100 / m2)"
msgstr "Perc. (m1 * 100 / m2)"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Percentage"
msgstr "Percentuale"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Sub (m1 - m2)"
msgstr "Sott. (m1 - m2)"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml:0
#, python-format
msgid "Sum (m1 + m2)"
msgstr "Som. (m1 + m2)"
#. module: web_pivot_computed_measure
#. odoo-javascript
#: code:addons/web_pivot_computed_measure/static/src/pivot/pivot_model.esm.js:0
#, python-format
msgid ""
"This measure is currently used by a 'computed measure'. Please, disable the "
"computed measure first."
msgstr ""
"Questa misura è utilizzata in una 'misura calcolata'. Disabilitare prima la "
"misura calcolata."
| OCA/web/web_pivot_computed_measure/i18n/it.po/0 | {
"file_path": "OCA/web/web_pivot_computed_measure/i18n/it.po",
"repo_id": "OCA",
"token_count": 2021
} | 78 |
/** @odoo-module **/
/* Copyright 2022 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
import tour from "web_tour.tour";
tour.register(
"web_pivot_computed_measure_tour",
{
url: "/web",
test: true,
},
[
{
trigger: ".o_navbar_apps_menu button",
},
{
trigger: '.o_app[data-menu-xmlid="base.menu_administration"]',
},
{
trigger: 'button[data-menu-xmlid="base.menu_users"]',
},
{
trigger: 'a[data-menu-xmlid="base.menu_action_res_users"]',
},
{
trigger: "button.o_pivot",
},
{
trigger: 'button:contains(" Measures ")',
},
{
trigger: 'a:contains(" Computed Measure ")',
},
{
trigger: "select#computed_measure_field_1",
run: "text user_year_now",
},
{
trigger: "select#computed_measure_field_2",
run: "text user_year_born",
},
{
trigger: "select#computed_measure_operation",
run: "text m1-m2",
},
{
trigger: "select#computed_measure_format",
run: "text integer",
},
{
trigger: "button.o_add_computed_measure",
},
{
trigger: 'th.o_pivot_measure_row:contains("User Year Now")',
extra_trigger: 'div.o_value:contains("2,022")',
},
{
trigger: 'th.o_pivot_measure_row:contains("User Year Born")',
extra_trigger: 'div.o_value:contains("1,998")',
},
{
trigger: 'th.o_pivot_measure_row:contains("User Year Now-User Year Born")',
extra_trigger: 'div.o_value:contains("24")',
},
]
);
| OCA/web/web_pivot_computed_measure/static/src/test/test.esm.js/0 | {
"file_path": "OCA/web/web_pivot_computed_measure/static/src/test/test.esm.js",
"repo_id": "OCA",
"token_count": 1018
} | 79 |
from . import res_config_settings
| OCA/web/web_pwa_oca/models/__init__.py/0 | {
"file_path": "OCA/web/web_pwa_oca/models/__init__.py",
"repo_id": "OCA",
"token_count": 9
} | 80 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_refresher
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-01-04 02:42+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.14.1\n"
#. module: web_refresher
#. odoo-javascript
#: code:addons/web_refresher/static/src/xml/refresher.xml:0
#, python-format
msgid "Pager"
msgstr "Stranice"
#. module: web_refresher
#. odoo-javascript
#: code:addons/web_refresher/static/src/xml/refresher.xml:0
#, python-format
msgid "Refresh"
msgstr "Osvježi"
| OCA/web/web_refresher/i18n/hr.po/0 | {
"file_path": "OCA/web/web_refresher/i18n/hr.po",
"repo_id": "OCA",
"token_count": 401
} | 81 |
==============================
Web Remember Tree Column Width
==============================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:13342577539a6c70ca648db63c08e26c3f8141832217180d9d6c95e15fcc39cd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/16.0/web_remember_tree_column_width
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_remember_tree_column_width
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
Remember the tree columns' widths across sessions, and after filtering, grouping, or reordering.
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_remember_tree_column_width%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Vauxoo
Contributors
~~~~~~~~~~~~
* Francisco Javier Luna Vázquez <fluna@vauxoo.com>
* Tomás Álvarez <tomas@vauxoo.com>
* `Komit <https://komit-consulting.com/>`_:
* Cuong Nguyen Mtm <cuong.nmtm@komit-consulting.com>
Other credits
~~~~~~~~~~~~~
* Vauxoo
The migration of this module from 15.0 to 16.0 was financially supported by:
* Komit (https://komit-consulting.com/)
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
.. |maintainer-frahikLV| image:: https://github.com/frahikLV.png?size=40px
:target: https://github.com/frahikLV
:alt: frahikLV
.. |maintainer-luisg123v| image:: https://github.com/luisg123v.png?size=40px
:target: https://github.com/luisg123v
:alt: luisg123v
.. |maintainer-cuongnmtm| image:: https://github.com/cuongnmtm.png?size=40px
:target: https://github.com/cuongnmtm
:alt: cuongnmtm
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-frahikLV| |maintainer-luisg123v| |maintainer-cuongnmtm|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_remember_tree_column_width>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
| OCA/web/web_remember_tree_column_width/README.rst/0 | {
"file_path": "OCA/web/web_remember_tree_column_width/README.rst",
"repo_id": "OCA",
"token_count": 1379
} | 82 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_responsive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-02-02 22:13+0000\n"
"Last-Translator: eduardgm <eduard.garcia@qubiq.es>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.10\n"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Activities"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "All"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Attachment counter loading..."
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Attachments"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "CLEAR"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "Discard"
msgstr "Descartar"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "FILTER"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/apps_menu/apps_menu.xml:0
#, python-format
msgid "Home Menu"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Log note"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#, python-format
msgid "Maximize"
msgstr "Maximitzar"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#, python-format
msgid "Minimize"
msgstr "Minimitzar"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "New"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "SEE RESULT"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "Save"
msgstr "Guardar"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/apps_menu/apps_menu.xml:0
#, python-format
msgid "Search menus..."
msgstr "Cercar menús..."
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "Search..."
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Send message"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "View switcher"
msgstr ""
#, python-format
#~ msgid "Create"
#~ msgstr "Crear"
#~ msgid "Chatter Position"
#~ msgstr "Posició del chatter"
#, python-format
#~ msgid "Edit"
#~ msgstr "Editar"
#~ msgid "Normal"
#~ msgstr "Normal"
#, python-format
#~ msgid "Quick actions"
#~ msgstr "Accions ràpides"
#~ msgid "Sided"
#~ msgstr "Lateral"
#~ msgid "Users"
#~ msgstr "Usuaris"
#~ msgid "Close"
#~ msgstr "Tancar"
#~ msgid "false"
#~ msgstr "fals"
| OCA/web/web_responsive/i18n/ca.po/0 | {
"file_path": "OCA/web/web_responsive/i18n/ca.po",
"repo_id": "OCA",
"token_count": 1636
} | 83 |
* Dave Lasley <dave@laslabs.com>
* Jairo Llopis <jairo.llopis@tecnativa.com>
* `Onestein <https://www.onestein.nl>`_:
* Dennis Sluijk <d.sluijk@onestein.nl>
* Anjeel Haria
* Sergio Teruel <sergio.teruel@tecnativa.com>
* Alexandre Díaz <dev@redneboa.es>
* Mathias Markl <mathias.markl@mukit.at>
* Iván Todorovich <ivan.todorovich@gmail.com>
* Sergey Shebanin <sergey@shebanin.ru>
* David Vidal <david.vidal@tecnativa.com>
| OCA/web/web_responsive/readme/CONTRIBUTORS.rst/0 | {
"file_path": "OCA/web/web_responsive/readme/CONTRIBUTORS.rst",
"repo_id": "OCA",
"token_count": 196
} | 84 |
/* Copyright 2018 Tecnativa - Jairo Llopis
* Copyright 2021 ITerra - Sergey Shebanin
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
@mixin full-screen-dropdown {
border: none;
box-shadow: none;
min-height: calc(100vh - #{$o-navbar-height});
min-height: calc(var(--vh100, 100vh) - #{$o-navbar-height});
position: fixed;
margin: 0;
width: 100vw;
z-index: 1000;
left: 0 !important;
}
.o_apps_menu_opened .o_main_navbar {
.o_menu_brand,
.o_menu_sections {
display: none !important;
}
}
// Iconized full screen apps menu
.o_navbar_apps_menu {
.fade-enter-active,
.fade-leave-active {
transition: opacity 100ms ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
.dropdown-menu-custom {
@include full-screen-dropdown();
cursor: pointer;
background: url("../../img/home-menu-bg-overlay.svg"),
linear-gradient(
to bottom,
$o-brand-odoo,
desaturate(lighten($o-brand-odoo, 20%), 15)
);
background-size: cover;
border-radius: 0;
// Display apps in a grid
align-content: flex-start;
display: flex !important;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
@include media-breakpoint-up(lg) {
padding: {
left: calc((100vw - 850px) / 2);
right: calc((100vw - 850px) / 2);
}
}
.dropdown-item {
padding: 0;
}
.o_app {
outline: 0;
height: 100%;
display: flex;
align-items: center;
text-align: center;
flex-direction: column;
justify-content: flex-start;
white-space: normal;
color: $white !important;
padding: 15px 0 10px;
font-size: 1.25rem;
text-shadow: 1px 1px 1px rgba($black, 0.4);
border-radius: 4px;
transition: 300ms ease;
transition-property: background-color;
&:focus {
background-color: rgba($white, 0.05) !important;
}
img {
box-shadow: none;
margin-bottom: 5px;
transition: 300ms ease;
transition-property: box-shadow, transform;
}
&:hover img,
a:focus img {
transform: translateY(-3px);
box-shadow: 0 9px 12px -4px rgba($black, 0.3);
}
// Size depends on screen
width: 33.33333333%;
@include media-breakpoint-up(sm) {
width: 25%;
}
@include media-breakpoint-up(md) {
width: 16.6666666%;
}
}
// Hide app icons when searching
.has-results ~ .o_app {
display: none;
}
.o-app-icon {
height: auto;
max-width: 6rem;
padding: 0;
}
// Search input for menus
.form-row {
width: 100%;
}
.search-container {
width: 100%;
margin: 1rem 1.5rem 0;
.search-input {
display: flex;
justify-items: center;
box-shadow: inset 0 1px 0 rgba($white, 0.1), 0 1px 0 rgba($black, 0.1);
text-shadow: 0 1px 0 rgba($black, 0.5);
border-radius: 4px;
padding: 0.4rem 0.8rem;
margin-bottom: 1rem;
background-color: rgba($white, 0.1);
@include media-breakpoint-up(md) {
padding: 0.8rem 1.2rem;
}
.search-icon {
color: $white;
font-size: 1.5rem;
margin-right: 1rem;
padding-top: 1px;
}
.form-control {
height: 2rem;
background: none;
border: none;
color: $white;
display: block;
padding: 1px 2px 2px 2px;
box-shadow: none;
&::placeholder {
color: $white;
opacity: 0.5;
}
}
}
// Allow to scroll only on results, keeping static search box above
.search-results {
.text-ellipsis {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.text-primary {
color: red !important;
}
margin-top: 1rem;
max-height: calc(100vh - #{$o-navbar-height} - 8rem) !important;
overflow: auto;
position: relative;
}
.search-result {
display: block;
align-items: center;
background-position: left;
background-repeat: no-repeat;
background-size: contain;
color: $white;
cursor: pointer;
line-height: 2.5rem;
padding-left: 3.5rem;
white-space: normal;
font-weight: 100;
&.highlight,
&:hover {
background-color: rgba($black, 0.11);
}
b {
font-weight: 700;
}
}
}
}
}
.dropdown-menu-custom {
max-height: 70vh;
overflow: auto;
background-clip: border-box;
box-shadow: $o-dropdown-box-shadow;
}
| OCA/web/web_responsive/static/src/components/apps_menu/apps_menu.scss/0 | {
"file_path": "OCA/web/web_responsive/static/src/components/apps_menu/apps_menu.scss",
"repo_id": "OCA",
"token_count": 3434
} | 85 |
<svg xmlns="http://www.w3.org/2000/svg" width="2000" height="1128" viewBox="0 0 2000 1128">
<polygon fill-opacity=".03" points="0 1077.844 392.627 778.443 1504.99 1127.745 0 1127.745"/>
<polygon fill-opacity=".02" points="392.216 778.443 283.294 0 0 0 0 666.504"/>
<polygon fill-opacity=".03" points="1000 0 2000 1009.98 2000 439.94 1749.817 0"/>
</svg>
| OCA/web/web_responsive/static/src/img/home-menu-bg-overlay.svg/0 | {
"file_path": "OCA/web/web_responsive/static/src/img/home-menu-bg-overlay.svg",
"repo_id": "OCA",
"token_count": 159
} | 86 |
* Andrius Preimantas <andrius@versada.lt>
* Adrien Didenot <adrien.didenot@horanet.com>
* Francesco Apruzzese <f.apruzzese@apuliasoftware.it>
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
* Pedro Guirao <pedro.guirao@ingenieriacloud.com>
* Nedas Žilinskas <nedas.zilinskas@avoin.systems>
* Sandip SerpentCS <sandip.v.serpentcs@gmail.com>
| OCA/web/web_search_with_and/readme/CONTRIBUTORS.rst/0 | {
"file_path": "OCA/web/web_search_with_and/readme/CONTRIBUTORS.rst",
"repo_id": "OCA",
"token_count": 175
} | 87 |
/** @odoo-module **/
import {clear} from "@mail/model/model_field_command";
import {escapeAndCompactTextContent} from "@mail/js/utils";
import {registerPatch} from "@mail/model/model_core";
registerPatch({
name: "Chatter",
recordMethods: {
// Fn overwrite
onClickSendMessage() {
if (this.composerView) {
// Change `isLog` to false since this should only be possible when you
// press "Log Note" first, otherwise this won't hurt.
this.composerView.composer.update({isLog: false});
// Open the full composer with `composerView` because it carries through
// the composer options.
this.composerView.openFullComposer();
// Clear the `composerView` since we don't need it no more.
this.update({composerView: clear()});
return;
}
this.openFullComposer();
},
async openFullComposer() {
// Rough copy of composer view function `openFullComposer`.
// Get composer from thread.
// We access data from the composer since history still is saved there.
// e.g. open and close "Log note".
const composer = this.thread.composer;
const context = {
default_attachment_ids: composer.attachments.map((att) => att.id),
default_body: escapeAndCompactTextContent(composer.textInputContent),
default_is_log: false,
default_model: this.threadModel,
default_partner_ids: composer.recipients.map((partner) => partner.id),
default_res_id: this.threadId,
mail_post_autofollow: this.thread.hasWriteAccess,
};
const action = {
type: "ir.actions.act_window",
name: this.env._t("Compose Email"),
res_model: "mail.compose.message",
view_mode: "form",
views: [[false, "form"]],
target: "new",
context,
};
const options = {
on_close: () => {
if (composer.exists()) {
composer._reset();
if (composer.activeThread) {
composer.activeThread.fetchData(["messages"]);
}
}
},
};
await this.env.services.action.doAction(action, options);
},
},
});
| OCA/web/web_send_message_popup/static/src/models/chatter/chatter.esm.js/0 | {
"file_path": "OCA/web/web_send_message_popup/static/src/models/chatter/chatter.esm.js",
"repo_id": "OCA",
"token_count": 1304
} | 88 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_timeline
#
# Translators:
# leemannd <denis.leemann@camptocamp.com>, 2017
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 03:50+0000\n"
"PO-Revision-Date: 2024-01-11 16:49+0000\n"
"Last-Translator: Houzéfa Abbasbhay <houzefa.abba@xcg-consulting.fr>\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "<b>UNASSIGNED</b>"
msgstr "<b>NON ASSIGNÉ</b>"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_controller.esm.js:0
#, python-format
msgid "Are you sure you want to delete this record?"
msgstr "Êtes vous sûr de vouloir supprimer cet enregistrement ?"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Day"
msgstr "Jour"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Month"
msgstr "Mois"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "Template \"timeline-item\" not present in timeline view definition."
msgstr ""
"Le modèle \"timeline-item\" n'est pas présent dans la définition de la vue "
"timeline."
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_view.js:0
#: model:ir.model.fields.selection,name:web_timeline.selection__ir_ui_view__type__timeline
#, python-format
msgid "Timeline"
msgstr "Chronologie"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "Timeline view has not defined 'date_start' attribute."
msgstr "La vue chronologique n'a pas défini l'attribut 'date_start'."
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Today"
msgstr "Aujourd'hui"
#. module: web_timeline
#: model:ir.model,name:web_timeline.model_ir_ui_view
msgid "View"
msgstr "Vue"
#. module: web_timeline
#: model:ir.model.fields,field_description:web_timeline.field_ir_ui_view__type
msgid "View Type"
msgstr "Type de vue"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_controller.esm.js:0
#, python-format
msgid "Warning"
msgstr "Alerte"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Week"
msgstr "Semaine"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Year"
msgstr "Année"
#~ msgid "Activity"
#~ msgstr "Activité"
#~ msgid "Calendar"
#~ msgstr "Calendrier"
#~ msgid "Diagram"
#~ msgstr "Diagramme"
#~ msgid "Form"
#~ msgstr "Formulaire"
#~ msgid "Gantt"
#~ msgstr "Gantt"
#~ msgid "Graph"
#~ msgstr "Graphique"
#~ msgid "Kanban"
#~ msgstr "Kanban"
#~ msgid "Pivot"
#~ msgstr "Pivot"
#~ msgid "QWeb"
#~ msgstr "QWeb"
#~ msgid "Search"
#~ msgstr "Recherche"
#~ msgid "Tree"
#~ msgstr "Arborescence"
#~ msgid "ir.ui.view"
#~ msgstr "ir.ui.view"
| OCA/web/web_timeline/i18n/fr.po/0 | {
"file_path": "OCA/web/web_timeline/i18n/fr.po",
"repo_id": "OCA",
"token_count": 1501
} | 89 |
For accessing the timeline view, you have to click on the button with the clock
icon in the view switcher. The first time you access to it, the timeline window
is zoomed to fit all the current elements, the same as when you perform a
search, filter or group by operation.
You can use the mouse scroll to zoom in or out in the timeline, and click on
any free area and drag for panning the view in that direction.
The records of your model will be shown as rectangles whose widths are the
duration of the event according our definition. You can select them clicking
on this rectangle. You can also use Ctrl or Shift keys for adding discrete
or range selections. Selected records are hightlighted with a different color
(but the difference will be more noticeable depending on the background color).
Once selected, you can drag and move the selected records across the timeline.
When a record is selected, a red cross button appears on the upper left corner
that allows to remove that record. This doesn't work for multiple records
although they were selected.
Records are grouped in different blocks depending on the group by criteria
selected (if none is specified, then the default group by is applied).
Dragging a record from one block to another change the corresponding field to
the value that represents the block. You can also click on the group name to
edit the involved record directly.
Double-click on the record to edit it. Double-click in open area to create a
new record with the group and start date linked to the area you clicked in.
By holding the Ctrl key and dragging left to right, you can create a new record
with the dragged start and end date.
| OCA/web/web_timeline/readme/USAGE.rst/0 | {
"file_path": "OCA/web/web_timeline/readme/USAGE.rst",
"repo_id": "OCA",
"token_count": 367
} | 90 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_tree_duplicate
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-05 08:47+0000\n"
"PO-Revision-Date: 2023-07-05 08:47+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_tree_duplicate
#. odoo-javascript
#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0
#, python-format
msgid "Duplicate"
msgstr "שכפול"
#. module: web_tree_duplicate
#. odoo-javascript
#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0
#, python-format
msgid "Duplicated Records"
msgstr "רשומות משוכפלות"
| OCA/web/web_tree_duplicate/i18n/he_IL.po/0 | {
"file_path": "OCA/web/web_tree_duplicate/i18n/he_IL.po",
"repo_id": "OCA",
"token_count": 362
} | 91 |
# Copyright 2013 Therp BV (<http://therp.nl>).
# Copyright 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2017 Sodexis <dev@sodexis.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Clickable many2one fields for tree views",
"summary": "Open the linked resource when clicking on their name",
"version": "16.0.1.0.0",
"category": "Hidden",
"website": "https://github.com/OCA/web",
"author": "Therp BV, "
"Tecnativa, "
"Camptocamp, "
"Onestein, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["web"],
"data": [],
"assets": {
"web.assets_backend": [
"web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.esm.js",
"web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.scss",
"web_tree_many2one_clickable/static/src/components/"
"many2one_button/many2one_button.xml",
]
},
}
| OCA/web/web_tree_many2one_clickable/__manifest__.py/0 | {
"file_path": "OCA/web/web_tree_many2one_clickable/__manifest__.py",
"repo_id": "OCA",
"token_count": 517
} | 92 |
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
| OCA/web/web_widget_bokeh_chart/__init__.py/0 | {
"file_path": "OCA/web/web_widget_bokeh_chart/__init__.py",
"repo_id": "OCA",
"token_count": 27
} | 93 |
/** @odoo-module **/
/* Copyright 2019 Tecnativa - David Vidal
* Copyright 2024 Tecnativa - Carlos Roca
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
import {DomainField} from "@web/views/fields/domain/domain_field";
import {DomainEditorDialog} from "./widget_domain_editor_dialog.esm";
import {patch} from "@web/core/utils/patch";
patch(DomainField.prototype, "web_widget_domain_editor_dialog.DomainField", {
onButtonClick(ev) {
ev.preventDefault();
const self = this;
if (this.props.readonly) {
return this._super.apply(this, arguments);
}
if (!this.props.value) {
this.props.value = "[]";
}
this.addDialog(DomainEditorDialog, {
title: this.env._t("Select records..."),
noCreate: true,
multiSelect: true,
resModel: this.getResModel(this.props),
dynamicFilters: [
{
description: this.env._t("Selected domain"),
domain:
this.getDomain(this.props.value).toList(
this.getContext(this.props)
) || [],
},
],
context: this.getContext(this.props) || {},
onSelected: function (resIds) {
self.update(this.get_domain(resIds));
},
});
},
});
| OCA/web/web_widget_domain_editor_dialog/static/src/js/domain_field.esm.js/0 | {
"file_path": "OCA/web/web_widget_domain_editor_dialog/static/src/js/domain_field.esm.js",
"repo_id": "OCA",
"token_count": 711
} | 94 |
/** @odoo-module **/
import core from "web.core";
import {registry} from "@web/core/registry";
import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {Component} from "@odoo/owl";
var _lt = core._lt;
export class FieldDynamicDropdown extends Component {
get options() {
var field_type = this.props.record.fields[this.props.name].type || "";
if (["char", "integer", "selection"].includes(field_type)) {
this._setValues();
return this.props.record.fields[this.props.name].selection.filter(
(option) => option[0] !== false && option[1] !== ""
);
}
return [];
}
get value() {
const rawValue = this.props.value;
this.props.setDirty(false);
return this.props.type === "many2one" && rawValue ? rawValue[0] : rawValue;
}
parseInteger(value) {
return Number(value);
}
/**
* @param {Event} ev
*/
onChange(ev) {
let lastSetValue = null;
let isInvalid = false;
var isDirty = ev.target.value !== lastSetValue;
const field = this.props.record.fields[this.props.name];
let value = JSON.parse(ev.target.value);
if (isDirty) {
if (value && field.type === "integer") {
value = Number(value);
if (!value) {
if (this.props.record) {
this.props.record.setInvalidField(this.props.name);
}
isInvalid = true;
}
}
if (!isInvalid) {
Promise.resolve(this.props.update(value));
lastSetValue = ev.target.value;
}
}
if (this.props.setDirty) {
this.props.setDirty(isDirty);
}
}
stringify(value) {
return JSON.stringify(value);
}
_setValues() {
if (this.props.record.preloadedData[this.props.name]) {
var sel_value = this.props.record.preloadedData[this.props.name];
// Convert string element to integer if field is integer
if (this.props.record.fields[this.props.name].type === "integer") {
sel_value = sel_value.map((val_updated) => {
return val_updated.map((e) => {
if (typeof e === "string" && !isNaN(Number(e))) {
return Number(e);
}
return e;
});
});
}
this.props.record.fields[this.props.name].selection = sel_value;
}
}
}
FieldDynamicDropdown.description = _lt("Dynamic Dropdown");
FieldDynamicDropdown.template = "web.SelectionField";
FieldDynamicDropdown.legacySpecialData = "_fetchDynamicDropdownValues";
FieldDynamicDropdown.props = {
...standardFieldProps,
};
FieldDynamicDropdown.supportedTypes = ["char", "integer", "selection"];
registry.category("fields").add("dynamic_dropdown", FieldDynamicDropdown);
| OCA/web/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js/0 | {
"file_path": "OCA/web/web_widget_dropdown_dynamic/static/src/js/field_dynamic_dropdown.esm.js",
"repo_id": "OCA",
"token_count": 1482
} | 95 |
You need to install the python mpld3 library::
pip install mpld3
| OCA/web/web_widget_mpld3_chart/readme/INSTALL.rst/0 | {
"file_path": "OCA/web/web_widget_mpld3_chart/readme/INSTALL.rst",
"repo_id": "OCA",
"token_count": 21
} | 96 |
* `GRAP <http://www.grap.coop>`_:
* Quentin DUPONT <quentin.dupont@grap.coop>
* `Tecnativa <https://www.tecnativa.com/>`_:
* Alexandre Díaz
* Carlos Roca
* Helly kapatel <helly.kapatel@initos.com>
* Thanakrit Pintana <thanakrit.p39@gmail.com>
* Dhara Solanki <dhara.solanki@initos.com>
| OCA/web/web_widget_numeric_step/readme/CONTRIBUTORS.rst/0 | {
"file_path": "OCA/web/web_widget_numeric_step/readme/CONTRIBUTORS.rst",
"repo_id": "OCA",
"token_count": 137
} | 97 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_open_tab
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-10-13 20:46+0000\n"
"Last-Translator: Corneliuus <cornelius@clk-it.de>\n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: web_widget_open_tab
#: model:ir.model.fields,field_description:web_widget_open_tab.field_ir_model__add_open_tab_field
msgid "Add Open Tab Field"
msgstr ""
#. module: web_widget_open_tab
#: model:ir.model.fields,help:web_widget_open_tab.field_ir_model__add_open_tab_field
msgid "Adds open-tab field in list views."
msgstr ""
#. module: web_widget_open_tab
#: model:ir.model,name:web_widget_open_tab.model_base
msgid "Base"
msgstr ""
#. module: web_widget_open_tab
#. odoo-javascript
#: code:addons/web_widget_open_tab/static/src/js/open_tab_widget.esm.js:0
#, python-format
msgid "Click to open on new tab"
msgstr ""
#. module: web_widget_open_tab
#: model:ir.model,name:web_widget_open_tab.model_ir_model
msgid "Models"
msgstr ""
#. module: web_widget_open_tab
#. odoo-javascript
#: code:addons/web_widget_open_tab/static/src/js/open_tab_widget.esm.js:0
#, python-format
msgid "Open Tab"
msgstr ""
#, python-format
#~ msgid "Click in order to open on new tab"
#~ msgstr "Anklicken, um in einem neuen Tab zu öffnen"
#, python-format
#~ msgid "Widget"
#~ msgstr "Widget"
| OCA/web/web_widget_open_tab/i18n/de.po/0 | {
"file_path": "OCA/web/web_widget_open_tab/i18n/de.po",
"repo_id": "OCA",
"token_count": 656
} | 98 |
<?xml version="1.0" encoding="UTF-8" ?>
<template>
<t t-name="web_widget_open_tab.openTab" owl="1">
<a
class="btn open_tab_widget fa fa-external-link"
t-att-href="_getReference()"
target="_blank"
t-on-click="openNewTab"
t-att-title="props.title"
t-on-mouseenter="ev => this.loadAttrs(ev)"
>
</a>
</t>
</template>
| OCA/web/web_widget_open_tab/static/src/xml/open_tab_widget.xml/0 | {
"file_path": "OCA/web/web_widget_open_tab/static/src/xml/open_tab_widget.xml",
"repo_id": "OCA",
"token_count": 228
} | 99 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_x2many_2d_matrix
#
# Translators:
# Viktoras Norkus <viktoras@bmx.lt>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-25 01:58+0000\n"
"PO-Revision-Date: 2018-02-15 12:40+0200\n"
"Last-Translator: Viktoras Norkus <viktoras@bmx.lt>, 2018\n"
"Language-Team: Lithuanian (https://www.transifex.com/oca/teams/23907/lt/)\n"
"Language: lt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
"%100<10 || n%100>=20) ? 1 : 2);\n"
#. module: web_widget_x2many_2d_matrix
#. odoo-javascript
#: code:addons/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.xml:0
#, python-format
msgid "Nothing to display."
msgstr ""
#, fuzzy, python-format
#~ msgid "Sum Total"
#~ msgstr "Suma"
| OCA/web/web_widget_x2many_2d_matrix/i18n/lt.po/0 | {
"file_path": "OCA/web/web_widget_x2many_2d_matrix/i18n/lt.po",
"repo_id": "OCA",
"token_count": 450
} | 100 |
/** @odoo-module **/
import {Component} from "@odoo/owl";
import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {registry} from "@web/core/registry";
import {archParseBoolean} from "@web/views/utils";
import {X2Many2DMatrixRenderer} from "@web_widget_x2many_2d_matrix/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.esm";
export class X2Many2DMatrixField extends Component {
setup() {
this.activeField = this.props.record.activeFields[this.props.name];
}
getList() {
return this.props.value;
}
get list() {
return this.getList();
}
_getDefaultRecordValues() {
return {};
}
async commitChange(x, y, value) {
const fields = this.props.matrixFields;
const values = this._getDefaultRecordValues();
const matchingRecords = this.list.records.filter((record) => {
let recordX = record.data[fields.x];
let recordY = record.data[fields.y];
if (record.fields[fields.x].type === "many2one") {
recordX = recordX[0];
}
if (record.fields[fields.y].type === "many2one") {
recordY = recordY[0];
}
return recordX === x && recordY === y;
});
if (matchingRecords.length === 1) {
values[fields.value] = value;
await matchingRecords[0].update(values);
} else {
values[fields.x] = x;
values[fields.y] = y;
if (this.list.fields[this.props.matrixFields.x].type === "many2one") {
values[fields.x] = [x, "/"];
}
if (this.list.fields[this.props.matrixFields.y].type === "many2one") {
values[fields.y] = [y, "/"];
}
let total = 0;
if (matchingRecords.length) {
total = matchingRecords
.map((r) => r.data[fields.value])
.reduce((aggr, v) => aggr + v);
}
const diff = value - total;
values[fields.value] = diff;
const record = await this.list.addNew({
mode: "edit",
});
await record.update(values);
}
this.props.setDirty(false);
}
}
X2Many2DMatrixField.template = "web_widget_x2many_2d_matrix.X2Many2DMatrixField";
X2Many2DMatrixField.props = {
...standardFieldProps,
matrixFields: Object,
isXClickable: Boolean,
isYClickable: Boolean,
showRowTotals: Boolean,
showColumnTotals: Boolean,
};
X2Many2DMatrixField.components = {X2Many2DMatrixRenderer};
X2Many2DMatrixField.extractProps = ({attrs}) => {
return {
matrixFields: {
value: attrs.field_value,
x: attrs.field_x_axis,
y: attrs.field_y_axis,
},
isXClickable: archParseBoolean(attrs.x_axis_clickable),
isYClickable: archParseBoolean(attrs.y_axis_clickable),
showRowTotals:
"show_row_totals" in attrs ? archParseBoolean(attrs.show_row_totals) : true,
showColumnTotals:
"show_column_totals" in attrs
? archParseBoolean(attrs.show_column_totals)
: true,
};
};
registry.category("fields").add("x2many_2d_matrix", X2Many2DMatrixField);
| OCA/web/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_field/x2many_2d_matrix_field.esm.js/0 | {
"file_path": "OCA/web/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_field/x2many_2d_matrix_field.esm.js",
"repo_id": "OCA",
"token_count": 1643
} | 101 |
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*
*= require reset
*= require grid
*
*= require bootstrap
*= require font-awesome
*= require sh/shCoreDefault
*
*= require accordion
*= require autocomplete
*= require smart_form
*= require sortable_table
*
*= require squash
*=
*= require accounts
*= require bugs
*= require feed
*= require flash
*= require membership
*= require occurrences
*= require projects
*= require sessions
*= require users
*/
| SquareSquash/web/app/assets/stylesheets/application.css/0 | {
"file_path": "SquareSquash/web/app/assets/stylesheets/application.css",
"repo_id": "SquareSquash",
"token_count": 260
} | 102 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Subclasses `ActionController::Responder` to include a little more detail in
# the JSON response for 422 errors and successful updates. In particular:
#
# * Alters the default response for successful `create` API requests to render
# the resource representation to the response body.
# * Alters the default response for failing `create` and `update` requests to
# render the errors object with the object's class name
# (see {ApplicationController}, section **Typical Responses**).
class JsonDetailResponder < ActionController::Responder
protected
# @private
def json_resource_errors
{resource.class.model_name.singular => resource.errors}
end
# @private
def api_behavior
raise MissingRenderer.new(format) unless has_renderer?
if put? || patch?
display resource, location: api_location
else
super
end
end
end
| SquareSquash/web/app/controllers/additions/json_detail_responder.rb/0 | {
"file_path": "SquareSquash/web/app/controllers/additions/json_detail_responder.rb",
"repo_id": "SquareSquash",
"token_count": 423
} | 103 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Singleton resource controller for working with the current {User}'s
# {Membership} in a {Project}.
class Project::MembershipController < ApplicationController
before_filter :find_project
before_filter :find_membership, except: :join
before_filter :must_not_be_owner, only: :destroy
respond_to :html, :json
# Creates a new Membership linking this Project to the current User. The user
# will have member privileges.
#
# Routes
# ------
#
# * `POST /projects/:project_id/membership/join`
#
# Path Parameters
# ---------------
#
# | | |
# |:-------------|:----------------------------------------------------------------------|
# | `project_id` | The Project's slug. |
# | `next` | For HTML requests, the URL to be taken to next (default project URL). |
def join
@membership = @project.memberships.where(user_id: current_user.id).find_or_create! { |m| m.user = current_user }
respond_with @membership, location: project_url(@project)
end
# Displays a form where a User can modify their Membership settings.
#
# Routes
# ------
#
# * `GET /projects/:project_id/membership/edit`
#
# Path Parameters
# ---------------
#
# | | |
# |:-------------|:--------------------|
# | `project_id` | The Project's slug. |
def edit
respond_with @membership
end
# Updates a User's email settings for this Membership's Project.
#
# Routes
# ------
#
# * `PATCH /projects/:project_id/membership`
#
# Path Parameters
# ---------------
#
# | | |
# |:-------------|:--------------------|
# | `project_id` | The Project's slug. |
#
# Body Parameters
# ---------------
#
# | | |
# |:-------------|:-------------------------------------------------------|
# | `membership` | Parameterized hash of new Membership attribute values. |
def update
@membership.update_attributes membership_params
respond_with @membership, location: edit_project_my_membership_url(@project)
end
# Removes membership from a Project. A Project owner cannot leave his/her
# Project without first reassigning ownership.
#
# Routes
# ------
#
# * `DELETE /project/:project_id/membership`
#
# Path Parameters
# ---------------
#
# | | |
# |:-------------|:--------------------|
# | `project_id` | The Project's slug. |
#
# Responses
# ---------
#
# ### Deleting an owned project
#
# If the User attempts to delete a Project s/he owns, a 401 Unauthorized
# status is returned with an empty response body.
def destroy
@membership.destroy
respond_with @membership do |format|
format.html { redirect_to account_url, flash: {success: t('controllers.project.membership.destroy.deleted', name: @membership.project.name)} }
end
end
private
def find_membership
@membership = current_user.memberships.find_by_project_id!(@project.id)
end
def must_not_be_owner
if @membership.role == :owner
respond_to do |format|
format.html { redirect_to account_url, alert: t('controllers.project.membership.must_not_be_owner') }
end
return false
else
return true
end
end
def membership_params
params.require(:membership).permit(:send_assignment_emails,
:send_comment_emails,
:send_resolution_emails)
end
end
| SquareSquash/web/app/controllers/project/membership_controller.rb/0 | {
"file_path": "SquareSquash/web/app/controllers/project/membership_controller.rb",
"repo_id": "SquareSquash",
"token_count": 1627
} | 104 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A bug is a group of {Occurrence Occurrences} that Squash believes to share the
# same root cause. Bugs are the core unit of functionality in Squash; they can
# be assigned to {User Users}, {Comment commented} on, etc.
#
# Separate Bugs are created for each `environment` they occur in.
#
# Like {Comment Comments}, each Bug is assigned a `number` in sequence among
# other Bugs of the same Project. This number is used when referring to Bugs,
# providing more useful information than the ID.
#
# Occurrences of a Bug can span multiple {Deploy Deploys} of different revisions
# of the code, so the revision/file/line number is recorded from the first
# occurrence of the Bug. Thus, when `git blame` is run to guess at who is at
# fault, this is done on the revision of the code at the first occurrence.
#
# When a bug is first created, the program determines the relevant file and line
# number. This is in general the highest line of back trace that is not library
# code.
#
# Duplicate Bugs
# --------------
#
# The user can mark a Bug as a duplicate of another Bug; this is done by
# associating the original Bug to the duplicate by way of the `duplicate_of_id`
# relation.
#
# When this happens, all Occurrences of the duplicate Bug are moved to the
# original Bug instead, and future Occurrences are placed under the original
# Bug. Because of this, marking a Bug as a duplicate is irreversible.
#
# When the user deletes a Bug with duplicates, the duplicates are also deleted.
#
# Associations
# ============
#
# | | |
# |:--------------------------|:----------------------------------------------------------------------------------|
# | `environment` | The {Environment} this Bug occurred in. |
# | `project` | The {Project} this Bug occurred in. |
# | `deploy` | The {Deploy} that introduced the Bug. |
# | `assigned_user` | The {User} assigned to fix this Bug. |
# | `occurrences` | The separate {Occurrence Occurrences} of this Bug. |
# | `comments` | The {Comment Comments} on this Bug. |
# | `events` | The {Event Events} that happened to this Bug. |
# | `watches` | The {Watch Watches} representing Users watching this Bug. |
# | `duplicate_of` | Indicates that this Bug was marked as a duplicate of the associated {Bug}. |
# | `duplicate_bugs` | The {Bug Bugs} that were marked as a duplicate of this Bug. |
# | `notification_thresholds` | The {NotificationThreshold NotificationThresholds} Users have placed on this Bug. |
#
# Properties
# ==========
#
# | | |
# |:-------------------------|:-------------------------------------------------------------------------------------------|
# | `class_name` | The name of exception class (or error class/number). |
# | `file` | The path name of the file determined to be where the Bug is, relative to the project root. |
# | `line` | The line number of the above file where the Bug was determined to be. |
# | `revision` | The revision of the project when the Bug first occurred. |
# | `blamed_revision` | The most recent commit that modified the above file and line number. |
# | `resolution_revision` | The commit that fixed this Bug. |
# | `number` | A consecutively incrementing value among other Bugs of the same Project. |
# | `fixed` | If `true`, this Bug has already been resolved. |
# | `fix_deployed` | If `true`, the commit that fixes this Bug has been deployed. |
# | `irrelevant` | If `true`, this Bug does not represent an actual programmer error, and will not be fixed. |
# | `first_occurrence` | The time at which this Bug first occurred. |
# | `latest_occurrence` | The time of the most recent occurrence. |
# | `occurrences_count` | The total number of occurrences so far. |
# | `comments_count` | The total number of comments left on the Bug. |
# | `client` | The client library that first saw the Bug (Rails, iOS, Android, etc.). |
# | `searchable_text` | Automatically-managed lexeme vector for text-based search. |
# | `any_occurrence_crashed` | `true` if any associated Occurrence crashed. |
#
# Metadata
# ========
#
# | | |
# |:-----------------------|:-----------------------------------------------------------------------------------------------------|
# | `message_template` | The form of error messages of this error, with occurrence-specific parts replaced with placeholders. |
# | `fixed_at` | When the bug was marked as fixed (set automatically). |
# | `notify_on_occurrence` | An array of User IDs to email whenever a new Occurrence is added. |
# | `notify_on_deploy` | An array of User IDs to email when the Bug's resolution commit has been deployed. |
# | `special_file` | If `true`, the `file` property has a special value (e.g., a function address), as does `line`. |
# | `jira_issue` | The key of a linked JIRA issue, such as "PROJ-123". |
# | `jira_status_id` | The ID value of the status field of the JIRA issue that should automatically resolve this Bug. |
# | `page_threshold` | Will notify PagerDuty any time this bug occurs this many times within a given period.. |
# | `page_period` | Will notify PagerDuty any time this bug occurs a given number of times within this period (seconds). |
# | `page_last_tripped_at` | The last time PagerDuty was notified due to `page_threshold` being exceeded. |
class Bug < ActiveRecord::Base
belongs_to :environment, inverse_of: :bugs
belongs_to :assigned_user, class_name: 'User', inverse_of: :assigned_bugs
belongs_to :deploy, inverse_of: :bugs
belongs_to :duplicate_of, class_name: 'Bug', inverse_of: :duplicate_bugs
has_many :duplicate_bugs, class_name: 'Bug', foreign_key: 'duplicate_of_id', inverse_of: :duplicate_of, dependent: :destroy
has_one :project, through: :environment
has_many :occurrences, dependent: :delete_all, inverse_of: :bug
has_many :comments, dependent: :delete_all, inverse_of: :bug
has_many :events, dependent: :delete_all, inverse_of: :bug
has_many :watches, dependent: :delete_all, inverse_of: :bug
has_many :notification_thresholds, dependent: :delete_all, inverse_of: :bug
has_many :device_bugs, dependent: :delete_all, inverse_of: :bug
# @return [User, Occurrence, JIRA::Resource::Issue] The User who is currently
# modifying this Bug, or the Occurrence that is causing this bug to be
# reopened, or other object that is responsible for the change, or `nil` for
# internal modifications. Used for {Event Events}.
attr_accessor :modifier
# @return [Deploy] The deploy that will mark this Bug as `fix_deployed`. Used
# for Events.
attr_accessor :fixing_deploy
# @private
attr_accessor :duplicate_of_number
attr_readonly :environment, :number, :first_occurrence, :latest_occurrence,
:occurrences_count, :comments_count, :class_name,
:message_template, :revision, :file, :line, :blamed_revision
include HasMetadataColumn
has_metadata_column(
message_template: {presence: true, length: {maximum: 1000}},
fixed_at: {type: Time, allow_nil: true},
notify_on_occurrence: {type: Array, default: []},
notify_on_deploy: {type: Array, default: []},
special_file: {type: Boolean, default: false, allow_nil: false},
jira_issue: {type: String, allow_nil: true},
jira_status_id: {type: Fixnum, allow_nil: true, numericality: {only_integer: true, greater_than_or_equal_to: 0}},
page_threshold: {type: Fixnum, numericality: {greater_than: 0}, allow_nil: true},
page_period: {type: Fixnum, numericality: {greater_than: 0}, allow_nil: true},
page_last_tripped_at: {type: Time, allow_nil: true}
)
validates :environment,
presence: true
validates :class_name,
presence: true,
length: {maximum: 128}
validates :file,
presence: true,
length: {maximum: 255}
validates :line,
presence: true,
numericality: {only_integer: true, greater_than: 0}
validates :blamed_revision, :resolution_revision,
length: {is: 40},
format: {with: /\A[0-9a-f]+\z/},
allow_nil: true
validates :revision,
presence: true,
length: {is: 40},
format: {with: /\A[0-9a-f]+\z/}
#validates :first_occurrence,
# presence: true
#validates :latest_occurrence,
# presence: true
#validates :occurrences_count,
# presence: true,
# numericality: {only_integer: true, greater_than_or_equal_to: 0}
#validates :comments_count,
# presence: true,
# numericality: {only_integer: true, greater_than_or_equal_to: 0}
#validates :number,
# presence: true,
# numericality: {only_integer: true, greater_than: 0},
# uniqueness: {scope: :environment_id}
validate :open_bugs_cannot_be_deployed, :assigned_user_must_be_project_member,
:resolution_revision_cant_be_set_without_closing,
:cannot_be_duplicate_of_duplicate, :cannot_set_duplicate_twice,
:cannot_change_original_to_duplicate,
:cannot_be_duplicate_of_foreign_bug
before_validation(on: :create) { |obj| obj.revision = obj.revision.downcase if obj.revision }
before_validation { |obj| obj.fixed_at = Time.now if obj.fixed? && !obj.fixed_was }
before_create { |obj| obj.notify_on_occurrence = [] } # if anyone can explain to me why this defaults to [1] and not []...
after_create :reload # grab the number value after the rule has been run
after_save :index_for_search!
set_nil_if_blank :blamed_revision, :resolution_revision, :jira_issue
scope :query, ->(query) {
select('*, TS_RANK_CD(searchable_text, query, 2|4|32) AS rank').
from("bugs, TO_TSQUERY('english', #{connection.quote(query || '')}) query").
where("query @@ searchable_text").
order('rank DESC')
}
# Reopens a Bug by marking it as unfixed. Sets `fix_deployed` to `false` as
# well. You can pass in a cause that will be used to add information to the
# resulting {Event}.
#
# @param [User, Occurrence] cause The User or Occurrence that caused this Bug
# to be reopened.
def reopen(cause=nil)
self.fixed = false
self.fix_deployed = false
self.modifier = cause
end
# @return [:open, :assigned, :fixed, :fix_deployed] The current status of this
# Bug.
def status
return :fix_deployed if fix_deployed?
return :fixed if fixed?
return :assigned if assigned_user_id
return :open
end
# @return [Git::Object::Commit] The commit corresponding to `revision`.
def occurrence_commit
return nil unless environment.project.repo
@occurrence_commit ||= begin
oc = environment.project.repo.object revision
BackgroundRunner.run(ProjectRepoFetcher, environment.project_id) unless oc
oc
end
end
# @return [Git::Object::Commit] The commit corresponding to `blamed_revision`.
def blamed_commit
return nil unless environment.project.repo
@blamed_commit ||= begin
bc = environment.project.repo.object blamed_revision
BackgroundRunner.run(ProjectRepoFetcher, environment.project_id) unless bc
bc
end
end
# @return [Git::Object::Commit] The commit corresponding to
# `resolution_revision`.
def resolution_commit
return nil unless environment.project.repo
@resolution_commit ||= begin
rc = environment.project.repo.object resolution_revision
BackgroundRunner.run(ProjectRepoFetcher, environment.project_id) unless rc
rc
end
end
# @return [String, Array<String>, nil] The email(s) of the person/people who
# is/are determined via `git-blame` to be at fault. This is typically the
# email associated with the commit, but could be a different email if a
# nonstandard author format is used, another User has assumed the original
# User's emails, or the User has specified a different primary Email.
def blamed_email
emails = blamed_users.map(&:email)
return case emails.size
when 0 then nil
when 1 then emails.first
else emails
end
end
# Similar to {#blamed_email}, but returns an array of Email objects that are
# associated with Users. Any unrecognized email addresses are represented as
# unsaved Email objects whose `user` is set to `nil`.
#
# @return [Array<Email>] The email(s) of the person/people who is/are
# determined via `git-blame` to be at fault.
# @see #blamed_email
def blamed_users
return [] unless blamed_commit
all_emails = [find_responsible_user(blamed_commit.author.email)].compact
# first priority is to use the email associated with the commit itself
emails = all_emails.map { |em| Email.primary.by_email(em).first }.compact
# second priority is matching a project member by commit author(s)
emails = emails_from_commit_author.map do |em|
Email.primary.by_email(find_responsible_user(em)).first || Email.new(email: em)
# build a fake empty email object to stand in for emails not linked to known user accounts
end if emails.empty?
# third priority is unknown emails associated with the commit itself (if the project is so configured)
if emails.empty? && environment.project.sends_emails_outside_team?
# build a fake empty email object to stand in for emails not linked to known user accounts
emails = all_emails.map { |em| Email.new(email: em) }
if environment.project.trusted_email_domain
emails.select! { |em| em.email.split('@').last == environment.project.trusted_email_domain }
end
end
return emails
end
# @return [true, false] `true` if `file` is a library file, or `false` if it
# is a project file.
def library_file?
special_file? || environment.project.path_type(file) == :library
end
# @private
def to_param() number.to_s end
# @return [String] Localized, human-readable name. This duck-types this class
# for use with breadcrumbs.
def name
I18n.t 'models.bug.name', number: number
end
# Marks this Bug as duplicate of another Bug, and transfers all Occurrences
# over to the other Bug. `save!`s the record.
#
# @param [Bug] bug The Bug this Bug is a duplicate of.
def mark_as_duplicate!(bug)
transaction do
self.duplicate_of = bug
save!
occurrences.update_all(bug_id: bug.id)
end
end
# @return [true, false] Whether this Bug is marked as a duplicate of another
# Bug.
def duplicate?() !duplicate_of_id.nil? end
# @private
def as_json(options=nil)
options ||= {}
options[:except] = Array.wrap(options[:except])
options[:except] << :id << :environment_id << :assigned_user_id <<
:searchable_text << :notify_on_occurrence << :notify_on_deploy
options[:methods] = Array.wrap(options[:methods])
options[:methods] << :status
super options
end
# @private
def to_json(*args) as_json(*args).to_json end
# Re-creates the text search index for this Bug. Loads all the Bug's Comments;
# should be done in a thread. Saves the record.
def index_for_search!
message_text = message_template.gsub(/\[.+?\]/, '')
comment_text = comments.map(&:body).compact.join(' ')
self.class.connection.execute <<-SQL
UPDATE bugs
SET searchable_text = SETWEIGHT(TO_TSVECTOR(#{self.class.connection.quote(class_name || '')}), 'A') ||
SETWEIGHT(TO_TSVECTOR(#{self.class.connection.quote(message_text || '')}), 'B') ||
SETWEIGHT(TO_TSVECTOR(#{self.class.connection.quote(comment_text || '')}), 'C')
WHERE id = #{id}
SQL
end
# @return [String] The incident key used to refer to this Bug in PagerDuty.
def pagerduty_incident_key
"Squash:Bug:#{id}"
end
# @return [true, false] Whether or not this Bug has occurred `page_threshold`
# times in the past `page_period` seconds.
def page_threshold_tripped?
return false unless page_threshold && page_period
(page_last_tripped_at.nil? || page_last_tripped_at < page_period.seconds.ago) &&
occurrences.where('occurred_at >= ?', page_period.seconds.ago).count >= page_threshold
end
private
# warning: this can get slow. always returns valid primary emails
def emails_from_commit_author
names = blamed_commit.author.name.split(/\s*(?:[+&]| and )\s*/)
emails = []
environment.project.memberships.includes(:user).find_each do |m|
emails << m.user.email if names.any? { |name| m.user.name.downcase.strip.squeeze(' ') == name.downcase.strip.squeeze(' ') }
end
emails
end
def open_bugs_cannot_be_deployed
errors.add(:fix_deployed, :not_fixed) if fix_deployed? && !fixed?
end
def assigned_user_must_be_project_member
errors.add(:assigned_user_id, :not_member) if assigned_user && assigned_user.role(environment.project).nil?
end
def resolution_revision_cant_be_set_without_closing
if !fixed_changed? && !fixed? && resolution_revision_changed? && resolution_revision.present?
errors.add(:resolution_revision, :set_on_unfixed)
end
end
def find_responsible_user(email, history=[])
# verify that the email's not one we've seen before (circular dependency)
raise "Circular email redirection! #{history.join(' -> ')} -> #{email}" if history.include? email
# add this email to the history
history << email
# locate a user who has this address as a non-primary (redirecting) email
redirected_email = Email.redirected.by_email(email).where(project_id: environment.project.id).first
redirected_email ||= Email.redirected.by_email(email).first
# if one exists
if redirected_email
# recurse again with the redirected user's primary email, in case someone has taken over HIS/HER emails
return find_responsible_user(redirected_email.user.email, history)
else
# this email has not been assumed by anyone else; return it
return email
end
end
def cannot_be_duplicate_of_duplicate
errors.add(:duplicate_of_id, :is_a_duplicate) if duplicate_of.try!(:duplicate?)
end
def cannot_change_original_to_duplicate
errors.add(:duplicate_of_id, :has_duplicates) if duplicate_of_id? && !duplicate_bugs.empty?
end
def cannot_set_duplicate_twice
errors.add(:duplicate_of_id, :already_duplicate) if duplicate_of_id_changed? && !duplicate_of_id_was.nil?
end
def cannot_be_duplicate_of_foreign_bug
errors.add(:duplicate_of_id, :foreign_bug) if duplicate_of && duplicate_of.environment_id != environment_id
end
end
| SquareSquash/web/app/models/bug.rb/0 | {
"file_path": "SquareSquash/web/app/models/bug.rb",
"repo_id": "SquareSquash",
"token_count": 8388
} | 105 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# An individual occurrence of a {Bug}, or put another way, a single instance of
# an exception occurring and being recorded. Occurrences record all relevant
# information about the exception itself and the state of the program when the
# exception occurred.
#
# Most of this data is part of the metadata column and is therefore schemaless.
# Rather than tailoring the fields to one particular class of projects (e.g.,
# Rails apps), new fields can be easily added to fit any type of project.
#
# Occurrences can also have `user_data`. This is typically added at runtime by
# the code when the exception is raised, and provides freeform contextual data
# relevant to the error.
#
# There are a number of SQL triggers and rules to ensure cached counters and
# similar fields are kept in sync between {Bug Bugs} and Occurrences; see the
# migration for further information.
#
# Like {Comment Comments}, each Occurrence is assigned a `number` in sequence
# among other occurrences of the same Bug. This number is used when referring to
# Occurrences, providing more useful information than the ID.
#
# Backtraces, concurrency, and symbolication
# ------------------------------------------
#
# Each Occurrence has multiple backtraces, one for each thread or other unit of
# execution (client specific). These backtraces can appear in one of two
# formats:
#
# ### Current format
#
# The current backtrace format is an array of hashes. Each hash has the
# following keys:
#
# | Key | Required | Description |
# |:------------|:---------|:--------------------------------------------------------------------------|
# | `name` | yes | A name for the thread or fiber. |
# | `faulted` | yes | If `true`, this is the thread or fiber in which the exception was raised. |
# | `backtrace` | yes | The stack trace for this thread or fiber. |
# | `registers` | no | The value of the registers for this thread (hash). |
#
# The `backtrace` value is an array of hashes, one per line of the backtrace,
# ordered from outermost stack element to innermost. Each hash can have the
# following keys (all are required):
#
# | | |
# |:---------|:----------------------------------------------------|
# | `file` | The file name. |
# | `line` | The line number in the file. |
# | `symbol` | The name of the method containing that line number. |
#
# #### Special backtraces
#
# For certain special stack trace lines, a `type` field will be present
# indicating the type of special stack trace line this is. If the `type` field
# is present, other fields will appear alongside it.
#
# For unsymbolicated backtrace lines, the `type` field will be **address** and
# the only other field will be named "address" and will be the integer stack
# trace return address. Unsymbolicated backtrace lines can be symbolicated by
# calling {#symbolicate}, assuming an appropriate {Symbolication} is available.
#
# For un-sourcemapped JavaScript lines, the `type` field will start with **js:**
# (the type depends on the stage of the JavaScript [hosted, concatenated,
# compiled, etc.]), and the other fields will be:
#
# | | |
# |:----------|:-------------------------------------------------------------------|
# | `url` | The URL of the compiled JavaScript asset. |
# | `line` | The line number in the compiled file. |
# | `column` | The column number in the compiled file. |
# | `symbol` | The compiled method or function name. |
# | `context` | An array of strings containing the lines of code around the error. |
#
# Some elements will be `nil` depending on browser support. Un-sourcemapped
# lines can be source-mapped by calling {#sourcemap}, assuming an appropriate
# {SourceMap} is available.
#
# For obfuscated Java backtrace lines, the `type` field will be **obfuscated**
# and the other fields will be (all are required):
#
# | | |
# |:---------|:--------------------------------------------------------|
# | `file` | The obfuscated file name without path (e.g., "A.java"). |
# | `line` | The line number within that file. |
# | `symbol` | The method name (can be obfuscated). |
# | `class` | The class name (can be obfuscated). |
#
# Obfuscated backtrace lines can be de-obfuscated by calling {#deobfuscate},
# assuming an appropriate {ObfuscationMap} is available.
#
# ### Legacy format
#
# Older client libraries may report backtraces in this format:
#
# ```` ruby
# [
# ["Thread 0", true, [
# ["file/path.rb", 123, "method_name"],
# ...
# ]],
# ...
# ]
# ````
#
# So, the outermost array is a list of threads. Each entry in that array has
# three elements:
#
# * the name of the thread (client-specific),
# * whether or not the thread was responsible for the exception, and
# * the backtrace array.
#
# Each element of the backtrace array is an array consisting of
#
# * the file path (relative to the project root for non-library files),
# * the line number, and
# * the method or function name (or `nil`).
#
# For certain special cases, this array will consist of other than three
# elements. These special cases are:
#
# #### Unsymbolicated backtrace lines
#
# If a line in the backtrace is not yet symbolicated, it is stored in a different
# format. Each unsymbolicated line of a backtrace becomes a _two_-element array.
# The first element is the constant "_RETURN_ADDRESS_", and the second is an
# integer stack trace return address.
#
# Unsymbolicated backtrace lines can be symbolicated by calling {#symbolicate},
# assuming an appropriate {Symbolication} is available.
#
# #### Un-sourcemapped JavaScript files
#
# If a line in a backtrace corresponds to a JavaScript asset that has not yet
# been mapped to an un-minified source file, it is stored as a six-element
# array:
#
# 0. the constant "_JS_ASSET_",
# 1. the URL of the JavaScript source file,
# 2. the line number,
# 3. the column number,
# 4. the function name, and
# 5. the context (an array of strings [lines of code around the error])
#
# Some elements will be `nil` depending on browser support. Un-sourcemapped
# lines can be source-mapped by calling {#sourcemap}, assuming an appropriate
# {SourceMap} is available.
#
# #### Obfuscated Java files
#
# Java backtraces do not contain the full file path, and the class name can be
# obfuscated using yGuard. If a line in a backtrace comes from a Java stack
# trace, it is stored as a five-element array:
#
# 0. the constant "_JAVA_",
# 1. the name of the source file (can be obfuscated; e.g., "A.java"),
# 2. the line number
# 3. the method name (can be obfuscated), and
# 4. the class name.
#
# Obfuscated backtrace lines can be de-obfuscated by calling {#deobfuscate},
# assuming an appropriate {ObfuscationMap} is available.
#
# Nesting
# -------
#
# This class can record exceptions that have been nested underneath one or more
# parent exceptions, a paradigm that can be seen occasionally in Ruby (e.g.,
# `ActionView::TemplateError`) and far too frequently in Java. It is up to the
# individual client libraries to detect and record nesting parents.
#
# If an exception was nested underneath parent(s), the `parent_exceptions`
# property should be an array of hashes, each hash representing a parent
# exception, ordered from innermost to outermost parent. Each hash takes the
# following keys:
#
# * `class_name` (the name of the exception class)
# * `message`
# * `backtraces`
# * `ivars`
# * `association` (the name of the instance variable containing the inner
# exception, or some other identifier as to how the two exceptions are
# associated)
#
# The values for these keys are the same as is described in _Global Fields_
# below unless otherwise specified. The `association` field is optional.
#
# Truncation
# ----------
#
# Because Occurrences store a lot of information, it may be necessary to
# truncate older records. Truncation removes all metadata, leaving only the
# revision, date, and client information. It helps free up space by discarding
# possibly redundant information.
#
# You can truncate Occurrences with the {#truncate!} and {.truncate!} methods.
#
# Redirection
# -----------
#
# It may be the case that an Occurrence needs to move from one Bug to another,
# as for example, when symbolication occurs after an Occurrence is saved, and
# the symbolication reveals that the Occurrence should belong to a different
# Bug.
#
# In this case, a new duplicate Occurrence is created under the correct Bug,
# this Occurrence is truncated, and marked as a redirect. In the front-end,
# visitors to this Occurrence will be redirected to the correct Occurrence.
#
# Unfortunately, the old, truncated Occurrence remains attached to the old
# (incorrect) Bug, negatively impacting that Bug's statistics. No solution for
# this problem has been written.
#
# Redirection should be done with the {#redirect_to!} method.
#
# Associations
# ============
#
# | | |
# |:----------------|:--------------------------------------------------------------------------|
# | `bug` | The {Bug} this is an occurrence of. |
# | `symbolication` | The {Symbolication} for the backtraces (if available, and if applicable). |
#
# Properties
# ==========
#
# | | |
# |:--------------|:----------------------------------------------------------------------------|
# | `revision` | The revision of the {Project} at the point this occurrence happened. |
# | `number` | A consecutively incrementing value among other Occurrences of the same Bug. |
# | `occurred_at` | The time at which this occurrence happened. |
# | `client` | The client library that sent the occurrence (Rails, iOS, Android, etc.). |
# | `crashed` | If true, the exception was not caught and resulted in a crash. |
#
# Metadata
# ========
#
# Global Fields
# -------------
#
# | | |
# |:--------------------|:------------------------------------------------------------------------------------------------|
# | `message` | The error or exception message. |
# | `backtraces` | Each thread's backtrace (see above). |
# | `ivars` | The exception's instance variables. |
# | `user_data` | Any additional annotated data sent with the exception. |
# | `parent_exceptions` | Information on any parent exceptions that this exception was nested under. See _Nesting_ above. |
#
# Host Platform
# -------------
#
# | | |
# |:------------|:-------------------------------------------------------------|
# | `arguments` | The launch arguments, as a string. |
# | `env_vars` | A hash of the names and values of the environment variables. |
# | `pid` | The PID of the process that raised the exception. |
#
# Server Applications
# -------------------
#
# | | |
# |:-----------|:------------------------------|
# | `root` | The path to the project root. |
# | `hostname` | The computer's hostname. |
#
# Client Applications
# -------------------
#
# | | |
# |:-------------------|:-----------------------------------------------------------------------|
# | `version` | The human version number of the application. |
# | `build` | The machine version number of the application. |
# | `device_id` | An ID number unique to the specific device. |
# | `device_type` | A string identifying the device make and model. |
# | `operating_system` | The name of the operating system the application was running under. |
# | `os_version` | The human-readable version number of the operating system. |
# | `os_build` | The build number of the operating system. |
# | `physical_memory` | The amount of memory on the client platform, in bytes. |
# | `symbolication_id` | The UUID for the symbolication data. |
# | `architecture` | The processor architecture of the device (e.g., "i386"). |
# | `parent_process` | The name of the process that launched this process. |
# | `process_native` | If `false`, the process was running under an emulator (e.g., Rosetta). |
# | `process_path` | The path to the application on disk. |
#
# Geolocation Data
# ----------------
#
# | | |
# |:---------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
# | `lat` | The latitude, in degrees decimal. |
# | `lon` | The longitude, in degrees decimal. |
# | `altitude` | The altitude, in meters above sea level. |
# | `location_precision` | A number describing the 2D precision of the location fix (device-specific). |
# | `heading` | The magnetic heading of the device, in degrees decimal. For some devices, this is compass orientation; for others, vector angle of first derivative of position. |
# | `speed` | Velocity of the device, in meters per second. |
#
# Mobile Devices
# --------------
#
# | | |
# |:-------------------|:----------------------------------------------------------------------|
# | `network_operator` | The network operator (e.g., AT&T). |
# | `network_type` | The data network type (e.g., 4G-LTE). |
# | `connectivity` | Connectivity source (e.g., cellular or wi-fi). |
# | `power_state` | The charging/power state (e.g., charging). Platform-specific string. |
# | `orientation` | The device's orientation (e.g., landscape). Platform-specific string. |
#
# HTTP
# ----
#
# | | |
# |:-----------------|:-----------------------------------------------------------|
# | `request_method` | The HTTP request method (e.g., "GET"). |
# | `schema` | The schema of the request URL (e.g., "http"). |
# | `host` | The host portion of the request URL. |
# | `port` | The port on which the request sent. |
# | `path` | The path portion of the request URL, with leading "/". |
# | `query` | The query portion of the request URL, without leading "?". |
# | `fragment` | The anchor portion of the URL, without leading "#". |
# | `headers` | A hash of header names and values for the request. |
#
# Ruby on Rails
# -------------
#
# | | |
# |:-------------|:-------------------------------------------|
# | `controller` | The Rails controller handling the request. |
# | `action` | The Rails action that was invoked. |
# | `params` | The contents of the `params` hash. |
# | `session` | The contents of the `session` hash. |
# | `flash` | The contents of the `flash` hash. |
# | `cookies` | The contents of the `cookies` hash. |
#
# Android
# -------
#
# | | |
# |:---------|:---------------------------------------|
# | `rooted` | If `true`, the device has been rooted. |
#
# Web Browser
# -----------
#
# | | |
# |:-------------------------|:--------------------------------------------------------|
# | `browser_name` | The name of the Web browser (e.g., "Safari"). |
# | `browser_version` | The browser version (e.g., "5.1.5"). |
# | `browser_engine` | The rendering engine (e.g., "webkit"). |
# | `browser_os` | The client's operating system (e.g., "Mac OS X"). |
# | `browser_engine_version` | The version of the rendering engine (e.g., "534.55.3"). |
#
# Web Browser Platform
# --------------------
#
# | | |
# |:----------------|:----------------------------------------------------------------------|
# | `screen_width` | The width of the device displaying the browser window, in pixels. |
# | `screen_height` | The height of the device displaying the browser window, in pixels. |
# | `window_width` | The width of the browser window at the time of exception, in pixels. |
# | `window_height` | The height of the browser window at the time of exception, in pixels. |
# | `color_depth` | The color bit depth of the device displaying the browser window. |
class Occurrence < ActiveRecord::Base
belongs_to :bug, inverse_of: :occurrences
belongs_to :symbolication, primary_key: 'uuid', inverse_of: :occurrences
belongs_to :redirect_target, class_name: 'Occurrence', foreign_key: 'redirect_target_id', inverse_of: :redirected_occurrence
has_one :redirected_occurrence, class_name: 'Occurrence', foreign_key: 'redirect_target_id', inverse_of: :redirect_target, dependent: :destroy
include HasMetadataColumn
has_metadata_column(
# Universal
message: {presence: true, length: {maximum: 1000}},
backtraces: {type: Array, presence: true},
ivars: {type: Hash, allow_nil: true},
user_data: {type: Hash, allow_nil: true},
parent_exceptions: {type: Array, allow_nil: true},
# Universal - Host platform
arguments: {allow_nil: true},
env_vars: {type: Hash, allow_nil: true},
pid: {type: Fixnum, numericality: {only_integer: true, greater_than: 0}, allow_nil: true},
parent_process: {length: {maximum: 150}, allow_nil: true},
process_native: {type: Boolean, allow_nil: true},
process_path: {length: {maximum: 1024}, allow_nil: true},
# Universal - User identification
user_id: {length: {maximum: 256}, allow_nil: true},
# Server apps
root: {length: {maximum: 500}, allow_nil: true},
hostname: {length: {maximum: 255}, allow_nil: true},
# Client apps
version: {length: {maximum: 50}, allow_nil: true},
build: {length: {maximum: 50}, allow_nil: true},
device_id: {length: {maximum: 150}, allow_nil: true},
device_type: {length: {maximum: 150}, allow_nil: true},
operating_system: {length: {maximum: 50}, allow_nil: true},
os_build: {length: {maximum: 50}, allow_nil: true},
os_version: {length: {maximum: 50}, allow_nil: true},
physical_memory: {type: Fixnum, numericality: {only_integer: true, greater_than: 0}, allow_nil: true},
architecture: {length: {maximum: 50}, allow_nil: true},
# Geolocation
lat: {type: Float, numericality: {within: -90..90}, allow_nil: true},
lon: {type: Float, numericality: {within: -180..180}, allow_nil: true},
altitude: {type: Float, numericality: true, allow_nil: true},
location_precision: {type: Float, numericality: true, allow_nil: true},
heading: {type: Float, numericality: {within: 0..360}, allow_nil: true},
speed: {type: Float, numericality: true, allow_nil: true},
# Mobile
network_operator: {length: {maximum: 100}, allow_nil: true},
network_type: {length: {maximum: 50}, allow_nil: true},
connectivity: {length: {maximum: 50}, allow_nil: true},
power_state: {length: {maximum: 100}, allow_nil: true},
orientation: {length: {maximum: 100}, allow_nil: true},
# HTTP
request_method: {length: {maximum: 50}, allow_nil: true},
schema: {length: {maximum: 50}, allow_nil: true},
host: {length: {maximum: 255}, allow_nil: true},
port: {type: Fixnum, allow_nil: true},
path: {length: {maximum: 500}, allow_nil: true},
query: {length: {maximum: 255}, allow_nil: true},
fragment: {length: {maximum: 255}, allow_nil: true},
headers: {type: Hash, allow_nil: true},
# Ruby on Rails
controller: {length: {maximum: 100}, allow_nil: true},
action: {length: {maximum: 100}, allow_nil: true},
params: {type: Hash, allow_nil: true},
session: {type: Hash, allow_nil: true},
flash: {type: Hash, allow_nil: true},
cookies: {type: Hash, allow_nil: true},
# Android
rooted: {type: Boolean, allow_nil: true},
# Browser
browser_name: {length: {maximum: 50}, allow_nil: true},
browser_version: {length: {maximum: 50}, allow_nil: true},
browser_engine: {length: {maximum: 50}, allow_nil: true},
browser_os: {length: {maximum: 50}, allow_nil: true},
browser_engine_version: {length: {maximum: 50}, allow_nil: true},
# Browser Platform
screen_width: {type: Integer, allow_nil: true},
screen_height: {type: Integer, allow_nil: true},
window_width: {type: Integer, allow_nil: true},
window_height: {type: Integer, allow_nil: true},
color_depth: {type: Integer, allow_nil: true}
)
attr_readonly :bug, :revision, :number, :occurred_at
# Fields that cannot be used by the aggregation view. These are fields with a
# a continuous range of possible values, or fields with unusual data types.
NON_AGGREGATING_FIELDS = %w( number message backtraces ivars arguments env_vars
user_data parent_exceptions headers params fragment
session flash cookies id bug_id metadata lat lon
altitude location_precision heading speed
user_id occurred_at root symbolication_id
redirect_target_id )
# Fields that can be used by the aggregation view.
AGGREGATING_FIELDS = (Occurrence.columns.map(&:name) rescue []) + Occurrence.metadata_column_fields.keys.map(&:to_s) - NON_AGGREGATING_FIELDS
validates :bug,
presence: true
validates :revision,
presence: true,
length: {is: 40},
format: {with: /\A[0-9a-f]+\z/}
#validates :number,
# presence: true,
# numericality: {only_integer: true, greater_than: 0},
# uniqueness: {scope: :bug_id}
validates :occurred_at,
presence: true,
timeliness: {type: :time}
set_nil_if_blank :user_id, :root, :hostname, :version, :device_id,
:device_type, :operating_system, :network_operator,
:network_type, :connectivity, :schema, :host, :path, :query,
:controller, :action, :browser_name, :browser_version,
:browser_engine, :browser_os, :browser_engine_version
before_validation(on: :create) { |obj| obj.revision = obj.revision.downcase if obj.revision }
after_create :reload # grab the number value after the rule has been run
before_create :sourcemap
before_create :symbolicate
before_create :deobfuscate
# @return [URI::Generic] The URL of the Web request that resulted in this
# Occurrence.
def url
@url ||= begin
return nil unless web?
return nil unless URI.scheme_list.include?(schema.upcase)
URI.scheme_list[schema.upcase].build(host: host, port: port, path: path, query: query, fragment: fragment)
rescue URI::InvalidComponentError
nil
end
end
# @return [Array<Hash>] The backtrace in `backtrace` that is at fault.
def faulted_backtrace
bt = backtraces.detect { |b| b['faulted'] }
bt ? bt['backtrace'] : []
end
# @return [true, false] Whether or not this exception was nested under one or
# more parents.
def nested?() parent_exceptions.present? end
# @return [Array<Hash>] The `parent_exceptions` array with the innermost
# exception (the exception around which this Occurrence was created)
# prepended.
def exception_hierarchy
[{'class_name' => bug.class_name, 'message' => message, 'backtraces' => backtraces, 'ivars' => ivars}] + (parent_exceptions || [])
end
# @return [Hash<String, Object>] Any metadata fields that are not defined in
# the `has_metadata_column` call.
def extra_data
_metadata_hash.except(*self.class.metadata_column_fields.keys.map(&:to_s))
end
# @return [true, false] Whether or not this Occurrence has Web request
# information.
def web?
schema? && host? && path?
end
# @return [tue, false] Whether or not this Occurrence has server-side Web
# request information.
def request?
params? || headers?
end
# @return [true, false] Whether or not this Occurrence has Rails information.
def rails?
client == 'rails' && controller && action
end
# @return [true, false] Whether or not this Occurrence has user data or
# instance variables.
def additional?
user_data.present? || extra_data.present? || ivars.present?
end
# @return [true, false] Whether or not this exception occurred as part of an
# XMLHttpRequest (Ajax) request.
def xhr?
headers && headers['XMLHttpRequest'].present?
end
# @return [true, false] Whether this Occurrence contains information about the
# hosted server on which it occurred.
def server?
hostname && pid
end
# @return [true, false] Whether this Occurrence contains information about the
# client platform on which it occurred.
def client?
build && device_type && operating_system
end
# @return [true, false] Whether this Occurrence contains client geolocation
# information.
def geo?
lat && lon
end
# @return [true, false] Whether this Occurrence contains mobile network
# information.
def mobile?
network_operator && network_type
end
# @return [true, false] Whether this Occurrence contains Web browser
# user-agent information.
def browser?
browser_name && browser_version
end
# @return [true, false] Whether this Occurrence contains Web browser platform
# information.
def screen?
(window_width && window_height) || (screen_width && screen_height)
end
# @private
def to_param() number.to_s end
# @return [String] Localized, human-readable name. This duck-types this class
# for use with breadcrumbs.
def name
I18n.t 'models.occurrence.name', number: number
end
# Truncates this Occurrence and saves it. Does nothing if the occurrence has
# already been truncated. All metadata will be erased to save space.
def truncate!
return if truncated?
update_column :metadata, nil
end
# @return [true, false] Whether this occurrence has been truncated.
def truncated?
metadata.nil?
end
# Truncates a group of Occurrences.
#
# @param [ActiveRecord::Relation] scope The Occurrences to truncate.
# @see #truncate!
def self.truncate!(scope)
scope.update_all metadata: nil
end
# Redirects this Occurrence to a given Occurrence. See the class docs for a
# description of redirection. Also truncates the Occurrence and saves the
# record.
#
# If this is the last remaining Occurrence under a Bug to be redirected, the
# Bug is marked as irrelevant. This removes from the list Bugs with
# unsymbolicated Occurrences once the Symbolication is uploaded.
#
# @param [Occurrence] occurrence The Occurrence to redirect this Occurrence
# to.
def redirect_to!(occurrence)
update_column :redirect_target_id, occurrence.id
truncate!
# if all occurrences for this bug redirect, mark the bug as unimportant
if bug.occurrences.where(redirect_target_id: nil).none?
bug.update_attribute :irrelevant, true
end
end
# Symbolicates this Occurrence's backtrace. Does nothing if there is no linked
# {Symbolication} or if there is nothing to symbolicate.
#
# @param [Symbolication] symb A Symbolication to use (by default, it's the
# linked Symbolication).
# @see #symbolicate!
def symbolicate(symb=nil)
symb ||= symbolication
return unless symb
return if truncated?
return if symbolicated?
(bt = backtraces).each do |bt|
bt['backtrace'].each do |elem|
next unless elem['type'] == 'address'
symbolicated = symb.symbolicate(elem['address'])
elem.replace(symbolicated) if symbolicated
end
end
self.backtraces = bt # refresh the actual JSON
end
# Like {#symbolicate}, but saves the record.
#
# @param [Symbolication] symb A Symbolication to use (by default, it's the
# linked Symbolication).
def symbolicate!(symb=nil)
symb ||= symbolication
return unless symb
return if truncated?
return if symbolicated?
symbolicate symb
save!
end
# @return [true, false] Whether all lines of every stack trace have been
# symbolicated. (Truncated Occurrences will return `true`.)
def symbolicated?
return true if truncated?
backtraces.all? do |bt|
bt['backtrace'].none? { |elem| elem['type'] == 'address' }
end
end
# @overload sourcemap(source_map, ...)
# Apply one or more source maps to this Occurrence's backtrace. Any matching
# un-sourcemapped lines will be converted. Source maps will be searched and
# applied in until no further lines can be converted (see {SourceMap}).
#
# Does not save the record.
#
# @param [SourceMap] source_map A source map to apply.
# @see #sourcemap!
def sourcemap(*sourcemaps)
return if truncated?
return if sourcemapped?
sourcemaps = bug.environment.source_maps.where(revision: revision) if sourcemaps.empty?
return if sourcemaps.empty?
sourcemaps = sourcemaps.group_by(&:from)
(bt = backtraces).each do |bt|
bt['backtrace'].each do |elem|
found_at_least_one_applicable_sourcemap = true
# repeat until there's no more sourcemapping we can do on this line
while found_at_least_one_applicable_sourcemap
# assume we haven't found one
found_at_least_one_applicable_sourcemap = false
next unless elem['type'].start_with?('js:')
type = elem['type'][3..-1]
# try every valid source map on this line
sourcemapped = nil
Array.wrap(sourcemaps[type]).each do |map|
file = (map.from == 'hosted' ? elem['url'] : elem['file'])
sourcemapped = map.resolve(file, elem['line'], elem['column'])
if sourcemapped
sourcemapped['type'] = "js:#{map.to}"
# stop when we find one that applies
break
end
end
if !sourcemapped && elem['type'] == 'js:hosted' && bug.environment.project.digest_in_asset_names?
# It's possible the most recent version of this asset was generated
# in a previous deploy. Search all source maps for one that can
# resolve our file name.
if (matching_sourcemap = bug.environment.source_maps.where(filename: elem['url'], from: 'hosted').first)
sourcemapped = matching_sourcemap.resolve(elem['url'], elem['line'], elem['column'])
if sourcemapped
sourcemapped['type'] = "js:#{matching_sourcemap.to}"
# Since this digest was generated in a previous deploy, we need
# to add all the sourcemaps generated in that deploy to our list
sourcemaps.merge! bug.environment.source_maps.where(revision: matching_sourcemap.revision).group_by(&:from)
end
end
end
# if we found one that applies
if sourcemapped
# change the backtrace
elem.replace sourcemapped
# and make sure we try sourcemapping the line again
found_at_least_one_applicable_sourcemap = true
end
end
# clear out the type if we were able to sourcemap at least once
elem.delete('type') if elem['type'] != 'js:hosted'
end
end
self.backtraces = bt # refresh the actual JSON
end
# Same as {#sourcemap}, but also `save!`s the record.
def sourcemap!(*sourcemaps)
return if truncated?
return if sourcemapped?
sourcemaps = bug.environment.source_maps.where(revision: revision) if sourcemaps.empty?
return if sourcemaps.empty?
sourcemap *sourcemaps
save!
end
# @return [true, false] Whether all lines of every stack trace have been
# sourcemapped. (Truncated Occurrences will return `true`.)
def sourcemapped?
return true if truncated?
backtraces.all? do |bt|
bt['backtrace'].none? { |elem| elem['type'] && elem['type'] == 'js:hosted' }
end
end
# De-obfuscates this Occurrence's backtrace. Does nothing if the linked Deploy
# has no {ObfuscationMap} or if there are no obfuscated backtrace elements.
#
# @param [ObfuscationMap] map An ObfuscationMap to use (by default, it's the
# linked Deploy's ObfuscationMap).
# @see #deobfuscate!
def deobfuscate(map=nil)
map ||= bug.deploy.try!(:obfuscation_map)
return unless map
return if truncated?
return if deobfuscated?
(bt = backtraces).each do |bt|
bt['backtrace'].each do |elem|
next unless elem['type'] == 'obfuscated'
klass = map.namespace.obfuscated_type(elem['class_name'])
next unless klass && klass.path
meth = map.namespace.obfuscated_method(klass, elem['symbol'])
elem.replace(
'file' => klass.path,
'line' => elem['line'],
'symbol' => meth.try!(:full_name) || elem['symbol']
)
end
end
self.backtraces = bt # refresh the actual JSON
end
# Like {#deobfuscate}, but saves the record.
#
# @param [ObfuscationMap] map An ObfuscationMap to use (by default, it's the
# linked Deploy's ObfuscationMap).
def deobfuscate!(map=nil)
map ||= bug.deploy.try!(:obfuscation_map)
return unless map
return if truncated?
return if deobfuscated?
deobfuscate map
save!
end
# @return [true, false] Whether all lines of every stack trace have been
# deobfuscated. (Truncated Occurrences will return `true`.)
def deobfuscated?
return true if truncated?
backtraces.all? do |bt|
bt['backtrace'].none? { |elem| elem['type'] == 'obfuscated' }
end
end
# Recalculates the blame for this Occurrence and re-determines which Bug it
# should be a member of. If different from the current Bug, creates a
# duplicate Occurrence under the new Bug and redirects this Occurrence to it.
# Saves the record.
def recategorize!
blamer = bug.environment.project.blamer.new(self)
new_bug = blamer.find_or_create_bug!
if new_bug.id != bug_id
copy = new_bug.occurrences.build
copy.assign_attributes attributes.except('number', 'id', 'bug_id')
copy.save!
blamer.reopen_bug_if_necessary! new_bug
redirect_to! copy
end
end
# @return [Git::Object::Commit] The Commit for this Occurrence's `revision`.
def commit() bug.environment.project.repo.object revision end
# @private
def as_json(options={})
options[:except] = Array.wrap(options[:except])
options[:except] << :id
options[:except] << :bug_id
super options
end
# @private
def backtraces
self.class.convert_backtraces(attribute('backtraces'))
end
# Converts a backtrace list in the legacy format into the current backtrace
# format.
#
# @param [Array<Array>] bts An array of backtraces in the legacy format.
# @return [Array<Hash>] The backtraces in the current format.
def self.convert_backtraces(bts)
return bts if bts.first.kind_of?(Hash)
bts.map do |(name, faulted, trace)|
{
'name' => name,
'faulted' => faulted,
'backtrace' => convert_legacy_backtrace_format(trace)
}
end
end
private
def self.convert_legacy_backtrace_format(backtrace)
backtrace.map do |bt_line|
if bt_line.length == 3
{
'file' => bt_line[0],
'line' => bt_line[1],
'symbol' => bt_line[2]
}
else
case bt_line.first
when '_RETURN_ADDRESS_'
{
'type' => 'address',
'address' => bt_line[1]
}
when '_JS_ASSET_'
{
'type' => 'js:hosted',
'url' => bt_line[1],
'line' => bt_line[2],
'column' => bt_line[3],
'symbol' => bt_line[4],
'context' => bt_line[5]
}
when '_JAVA_'
{
'type' => 'obfuscated',
'file' => bt_line[1],
'line' => bt_line[2],
'symbol' => bt_line[3],
'class' => bt_line[4]
}
else
raise "Unknown special legacy backtrace format #{bt_line.first}"
end
end
end
end
end
| SquareSquash/web/app/models/occurrence.rb/0 | {
"file_path": "SquareSquash/web/app/models/occurrence.rb",
"repo_id": "SquareSquash",
"token_count": 16527
} | 106 |
# encoding: utf-8
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require Rails.root.join('app', 'views', 'layouts', 'application.html.rb')
module Views
# @private
module Bugs
# @private
class Show < Views::Layouts::Application
include Accordion
needs :project, :environment, :bug, :aggregation_dimensions,
:new_issue_url
protected
def page_title() "Bug ##{number_with_delimiter @bug.number} (#{@project.name} #{@environment.name.capitalize})" end
def body_content
full_width_section do
bug_title
notice_bars
bug_info
end
tabbed_section -> { tab_header }, -> { tab_content }
end
def breadcrumbs() [@project, @environment, @bug] end
private
def bug_title
h1 do
text @bug.class_name
a id: 'watch', href: '#', class: "fa fa-star#{'-o' unless current_user.watches?(@bug)}", alt: "Watch/unwatch this bug"
end
end
def notice_bars
fixed_bar if @bug.fixed?
duplicate_bar if @bug.duplicate?
uneditable_bar unless current_user.role(@bug)
end
def fixed_bar
div(class: 'alert success') do
text "This bug has been marked as resolved."
if @bug.resolution_revision
text " ("
text! commit_link(@project, @bug.resolution_revision)
text ")"
end
text " The fix has been deployed." if @bug.fix_deployed?
end
end
def duplicate_bar
div(class: 'alert warning') do
text "This bug is a duplicate of "
link_to "##{number_with_delimiter @bug.duplicate_of.number}", project_environment_bug_url(@project, @environment, @bug.duplicate_of)
text "."
end
end
def uneditable_bar
p(class: 'alert info') do
text "You will need to "
a "join this project", href: join_project_my_membership_url(@project), :'data-sqmethod' => 'POST', id: 'join-link'
text " to edit this bug. "
end
end
def bug_info
h5 "Message"
pre @bug.message_template, class: 'scrollable'
h5 "Location"
bug_location
if @bug.special_file?
case @bug.file #TODO don't guess, record this information
when /^0x/
p "This bug has not been symbolicated. If you would like meaningful backtraces, please upload a symbolication file using your language’s client library.", class: 'alert info'
when /^https?:\/\//
p "No JavaScript source map was found for this bug. If you would like meaningful backtraces, please upload a source map using the Squash JavaScript client library.", class: 'alert info'
when /\.java$/
p "No Java renamelog was found for this bug. If you would like more meaningful backtraces, please upload a renamelog.xml file using the Squash Java deobfuscator.", class: 'alert info'
else
p "The backtraces for this bug cannot be displayed because they are in an unknown format.", class: 'alert error'
end
end
end
def bug_location
p(id: 'location') do
if @bug.special_file?
case @bug.file # TODO don't guess, record this information
when /^\[S\] / then text("<simple blamer> ")
else text("#{@bug.file} ")
end
else
text "#{@bug.file}, line #{number_with_delimiter @bug.line} "
end
span(class: 'aux') do
text "(revision "
text! commit_link(@project, @bug.revision)
text ")"
end
end
unless @bug.library_file?
p(id: 'editor-links') do
text! editor_link 'textmate', @project, @bug.file, @bug.line; br
text! editor_link 'sublime', @project, @bug.file, @bug.line; br
text! editor_link 'vim', @project, @bug.file, @bug.line; br
text! editor_link 'emacs', @project, @bug.file, @bug.line; br
text! editor_link 'rubymine', @project, @bug.file, @bug.line
end
pre class: 'context', :'data-project' => @project.to_param, :'data-revision' => @bug.revision, :'data-file' => @bug.file, :'data-line' => @bug.line
end
end
def tab_header
ul(class: 'tab-header') do
li(class: 'active') { a "History", href: '#history', rel: 'tab' }
li { a "Git Blame", href: '#blame', rel: 'tab' } if @bug.blamed_revision
li { a "The Fix", href: '#fix', rel: 'tab' } if @bug.resolution_revision
li { a "Management", href: '#management', rel: 'tab' } if current_user.role(@project)
li { a "Notifications", href: '#notifications', rel: 'tab' }
li do
a(href: '#comments', rel: 'tab') do
text "Comments"
text " (#{number_with_delimiter @bug.comments_count})" if @bug.comments_count > 0
end
end
li { a "Aggregation", href: '#aggregation', rel: 'tab' }
li(class: 'with-table') do
a(href: '#occurrences', rel: 'tab') do
text "Occurrences"
text " (#{number_with_delimiter @bug.occurrences_count})" if @bug.occurrences_count > 0
end
end
end
end
def tab_content
div(class: 'tab-content tab-primary') do
div(class: 'active', id: 'history') { history_tab }
div(id: 'blame') { blame_tab } if @bug.blamed_revision
div(id: 'fix') { fix_tab } if @bug.resolution_revision
div(id: 'management') { management_tab } if current_user.role(@project)
div(id: 'notifications') { notifications_tab }
div(id: 'comments') { comments_tab }
div(id: 'aggregation') { aggregation_tab }
div(class: 'with-table', id: 'occurrences') { occurrences_tab }
end
end
def history_tab
dl do
dt "First occurrence"
dd { time id: 'first-occurrence', datetime: @bug.first_occurrence.xmlschema }
dt "Latest occurrence"
dd { time id: 'latest-occurrence', datetime: @bug.latest_occurrence.xmlschema }
end
h4 "Occurrence Histogram"
div id: 'histogram'
h4 "Recent Events"
ul id: 'events'
end
def blame_tab
if @bug.blamed_commit
victims = @bug.blamed_users
p do
text "According to the VCS blame function, fault seems to lie with "
text! victims.map { |v| capture { mail_to v.email, (v.user.try!(:name) || v.email) } }.to_sentence
text ".*"
end if victims.any?
commit_summary @bug.blamed_commit
p("*The mailto link is not provided for purposes of sending hate mail.", class: 'small') if victims.any?
diff 'blame', @bug.blamed_commit
else
p do
text "According to the VCS blame function, commit "
text! commit_link(@project, @bug.blamed_revision)
text " seems to be at fault. This revision does not appear in the Git repository. (You might be able to fix this by refreshing the page.)"
end
end
end
def fix_tab
if !@bug.fixed?
div "This bug was automatically reopened. Perhaps the fix below didn’t work?", class: 'alert important'
end
if @bug.resolution_commit
commit_summary @bug.resolution_commit
diff 'fix', @bug.resolution_commit
else
p do
text "This bug was fixed by commit "
text! commit_link(@project, @bug.resolution_revision)
text ". This revision does not appear in the Git repository. (You might be able to fix this by refreshing the page.)"
end
end
end
def management_tab
p { em "How are things going with this bug?" }
form_for [@project, @environment, @bug], format: 'json', html: {class: 'labeled whitewashed', id: 'management-form'} do |f|
fieldset do
h5 "We’re working on it."
f.label :assigned_user_id
f.select :assigned_user_id, @project.members.order('username ASC').map { |u| ["#{u.username} (#{u.name})", u.id] }, include_blank: true
div do
f.label :jira_issue
div(class: 'field-group') do
span(class: 'input-append') do
f.text_field :jira_issue, placeholder: "PROJECT-123", size: 14
span " ", class: 'add-on', id: 'jira-status'
end
label " or create new JIRA issue in ", for: 'jira-projects'
select id: 'jira-projects', name: 'jira-projects', disabled: 'disabled'
end
p class: 'help-block', id: 'jira-name'
f.label :jira_status_id, "mark this bug as fixed once the issue is"
f.select :jira_status_id, [["Loading…", nil]], disabled: true
p "With this option, you can automatically close one or more bugs when a JIRA issue is resolved.", class: 'help-block'
end unless Squash::Configuration.jira.disabled?
end
fieldset do
h5 "We fixed it."
f.label(:fixed) do
f.check_box :fixed
text "This bug has been fixed", class: 'checkbox-label'
end
f.label :resolution_revision
f.text_field :resolution_revision, maxlength: 40
f.label(:fix_deployed) do
f.check_box :fix_deployed
text "The fix for this bug has been deployed", class: 'checkbox-label'
end
end
fieldset do
h5 "It’s not really a bug; no one’s going to fix it."
f.label(:irrelevant) do
f.check_box :irrelevant
text "Keep this bug, but don’t notify anyone about it", class: 'checkbox-label'
end
p "… or …"
button "Delete this bug",
href: project_environment_bug_url(@project, @environment, @bug),
'data-sqmethod' => 'DELETE',
class: 'warning',
'data-sqconfirm' => "Are you sure you want to delete this bug and all its occurrences?"
p(class: 'help-block') do
text "This will remove all occurrences, comments, etc. Use for (e.g.) sensitive data or false notifications."
text " All bugs marked as duplicate of this bug will be deleted as well." if @bug.duplicate?
end
end
fieldset do
h5 "It’s a duplicate of another bug."
f.label :duplicate_of_number
div(class: 'input-prepend') do
span '#', class: 'add-on'
f.number_field :duplicate_of_number, disabled: @bug.duplicate?, class: 'input-small'
end
unless @bug.duplicate?
p "Make sure you enter the number correctly! This cannot be undone. All occurrences of this bug (past, present, and future) will be moved over to the bug you specify here.", class: 'help-block'
end
end
fieldset do
h5 "… and I’d like to add a comment."
div(class: 'comment') do
h6(class: 'comment-author') do
image_tag current_user.gravatar
link_to current_user.name, account_url
end
image_tag 'comment-arrow.png'
div(class: 'comment-body') do
fields_for @bug.comments.build do |nc|
nc.text_area :body, rows: 4, cols: '', id: nil
end
end
end
end
div(class: 'form-actions') { f.submit class: 'default' }
end
end
def notifications_tab
form(class: 'labeled whitewashed') do
label do
input type: 'checkbox', checked: @bug.notify_on_occurrence.include?(current_user.id), name: 'bug[notify_on_occurrence]', id: 'notify_on_occurrence'
text "Email me whenever a new occurrence of this bug is recorded"
end
label do
input type: 'checkbox', checked: @bug.notify_on_deploy.include?(current_user.id), name: 'bug[notify_on_deploy]', id: 'notify_on_deploy'
text "Email me when the fix for this bug is deployed"
end
end
if @project.pagerduty_service_key?
form_for([@project, @environment, @bug], format: 'json', html: {class: 'labeled whitewashed', id: 'page-threshold-form'}) do |f|
fieldset do
h5 "Page the team when this bug occurs a lot"
p "You will be paged even if the bug is marked as unimportant. This is useful for exceptions you do not intend to fix, but can blow up."
f.label :page_threshold, "this many exceptions occur"
f.number_field :page_threshold, class: 'input-small'
f.label :page_period, "in this period of time"
span(class: 'input-append') do
f.number_field :page_period, class: 'input-small input-inline'
span " seconds"
end
end
div(class: 'form-actions') { f.submit class: 'default' }
end
end
nt = current_user.notification_thresholds.find_by_bug_id(@bug.id) || NotificationThreshold.new
form_for(nt, url: project_environment_bug_notification_threshold_url(@project, @environment, @bug, format: 'json'), html: {class: 'labeled whitewashed', id: 'notification-form'}) do |f|
fieldset do
h5 "Email me when this bug occurs a lot"
f.label :threshold, "this many exceptions occur"
f.number_field :threshold, class: 'input-small'
f.label :period, "in this period of time"
span(class: 'input-append') do
f.number_field :period, class: 'input-small input-inline'
span " seconds"
end
div(class: 'form-actions') do
f.submit class: 'default'
button_to 'Remove', project_environment_bug_notification_threshold_url(@project, @environment, @bug), :'data-sqmethod' => 'DELETE'
end
end
end
end
def comments_tab
div(class: 'comment') do
h5(class: 'comment-author') do
image_tag current_user.gravatar
link_to current_user.name, account_url
end
image_tag 'comment-arrow.png'
div(class: 'comment-body') do
form_for [@project, @environment, @bug, @bug.comments.build] do |f|
f.text_area :body, rows: 4, cols: ''
p { f.submit class: 'default' }
end
end
end
div(id: 'comments-list')
end
def aggregation_tab
div(class: 'inset-content') do
aggregation_options
div id: 'aggregation-charts'
end
end
def occurrences_tab
table id: 'occurrences-table'
end
def commit_summary(commit)
pre <<-COMMIT, class: 'brush: git; light: true'
commit #{commit.sha}
Author: #{commit.author.name} <#{commit.author.email}>
Date: #{l commit.author.date, format: :git}
#{word_wrap commit.message}
COMMIT
end
def diff(id, commit)
return unless commit.parents.size == 1
diffs = @project.repo.diff(commit.parent, commit)
return if diffs.size > 30 || diffs.size == 0
details(class: 'diff') do
summary "Diff"
accordion('diffs') do |acc|
diffs.each_with_index do |diff, index|
render_diff diff, id, index, acc
end
end
end
end
def render_diff(diff, id, index, acc)
deletions = diff.patch.split("\n").select { |l| l.start_with?('-') }.size - 1
additions = diff.patch.split("\n").select { |l| l.start_with?('+') }.size - 1
icon = if diff.type == 'new' then 'plus-circle'
elsif diff.type == 'deleted' then 'minus-circle'
elsif diff.type == 'renamed' then 'share'
else 'edit' end
title = <<-HTML.html_safe
<i class="fa fa-#{icon}"></i>
<strong>#{diff.path}</strong>
<code class=short>#{diff.type}</code>
<span class="additions-deletions">
HTML
title << <<-HTML.html_safe if additions > 0
<span class="additions">+#{number_with_delimiter additions}</span>
HTML
title << <<-HTML.html_safe if deletions > 0
<span class="deletions">-#{number_with_delimiter deletions}</span>
HTML
title << <<-HTML.html_safe
</span>
HTML
acc.accordion_item("#{id}-diff-#{index}", title, diff.path == @bug.file) do
if diff.binary?
p "(binary)"
else
pre diff.patch.encode('UTF-8'), class: 'brush: diff, light: true'
end
end
end
def aggregation_options
form(id: 'aggregation-filter') do
p "Select up to four dimensions to analyze:"
div(id: 'aggregation-options') do
4.times do
div { select_tag "dimensions[]", options_for_select(@aggregation_dimensions), id: nil }
end
div(id: 'agg-submit') { submit_tag "Go", class: 'default small' }
end
end
end
end
end
end
| SquareSquash/web/app/views/bugs/show.html.rb/0 | {
"file_path": "SquareSquash/web/app/views/bugs/show.html.rb",
"repo_id": "SquareSquash",
"token_count": 8491
} | 107 |
# encoding: utf-8
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require Rails.root.join('app', 'views', 'layouts', 'application.html.rb')
module Views
# @private
module Project
# @private
module Membership
# @private
class Edit < Views::Layouts::Application
needs :project, :membership
protected
def page_title() "My Membership in #{@project.name}" end
def body_content
full_width_section do
div(class: 'row') do
div(class: 'four columns') { h5 "Email notifications" }
div(class: 'twelve columns') { email_settings }
end
div(class: 'row') do
div(class: 'four columns') { h5 "Emails I’ve taken responsibility for" }
div(class: 'twelve columns') { email_aliases }
end
end
end
def sidebar
div(class: 'inset') do
project_owner
project_overview
if current_user.role(@project) != :owner && !current_user.role(@project).nil?
p { button_to "Leave Project", project_my_membership_url(@project), 'data-sqmethod' => 'DELETE', class: 'warning' }
end
end
ul(class: 'nav-list') { sidebar_projects }
end
def breadcrumbs() [@project, 'Membership'] end
private
def project_owner
h4 "Owner"
div(class: 'profile-widget') do
image_tag @project.owner.gravatar
h5 { link_to @project.owner.name, user_url(@project.owner) }
p { strong @project.owner.username }
p "Project created on #{l @project.created_at, format: :short_date}."
end
end
def project_overview
h4 "Overview"
dl do
dt "Environments"
dd number_with_delimiter(@project.environments.count)
dt "Members"
dd do
text number_with_delimiter(@project.memberships.count)
text " ("
text pluralize_with_delimiter(@project.memberships.where(admin: true).count, 'administrator')
text ")"
end
end
end
def email_settings
form_for(@membership,
url: {controller: 'project/membership', action: 'update', project_id: @project.to_param},
method: :patch,
html: {class: 'labeled'}) do |f|
fieldset do
h5 "email me when…"
f.label(:send_assignment_emails) do
f.check_box :send_assignment_emails
text "I am assigned to a bug"
end
f.label(:send_comment_emails) do
f.check_box :send_comment_emails
text "Someone comments on a bug"
end
p "You will only be notified for bugs you are assigned to or have commented on.", class: 'help-block'
f.label(:send_resolution_emails) do
f.check_box :send_resolution_emails
text "Someone else resolves a bug I am assigned to"
end
div(class: 'form-actions') { f.submit class: 'default' }
end
end
end
def email_aliases
div id: 'email-aliases'
p do
text <<-TEXT
If you want to take responsibility for all exceptions caused by
someone else’s commits to this project, add his or her email address
above. You’ll be emailed instead. If you want to take responsibility
for that person’s exceptions across all projects (say, s/he left the
company), visit
TEXT
link_to "your account page", account_url
text '.'
end
end
end
end
end
end
| SquareSquash/web/app/views/project/membership/edit.html.rb/0 | {
"file_path": "SquareSquash/web/app/views/project/membership/edit.html.rb",
"repo_id": "SquareSquash",
"token_count": 2077
} | 108 |
---
disabled: true
api_key: YOUR_PRODUCTION_SQUASH_API_KEY
api_host: YOUR_URL
| SquareSquash/web/config/environments/production/dogfood.yml/0 | {
"file_path": "SquareSquash/web/config/environments/production/dogfood.yml",
"repo_id": "SquareSquash",
"token_count": 32
} | 109 |
# Ugh. The sourcemap gem defines a module called SourceMap, which shares the name
# of one of our models. So we have to rename it before we load our model.
if ::SourceMap.kind_of?(Module)
::GemSourceMap = ::SourceMap
Object.send :remove_const, :SourceMap
elsif ::SourceMap.kind_of?(Class)
raise "SourceMap (the model) defined prior to SourceMap (the module) -- see application.rb"
else
raise "SourceMap must be defined -- see application.rb"
end
# and redefine the methods that use the other SourceMap class
# @private
class Sprockets::Asset
def sourcemap
relative_path = if pathname.to_s.include?(Rails.root.to_s)
pathname.relative_path_from(Rails.root)
else
pathname
end.to_s
# any extensions after the ".js" can be removed, because they will have
# already been processed
relative_path.gsub! /(?<=\.js)\..*$/, ''
resource_path = [Rails.application.config.assets.prefix, logical_path].join('/')
mappings = Array.new
to_s.lines.each_with_index do |_, index|
offset = GemSourceMap::Offset.new(index, 0)
mappings << GemSourceMap::Mapping.new(relative_path, offset, offset)
end
GemSourceMap::Map.new(mappings, resource_path)
end
end
# @private
class Sprockets::BundledAsset < Sprockets::Asset
def sourcemap
to_a.inject(GemSourceMap::Map.new) do |map, asset|
map + asset.sourcemap
end
end
end
| SquareSquash/web/config/preinitializers/source_maps.rb/0 | {
"file_path": "SquareSquash/web/config/preinitializers/source_maps.rb",
"repo_id": "SquareSquash",
"token_count": 561
} | 110 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Finds PRE tags of class "context" and asynchronously loads context data from
# the Git repository. Displays a selected line of code from the repo with 3
# lines of context above and below.
#
jQuery.fn.applyContext = ->
for tag in this
do (tag) ->
element = $(tag)
$.ajax "/projects/#{element.attr 'data-project'}/commits/#{element.data 'revision'}/context.json",
type: 'GET'
data: $.param
file: element.data('file')
line: element.data('line')
context: (element.data('context') || 3)
success: (snippet) ->
element.text(snippet.code).removeClass().addClass("brush: #{snippet.brush}; ruler: true; first-line: #{snippet.first_line}; highlight: #{element.data('line')}; toolbar: false; unindent: false")
SyntaxHighlighter.highlight()
error: (xhr) ->
if xhr && xhr.responseText
element.text JSON.parse(xhr.responseText).error
else
element.text "Couldn’t load context."
this
# Loads context data for any appropriate PRE tags already on the page at load
# time.
#
$(document).ready -> $('pre.context').applyContext()
| SquareSquash/web/lib/assets/javascripts/context.js.coffee/0 | {
"file_path": "SquareSquash/web/lib/assets/javascripts/context.js.coffee",
"repo_id": "SquareSquash",
"token_count": 634
} | 111 |
@import "vars";
.accordion {
margin: 10px 0;
&>.accordion-pair {
&>h5 {
background-color: $gray5;
margin: 0;
padding: 10px 20px;
border-radius: $radius-size;
margin-top: 5px;
a { text-decoration: none; }
}
&:first-child>h5 { margin-top: 0; }
&>div {
padding: 10px 20px;
background-color: white;
border-bottom-left-radius: $radius-size;
border-bottom-right-radius: $radius-size;
}
&.shown {
&>h5 {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
}
}
}
| SquareSquash/web/lib/assets/stylesheets/accordion.css.scss/0 | {
"file_path": "SquareSquash/web/lib/assets/stylesheets/accordion.css.scss",
"repo_id": "SquareSquash",
"token_count": 295
} | 112 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'digest/sha2'
module Blamer
# A simple, Git-free blamer that groups occurrences with identical stack
# traces. While less cool than the {Blamer::Recency Recency} blamer, it has
# the advantage of not requiring access to the Git repository.
class Simple < Base
protected
def bug_search_criteria
@special = true
file = '[S] ' + Digest::SHA2.hexdigest(occurrence.faulted_backtrace.to_json)
{
class_name: occurrence.bug.class_name,
file: file,
line: 1,
blamed_revision: nil
}
end
end
end
| SquareSquash/web/lib/blamer/simple.rb/0 | {
"file_path": "SquareSquash/web/lib/blamer/simple.rb",
"repo_id": "SquareSquash",
"token_count": 435
} | 113 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Worker that loads Occurrences affected by the addition of a new
# Symbolication, and attempts to symbolicate them using the new map.
class SymbolicationWorker
include BackgroundRunner::Job
# Creates a new worker instance and performs a symbolication.
#
# @param [Integer] uuid The UUID of a {Symbolication}.
def self.perform(uuid)
new(Symbolication.find_by_uuid!(uuid)).perform
end
# Creates a new worker instance.
#
# @param [Symbolication] sym A symbolication to process.
def initialize(sym)
@symbolication = sym
end
# Locates relevant Occurrences and attempts to symbolicate them.
def perform
@symbolication.occurrences.cursor.each do |occ|
begin
occ.symbolicate! @symbolication
occ.recategorize!
rescue => err
# for some reason the cursors gem eats exceptions
Squash::Ruby.notify err, occurrence: occ
end
end
end
end
| SquareSquash/web/lib/workers/symbolication_worker.rb/0 | {
"file_path": "SquareSquash/web/lib/workers/symbolication_worker.rb",
"repo_id": "SquareSquash",
"token_count": 492
} | 114 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'rails_helper'
class FakeController < ApplicationController
def self.helper_method(*args) end
def logger(*args) Rails.logger end
def session() @session ||= Hash.new end
def _current_user() @current_user end
def _current_user=(u) @current_user = u end
include AuthenticationHelpers
end
RSpec.describe AuthenticationHelpers, type: :integration do
before(:all) { @user = FactoryGirl.create(:user) }
before(:each) { @controller = FakeController.new }
describe "#log_out" do
it "should clear the session and @current_user" do
@controller.session[:user_id] = @user.id
@controller._current_user = @user
@controller.log_out
expect(@controller.session[:user_id]).to be_nil
expect(@controller._current_user).to be_nil
end
end
describe "#current_user" do
it "should return the cached user" do
@controller._current_user = @user
@controller.session[:user_id] = @user.id
expect(@controller.current_user).to eql(@user)
end
it "should locate the user from the session" do
@controller.session[:user_id] = @user.id
expect(@controller.current_user).to eql(@user)
expect(@controller._current_user).to eql(@user)
end
it "should return nil if the session is blank, even if there is a cached user" do
@controller._current_user = @user
expect(@controller.current_user).to be_nil
end
end
describe "#logged_in?" do
it "should return true if the user is logged in" do
@controller.send :log_in_user, @user
expect(@controller.logged_in?).to eql(true)
end
it "should return false if the user is logged out" do
@controller.log_out
expect(@controller.logged_in?).to eql(false)
end
end
describe "#logged_out?" do
it "should return true if the user is logged out" do
@controller.log_out
expect(@controller.logged_out?).to eql(true)
end
it "should return false if the user is logged in" do
@controller.send :log_in_user, @user
expect(@controller.logged_out?).to eql(false)
end
end
describe "#login_required" do
it "should return true if the user is logged in" do
@controller.send :log_in_user, @user
expect(@controller.send(:login_required)).to eql(true)
end
it "should return false and redirect if the user is logged out" do
expect(@controller).to receive(:respond_to).once
@controller.log_out
expect(@controller.send(:login_required)).to eql(false)
end
end
describe "#must_be_unauthenticated" do
it "should return false and redirect if the user is logged in" do
expect(@controller).to receive(:respond_to).once
@controller.send :log_in_user, @user
expect(@controller.send(:must_be_unauthenticated)).to eql(false)
end
it "should return true if the user is logged out" do
@controller.log_out
expect(@controller.send(:must_be_unauthenticated)).to eql(true)
end
end
describe "#log_in_user" do
it "should set the session and the cached user" do
@controller.send :log_in_user, @user
expect(@controller.session[:user_id]).to eql(@user.id)
expect(@controller._current_user).to eql(@user)
end
end
end
| SquareSquash/web/spec/controllers/additions/authentication_helpers_spec.rb/0 | {
"file_path": "SquareSquash/web/spec/controllers/additions/authentication_helpers_spec.rb",
"repo_id": "SquareSquash",
"token_count": 1390
} | 115 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'rails_helper'
RSpec.describe Project::MembershipController, type: :controller do
describe "#join" do
before :each do
@project = FactoryGirl.create(:project)
@user = FactoryGirl.create(:user)
end
it "should require a logged-in user" do
post :join, project_id: @project.to_param
expect(response).to redirect_to(login_url(next: request.fullpath))
expect(@project.memberships.count).to eql(1)
end
context "[authenticated]" do
before(:each) { login_as @user }
it "should redirect given an existing membership" do
FactoryGirl.create :membership, project: @project, user: @user
post :join, project_id: @project.to_param
expect(response).to redirect_to(project_url(@project))
expect(@project.memberships.count).to eql(2)
end
it "should create a new membership" do
post :join, project_id: @project.to_param
expect(response).to redirect_to(project_url(@project))
expect(@project.memberships.count).to eql(2)
expect(@user.role(@project)).to eql(:member)
end
end
end
describe "#update" do
before(:each) { @membership = FactoryGirl.create(:membership) }
it "should require a logged-in user" do
patch :update, project_id: @membership.project.to_param, membership: {send_comment_emails: '1'}
expect(response).to redirect_to(login_url(next: request.fullpath))
expect(@membership.reload.send_comment_emails).to eql(false)
end
context "[authenticated]" do
before(:each) { login_as @membership.user }
it "should modify the membership" do
patch :update, project_id: @membership.project.to_param, membership: {send_comment_emails: '1'}
expect(response.status).to redirect_to(edit_project_my_membership_url(@membership.project))
expect(@membership.reload.send_comment_emails).to eql(true)
end
it "should not allow protected attributes to be updated" do
patch :update, project_id: @membership.project.to_param, membership: {project_id: 123}
expect { @membership.reload }.not_to change(@membership, :project_id)
end
end
end
describe "#destroy" do
before(:each) { @membership = FactoryGirl.create(:membership) }
it "should require a logged-in user" do
delete :destroy, project_id: @membership.project.to_param
expect(response).to redirect_to(login_url(next: request.fullpath))
end
it "should not allow the owner to delete his/her project" do
login_as @membership.project.owner
delete :destroy, project_id: @membership.project.to_param
expect(response).to redirect_to(account_url)
end
context "[authenticated]" do
before(:each) { login_as @membership.user }
it "should delete the membership" do
delete :destroy, project_id: @membership.project.to_param
expect(response).to redirect_to(account_url)
expect { @membership.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
end
| SquareSquash/web/spec/controllers/project/membership_controller_spec.rb/0 | {
"file_path": "SquareSquash/web/spec/controllers/project/membership_controller_spec.rb",
"repo_id": "SquareSquash",
"token_count": 1341
} | 116 |
HTTP/1.1 200 OK
Server: nginx/1.0.14
Date: Wed, 14 Nov 2012 04:09:11 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
X-UA-Compatible: IE=Edge,chrome=1
Cache-Control: no-cache
X-Request-Id: 20436b8395ad658aa642721c14fda3ef
X-Runtime: 0.019127
X-Rack-Cache: invalidate, pass
Set-Cookie: uid=CqQdA1CjGWdd8GH+jTjOAg==; expires=Thu, 31-Dec-37 23:55:55 GMT; domain=pagerduty.com; path=/
{"status":"success","message":"You did it!"}
| SquareSquash/web/spec/fixtures/pagerduty_response.json/0 | {
"file_path": "SquareSquash/web/spec/fixtures/pagerduty_response.json",
"repo_id": "SquareSquash",
"token_count": 205
} | 117 |
# encoding: utf-8
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'rails_helper'
RSpec.describe Bug, type: :model do
context "[database rules]" do
it "should automatically increment/decrement occurrences_count" do
bug = FactoryGirl.create(:bug)
expect(bug.occurrences_count).to be_zero
occurrence = FactoryGirl.create(:rails_occurrence, bug: bug)
expect(bug.reload.occurrences_count).to eql(1)
occurrence.destroy
expect(bug.reload.occurrences_count).to be_zero
end
it "should automatically increment/decrement comments_count" do
bug = FactoryGirl.create(:bug)
owner = bug.environment.project.owner
expect(bug.comments_count).to be_zero
comment = FactoryGirl.create(:comment, bug: bug, user: owner)
expect(bug.reload.comments_count).to eql(1)
comment.destroy
expect(bug.reload.comments_count).to be_zero
end
it "should automatically set latest_occurrence" do
bug = FactoryGirl.create(:bug)
expect(bug.latest_occurrence).to be_nil
occurrence = FactoryGirl.create(:rails_occurrence, bug: bug)
expect(bug.reload.latest_occurrence).to eql(occurrence.occurred_at)
occurrence = FactoryGirl.create(:rails_occurrence, bug: bug, occurred_at: occurrence.occurred_at + 1.day)
expect(bug.reload.latest_occurrence).to eql(occurrence.occurred_at)
FactoryGirl.create :rails_occurrence, bug: bug, occurred_at: occurrence.occurred_at - 5.hours
expect(bug.reload.latest_occurrence).to eql(occurrence.occurred_at)
end
it "should set number sequentially for a given bug" do
env1 = FactoryGirl.create(:environment)
env2 = FactoryGirl.create(:environment)
bug1_1 = FactoryGirl.create(:bug, environment: env1)
bug1_2 = FactoryGirl.create(:bug, environment: env1)
bug2_1 = FactoryGirl.create(:bug, environment: env2)
bug2_2 = FactoryGirl.create(:bug, environment: env2)
expect(bug1_1.number).to eql(1)
expect(bug1_2.number).to eql(2)
expect(bug2_1.number).to eql(1)
expect(bug2_2.number).to eql(2)
end
it "should not reuse deleted numbers" do
#bug = FactoryGirl.create(:bug)
#FactoryGirl.create :occurrence, bug: bug
#FactoryGirl.create(:occurrence, bug: bug).destroy
#FactoryGirl.create(:occurrence, bug: bug).number.should eql(3)
#TODO get this part of the spec to work (for URL-resource identity integrity)
bug = FactoryGirl.create(:bug)
FactoryGirl.create :rails_occurrence, bug: bug
c = FactoryGirl.create(:rails_occurrence, bug: bug)
FactoryGirl.create :rails_occurrence, bug: bug
c.destroy
expect(FactoryGirl.create(:rails_occurrence, bug: bug).number).to eql(4)
end
end
context "[hooks]" do
it "should downcase the revision" do
expect(FactoryGirl.create(:bug, revision: '2DC20C984283BEDE1F45863B8F3B4DD9B5B554CC').revision).to eql('2dc20c984283bede1f45863b8f3b4dd9b5b554cc')
end
it "should set fixed_at when a bug is fixed" do
bug = FactoryGirl.create(:bug)
expect(bug.fixed_at).to be_nil
bug.fixed = true
bug.save!
expect(bug.fixed_at.to_i).to be_within(2).of(Time.now.to_i)
end
context "[PagerDuty integration]" do
before :each do
@project = FactoryGirl.create(:project, pagerduty_service_key: 'abc123', pagerduty_enabled: true)
@environment = FactoryGirl.create(:environment, project: @project, notifies_pagerduty: true)
@user = FactoryGirl.create(:membership, project: @project).user
@bug = FactoryGirl.create(:bug, environment: @environment)
end
it "should not send any PagerDuty events when the bug is modified other than described below" do
expect_any_instance_of(Service::PagerDuty).not_to receive(:acknowledge)
expect_any_instance_of(Service::PagerDuty).not_to receive(:resolve)
@bug.update_attribute :jira_issue, 'ONCALL-1367'
end
it "should send a PagerDuty acknowledge event when the bug is assigned" do
expect_any_instance_of(Service::PagerDuty).to receive(:acknowledge).once.with(
@bug.pagerduty_incident_key,
/was assigned to #{Regexp.escape @user.name}/,
an_instance_of(Hash)
)
@bug.update_attribute :assigned_user, @user
end
it "should send a PagerDuty acknowledge event when the bug is marked irrelevant" do
expect_any_instance_of(Service::PagerDuty).to receive(:acknowledge).once.with(
@bug.pagerduty_incident_key,
/was marked as irrelevant/,
an_instance_of(Hash)
)
@bug.update_attribute :irrelevant, true
end
it "should send a PagerDuty acknowledge event when the bug is resolved" do
expect_any_instance_of(Service::PagerDuty).to receive(:acknowledge).once.with(
@bug.pagerduty_incident_key,
/was marked as resolved/,
an_instance_of(Hash)
)
@bug.update_attribute :fixed, true
end
it "should send a PagerDuty resolve event when the bug is deployed" do
expect_any_instance_of(Service::PagerDuty).to receive(:acknowledge).once
@bug.update_attribute :fixed, true
expect_any_instance_of(Service::PagerDuty).to receive(:resolve).once.with(
@bug.pagerduty_incident_key,
/was deployed/
)
@bug.update_attribute :fix_deployed, true
end
it "should not send any events when the environment has PagerDuty disabled" do
@environment.update_attribute :notifies_pagerduty, false
@bug.reload
expect_any_instance_of(Service::PagerDuty).not_to receive(:resolve)
@bug.update_attribute :fixed, true
end
it "should not send any events when the project has no PagerDuty configuration" do
@project.update_attribute :pagerduty_service_key, nil
@bug.reload
expect_any_instance_of(Service::PagerDuty).not_to receive(:resolve)
@bug.update_attribute :fixed, true
end
it "should send events when the project has PagerDuty incident reporting disabled" do
@project.update_attribute :pagerduty_enabled, false
@bug.reload
expect_any_instance_of(Service::PagerDuty).to receive(:acknowledge).once
@bug.update_attribute :fixed, true
end
end unless Squash::Configuration.pagerduty.disabled?
end
context "[validations]" do
it "should not allow an unfixed bug to be marked as fix_deployed" do
bug = FactoryGirl.build(:bug, fixed: false, fix_deployed: true)
expect(bug).not_to be_valid
expect(bug.errors[:fix_deployed]).not_to be_empty
end
it "should only let project members be assigned to bugs" do
bug = FactoryGirl.create(:bug)
bug.assigned_user = FactoryGirl.create(:user)
expect(bug).not_to be_valid
expect(bug.errors[:assigned_user_id]).to eql(['is not a project member'])
end
end
context "[events]" do
before :all do
@environment = FactoryGirl.create(:environment)
@modifier = FactoryGirl.create(:membership, project: @environment.project).user
end
context "[open]" do
it "should create an open event when first created" do
bug = FactoryGirl.create(:bug, environment: @environment)
expect(bug.events.count).to eql(1)
expect(bug.events.first.kind).to eql('open')
end
end
context "[assign]" do
before :all do
@bug = FactoryGirl.create(:bug, environment: @environment)
@assignee = FactoryGirl.create(:membership, project: @environment.project).user
end
it "should create an assign event when assigned by a user to a user" do
@bug.update_attribute :assigned_user, nil
@bug.modifier = @modifier
@bug.update_attribute :assigned_user, @assignee
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('assign')
expect(event.user_id).to eql(@modifier.id)
expect(event.data['assignee_id']).to eql(@assignee.id)
end
it "should create an assign event when assigned by a user to to no one" do
@bug.update_attribute :assigned_user, @assignee
@bug.modifier = @modifier
@bug.update_attribute :assigned_user, nil
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('assign')
expect(event.user_id).to eql(@modifier.id)
expect(event.data['assignee_id']).to be_nil
end
it "should create an assign event when assigned by no one to a user" do
@bug.update_attribute :assigned_user, nil
@bug.modifier = nil
@bug.update_attribute :assigned_user, @assignee
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('assign')
expect(event.user_id).to be_nil
expect(event.data['assignee_id']).to eql(@assignee.id)
end
it "should create an assign event when assigned by no one to to no one" do
@bug.update_attribute :assigned_user, @assignee
@bug.modifier = nil
@bug.update_attribute :assigned_user, nil
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('assign')
expect(event.user_id).to be_nil
expect(event.data['assignee_id']).to be_nil
end
end
context "[dupe]" do
before(:each) { @bug = FactoryGirl.create(:bug, environment: @environment) }
it "should create a dupe event when marked as a duplicate by someone" do
original = FactoryGirl.create(:bug, environment: @bug.environment)
@bug.modifier = @modifier
@bug.update_attribute :duplicate_of, original
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('dupe')
expect(event.user_id).to eql(@modifier.id)
end
it "should create a dupe event when marked as a duplicate" do
original = FactoryGirl.create(:bug, environment: @bug.environment)
@bug.update_attribute :duplicate_of, original
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('dupe')
expect(event.user_id).to be_nil
end
end
context "[close]" do
before(:all) { @bug = FactoryGirl.create(:bug, environment: @environment) }
before(:each) { @revision = '8f29160c367cc3e73c112e34de0ee48c4c323ff7' }
it "should create a 'fixed' close event when fixed" do
@bug.modifier = nil
@bug.update_attribute :fixed, false
@bug.update_attribute :irrelevant, false
@bug.update_attributes fixed: true, resolution_revision: @revision
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('close')
expect(event.user_id).to be_nil
expect(event.data['status']).to eql('fixed')
expect(event.data['revision']).to eql(@revision)
end
it "should create a 'fixed' close event when fixed by a user" do
@bug.modifier = @modifier
@bug.update_attribute :fixed, false
@bug.update_attribute :irrelevant, false
@bug.update_attributes fixed: true, resolution_revision: @revision
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('close')
expect(event.user).to eql(@modifier)
expect(event.data['status']).to eql('fixed')
expect(event.data['revision']).to eql(@revision)
end
it "should create an 'irrelevant' close event when marked irrelevant" do
@bug.modifier = nil
@bug.update_attribute :fixed, false
@bug.update_attribute :irrelevant, false
@bug.update_attribute :irrelevant, true
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('close')
expect(event.user_id).to be_nil
expect(event.data['status']).to eql('irrelevant')
end
it "should create an 'irrelevant' close event when marked irrelevant by a user" do
@bug.modifier = @modifier
@bug.update_attribute :fixed, false
@bug.update_attribute :irrelevant, false
@bug.update_attribute :irrelevant, true
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('close')
expect(event.user).to eql(@modifier)
expect(event.data['status']).to eql('irrelevant')
end
it "should create a 'fixed' close event when fixed and marked irrelevant" do
@bug.update_attribute :fixed, false
@bug.update_attribute :irrelevant, false
@bug.fixed = true
@bug.irrelevant = true
@bug.resolution_revision = @revision
@bug.save!
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('close')
expect(event.data['status']).to eql('fixed')
expect(event.data['revision']).to eql(@revision)
end
end
context "[deploy]" do
before(:each) { @bug = FactoryGirl.create(:bug, environment: @environment, fixed: true) }
it "should create a deploy event when marked fix_deployed" do
@bug.update_attribute :fix_deployed, true
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('deploy')
expect(event.data['revision']).to be_nil
end
it "should create a deploy event with revision when marked fix_deployed by a deploy" do
@bug.update_attribute :fix_deployed, false
deploy = FactoryGirl.create(:deploy, environment: @environment)
@bug.fixing_deploy = deploy
@bug.update_attribute :fix_deployed, true
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('deploy')
expect(event.data['revision']).to eql(deploy.revision)
end
end
context "[reopen]" do
before :each do
@bug = FactoryGirl.create(:bug, environment: @environment, fixed: true)
@occurrence = FactoryGirl.create(:rails_occurrence, bug: @bug)
end
it "should send an email if the bug was reopened from a fixed state by the system" do
ActionMailer::Base.deliveries.clear
@bug.reopen @occurrence
allow(@bug).to receive(:blamed_email).and_return('blamed@example.com')
@bug.assigned_user = @modifier
@bug.save!
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include('Reopened')
expect(ActionMailer::Base.deliveries.first.to).to eql([@modifier.email])
end
it "should email the blamed user if no one is assigned" do
ActionMailer::Base.deliveries.clear
@bug.reopen @occurrence
allow(@bug).to receive(:blamed_email).and_return('blamed@example.com')
@bug.save!
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include('Reopened')
expect(ActionMailer::Base.deliveries.first.to).to eql(%w(blamed@example.com))
end
it "should not send an email if the bug was reopened from an irrelevant state" do
@bug.update_attribute :irrelevant, true
ActionMailer::Base.deliveries.clear
@bug.reopen @occurrence
allow(@bug).to receive(:blamed_email).and_return('blamed@example.com')
@bug.save!
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug was reopened by a user" do
ActionMailer::Base.deliveries.clear
@bug.reopen @modifier
allow(@bug).to receive(:blamed_email).and_return('blamed@example.com')
@bug.save!
expect(ActionMailer::Base.deliveries).to be_empty
end
{'user' => '@modifier', 'occurrence' => '@occurrence'}.each do |modifier_type, modifier|
context "[modifier is #{modifier_type}]" do
before(:each) { @bug.modifier = eval(modifier) }
it "should create an 'unfixed' reopen event when a relevant fixed bug is marked unfixed" do
@bug.update_attribute :fixed, false
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('reopen')
expect(event.data['from']).to eql('fixed')
if @bug.modifier.kind_of?(User)
expect(event.user).to eql(@bug.modifier)
else
expect(event.data['occurrence_id']).to eql(@bug.modifier.id)
end
end
it "should not create an 'unfixed' reopen event when an irrelevant fixed bug is marked unfixed" do
@bug.update_attributes irrelevant: true, fixed: true
Event.delete_all
@bug.update_attribute :fixed, false
expect(@bug.events(true).count).to be_zero
end
it "should create a 'relevant' reopen event when an unfixed irrelevant bug is marked relevant" do
@bug.update_attributes irrelevant: true, fixed: false
@bug.update_attribute :irrelevant, false
event = @bug.events(true).order('id ASC').last
expect(event.kind).to eql('reopen')
expect(event.data['from']).to eql('irrelevant')
if @bug.modifier.kind_of?(User)
expect(event.user).to eql(@bug.modifier)
else
expect(event.data['occurrence_id']).to eql(@bug.modifier.id)
end
end
it "should not create a 'relevant' reopen event when a fixed irrelevant bug is marked relevant" do
@bug.update_attributes irrelevant: true, fixed: true
Event.delete_all
@bug.update_attribute :irrelevant, false
expect(@bug.events(true).count).to be_zero
end
end
end
end
end
context "[emails]" do
context "[assignment]" do
before :all do
@project = FactoryGirl.create(:project)
@assigner = FactoryGirl.create(:membership, project: @project).user
@assignee = FactoryGirl.create(:membership, project: @project).user
end
before :each do
@bug = FactoryGirl.create(:bug, environment: FactoryGirl.create(:environment, project: @project))
ActionMailer::Base.deliveries.clear
end
it "should send an email when a user assigns the bug to another user" do
@bug.modifier = @assigner
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include("You have been assigned")
expect(ActionMailer::Base.deliveries.first.to).to include(@assignee.email)
end
it "should not send an email when the system assigns the bug to another user" do
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email when a user assigns the bug to himself" do
@bug.modifier = @assignee
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email when a user un-assigns a bug" do
@bug.modifier = @assigner
@bug.update_attribute :assigned_user, nil
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is fixed" do
@bug.update_attribute :fixed, true
ActionMailer::Base.deliveries.clear
@bug.modifier = @assigner
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is irrelevant" do
@bug.update_attribute :irrelevant, true
ActionMailer::Base.deliveries.clear
@bug.modifier = @assigner
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the environment has email sending disabled" do
@bug.environment.update_attribute :sends_emails, false
@bug.modifier = @assigner
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the user has assignment emails disabled" do
Membership.for(@assignee, @project).first.update_attribute :send_assignment_emails, false
@bug.modifier = @assigner
@bug.update_attribute :assigned_user, @assignee
expect(ActionMailer::Base.deliveries).to be_empty
end
end
context "[resolution]" do
before :all do
@project = FactoryGirl.create(:project)
@resolver = FactoryGirl.create(:membership, project: @project).user
@assigned = FactoryGirl.create(:membership, project: @project).user
end
before :each do
@bug = FactoryGirl.create(:bug,
environment: FactoryGirl.create(:environment, project: @project),
assigned_user: @assigned)
ActionMailer::Base.deliveries.clear
end
it "should send an email when someone other than the assigned user resolves a bug" do
@bug.modifier = @resolver
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include("was resolved")
expect(ActionMailer::Base.deliveries.first.to).to include(@assigned.email)
end
it "should send an email when the system resolves a bug" do
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include("was resolved")
expect(ActionMailer::Base.deliveries.first.to).to include(@assigned.email)
end
it "should not send an email when the assigned user resolves a bug" do
@bug.modifier = @assigned
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is marked irrelevant" do
@bug.update_attribute :irrelevant, true
ActionMailer::Base.deliveries.clear
@bug.modifier = @resolver
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is resolved and no one is assigned" do
@bug.update_attribute :assigned_user, nil
ActionMailer::Base.deliveries.clear
@bug.modifier = @resolver
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should send an email when someone other than the assigned user marks a bug irrelevant" do
@bug.modifier = @resolver
@bug.update_attribute :irrelevant, true
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include("was marked irrelevant")
expect(ActionMailer::Base.deliveries.first.to).to include(@assigned.email)
end
it "should send an email when the system marks a bug irrelevant" do
@bug.update_attribute :irrelevant, true
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include("was marked irrelevant")
expect(ActionMailer::Base.deliveries.first.to).to include(@assigned.email)
end
it "should not send an email when the assigned user marks a bug irrelevant" do
@bug.modifier = @assigned
@bug.update_attribute :irrelevant, true
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is resolved" do
@bug.update_attribute :fixed, true
ActionMailer::Base.deliveries.clear
@bug.modifier = @resolver
@bug.update_attribute :irrelevant, true
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is marked irrelevant and no one is assigned" do
@bug.update_attribute :assigned_user, nil
ActionMailer::Base.deliveries.clear
@bug.modifier = @resolver
@bug.update_attribute :irrelevant, true
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the environment has email sending disabled" do
@bug.environment.update_attribute :sends_emails, false
@bug.modifier = @assigned
@bug.update_attribute :assigned_user, @assigned
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the user has disabled resolution emails" do
Membership.for(@assigned, @project).first.update_attribute :send_resolution_emails, false
@bug.modifier = @resolver
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries).to be_empty
end
end
context "[initial]" do
before :each do
ActionMailer::Base.deliveries.clear
end
it "should send an email to the all mailing list" do
project = FactoryGirl.create(:project, all_mailing_list: 'foo@example.com')
env = FactoryGirl.create(:environment, project: project)
bug = FactoryGirl.create(:bug, environment: env)
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include(bug.class_name)
expect(ActionMailer::Base.deliveries.first.subject).to include(File.basename(bug.file))
expect(ActionMailer::Base.deliveries.first.to).to include('foo@example.com')
end
it "should not send an email if no all-bugs mailing list is specified" do
project = FactoryGirl.create(:project, all_mailing_list: nil)
env = FactoryGirl.create(:environment, project: project)
bug = FactoryGirl.create(:bug, environment: env)
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the environment has email sending disabled" do
project = FactoryGirl.create(:project, all_mailing_list: 'foo@example.com')
env = FactoryGirl.create(:environment, project: project, sends_emails: false)
bug = FactoryGirl.create(:bug, environment: env)
expect(ActionMailer::Base.deliveries).to be_empty
end
end
context "[blame]" do
before :each do
@bug = FactoryGirl.create(:bug)
ActionMailer::Base.deliveries.clear
end
it "should send an email to the blamed user" do
@bug = FactoryGirl.build(:bug)
allow(@bug).to receive(:blamed_email).and_return('foo@example.com')
allow(@bug).to receive(:blamed_commit).and_return('abc123')
@bug.save!
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include(@bug.class_name)
expect(ActionMailer::Base.deliveries.first.subject).to include(File.basename(@bug.file))
expect(ActionMailer::Base.deliveries.first.to).to include('foo@example.com')
end
it "should not send an email if no one is to blame" do
@bug = FactoryGirl.build(:bug)
allow(@bug).to receive(:blamed_email).and_return(nil)
@bug.save!
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the environment has email sending disabled" do
@bug = FactoryGirl.build(:bug, environment: FactoryGirl.create(:environment, sends_emails: false))
allow(@bug).to receive(:blamed_email).and_return('foo@example.com')
@bug.save!
expect(ActionMailer::Base.deliveries).to be_empty
end
# other specs in #blamed_email specs
end
context "[critical]" do
before :each do
@project = FactoryGirl.create(:project, critical_mailing_list: 'foo@example.com', critical_threshold: 3)
@bug = FactoryGirl.create(:bug, environment: FactoryGirl.create(:environment, project: @project))
ActionMailer::Base.deliveries.clear
end
it "should send an email to the critical mailing list once when the threshold is exceeded" do
FactoryGirl.create_list :rails_occurrence, 2, bug: @bug
expect(ActionMailer::Base.deliveries).to be_empty
FactoryGirl.create :rails_occurrence, bug: @bug
expect(ActionMailer::Base.deliveries.size).to eql(1)
expect(ActionMailer::Base.deliveries.first.subject).to include(@bug.class_name)
expect(ActionMailer::Base.deliveries.first.subject).to include(File.basename(@bug.file))
expect(ActionMailer::Base.deliveries.first.to).to include('foo@example.com')
FactoryGirl.create :rails_occurrence, bug: @bug
expect(ActionMailer::Base.deliveries.size).to eql(1)
end
it "should not send an email if the bug is marked as irrelevant" do
FactoryGirl.create_list :rails_occurrence, 2, bug: @bug
@bug.update_attribute :irrelevant, true
expect(ActionMailer::Base.deliveries).to be_empty
FactoryGirl.create :rails_occurrence, bug: @bug
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if the bug is fixed" do
FactoryGirl.create_list :rails_occurrence, 2, bug: @bug
@bug.update_attribute :fixed, true
expect(ActionMailer::Base.deliveries).to be_empty
FactoryGirl.create :rails_occurrence, bug: @bug
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if no critical mailing list is specified" do
@project.update_attribute :critical_mailing_list, nil
FactoryGirl.create_list :rails_occurrence, 3, bug: @bug
expect(ActionMailer::Base.deliveries).to be_empty
end
it "should not send an email if no critical mailing list is specified" do
@bug.environment.update_attribute :sends_emails, false
FactoryGirl.create_list :rails_occurrence, 3, bug: @bug
expect(ActionMailer::Base.deliveries).to be_empty
end
end
context "[occurrence]" do
before :all do
@project = FactoryGirl.create(:project)
@user1 = FactoryGirl.create(:membership, project: @project).user
@user2 = FactoryGirl.create(:membership, project: @project).user
@user3 = FactoryGirl.create(:membership, project: @project).user
@bug = FactoryGirl.create(:bug, environment: FactoryGirl.create(:environment, project: @project))
end
before(:each) { ActionMailer::Base.deliveries.clear }
it "should send an email to the users who have signed up to be notified of occurrences" do
@bug.update_attribute :notify_on_occurrence, [@user1, @user2].map(&:id)
@occurrence = FactoryGirl.create(:rails_occurrence, bug: @bug)
expect(ActionMailer::Base.deliveries.size).to eql(2)
expect(ActionMailer::Base.deliveries.map(&:to).flatten.sort).to eql([@user1.email, @user2.email])
ActionMailer::Base.deliveries.each { |d| expect(d.subject).to include('New occurrence') }
end
end
context "[deploy]" do
before :all do
@project = FactoryGirl.create(:project)
@user1 = FactoryGirl.create(:membership, project: @project).user
@user2 = FactoryGirl.create(:membership, project: @project).user
@user3 = FactoryGirl.create(:membership, project: @project).user
@bug = FactoryGirl.create(:bug, fixed: true, environment: FactoryGirl.create(:environment, project: @project))
end
before(:each) { ActionMailer::Base.deliveries.clear }
it "should send an email to the users who have signed up to be notified of deploys" do
@bug.update_attribute :notify_on_deploy, [@user1, @user2].map(&:id)
@bug.update_attribute :fix_deployed, true
expect(ActionMailer::Base.deliveries.size).to eql(2)
expect(ActionMailer::Base.deliveries.map(&:to).flatten.sort).to match_array([@user1.email, @user2.email])
ActionMailer::Base.deliveries.each { |d| expect(d.subject).to include('was deployed') }
end
end
end
context "[auto-watching]" do
before :each do
@user = FactoryGirl.create(:user)
@bug = FactoryGirl.create(:bug)
FactoryGirl.create :membership, user: @user, project: @bug.environment.project
end
it "should automatically have the assignee watch the bug when assigned" do
@user.watches.destroy_all
@bug.update_attribute :assigned_user, @user
expect(@user.watches.count).to eql(1)
expect(@user.watches(true).first.bug_id).to eql(@bug.id)
end
it "should do nothing if the assignee is already watching the bug" do
@user.watches.destroy_all
FactoryGirl.create :watch, user: @user, bug: @bug
@bug.update_attribute :assigned_user, @user
expect(@user.watches.count).to eql(1)
expect(@user.watches(true).first.bug_id).to eql(@bug.id)
end
end
describe "#blamed_users" do
before :each do
@bug = FactoryGirl.create(:bug)
@sean = FactoryGirl.create(:user, first_name: 'Sean', last_name: 'Sorrell', username: 'ssorrell')
@karen = FactoryGirl.create(:user, first_name: 'Karen', last_name: 'Liu', username: 'karen')
@lewis = FactoryGirl.create(:user, first_name: 'mike', last_name: 'lewis', username: 'lewis')
[@sean, @karen, @lewis].each do |user|
FactoryGirl.create :membership, user: user, project: @bug.environment.project
end
end
before(:each) do
allow(@bug).to receive(:blamed_commit).and_return(double('Git::Commit'))
allow(@bug.blamed_commit).to receive(:author).and_return(double('Git::Author'))
end
it "should return the commit author email for known emails" do
allow(@bug.blamed_commit.author).to receive(:email).and_return(@sean.email)
allow(@bug.blamed_commit.author).to receive(:name).and_return(nil)
expect(@bug.blamed_users).to eql([@sean.emails.primary.first])
end
it "should match a single commit author by name" do
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+kliu@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Karen Liu")
expect(@bug.blamed_users).to eql([@karen.emails.primary.first])
end
it "should match multiple commit authors by name" do
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+ssorrell+lewis@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Sean Sorrell + Mike Lewis")
expect(@bug.blamed_users).to eql([@sean.emails.primary.first, @lewis.emails.primary.first])
end
it "should match as many commit authors as it can" do
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+lewis+zach@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Mike Lewis & Zach Brock")
expect(@bug.blamed_users).to eql([@lewis.emails.primary.first])
end
it "should return an empty array if no matches can be found" do
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+ne+ek@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Nolan Evans + Erica Kwan")
expect(@bug.blamed_users).to be_empty
end
it "should use the commit author if the project is sending to unknown emails and there's an author match" do
@bug.environment.project.sends_emails_outside_team = true
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+lewis+zach@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Mike Lewis & Zach Brock")
expect(@bug.blamed_users).to eql([@lewis.emails.primary.first])
end
it "should use the commit email if the project is sending to unknown emails and there's no author match" do
@bug.environment.project.sends_emails_outside_team = true
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+ne+ek@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Nolan Evans + Erica Kwan")
expect(@bug.blamed_users.size).to eql(1)
expect(@bug.blamed_users.first).to be_kind_of(Email)
expect(@bug.blamed_users.first.email).to eql("github+ne+ek@squareup.com")
expect(@bug.blamed_users.first.user).to be_nil
end
it "should not use the commit email if the project is sending to unknown emails but the domain is not trusted" do
@bug.environment.project.sends_emails_outside_team = true
@bug.environment.project.trusted_email_domain = 'paypal.com'
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+ne+ek@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Nolan Evans + Erica Kwan")
expect(@bug.blamed_users).to be_empty
end
it "should use the commit email if the project is sending to unknown emails and the domain is trusted" do
@bug.environment.project.sends_emails_outside_team = true
@bug.environment.project.trusted_email_domain = 'squareup.com'
allow(@bug.blamed_commit.author).to receive(:email).and_return("github+ne+ek@squareup.com")
allow(@bug.blamed_commit.author).to receive(:name).and_return("Nolan Evans + Erica Kwan")
expect(@bug.blamed_users.size).to eql(1)
expect(@bug.blamed_users.first).to be_kind_of(Email)
expect(@bug.blamed_users.first.email).to eql("github+ne+ek@squareup.com")
expect(@bug.blamed_users.first.user).to be_nil
end
context "[redirection]" do
before(:each) { Email.redirected.delete_all }
it "should return a user who has specified that the commit author's emails be redirected to him" do
allow(@bug.blamed_commit.author).to receive(:email).and_return(@sean.email)
FactoryGirl.create(:email, email: @sean.email, user: @karen) # Karen took over Sean's exceptions
expect(@bug.blamed_email).to eql(@karen.email)
end
it "should go deeper" do # BWWWWHHHHHHAAAAAAMMMMMMM
allow(@bug.blamed_commit.author).to receive(:email).and_return(@sean.email)
FactoryGirl.create(:email, email: @sean.email, user: @karen) # Karen took over Sean's exceptions
FactoryGirl.create(:email, email: @karen.email, user: @lewis) # ... then Mike took over Karen's exceptions
expect(@bug.blamed_email).to eql(@lewis.email)
end
it "should give priority to project-specific redirects" do
erica = FactoryGirl.create(:user, first_name: 'Erica', last_name: 'Kwan', username: 'erica')
allow(@bug.blamed_commit.author).to receive(:email).and_return(@sean.email)
FactoryGirl.create(:email, email: @sean.email, user: erica) # Erica took over all of Sean's exceptions
FactoryGirl.create(:email, email: @sean.email, user: @karen, project: @bug.environment.project) # .. but Karen took over Sean's exceptions *on that project only*
FactoryGirl.create(:email, email: @karen.email, user: @lewis) # ... then Mike took over *all* of Karen's exceptions
expect(@bug.blamed_email).to eql(@lewis.email)
end
it "raise an exception for circular redirect chains" do
allow(@bug.blamed_commit.author).to receive(:email).and_return(@sean.email)
FactoryGirl.create(:email, email: @sean.email, user: @karen) # Karen took over Sean's exceptions
FactoryGirl.create(:email, email: @karen.email, user: @lewis) # ... then Mike took over Karen's exceptions
FactoryGirl.create(:email, email: @lewis.email, user: @sean) # ... but then Sean took over Mike's exceptions!
expect { @bug.blamed_email }.to raise_error(/Circular email redirection/)
end
it "should email a user's corporate email if they commit with a personal email" do
allow(@bug.blamed_commit.author).to receive(:email).and_return("karen.liu@gmail.com")
# Karen has a tendency to commit under her gmail address
FactoryGirl.create(:email, email: "karen.liu@gmail.com", user: @karen)
expect(@bug.blamed_email).to eql(@karen.email)
end
end
end
context "[duplicates]" do
before(:all) { @env = FactoryGirl.create(:environment) }
it "should not allow a bug to be marked as duplicate of a bug that's already a duplicate" do
already_duplicate_bug = FactoryGirl.create(:bug, environment: @env, duplicate_of: FactoryGirl.create(:bug, environment: @env))
bug = FactoryGirl.build(:bug, environment: @env, duplicate_of: already_duplicate_bug)
expect(bug).not_to be_valid
expect(bug.errors[:duplicate_of_id]).to eql(["cannot be the duplicate of a bug that’s marked as a duplicate"])
end
it "should not allow a bug to be marked as duplicate if another bug is marking this bug as a duplicate" do
bug = FactoryGirl.create(:bug, environment: @env)
duplicate_of_bug = FactoryGirl.create(:bug, environment: @env, duplicate_of: bug)
bug.duplicate_of = FactoryGirl.create(:bug, environment: @env)
expect(bug).not_to be_valid
expect(bug.errors[:duplicate_of_id]).to eql(["cannot be marked as duplicate because other bugs have been marked as duplicates of this bug"])
end
it "should allow a bug to NOT be marked as duplicate if another bug is marking this bug as a duplicate" do
bug = FactoryGirl.create(:bug, environment: @env)
FactoryGirl.create :bug, environment: @env, duplicate_of: bug
expect(bug).to be_valid
end
it "should not allow a bug's duplicate-of ID to be changed" do
bug = FactoryGirl.create(:bug, environment: @env, duplicate_of: FactoryGirl.create(:bug, environment: @env))
bug.duplicate_of = FactoryGirl.create(:bug, environment: @env)
expect(bug).not_to be_valid
expect(bug.errors[:duplicate_of_id]).to eql(["already marked as duplicate of a bug"])
end
it "should not allow a bug to be marked as a duplicate of a bug in a different environment" do
bug = FactoryGirl.create(:bug, environment: @env)
foreign_bug = FactoryGirl.create(:bug)
bug.duplicate_of = foreign_bug
expect(bug).not_to be_valid
expect(bug.errors[:duplicate_of_id]).to eql(["can only be the duplicate of a bug in the same environment"])
end
it "should not allow a bug to be un-marked as a duplicate" do
bug = FactoryGirl.create(:bug, environment: @env, duplicate_of: FactoryGirl.create(:bug, environment: @env))
bug.duplicate_of = nil
expect(bug).not_to be_valid
expect(bug.errors[:duplicate_of_id]).to eql(["already marked as duplicate of a bug"])
end
describe "#mark_as_duplicate!" do
before(:all) { @env = FactoryGirl.create(:environment) }
it "should associate the original bug" do
bug = FactoryGirl.create(:bug, environment: @env)
duplicate = FactoryGirl.create(:bug, environment: @env)
duplicate.mark_as_duplicate! bug
expect(duplicate.duplicate_of).to eql(bug)
end
it "should move all occurrences" do
bug = FactoryGirl.create(:bug, environment: @env)
duplicate = FactoryGirl.create(:bug, environment: @env)
occurrences = 5.times.map { FactoryGirl.create :rails_occurrence, bug: duplicate }
duplicate.mark_as_duplicate! bug
expect(occurrences.map(&:reload).map(&:bug_id)).to eql([bug.id]*5)
end
end
end
describe "#page_threshold_tripped?" do
before :each do
@bug = FactoryGirl.create(:bug, page_threshold: 10, page_period: 10.minutes, page_last_tripped_at: 20.minutes.ago)
end
it "should return false if a threshold or period has not been configured" do
expect(FactoryGirl.build(:bug, page_threshold: 10, page_period: nil)).not_to be_page_threshold_tripped
expect(FactoryGirl.build(:bug, page_threshold: nil, page_period: 1.minute)).not_to be_page_threshold_tripped
end
it "should return false if the threshold has not yet been exceeded within the period" do
FactoryGirl.create_list :rails_occurrence, 9, bug: @bug
expect(@bug).not_to be_page_threshold_tripped
end
it "should return true if the threshold has been exceeded within the period" do
FactoryGirl.create_list :rails_occurrence, 10, bug: @bug
expect(@bug).to be_page_threshold_tripped
end
it "should return false if the threshold was tripped within the last period" do
FactoryGirl.create_list :rails_occurrence, 10, bug: @bug
@bug.page_last_tripped_at = 45.seconds.ago
expect(@bug).not_to be_page_threshold_tripped
end
end
end
| SquareSquash/web/spec/models/bug_spec.rb/0 | {
"file_path": "SquareSquash/web/spec/models/bug_spec.rb",
"repo_id": "SquareSquash",
"token_count": 18353
} | 118 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'rails_helper'
RSpec.describe Watch, type: :model do
context "[observers]" do
before :all do
@user = FactoryGirl.create(:user)
@unwatched_event = FactoryGirl.create(:event)
@watched_event = FactoryGirl.create(:event)
@unwatched_bug = @unwatched_event.bug
watched_bug = @watched_event.bug
@watch = FactoryGirl.create(:watch, user: @user, bug: watched_bug)
end
it "should fill a user's feed with events when a bug is watched" do
FactoryGirl.create :watch, user: @user, bug: @unwatched_bug
expect(@user.user_events.pluck(:event_id)).to include(@unwatched_event.id)
end
it "should remove events from a user's feed when a bug is unwatched" do
@watch.destroy
expect(@user.user_events.pluck(:event_id)).not_to include(@watched_event.id)
end
end
end
| SquareSquash/web/spec/models/watch_spec.rb/0 | {
"file_path": "SquareSquash/web/spec/models/watch_spec.rb",
"repo_id": "SquareSquash",
"token_count": 511
} | 119 |
/* Flot plugin for showing crosshairs when the mouse hovers over the plot.
Copyright (c) 2007-2012 IOLA and Ole Laursen.
Licensed under the MIT license.
The plugin supports these options:
crosshair: {
mode: null or "x" or "y" or "xy"
color: color
lineWidth: number
}
Set the mode to one of "x", "y" or "xy". The "x" mode enables a vertical
crosshair that lets you trace the values on the x axis, "y" enables a
horizontal crosshair and "xy" enables them both. "color" is the color of the
crosshair (default is "rgba(170, 0, 0, 0.80)"), "lineWidth" is the width of
the drawn lines (default is 1).
The plugin also adds four public methods:
- setCrosshair( pos )
Set the position of the crosshair. Note that this is cleared if the user
moves the mouse. "pos" is in coordinates of the plot and should be on the
form { x: xpos, y: ypos } (you can use x2/x3/... if you're using multiple
axes), which is coincidentally the same format as what you get from a
"plothover" event. If "pos" is null, the crosshair is cleared.
- clearCrosshair()
Clear the crosshair.
- lockCrosshair(pos)
Cause the crosshair to lock to the current location, no longer updating if
the user moves the mouse. Optionally supply a position (passed on to
setCrosshair()) to move it to.
Example usage:
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
$("#graph").bind( "plothover", function ( evt, position, item ) {
if ( item ) {
// Lock the crosshair to the data point being hovered
myFlot.lockCrosshair({
x: item.datapoint[ 0 ],
y: item.datapoint[ 1 ]
});
} else {
// Return normal crosshair operation
myFlot.unlockCrosshair();
}
});
- unlockCrosshair()
Free the crosshair to move again after locking it.
*/
(function ($) {
var options = {
crosshair: {
mode: null, // one of null, "x", "y" or "xy",
color: "rgba(170, 0, 0, 0.80)",
lineWidth: 1
}
};
function init(plot) {
// position of crosshair in pixels
var crosshair = { x: -1, y: -1, locked: false };
plot.setCrosshair = function setCrosshair(pos) {
if (!pos)
crosshair.x = -1;
else {
var o = plot.p2c(pos);
crosshair.x = Math.max(0, Math.min(o.left, plot.width()));
crosshair.y = Math.max(0, Math.min(o.top, plot.height()));
}
plot.triggerRedrawOverlay();
};
plot.clearCrosshair = plot.setCrosshair; // passes null for pos
plot.lockCrosshair = function lockCrosshair(pos) {
if (pos)
plot.setCrosshair(pos);
crosshair.locked = true;
};
plot.unlockCrosshair = function unlockCrosshair() {
crosshair.locked = false;
};
function onMouseOut(e) {
if (crosshair.locked)
return;
if (crosshair.x != -1) {
crosshair.x = -1;
plot.triggerRedrawOverlay();
}
}
function onMouseMove(e) {
if (crosshair.locked)
return;
if (plot.getSelection && plot.getSelection()) {
crosshair.x = -1; // hide the crosshair while selecting
return;
}
var offset = plot.offset();
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));
plot.triggerRedrawOverlay();
}
plot.hooks.bindEvents.push(function (plot, eventHolder) {
if (!plot.getOptions().crosshair.mode)
return;
eventHolder.mouseout(onMouseOut);
eventHolder.mousemove(onMouseMove);
});
plot.hooks.drawOverlay.push(function (plot, ctx) {
var c = plot.getOptions().crosshair;
if (!c.mode)
return;
var plotOffset = plot.getPlotOffset();
ctx.save();
ctx.translate(plotOffset.left, plotOffset.top);
if (crosshair.x != -1) {
var adj = plot.getOptions().crosshair.lineWidth % 2 === 0 ? 0 : 0.5;
ctx.strokeStyle = c.color;
ctx.lineWidth = c.lineWidth;
ctx.lineJoin = "round";
ctx.beginPath();
if (c.mode.indexOf("x") != -1) {
var drawX = Math.round(crosshair.x) + adj;
ctx.moveTo(drawX, 0);
ctx.lineTo(drawX, plot.height());
}
if (c.mode.indexOf("y") != -1) {
var drawY = Math.round(crosshair.y) + adj;
ctx.moveTo(0, drawY);
ctx.lineTo(plot.width(), drawY);
}
ctx.stroke();
}
ctx.restore();
});
plot.hooks.shutdown.push(function (plot, eventHolder) {
eventHolder.unbind("mouseout", onMouseOut);
eventHolder.unbind("mousemove", onMouseMove);
});
}
$.plot.plugins.push({
init: init,
options: options,
name: 'crosshair',
version: '1.0'
});
})(jQuery);
| SquareSquash/web/vendor/assets/javascripts/flot/crosshair.js/0 | {
"file_path": "SquareSquash/web/vendor/assets/javascripts/flot/crosshair.js",
"repo_id": "SquareSquash",
"token_count": 2642
} | 120 |
/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/
jQuery.fn.extend({
everyTime: function(interval, label, fn, times) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, times);
});
},
oneTime: function(interval, label, fn) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, 1);
});
},
stopTime: function(label, fn) {
return this.each(function() {
jQuery.timer.remove(this, label, fn);
});
}
});
jQuery.extend({
timer: {
global: [],
guid: 1,
dataKey: "jQuery.timer",
regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
powers: {
// Yeah this is major overkill...
'ms': 1,
'cs': 10,
'ds': 100,
's': 1000,
'das': 10000,
'hs': 100000,
'ks': 1000000
},
timeParse: function(value) {
if (value == undefined || value == null)
return null;
var result = this.regex.exec(jQuery.trim(value.toString()));
if (result[2]) {
var num = parseFloat(result[1]);
var mult = this.powers[result[2]] || 1;
return num * mult;
} else {
return value;
}
},
add: function(element, interval, label, fn, times) {
var counter = 0;
if (jQuery.isFunction(label)) {
if (!times)
times = fn;
fn = label;
label = interval;
}
interval = jQuery.timer.timeParse(interval);
if (typeof interval != 'number' || isNaN(interval) || interval < 0)
return;
if (typeof times != 'number' || isNaN(times) || times < 0)
times = 0;
times = times || 0;
var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
if (!timers[label])
timers[label] = {};
fn.timerID = fn.timerID || this.guid++;
var handler = function() {
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
jQuery.timer.remove(element, label, fn);
};
handler.timerID = fn.timerID;
if (!timers[label][fn.timerID])
timers[label][fn.timerID] = window.setInterval(handler,interval);
this.global.push( element );
},
remove: function(element, label, fn) {
var timers = jQuery.data(element, this.dataKey), ret;
if ( timers ) {
if (!label) {
for ( label in timers )
this.remove(element, label, fn);
} else if ( timers[label] ) {
if ( fn ) {
if ( fn.timerID ) {
window.clearInterval(timers[label][fn.timerID]);
delete timers[label][fn.timerID];
}
} else {
for ( var fn in timers[label] ) {
window.clearInterval(timers[label][fn]);
delete timers[label][fn];
}
}
for ( ret in timers[label] ) break;
if ( !ret ) {
ret = null;
delete timers[label];
}
}
for ( ret in timers ) break;
if ( !ret )
jQuery.removeData(element, this.dataKey);
}
}
}
});
jQuery(window).bind("unload", function() {
jQuery.each(jQuery.timer.global, function(index, item) {
jQuery.timer.remove(item);
});
}); | SquareSquash/web/vendor/assets/javascripts/jquery-timers.js/0 | {
"file_path": "SquareSquash/web/vendor/assets/javascripts/jquery-timers.js",
"repo_id": "SquareSquash",
"token_count": 1436
} | 121 |
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (Wed, 12 Feb 2014 03:42:24 GMT)
*
* @copyright
* Copyright (C) 2004-2013 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
function Brush()
{
var keywords = 'abstract assert boolean break byte case catch char class const ' +
'continue default do double else enum extends ' +
'false final finally float for goto if implements import ' +
'instanceof int interface long native new null ' +
'package private protected public return ' +
'short static strictfp super switch synchronized this throw throws true ' +
'transient try void volatile while';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
{ regex: /\/\*([^\*][\s\S]*?)?\*\//gm, css: 'comments' }, // multiline comments
{ regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
{ regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
{ regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno
{ regex: /\@interface\b/g, css: 'color2' }, // @interface keyword
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
];
this.forHtmlScript({
left : /(<|<)%[@!=]?/g,
right : /%(>|>)/g
});
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['java'];
SyntaxHighlighter.brushes.Java = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();
| SquareSquash/web/vendor/assets/javascripts/sh/shBrushJava.js/0 | {
"file_path": "SquareSquash/web/vendor/assets/javascripts/sh/shBrushJava.js",
"repo_id": "SquareSquash",
"token_count": 848
} | 122 |
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
*
* @version
* 2.0.320 (July 26 2009)
*
* @copyright
* Copyright (C) 2004-2009 Alex Gorbatchev.
* Copyright (C) 2009 Nicolas Perriault
*
* @license
* This file is part of SyntaxHighlighter.
*
* SyntaxHighlighter is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SyntaxHighlighter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
*/
SyntaxHighlighter.brushes.Yaml = function()
{
// Contributed by Nicolas Perriault
var constants = '~ true false on off';
this.regexList = [
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // comment
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted string
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted string
{ regex: /^\s*([a-z0-9\._-])+\s*:/gmi, css: 'variable' }, // key
{ regex: /\s?(\.)([a-z0-9\._-])+\s?:/gmi, css: 'comments' }, // section
{ regex: /\s(@|:)([a-z0-9\._-])+\s*$/gmi, css: 'variable bold' }, // variable, reference
{ regex: /\s+\d+\s?$/gm, css: 'color2 bold' }, // integers
{ regex: /(\{|\}|\[|\]|,|~|:)/gm, css: 'constants' }, // inline hash and array, comma, null
{ regex: /^\s+(-)+/gm, css: 'string bold' }, // array list entry
{ regex: /^---/gm, css: 'string bold' }, // category
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' } // constants
];
};
SyntaxHighlighter.brushes.Yaml.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Yaml.aliases = ['yaml', 'yml'];
| SquareSquash/web/vendor/assets/javascripts/sh/shBrushYaml.js/0 | {
"file_path": "SquareSquash/web/vendor/assets/javascripts/sh/shBrushYaml.js",
"repo_id": "SquareSquash",
"token_count": 893
} | 123 |
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (Wed, 12 Feb 2014 03:42:24 GMT)
*
* @copyright
* Copyright (C) 2004-2013 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
.syntaxhighlighter{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
.syntaxhighlighter .line.highlighted.number{color:white !important;}
.syntaxhighlighter table caption{color:#f8f8f8 !important;}
.syntaxhighlighter table td.code .container textarea{background:#0a2b1d;color:#f8f8f8;}
.syntaxhighlighter .gutter{color:#497958 !important;}
.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
.syntaxhighlighter.printing .line .content{border:none !important;}
.syntaxhighlighter.collapsed{overflow:visible !important;}
.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
.syntaxhighlighter .toolbar a{color:white !important;}
.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
.syntaxhighlighter .keyword{color:#96dd3b !important;}
.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
.syntaxhighlighter .variable{color:#ffaa3e !important;}
.syntaxhighlighter .value{color:#f7e741 !important;}
.syntaxhighlighter .functions{color:#ffaa3e !important;}
.syntaxhighlighter .constants{color:#e0e8ff !important;}
.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
.syntaxhighlighter .comments{font-style:italic !important;}
.syntaxhighlighter .keyword{font-weight:bold !important;}
| SquareSquash/web/vendor/assets/stylesheets/sh/shThemeDjango.css/0 | {
"file_path": "SquareSquash/web/vendor/assets/stylesheets/sh/shThemeDjango.css",
"repo_id": "SquareSquash",
"token_count": 982
} | 124 |
Bitwarden believes that working with security researchers across the globe is crucial to keeping our users safe. If you believe you've found a security issue in our product or service, we encourage you to please submit a report through our [HackerOne Program](https://hackerone.com/bitwarden/). We welcome working with you to resolve the issue promptly. Thanks in advance!
# Disclosure Policy
- Let us know as soon as possible upon discovery of a potential security issue, and we'll make every effort to quickly resolve the issue.
- Provide us a reasonable amount of time to resolve the issue before any disclosure to the public or a third-party. We may publicly disclose the issue before resolving it, if appropriate.
- Make a good faith effort to avoid privacy violations, destruction of data, and interruption or degradation of our service. Only interact with accounts you own or with explicit permission of the account holder.
- If you would like to encrypt your report, please use the PGP key with long ID `0xDE6887086F892325FEC04CC0D847525B6931381F` (available in the public keyserver pool).
While researching, we'd like to ask you to refrain from:
- Denial of service
- Spamming
- Social engineering (including phishing) of Bitwarden staff or contractors
- Any physical attempts against Bitwarden property or data centers
# We want to help you!
If you have something that you feel is close to exploitation, or if you'd like some information regarding the internal API, or generally have any questions regarding the app that would help in your efforts, please email us at https://bitwarden.com/contact and ask for that information. As stated above, Bitwarden wants to help you find issues, and is more than willing to help.
Thank you for helping keep Bitwarden and our users safe!
| bitwarden/web/SECURITY.md/0 | {
"file_path": "bitwarden/web/SECURITY.md",
"repo_id": "bitwarden",
"token_count": 409
} | 125 |
import { Component, OnInit } from "@angular/core";
import { AbstractControl, FormBuilder, FormGroup } from "@angular/forms";
import { ActivatedRoute } from "@angular/router";
import { SelectOptions } from "jslib-angular/interfaces/selectOptions";
import { dirtyRequired } from "jslib-angular/validators/dirty.validator";
import { ApiService } from "jslib-common/abstractions/api.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { OrganizationService } from "jslib-common/abstractions/organization.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import {
OpenIdConnectRedirectBehavior,
Saml2BindingType,
Saml2NameIdFormat,
Saml2SigningBehavior,
SsoType,
} from "jslib-common/enums/ssoEnums";
import { Utils } from "jslib-common/misc/utils";
import { SsoConfigApi } from "jslib-common/models/api/ssoConfigApi";
import { Organization } from "jslib-common/models/domain/organization";
import { OrganizationSsoRequest } from "jslib-common/models/request/organization/organizationSsoRequest";
import { OrganizationSsoResponse } from "jslib-common/models/response/organization/organizationSsoResponse";
import { SsoConfigView } from "jslib-common/models/view/ssoConfigView";
const defaultSigningAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
@Component({
selector: "app-org-manage-sso",
templateUrl: "sso.component.html",
})
export class SsoComponent implements OnInit {
readonly ssoType = SsoType;
readonly ssoTypeOptions: SelectOptions[] = [
{ name: this.i18nService.t("selectType"), value: SsoType.None, disabled: true },
{ name: "OpenID Connect", value: SsoType.OpenIdConnect },
{ name: "SAML 2.0", value: SsoType.Saml2 },
];
readonly samlSigningAlgorithms = [
"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
"http://www.w3.org/2000/09/xmldsig#rsa-sha384",
"http://www.w3.org/2000/09/xmldsig#rsa-sha512",
"http://www.w3.org/2000/09/xmldsig#rsa-sha1",
];
readonly saml2SigningBehaviourOptions: SelectOptions[] = [
{
name: "If IdP Wants Authn Requests Signed",
value: Saml2SigningBehavior.IfIdpWantAuthnRequestsSigned,
},
{ name: "Always", value: Saml2SigningBehavior.Always },
{ name: "Never", value: Saml2SigningBehavior.Never },
];
readonly saml2BindingTypeOptions: SelectOptions[] = [
{ name: "Redirect", value: Saml2BindingType.HttpRedirect },
{ name: "HTTP POST", value: Saml2BindingType.HttpPost },
];
readonly saml2NameIdFormatOptions: SelectOptions[] = [
{ name: "Not Configured", value: Saml2NameIdFormat.NotConfigured },
{ name: "Unspecified", value: Saml2NameIdFormat.Unspecified },
{ name: "Email Address", value: Saml2NameIdFormat.EmailAddress },
{ name: "X.509 Subject Name", value: Saml2NameIdFormat.X509SubjectName },
{ name: "Windows Domain Qualified Name", value: Saml2NameIdFormat.WindowsDomainQualifiedName },
{ name: "Kerberos Principal Name", value: Saml2NameIdFormat.KerberosPrincipalName },
{ name: "Entity Identifier", value: Saml2NameIdFormat.EntityIdentifier },
{ name: "Persistent", value: Saml2NameIdFormat.Persistent },
{ name: "Transient", value: Saml2NameIdFormat.Transient },
];
readonly connectRedirectOptions: SelectOptions[] = [
{ name: "Redirect GET", value: OpenIdConnectRedirectBehavior.RedirectGet },
{ name: "Form POST", value: OpenIdConnectRedirectBehavior.FormPost },
];
showOpenIdCustomizations = false;
loading = true;
haveTestedKeyConnector = false;
organizationId: string;
organization: Organization;
formPromise: Promise<any>;
callbackPath: string;
signedOutCallbackPath: string;
spEntityId: string;
spMetadataUrl: string;
spAcsUrl: string;
enabled = this.formBuilder.control(false);
openIdForm = this.formBuilder.group(
{
authority: ["", dirtyRequired],
clientId: ["", dirtyRequired],
clientSecret: ["", dirtyRequired],
metadataAddress: [],
redirectBehavior: [OpenIdConnectRedirectBehavior.RedirectGet, dirtyRequired],
getClaimsFromUserInfoEndpoint: [],
additionalScopes: [],
additionalUserIdClaimTypes: [],
additionalEmailClaimTypes: [],
additionalNameClaimTypes: [],
acrValues: [],
expectedReturnAcrValue: [],
},
{
updateOn: "blur",
}
);
samlForm = this.formBuilder.group(
{
spNameIdFormat: [Saml2NameIdFormat.NotConfigured],
spOutboundSigningAlgorithm: [defaultSigningAlgorithm],
spSigningBehavior: [Saml2SigningBehavior.IfIdpWantAuthnRequestsSigned],
spMinIncomingSigningAlgorithm: [defaultSigningAlgorithm],
spWantAssertionsSigned: [],
spValidateCertificates: [],
idpEntityId: ["", dirtyRequired],
idpBindingType: [Saml2BindingType.HttpRedirect],
idpSingleSignOnServiceUrl: [],
idpSingleLogoutServiceUrl: [],
idpX509PublicCert: ["", dirtyRequired],
idpOutboundSigningAlgorithm: [defaultSigningAlgorithm],
idpAllowUnsolicitedAuthnResponse: [],
idpAllowOutboundLogoutRequests: [true],
idpWantAuthnRequestsSigned: [],
},
{
updateOn: "blur",
}
);
ssoConfigForm = this.formBuilder.group({
configType: [SsoType.None],
keyConnectorEnabled: [false],
keyConnectorUrl: [""],
openId: this.openIdForm,
saml: this.samlForm,
});
constructor(
private formBuilder: FormBuilder,
private route: ActivatedRoute,
private apiService: ApiService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService,
private organizationService: OrganizationService
) {}
async ngOnInit() {
this.ssoConfigForm.get("configType").valueChanges.subscribe((newType: SsoType) => {
if (newType === SsoType.OpenIdConnect) {
this.openIdForm.enable();
this.samlForm.disable();
} else if (newType === SsoType.Saml2) {
this.openIdForm.disable();
this.samlForm.enable();
} else {
this.openIdForm.disable();
this.samlForm.disable();
}
});
this.samlForm
.get("spSigningBehavior")
.valueChanges.subscribe(() =>
this.samlForm.get("idpX509PublicCert").updateValueAndValidity()
);
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
await this.load();
});
}
async load() {
this.organization = await this.organizationService.get(this.organizationId);
const ssoSettings = await this.apiService.getOrganizationSso(this.organizationId);
this.populateForm(ssoSettings);
this.callbackPath = ssoSettings.urls.callbackPath;
this.signedOutCallbackPath = ssoSettings.urls.signedOutCallbackPath;
this.spEntityId = ssoSettings.urls.spEntityId;
this.spMetadataUrl = ssoSettings.urls.spMetadataUrl;
this.spAcsUrl = ssoSettings.urls.spAcsUrl;
this.loading = false;
}
async submit() {
this.validateForm(this.ssoConfigForm);
if (this.ssoConfigForm.get("keyConnectorEnabled").value) {
await this.validateKeyConnectorUrl();
}
if (!this.ssoConfigForm.valid) {
this.readOutErrors();
return;
}
const request = new OrganizationSsoRequest();
request.enabled = this.enabled.value;
request.data = SsoConfigApi.fromView(this.ssoConfigForm.value as SsoConfigView);
this.formPromise = this.apiService.postOrganizationSso(this.organizationId, request);
try {
const response = await this.formPromise;
this.populateForm(response);
this.platformUtilsService.showToast("success", null, this.i18nService.t("ssoSettingsSaved"));
} catch {
// Logged by appApiAction, do nothing
}
this.formPromise = null;
}
async validateKeyConnectorUrl() {
if (this.haveTestedKeyConnector) {
return;
}
this.keyConnectorUrl.markAsPending();
try {
await this.apiService.getKeyConnectorAlive(this.keyConnectorUrl.value);
this.keyConnectorUrl.updateValueAndValidity();
} catch {
this.keyConnectorUrl.setErrors({
invalidUrl: true,
});
}
this.haveTestedKeyConnector = true;
}
toggleOpenIdCustomizations() {
this.showOpenIdCustomizations = !this.showOpenIdCustomizations;
}
getErrorCount(form: FormGroup): number {
return Object.values(form.controls).reduce((acc: number, control: AbstractControl) => {
if (control instanceof FormGroup) {
return acc + this.getErrorCount(control);
}
if (control.errors == null) {
return acc;
}
return acc + Object.keys(control.errors).length;
}, 0);
}
get enableTestKeyConnector() {
return (
this.ssoConfigForm.get("keyConnectorEnabled").value &&
!Utils.isNullOrWhitespace(this.keyConnectorUrl?.value)
);
}
get keyConnectorUrl() {
return this.ssoConfigForm.get("keyConnectorUrl");
}
get samlSigningAlgorithmOptions(): SelectOptions[] {
return this.samlSigningAlgorithms.map((algorithm) => ({ name: algorithm, value: algorithm }));
}
private validateForm(form: FormGroup) {
Object.values(form.controls).forEach((control: AbstractControl) => {
if (control.disabled) {
return;
}
if (control instanceof FormGroup) {
this.validateForm(control);
} else {
control.markAsDirty();
control.markAsTouched();
control.updateValueAndValidity();
}
});
}
private populateForm(ssoSettings: OrganizationSsoResponse) {
this.enabled.setValue(ssoSettings.enabled);
if (ssoSettings.data != null) {
const ssoConfigView = new SsoConfigView(ssoSettings.data);
this.ssoConfigForm.patchValue(ssoConfigView);
}
}
private readOutErrors() {
const errorText = this.i18nService.t("error");
const errorCount = this.getErrorCount(this.ssoConfigForm);
const errorCountText = this.i18nService.t(
errorCount === 1 ? "formErrorSummarySingle" : "formErrorSummaryPlural",
errorCount.toString()
);
const div = document.createElement("div");
div.className = "sr-only";
div.id = "srErrorCount";
div.setAttribute("aria-live", "polite");
div.innerText = errorText + ": " + errorCountText;
const existing = document.getElementById("srErrorCount");
if (existing != null) {
existing.remove();
}
document.body.append(div);
}
}
| bitwarden/web/bitwarden_license/src/app/organizations/manage/sso.component.ts/0 | {
"file_path": "bitwarden/web/bitwarden_license/src/app/organizations/manage/sso.component.ts",
"repo_id": "bitwarden",
"token_count": 3897
} | 126 |
import { Component } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { ApiService } from "jslib-common/abstractions/api.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { StateService } from "jslib-common/abstractions/state.service";
import { ProviderUserAcceptRequest } from "jslib-common/models/request/provider/providerUserAcceptRequest";
import { BaseAcceptComponent } from "src/app/common/base.accept.component";
@Component({
selector: "app-accept-provider",
templateUrl: "accept-provider.component.html",
})
export class AcceptProviderComponent extends BaseAcceptComponent {
providerName: string;
failedMessage = "providerInviteAcceptFailed";
requiredParameters = ["providerId", "providerUserId", "token"];
constructor(
router: Router,
i18nService: I18nService,
route: ActivatedRoute,
stateService: StateService,
private apiService: ApiService,
platformUtilService: PlatformUtilsService
) {
super(router, platformUtilService, i18nService, route, stateService);
}
async authedHandler(qParams: any) {
const request = new ProviderUserAcceptRequest();
request.token = qParams.token;
await this.apiService.postProviderUserAccept(
qParams.providerId,
qParams.providerUserId,
request
);
this.platformUtilService.showToast(
"success",
this.i18nService.t("inviteAccepted"),
this.i18nService.t("providerInviteAcceptedDesc"),
{ timeout: 10000 }
);
this.router.navigate(["/vault"]);
}
async unauthedHandler(qParams: any) {
this.providerName = qParams.providerName;
}
}
| bitwarden/web/bitwarden_license/src/app/providers/manage/accept-provider.component.ts/0 | {
"file_path": "bitwarden/web/bitwarden_license/src/app/providers/manage/accept-provider.component.ts",
"repo_id": "bitwarden",
"token_count": 603
} | 127 |
<div class="page-header">
<h1>{{ "myProvider" | i18n }}</h1>
</div>
<div *ngIf="loading">
<i
class="bwi bwi-spinner bwi-spin text-muted"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
<span class="sr-only">{{ "loading" | i18n }}</span>
</div>
<form
*ngIf="provider && !loading"
#form
(ngSubmit)="submit()"
[appApiAction]="formPromise"
ngNativeValidate
>
<div class="row">
<div class="col-6">
<div class="form-group">
<label for="name">{{ "providerName" | i18n }}</label>
<input
id="name"
class="form-control"
type="text"
name="Name"
[(ngModel)]="provider.name"
[disabled]="selfHosted"
/>
</div>
<div class="form-group">
<label for="billingEmail">{{ "billingEmail" | i18n }}</label>
<input
id="billingEmail"
class="form-control"
type="text"
name="BillingEmail"
[(ngModel)]="provider.billingEmail"
[disabled]="selfHosted"
/>
</div>
</div>
<div class="col-6">
<app-avatar data="{{ provider.name }}" dynamic="true" size="75" fontSize="35"></app-avatar>
</div>
</div>
<button type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
<span>{{ "save" | i18n }}</span>
</button>
</form>
| bitwarden/web/bitwarden_license/src/app/providers/settings/account.component.html/0 | {
"file_path": "bitwarden/web/bitwarden_license/src/app/providers/settings/account.component.html",
"repo_id": "bitwarden",
"token_count": 702
} | 128 |
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDaEy1cPw07irjg
4wUgaxshW7oQrgVoNZYRROmdU20K22L+HyG2ahW6usiWw8+6fPgVve7Y1z+/GYsK
DhaDdY1Ket3JvZHxoAJ/+6lYY+05PhtmYnyEZzZlnuYx/tu3vyGpsXqMpzL3ZrX2
Mh2dWE7ZXKxsyig4wSDJhBPMrW8HKXLrLR/JPFhu/nz5MpRF5LfzWU13FEfmS43s
PEkBCn5ZxhVX4eNclQhTl7oOo5LU+KCWn+C/GPQir7pdmMoYF6D5j3qtbsq9irPe
qR7HsM9z6DnX+L0mF31P2S6OTgLT3kuWJn9vqLUwvQWGFvSSzpw7JgGBK3eX6zE9
2koGWP9NAgMBAAECggEAIpwCie5TykxU1RQSfzegYaXuHLGRmB1RCMKYFOjlmGCD
EHOeZRXnBvCX3x2KfT1SHhk7q9xVeJ20LE9aEVj5qIVhZ6AXZnKPkwI8uRN61afe
r1wYCOdcgbo7LFoXQs0pqYXKPkJW217IqB8CBjO6p9KGZumago9cBb9ZaRVpVohZ
c6YHeatrna2mPb/EUPHdT0RHHQ5Dz2ToPjCkDtxsNHLZLekR35WIMtCBlp0xY5hb
5h54ZxnaMihvHTLa8L/pgxGEUsP+XFpdXkM1oREzh8tDRFcUL8mUVZq8bGyzALn5
MxDhdXqxrnyD2cQ/cSqXLs1/2mh5eccU3g5IaNtrAQKBgQD0Q4K2UYXa8jWQu7jI
b37zwr2EypLFjeluqF4fxs+oz3UYEXeBDK0Td19/tze6/XieKibKDtFrOZQwDDKC
AVxD7Dm58T9Jf4LDHNYOfYL3X/E4H+JrVBh94s0B00jVJ6TnEQDMuLi+wMGtvTdW
huxoNefIWKf73ozvxIF+nsyeDQKBgQDkjYoXkBtfNgQR42RVA0/UdLLDWWctMU4F
sJYc1bLL3txbf+fK7QzbU/ggLMW0hv8/IdyirGJhW3G0K0yhpAOlPhe36qv4QyhD
o2nFlRrzfzvGJAgH9b1s+VcL/cSIuv4aCkbv97DAoQGPzAWEKv5gY1iw1DsGgrz5
svZUvd7WQQKBgQDPrp7yuTngQNP+bT3dXb9JLqjIwRwt0E1LgugUiIuDcnCSuDct
iEOYK4UNKBDAckcd46T7Y8H3MwumFpjTJKj4L1+dk1tF+J6Lmnb99wVlozOLjsCK
lQQF9NJt3OEuKvjwZeqSJfUeavHB8QGeFjXnHP4nwAmEA2M9cYzQxeAf+QKBgCbS
U+6Er+GQT0iqk1RNZ7XyzJqaCQiII3Sb9iOXuPMgO9Xe+ARkF5b5wF/Wuw5bD+gt
XEjVdzCKU9oCsNWUAnqC/Yxj9CoLXj9+9mx1U0qhBgo1/Jc9ipuEDuEejc+b06Wg
sUP5krBlqNpAEX/Nvb+poFsI8a29b1QKrgTe64cBAoGALg92rZBG60N2n8fTokou
f1fui8Ftb+vOVGv9CM6icmNuwXeMF40A33Hvx14XLFk6B5p5dtVyOR660rRv4HRV
cBUm5wwCZjwR5Aj83XGR0PRbTNFNngHbawQiutSo6dw8cNNKCZMywVh2KX29dsLh
0Yj++kb8+G1kzFonR8WWoC8=
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICwzCCAaugAwIBAgIJAN5sbMfEx05qMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
BAMTCWxvY2FsaG9zdDAeFw0xODA2MDUwMzMxNDhaFw0yODA2MDIwMzMxNDhaMBQx
EjAQBgNVBAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBANoTLVw/DTuKuODjBSBrGyFbuhCuBWg1lhFE6Z1TbQrbYv4fIbZqFbq6yJbD
z7p8+BW97tjXP78ZiwoOFoN1jUp63cm9kfGgAn/7qVhj7Tk+G2ZifIRnNmWe5jH+
27e/IamxeoynMvdmtfYyHZ1YTtlcrGzKKDjBIMmEE8ytbwcpcustH8k8WG7+fPky
lEXkt/NZTXcUR+ZLjew8SQEKflnGFVfh41yVCFOXug6jktT4oJaf4L8Y9CKvul2Y
yhgXoPmPeq1uyr2Ks96pHsewz3PoOdf4vSYXfU/ZLo5OAtPeS5Ymf2+otTC9BYYW
9JLOnDsmAYErd5frMT3aSgZY/00CAwEAAaMYMBYwFAYDVR0RBA0wC4IJbG9jYWxo
b3N0MA0GCSqGSIb3DQEBCwUAA4IBAQCBTn7szrcs+fSs1Q/a2O3ng35zcme6NRhp
T65RP0ooj3tPT9QlTJyKjo9Yb2RW2RGVbQO86mkYe9N9wcZkzurZ6KDqsfBn3FkI
eZA1G/za907Dt/25mOdrsav7NmFBwxo9iuZ/cozgneK1mAXOu4nDI5yYvAlvNA6E
iXgls4WX1LtHL5b9YV7Jz27d5tTmGxEimakMBo+zr10vCtMCsTlDs/ChamnI7ljN
7B4WIVUMI3xOZzqClLnSzFJNReAlapjtGtp1qH6Y+6aZ9OErIwZOjE9CYYvm6MbE
CblXQ9Uifpwrc09TA5S2Y/9+VxUBF9xlxh8hkcGLTzlNFDzVWdmR
-----END CERTIFICATE-----
| bitwarden/web/dev-server.shared.pem/0 | {
"file_path": "bitwarden/web/dev-server.shared.pem",
"repo_id": "bitwarden",
"token_count": 2089
} | 129 |
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise" class="container" ngNativeValidate>
<div class="row justify-content-md-center mt-5">
<div class="col-5">
<p class="lead text-center mb-4">{{ "passwordHint" | i18n }}</p>
<div class="card d-block">
<div class="card-body">
<div class="form-group">
<label for="email">{{ "emailAddress" | i18n }}</label>
<input
id="email"
class="form-control"
type="text"
name="Email"
[(ngModel)]="email"
required
appAutofocus
inputmode="email"
appInputVerbatim="false"
/>
<small class="form-text text-muted">{{ "enterEmailToGetHint" | i18n }}</small>
</div>
<hr />
<div class="d-flex">
<button
type="submit"
class="btn btn-primary btn-block btn-submit"
[disabled]="form.loading"
>
<span [hidden]="form.loading">{{ "submit" | i18n }}</span>
<i
class="bwi bwi-spinner bwi-spin"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
</button>
<a routerLink="/login" class="btn btn-outline-secondary btn-block ml-2 mt-0">
{{ "cancel" | i18n }}
</a>
</div>
</div>
</div>
</div>
</div>
</form>
| bitwarden/web/src/app/accounts/hint.component.html/0 | {
"file_path": "bitwarden/web/src/app/accounts/hint.component.html",
"repo_id": "bitwarden",
"token_count": 848
} | 130 |
<form
#form
(ngSubmit)="submit()"
class="container"
[appApiAction]="initiateSsoFormPromise"
ngNativeValidate
>
<div class="row justify-content-md-center mt-5">
<div class="col-5">
<img class="logo mb-2 logo-themed" alt="Bitwarden" />
<div class="card d-block mt-4">
<div class="card-body" *ngIf="loggingIn">
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
{{ "loading" | i18n }}
</div>
<div class="card-body" *ngIf="!loggingIn">
<p>{{ "ssoLogInWithOrgIdentifier" | i18n }}</p>
<div class="form-group">
<label for="identifier">{{ "organizationIdentifier" | i18n }}</label>
<input
id="identifier"
class="form-control"
type="text"
name="Identifier"
[(ngModel)]="identifier"
required
appAutofocus
/>
</div>
<hr />
<div class="d-flex">
<button
type="submit"
class="btn btn-primary btn-block btn-submit"
[disabled]="form.loading"
>
<span> <i class="bwi bwi-sign-in" aria-hidden="true"></i> {{ "logIn" | i18n }} </span>
<i
class="bwi bwi-spinner bwi-spin"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
</button>
<a routerLink="/login" class="btn btn-outline-secondary btn-block ml-2 mt-0">
{{ "cancel" | i18n }}
</a>
</div>
</div>
</div>
</div>
</div>
</form>
| bitwarden/web/src/app/accounts/sso.component.html/0 | {
"file_path": "bitwarden/web/src/app/accounts/sso.component.html",
"repo_id": "bitwarden",
"token_count": 943
} | 131 |
import { DragDropModule } from "@angular/cdk/drag-drop";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { InfiniteScrollModule } from "ngx-infinite-scroll";
import { AppComponent } from "./app.component";
import { OssRoutingModule } from "./oss-routing.module";
import { OssModule } from "./oss.module";
import { ServicesModule } from "./services/services.module";
import { WildcardRoutingModule } from "./wildcard-routing.module";
@NgModule({
imports: [
OssModule,
BrowserAnimationsModule,
FormsModule,
ServicesModule,
InfiniteScrollModule,
DragDropModule,
OssRoutingModule,
WildcardRoutingModule, // Needs to be last to catch all non-existing routes
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
| bitwarden/web/src/app/app.module.ts/0 | {
"file_path": "bitwarden/web/src/app/app.module.ts",
"repo_id": "bitwarden",
"token_count": 276
} | 132 |
<router-outlet></router-outlet>
<div class="container my-5 text-muted text-center">
© {{ year }} Bitwarden Inc. <br />
{{ "versionNumber" | i18n: version }}
</div>
| bitwarden/web/src/app/layouts/frontend-layout.component.html/0 | {
"file_path": "bitwarden/web/src/app/layouts/frontend-layout.component.html",
"repo_id": "bitwarden",
"token_count": 65
} | 133 |
import { DragDropModule } from "@angular/cdk/drag-drop";
import { DatePipe, registerLocaleData, CommonModule } from "@angular/common";
import localeAf from "@angular/common/locales/af";
import localeAz from "@angular/common/locales/az";
import localeBe from "@angular/common/locales/be";
import localeBg from "@angular/common/locales/bg";
import localeBn from "@angular/common/locales/bn";
import localeBs from "@angular/common/locales/bs";
import localeCa from "@angular/common/locales/ca";
import localeCs from "@angular/common/locales/cs";
import localeDa from "@angular/common/locales/da";
import localeDe from "@angular/common/locales/de";
import localeEl from "@angular/common/locales/el";
import localeEnGb from "@angular/common/locales/en-GB";
import localeEnIn from "@angular/common/locales/en-IN";
import localeEo from "@angular/common/locales/eo";
import localeEs from "@angular/common/locales/es";
import localeEt from "@angular/common/locales/et";
import localeFi from "@angular/common/locales/fi";
import localeFil from "@angular/common/locales/fil";
import localeFr from "@angular/common/locales/fr";
import localeHe from "@angular/common/locales/he";
import localeHi from "@angular/common/locales/hi";
import localeHr from "@angular/common/locales/hr";
import localeHu from "@angular/common/locales/hu";
import localeId from "@angular/common/locales/id";
import localeIt from "@angular/common/locales/it";
import localeJa from "@angular/common/locales/ja";
import localeKa from "@angular/common/locales/ka";
import localeKm from "@angular/common/locales/km";
import localeKn from "@angular/common/locales/kn";
import localeKo from "@angular/common/locales/ko";
import localeLv from "@angular/common/locales/lv";
import localeMl from "@angular/common/locales/ml";
import localeNb from "@angular/common/locales/nb";
import localeNl from "@angular/common/locales/nl";
import localeNn from "@angular/common/locales/nn";
import localePl from "@angular/common/locales/pl";
import localePtBr from "@angular/common/locales/pt";
import localePtPt from "@angular/common/locales/pt-PT";
import localeRo from "@angular/common/locales/ro";
import localeRu from "@angular/common/locales/ru";
import localeSi from "@angular/common/locales/si";
import localeSk from "@angular/common/locales/sk";
import localeSl from "@angular/common/locales/sl";
import localeSr from "@angular/common/locales/sr";
import localeSv from "@angular/common/locales/sv";
import localeTr from "@angular/common/locales/tr";
import localeUk from "@angular/common/locales/uk";
import localeVi from "@angular/common/locales/vi";
import localeZhCn from "@angular/common/locales/zh-Hans";
import localeZhTw from "@angular/common/locales/zh-Hant";
import { NgModule } from "@angular/core";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router";
import { BadgeModule, ButtonModule, CalloutModule, MenuModule } from "@bitwarden/components";
import { InfiniteScrollModule } from "ngx-infinite-scroll";
import { ToastrModule } from "ngx-toastr";
import { JslibModule } from "jslib-angular/jslib.module";
registerLocaleData(localeAf, "af");
registerLocaleData(localeAz, "az");
registerLocaleData(localeBe, "be");
registerLocaleData(localeBg, "bg");
registerLocaleData(localeBn, "bn");
registerLocaleData(localeBs, "bs");
registerLocaleData(localeCa, "ca");
registerLocaleData(localeCs, "cs");
registerLocaleData(localeDa, "da");
registerLocaleData(localeDe, "de");
registerLocaleData(localeEl, "el");
registerLocaleData(localeEnGb, "en-GB");
registerLocaleData(localeEnIn, "en-IN");
registerLocaleData(localeEo, "eo");
registerLocaleData(localeEs, "es");
registerLocaleData(localeEt, "et");
registerLocaleData(localeFi, "fi");
registerLocaleData(localeFil, "fil");
registerLocaleData(localeFr, "fr");
registerLocaleData(localeHe, "he");
registerLocaleData(localeHi, "hi");
registerLocaleData(localeHr, "hr");
registerLocaleData(localeHu, "hu");
registerLocaleData(localeId, "id");
registerLocaleData(localeIt, "it");
registerLocaleData(localeJa, "ja");
registerLocaleData(localeKa, "ka");
registerLocaleData(localeKm, "km");
registerLocaleData(localeKn, "kn");
registerLocaleData(localeKo, "ko");
registerLocaleData(localeLv, "lv");
registerLocaleData(localeMl, "ml");
registerLocaleData(localeNb, "nb");
registerLocaleData(localeNl, "nl");
registerLocaleData(localeNn, "nn");
registerLocaleData(localePl, "pl");
registerLocaleData(localePtBr, "pt-BR");
registerLocaleData(localePtPt, "pt-PT");
registerLocaleData(localeRo, "ro");
registerLocaleData(localeRu, "ru");
registerLocaleData(localeSi, "si");
registerLocaleData(localeSk, "sk");
registerLocaleData(localeSl, "sl");
registerLocaleData(localeSr, "sr");
registerLocaleData(localeSv, "sv");
registerLocaleData(localeTr, "tr");
registerLocaleData(localeUk, "uk");
registerLocaleData(localeVi, "vi");
registerLocaleData(localeZhCn, "zh-CN");
registerLocaleData(localeZhTw, "zh-TW");
@NgModule({
imports: [
CommonModule,
DragDropModule,
FormsModule,
InfiniteScrollModule,
JslibModule,
ReactiveFormsModule,
RouterModule,
BadgeModule,
ButtonModule,
CalloutModule,
ToastrModule,
BadgeModule,
ButtonModule,
MenuModule,
],
exports: [
CommonModule,
DragDropModule,
FormsModule,
InfiniteScrollModule,
JslibModule,
ReactiveFormsModule,
RouterModule,
BadgeModule,
ButtonModule,
CalloutModule,
ToastrModule,
BadgeModule,
ButtonModule,
MenuModule,
],
providers: [DatePipe],
bootstrap: [],
})
export class SharedModule {}
| bitwarden/web/src/app/modules/shared.module.ts/0 | {
"file_path": "bitwarden/web/src/app/modules/shared.module.ts",
"repo_id": "bitwarden",
"token_count": 1900
} | 134 |
<div class="card vault-filters">
<div class="container loading-spinner" *ngIf="!isLoaded">
<i class="bwi bwi-spinner bwi-spin bwi-3x" aria-hidden="true"></i>
</div>
<div *ngIf="isLoaded">
<div class="card-header d-flex">
{{ "filters" | i18n }}
<a
class="ml-auto"
href="https://bitwarden.com/help/searching-vault/"
target="_blank"
rel="noopener"
appA11yTitle="{{ 'learnMore' | i18n }}"
>
<i class="bwi bwi-question-circle" aria-hidden="true"></i>
</a>
</div>
<div class="card-body">
<input
type="search"
placeholder="{{ (searchPlaceholder | i18n) || ('searchVault' | i18n) }}"
id="search"
class="form-control"
[(ngModel)]="searchText"
(input)="searchTextChanged()"
autocomplete="off"
appAutofocus
/>
<app-organization-filter
[hide]="hideOrganizations"
[activeFilter]="activeFilter"
[collapsedFilterNodes]="collapsedFilterNodes"
[organizations]="organizations"
[activePersonalOwnershipPolicy]="activePersonalOwnershipPolicy"
[activeSingleOrganizationPolicy]="activeSingleOrganizationPolicy"
(onNodeCollapseStateChange)="toggleFilterNodeCollapseState($event)"
(onFilterChange)="applyFilter($event)"
></app-organization-filter>
<div class="filter">
<app-status-filter
[hideFavorites]="hideFavorites"
[hideTrash]="hideTrash"
[activeFilter]="activeFilter"
(onFilterChange)="applyFilter($event)"
></app-status-filter>
</div>
<div class="filter">
<app-type-filter
[activeFilter]="activeFilter"
[collapsedFilterNodes]="collapsedFilterNodes"
(onNodeCollapseStateChange)="toggleFilterNodeCollapseState($event)"
(onFilterChange)="applyFilter($event)"
></app-type-filter>
</div>
<div class="filter">
<app-folder-filter
[hide]="hideFolders"
[activeFilter]="activeFilter"
[collapsedFilterNodes]="collapsedFilterNodes"
[folderNodes]="folders"
(onNodeCollapseStateChange)="toggleFilterNodeCollapseState($event)"
(onFilterChange)="applyFilter($event)"
(onAddFolder)="addFolder()"
(onEditFolder)="editFolder($event)"
></app-folder-filter>
</div>
<div class="filter">
<app-collection-filter
[hide]="hideCollections"
[activeFilter]="activeFilter"
[collapsedFilterNodes]="collapsedFilterNodes"
[collectionNodes]="collections"
(onNodeCollapseStateChange)="toggleFilterNodeCollapseState($event)"
(onFilterChange)="applyFilter($event)"
></app-collection-filter>
</div>
</div>
</div>
</div>
| bitwarden/web/src/app/modules/vault-filter/vault-filter.component.html/0 | {
"file_path": "bitwarden/web/src/app/modules/vault-filter/vault-filter.component.html",
"repo_id": "bitwarden",
"token_count": 1301
} | 135 |
import { VaultFilter } from "jslib-angular/modules/vault-filter/models/vault-filter.model";
export class VaultService {
calculateSearchBarLocalizationString(vaultFilter: VaultFilter): string {
if (vaultFilter.status === "favorites") {
return "searchFavorites";
}
if (vaultFilter.status === "trash") {
return "searchTrash";
}
if (vaultFilter.cipherType != null) {
return "searchType";
}
if (vaultFilter.selectedFolderId != null && vaultFilter.selectedFolderId != "none") {
return "searchFolder";
}
if (vaultFilter.selectedCollectionId != null) {
return "searchCollection";
}
if (vaultFilter.selectedOrganizationId != null) {
return "searchOrganization";
}
if (vaultFilter.myVaultOnly) {
return "searchMyVault";
}
return "searchVault";
}
}
| bitwarden/web/src/app/modules/vault/vault.service.ts/0 | {
"file_path": "bitwarden/web/src/app/modules/vault/vault.service.ts",
"repo_id": "bitwarden",
"token_count": 318
} | 136 |
<div class="page-header d-flex">
<h1>{{ "eventLogs" | i18n }}</h1>
<div class="ml-auto d-flex">
<div class="form-inline">
<label class="sr-only" for="start">{{ "startDate" | i18n }}</label>
<input
type="datetime-local"
class="form-control form-control-sm"
id="start"
placeholder="{{ 'startDate' | i18n }}"
[(ngModel)]="start"
placeholder="YYYY-MM-DDTHH:MM"
(change)="dirtyDates = true"
/>
<span class="mx-2">-</span>
<label class="sr-only" for="end">{{ "endDate" | i18n }}</label>
<input
type="datetime-local"
class="form-control form-control-sm"
id="end"
placeholder="{{ 'endDate' | i18n }}"
[(ngModel)]="end"
placeholder="YYYY-MM-DDTHH:MM"
(change)="dirtyDates = true"
/>
</div>
<form #refreshForm [appApiAction]="refreshPromise" class="d-inline">
<button
type="button"
class="btn btn-sm btn-outline-primary ml-3"
(click)="loadEvents(true)"
[disabled]="loaded && refreshForm.loading"
>
<i
class="bwi bwi-refresh bwi-fw"
aria-hidden="true"
[ngClass]="{ 'bwi-spin': loaded && refreshForm.loading }"
></i>
{{ "refresh" | i18n }}
</button>
</form>
<form #exportForm [appApiAction]="exportPromise" class="d-inline">
<button
type="button"
class="btn btn-sm btn-outline-primary btn-submit manual ml-3"
[ngClass]="{ loading: exportForm.loading }"
(click)="exportEvents()"
[disabled]="(loaded && exportForm.loading) || dirtyDates"
>
<i class="bwi bwi-spinner bwi-spin" aria-hidden="true"></i>
<span>{{ "export" | i18n }}</span>
</button>
</form>
</div>
</div>
<ng-container *ngIf="!loaded">
<i
class="bwi bwi-spinner bwi-spin text-muted"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
<span class="sr-only">{{ "loading" | i18n }}</span>
</ng-container>
<ng-container *ngIf="loaded">
<p *ngIf="!events || !events.length">{{ "noEventsInList" | i18n }}</p>
<table class="table table-hover" *ngIf="events && events.length">
<thead>
<tr>
<th class="border-top-0" width="210">{{ "timestamp" | i18n }}</th>
<th class="border-top-0" width="40">
<span class="sr-only">{{ "device" | i18n }}</span>
</th>
<th class="border-top-0" width="150">{{ "user" | i18n }}</th>
<th class="border-top-0">{{ "event" | i18n }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let e of events">
<td>{{ e.date | date: "medium" }}</td>
<td>
<i
class="text-muted bwi bwi-lg {{ e.appIcon }}"
title="{{ e.appName }}, {{ e.ip }}"
aria-hidden="true"
></i>
<span class="sr-only">{{ e.appName }}, {{ e.ip }}</span>
</td>
<td>
<span title="{{ e.userEmail }}">{{ e.userName }}</span>
</td>
<td [innerHTML]="e.message"></td>
</tr>
</tbody>
</table>
<button
#moreBtn
[appApiAction]="morePromise"
type="button"
class="btn btn-block btn-link btn-submit"
(click)="loadEvents(false)"
[disabled]="loaded && moreBtn.loading"
*ngIf="continuationToken"
>
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
<span>{{ "loadMore" | i18n }}</span>
</button>
</ng-container>
| bitwarden/web/src/app/organizations/manage/events.component.html/0 | {
"file_path": "bitwarden/web/src/app/organizations/manage/events.component.html",
"repo_id": "bitwarden",
"token_count": 1722
} | 137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.