Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
-布谷鸟-
nosqlclient
提交
e4cf8981
N
nosqlclient
项目概览
-布谷鸟-
/
nosqlclient
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nosqlclient
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e4cf8981
编写于
1月 01, 2016
作者:
S
Sercan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactored
上级
4dacbaf6
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
203 addition
and
214 deletion
+203
-214
client/common.js
client/common.js
+58
-20
client/views/pages/browse_collection.js
client/views/pages/browse_collection.js
+6
-1
client/views/query_templates/find/find.html
client/views/query_templates/find/find.html
+1
-1
client/views/query_templates/find/find.js
client/views/query_templates/find/find.js
+5
-51
client/views/query_templates/findone/findone.html
client/views/query_templates/findone/findone.html
+1
-1
client/views/query_templates/findone/findone.js
client/views/query_templates/findone/findone.js
+47
-6
client/views/query_templates/findone_and_update/findone_and_update.html
...uery_templates/findone_and_update/findone_and_update.html
+2
-2
client/views/query_templates/findone_and_update/findone_and_update.js
.../query_templates/findone_and_update/findone_and_update.js
+24
-0
client/views/query_templates/options/common/project.html
client/views/query_templates/options/common/project.html
+8
-0
client/views/query_templates/options/common/project.js
client/views/query_templates/options/common/project.js
+16
-0
client/views/query_templates/options/common/sort.html
client/views/query_templates/options/common/sort.html
+8
-0
client/views/query_templates/options/common/sort.js
client/views/query_templates/options/common/sort.js
+16
-0
client/views/query_templates/options/cursor_options/cursor_options.html
...uery_templates/options/cursor_options/cursor_options.html
+0
-18
client/views/query_templates/options/cursor_options/cursor_options.js
.../query_templates/options/cursor_options/cursor_options.js
+9
-46
client/views/query_templates/options/findone_modify_options/findone_modify_options.html
...ptions/findone_modify_options/findone_modify_options.html
+0
-18
client/views/query_templates/options/findone_modify_options/findone_modify_options.js
.../options/findone_modify_options/findone_modify_options.js
+1
-50
lib/methods.js
lib/methods.js
+1
-0
未找到文件。
client/common.js
浏览文件 @
e4cf8981
...
...
@@ -13,6 +13,64 @@ Template.clearSessions = function () {
Session
.
set
(
Template
.
strSessionSelectedCollection
,
undefined
);
};
Template
.
setOptionsComboboxChangeEvent
=
function
(
cmb
)
{
cmb
.
on
(
'
change
'
,
function
(
evt
,
params
)
{
var
array
=
Session
.
get
(
Template
.
strSessionSelectedOptions
);
if
(
params
.
deselected
)
{
array
.
remove
(
params
.
deselected
);
}
else
{
array
.
push
(
params
.
selected
);
}
Session
.
set
(
Template
.
strSessionSelectedOptions
,
array
);
});
};
Template
.
getParentTemplateName
=
function
(
levels
)
{
var
view
=
Blaze
.
currentView
;
if
(
typeof
levels
===
"
undefined
"
)
{
levels
=
1
;
}
while
(
view
)
{
if
(
view
.
name
.
indexOf
(
"
Template.
"
)
!=
-
1
&&
!
(
levels
--
))
{
return
view
.
name
.
substring
(
view
.
name
.
indexOf
(
'
.
'
)
+
1
);
}
view
=
view
.
parentView
;
}
};
Template
.
initializeAceEditor
=
function
(
id
,
evt
)
{
AceEditor
.
instance
(
id
,
{
mode
:
"
javascript
"
,
theme
:
'
dawn
'
},
function
(
editor
)
{
editor
.
$blockScrolling
=
Infinity
;
editor
.
setOptions
({
fontSize
:
"
11pt
"
,
showPrintMargin
:
false
});
// remove newlines in pasted text
editor
.
on
(
"
paste
"
,
function
(
e
)
{
e
.
text
=
e
.
text
.
replace
(
/
[\r\n]
+/g
,
"
"
);
});
// make mouse position clipping nicer
editor
.
renderer
.
screenToTextCoordinates
=
function
(
x
,
y
)
{
var
pos
=
this
.
pixelToScreenCoordinates
(
x
,
y
);
return
this
.
session
.
screenToDocumentPosition
(
Math
.
min
(
this
.
session
.
getScreenLength
()
-
1
,
Math
.
max
(
pos
.
row
,
0
)),
Math
.
max
(
pos
.
column
,
0
)
);
};
// disable Enter Shift-Enter keys
editor
.
commands
.
bindKey
(
"
Enter|Shift-Enter
"
,
evt
);
});
};
Template
.
registerHelper
(
'
isSelected
'
,
function
(
option
)
{
return
$
.
inArray
(
option
,
Session
.
get
(
Template
.
strSessionSelectedOptions
))
!=
-
1
;
});
Template
.
registerHelper
(
'
getConnection
'
,
function
()
{
if
(
Session
.
get
(
Template
.
strSessionConnection
))
{
return
Connections
.
findOne
({
_id
:
Session
.
get
(
Template
.
strSessionConnection
)});
...
...
@@ -27,7 +85,6 @@ Template.registerHelper('getSelectedCollection', function () {
return
Session
.
get
(
Template
.
strSessionSelectedCollection
);
});
/**
* Adds remove by value functionality to arrays. e.x. myArray.remove('myValue');
* */
...
...
@@ -40,23 +97,4 @@ Array.prototype.remove = function () {
}
}
return
this
;
};
/**
* Get the parent template instance
* @param {Number} [levels] How many levels to go up. Default is 1
* @returns {Blaze.TemplateInstance}
*/
Blaze
.
TemplateInstance
.
prototype
.
parentTemplate
=
function
(
levels
)
{
var
view
=
Blaze
.
currentView
;
if
(
typeof
levels
===
"
undefined
"
)
{
levels
=
1
;
}
while
(
view
)
{
if
(
view
.
name
.
indexOf
(
"
Template.
"
)
!=
-
1
&&
!
(
levels
--
))
{
return
view
.
templateInstance
();
}
view
=
view
.
parentView
;
}
};
\ No newline at end of file
client/views/pages/browse_collection.js
浏览文件 @
e4cf8981
...
...
@@ -15,6 +15,11 @@ Template.browseCollection.onRendered(function () {
});
cmb
.
chosen
();
cmb
.
on
(
'
change
'
,
function
(
evt
,
params
)
{
Session
.
set
(
Template
.
strSessionSelectedOptions
,
[]);
});
Session
.
set
(
Template
.
strSessionSelectedOptions
,
[]);
});
Template
.
browseCollection
.
events
({
...
...
@@ -41,7 +46,7 @@ Template.browseCollection.events({
var
queryTemplate
=
Session
.
get
(
Template
.
strSessionSelectedQuery
);
if
(
queryTemplate
)
{
Template
[
queryTemplate
].
executeQuery
();
}
else
{
}
else
{
Template
[
"
find
"
].
executeQuery
();
}
}
...
...
client/views/query_templates/find/find.html
浏览文件 @
e4cf8981
...
...
@@ -10,7 +10,7 @@
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
Options
</label>
<div
class=
"col-lg-11"
>
<select
id=
"cmbCursorOptions"
<select
id=
"cmb
Find
CursorOptions"
data-placeholder=
"Choose one or more options.."
multiple=
"true"
class=
"chosen-select form-control"
...
...
client/views/query_templates/find/find.js
浏览文件 @
e4cf8981
...
...
@@ -2,42 +2,13 @@
* Created by sercan on 30.12.2015.
*/
Template
.
find
.
onRendered
(
function
()
{
// set ace editor
Template
.
find
.
initializeAceEditor
();
Template
.
initializeAceEditor
(
'
preSelector
'
,
Template
.
find
.
executeQuery
);
Template
.
find
.
initializeOptions
();
Template
.
find
.
initializeSessionVariable
();
});
Template
.
find
.
initializeAceEditor
=
function
()
{
AceEditor
.
instance
(
"
preSelector
"
,
{
mode
:
"
javascript
"
,
theme
:
'
dawn
'
},
function
(
editor
)
{
editor
.
$blockScrolling
=
Infinity
;
editor
.
setOptions
({
fontSize
:
"
11pt
"
,
showPrintMargin
:
false
});
// remove newlines in pasted text
editor
.
on
(
"
paste
"
,
function
(
e
)
{
e
.
text
=
e
.
text
.
replace
(
/
[\r\n]
+/g
,
"
"
);
});
// make mouse position clipping nicer
editor
.
renderer
.
screenToTextCoordinates
=
function
(
x
,
y
)
{
var
pos
=
this
.
pixelToScreenCoordinates
(
x
,
y
);
return
this
.
session
.
screenToDocumentPosition
(
Math
.
min
(
this
.
session
.
getScreenLength
()
-
1
,
Math
.
max
(
pos
.
row
,
0
)),
Math
.
max
(
pos
.
column
,
0
)
);
};
// disable Enter Shift-Enter keys
editor
.
commands
.
bindKey
(
"
Enter|Shift-Enter
"
,
Template
.
find
.
executeQuery
);
});
};
Template
.
find
.
initializeOptions
=
function
()
{
var
cmb
=
$
(
'
#cmbCursorOptions
'
);
var
cmb
=
$
(
'
#cmb
Find
CursorOptions
'
);
$
.
each
(
CURSOR_OPTIONS
,
function
(
key
,
value
)
{
cmb
.
append
(
$
(
"
<option></option>
"
)
.
attr
(
"
value
"
,
key
)
...
...
@@ -45,27 +16,10 @@ Template.find.initializeOptions = function () {
});
cmb
.
chosen
();
Template
.
find
.
setCursorOptionsChangeEvent
(
cmb
);
};
Template
.
find
.
setCursorOptionsChangeEvent
=
function
(
cmb
)
{
cmb
.
on
(
'
change
'
,
function
(
evt
,
params
)
{
var
array
=
Session
.
get
(
Template
.
strSessionSelectedOptions
);
if
(
params
.
deselected
)
{
array
.
remove
(
params
.
deselected
);
}
else
{
array
.
push
(
params
.
selected
);
}
Session
.
set
(
Template
.
strSessionSelectedOptions
,
array
);
});
};
Template
.
find
.
initializeSessionVariable
=
function
()
{
Session
.
set
(
Template
.
strSessionSelectedOptions
,
[]);
Template
.
setOptionsComboboxChangeEvent
(
cmb
);
};
Template
.
find
.
executeQuery
=
function
(
methodName
)
{
Template
.
find
.
executeQuery
=
function
()
{
var
laddaButton
=
Template
.
browseCollection
.
initExecuteQuery
();
var
connection
=
Connections
.
findOne
({
_id
:
Session
.
get
(
Template
.
strSessionConnection
)});
var
selectedCollection
=
Session
.
get
(
Template
.
strSessionSelectedCollection
);
...
...
@@ -92,7 +46,7 @@ Template.find.executeQuery = function (methodName) {
return
;
}
Meteor
.
call
(
(
methodName
?
methodName
:
"
find
"
)
,
connection
,
selectedCollection
,
selector
,
cursorOptions
,
function
(
err
,
result
)
{
Meteor
.
call
(
"
find
"
,
connection
,
selectedCollection
,
selector
,
cursorOptions
,
function
(
err
,
result
)
{
if
(
err
||
result
.
error
)
{
var
errorMessage
;
if
(
err
)
{
...
...
client/views/query_templates/findone/findone.html
浏览文件 @
e4cf8981
...
...
@@ -10,7 +10,7 @@
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
Options
</label>
<div
class=
"col-lg-11"
>
<select
id=
"cmbCursorOptions"
<select
id=
"cmb
FindOne
CursorOptions"
data-placeholder=
"Choose one or more options.."
multiple=
"true"
class=
"chosen-select form-control"
...
...
client/views/query_templates/findone/findone.js
浏览文件 @
e4cf8981
...
...
@@ -2,14 +2,12 @@
* Created by RSercan on 1.1.2016.
*/
Template
.
findOne
.
onRendered
(
function
()
{
// set ace editor
Template
.
find
.
initializeAceEditor
();
Template
.
initializeAceEditor
(
'
preSelector
'
,
Template
.
findOne
.
executeQuery
);
Template
.
findOne
.
initializeOptions
();
Template
.
find
.
initializeSessionVariable
();
});
Template
.
findOne
.
initializeOptions
=
function
()
{
var
cmb
=
$
(
'
#cmbCursorOptions
'
);
var
cmb
=
$
(
'
#cmb
FindOne
CursorOptions
'
);
$
.
each
(
CURSOR_OPTIONS
,
function
(
key
,
value
)
{
// dont add limit, it will be 1 already
if
(
value
!=
CURSOR_OPTIONS
.
LIMIT
)
{
...
...
@@ -20,9 +18,52 @@ Template.findOne.initializeOptions = function () {
});
cmb
.
chosen
();
Template
.
find
.
setCursorOptions
ChangeEvent
(
cmb
);
Template
.
setOptionsCombobox
ChangeEvent
(
cmb
);
};
Template
.
findOne
.
executeQuery
=
function
()
{
Template
.
find
.
executeQuery
(
'
findOne
'
);
var
laddaButton
=
Template
.
browseCollection
.
initExecuteQuery
();
var
connection
=
Connections
.
findOne
({
_id
:
Session
.
get
(
Template
.
strSessionConnection
)});
var
selectedCollection
=
Session
.
get
(
Template
.
strSessionSelectedCollection
);
var
cursorOptions
=
Template
.
find
.
getCursorOptions
();
var
selector
=
ace
.
edit
(
"
preSelector
"
).
getSession
().
getValue
();
if
(
!
selector
)
{
selector
=
{};
}
else
{
try
{
selector
=
JSON
.
parse
(
selector
);
}
catch
(
err
)
{
toastr
.
error
(
"
Syntax error on selector:
"
+
err
.
message
);
laddaButton
.
ladda
(
'
stop
'
);
return
;
}
}
if
(
cursorOptions
[
"
ERROR
"
])
{
toastr
.
error
(
cursorOptions
[
"
ERROR
"
]);
laddaButton
.
ladda
(
'
stop
'
);
return
;
}
Meteor
.
call
(
"
findOne
"
,
connection
,
selectedCollection
,
selector
,
cursorOptions
,
function
(
err
,
result
)
{
if
(
err
||
result
.
error
)
{
var
errorMessage
;
if
(
err
)
{
errorMessage
=
err
.
message
;
}
else
{
errorMessage
=
result
.
error
.
message
;
}
toastr
.
error
(
"
Couldn't execute query:
"
+
errorMessage
);
// stop loading animation
laddaButton
.
ladda
(
'
stop
'
);
return
;
}
Template
.
browseCollection
.
setResult
(
result
.
result
);
// stop loading animation
laddaButton
.
ladda
(
'
stop
'
);
});
};
\ No newline at end of file
client/views/query_templates/findone_and_update/findone_and_update.html
浏览文件 @
e4cf8981
<template
name=
"findOne
ModifyOptions
"
>
<template
name=
"findOne
AndUpdate
"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
Selector
</label>
<div
class=
"col-lg-11"
>
...
...
@@ -10,7 +10,7 @@
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
Options
</label>
<div
class=
"col-lg-11"
>
<select
id=
"cmbFindOneOptions"
<select
id=
"cmbFindOne
Modify
Options"
data-placeholder=
"Choose one or more options.."
multiple=
"true"
class=
"chosen-select form-control"
...
...
client/views/query_templates/findone_and_update/findone_and_update.js
浏览文件 @
e4cf8981
/**
* Created by RSercan on 1.1.2016.
*/
Template
.
findOneAndUpdate
.
onRendered
(
function
()
{
// set ace editor
Template
.
initializeAceEditor
(
'
preSelector
'
,
Template
.
findOneAndUpdate
.
executeQuery
);
Template
.
findOneAndUpdate
.
initializeOptions
();
});
Template
.
findOneAndUpdate
.
initializeOptions
=
function
()
{
var
cmb
=
$
(
'
#cmbFindOneModifyOptions
'
);
$
.
each
(
CURSOR_OPTIONS
,
function
(
key
,
value
)
{
// dont add limit, it will be 1 already
if
(
value
!=
CURSOR_OPTIONS
.
LIMIT
)
{
cmb
.
append
(
$
(
"
<option></option>
"
)
.
attr
(
"
value
"
,
key
)
.
text
(
value
));
}
});
cmb
.
chosen
();
Template
.
setOptionsComboboxChangeEvent
(
cmb
);
};
Template
.
findOneAndUpdate
.
executeQuery
=
function
()
{
};
\ No newline at end of file
client/views/query_templates/options/common/project.html
0 → 100644
浏览文件 @
e4cf8981
<template
name=
"project"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
project
</label>
<div
class=
"col-lg-11"
>
<pre
class=
"form-control"
id=
'aceProject'
></pre>
</div>
</div>
</template>
\ No newline at end of file
client/views/query_templates/options/common/project.js
0 → 100644
浏览文件 @
e4cf8981
/**
* Created by RSercan on 1.1.2016.
*/
Template
.
project
.
onRendered
(
function
()
{
switch
(
Template
.
getParentTemplateName
(
2
))
{
case
QUERY_TYPES
.
FIND
:
Template
.
initializeAceEditor
(
'
aceProject
'
,
Template
.
find
.
executeQuery
);
break
;
case
QUERY_TYPES
.
FINDONE
:
Template
.
initializeAceEditor
(
'
aceProject
'
,
Template
.
findOne
.
executeQuery
);
break
;
case
QUERY_TYPES
.
FINDONE_AND_UPDATE
:
Template
.
initializeAceEditor
(
'
aceProject
'
,
Template
.
findOneAndUpdate
.
executeQuery
);
break
;
}
});
\ No newline at end of file
client/views/query_templates/options/common/sort.html
0 → 100644
浏览文件 @
e4cf8981
<template
name=
"sort"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
sort
</label>
<div
class=
"col-lg-11"
>
<pre
class=
"form-control"
id=
'aceSort'
></pre>
</div>
</div>
</template>
\ No newline at end of file
client/views/query_templates/options/common/sort.js
0 → 100644
浏览文件 @
e4cf8981
/**
* Created by RSercan on 1.1.2016.
*/
Template
.
sort
.
onRendered
(
function
()
{
switch
(
Template
.
getParentTemplateName
(
2
))
{
case
QUERY_TYPES
.
FIND
:
Template
.
initializeAceEditor
(
'
aceSort
'
,
Template
.
find
.
executeQuery
);
break
;
case
QUERY_TYPES
.
FINDONE
:
Template
.
initializeAceEditor
(
'
aceSort
'
,
Template
.
findOne
.
executeQuery
);
break
;
case
QUERY_TYPES
.
FINDONE_AND_UPDATE
:
Template
.
initializeAceEditor
(
'
aceSort
'
,
Template
.
findOneAndUpdate
.
executeQuery
);
break
;
}
});
\ No newline at end of file
client/views/query_templates/options/cursor_options/cursor_options.html
浏览文件 @
e4cf8981
...
...
@@ -19,15 +19,6 @@
{{/if}}
</template>
<template
name=
"project"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
project
</label>
<div
class=
"col-lg-11"
>
<pre
class=
"form-control"
id=
'aceProject'
></pre>
</div>
</div>
</template>
<template
name=
"limit"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
labelfo
>
limit
</label>
...
...
@@ -46,15 +37,6 @@
</div>
</template>
<template
name=
"sort"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
sort
</label>
<div
class=
"col-lg-11"
>
<pre
class=
"form-control"
id=
'aceSort'
></pre>
</div>
</div>
</template>
<template
name=
"max"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
max
</label>
...
...
client/views/query_templates/options/cursor_options/cursor_options.js
浏览文件 @
e4cf8981
/**
* Created by sercan on 31.12.2015.
*/
Template
.
cursorOptions
.
helpers
({
'
isSelected
'
:
function
(
option
)
{
return
$
.
inArray
(
option
,
Session
.
get
(
Template
.
strSessionSelectedOptions
))
!=
-
1
;
}
});
Template
.
project
.
onRendered
(
function
()
{
Template
.
cursorOptions
.
initializeAceEditor
(
'
aceProject
'
);
});
Template
.
sort
.
onRendered
(
function
()
{
Template
.
cursorOptions
.
initializeAceEditor
(
'
aceSort
'
);
});
Template
.
max
.
onRendered
(
function
()
{
Template
.
cursorOptions
.
initializeAceEditor
(
'
aceMax
'
);
});
...
...
@@ -24,37 +10,14 @@ Template.min.onRendered(function () {
});
Template
.
cursorOptions
.
initializeAceEditor
=
function
(
id
)
{
AceEditor
.
instance
(
id
,
{
mode
:
"
javascript
"
,
theme
:
'
dawn
'
},
function
(
editor
)
{
editor
.
$blockScrolling
=
Infinity
;
editor
.
setOptions
({
fontSize
:
"
11pt
"
,
showPrintMargin
:
false
});
// remove newlines in pasted text
editor
.
on
(
"
paste
"
,
function
(
e
)
{
e
.
text
=
e
.
text
.
replace
(
/
[\r\n]
+/g
,
"
"
);
});
// make mouse position clipping nicer
editor
.
renderer
.
screenToTextCoordinates
=
function
(
x
,
y
)
{
var
pos
=
this
.
pixelToScreenCoordinates
(
x
,
y
);
return
this
.
session
.
screenToDocumentPosition
(
Math
.
min
(
this
.
session
.
getScreenLength
()
-
1
,
Math
.
max
(
pos
.
row
,
0
)),
Math
.
max
(
pos
.
column
,
0
)
);
};
// find and findOne templates uses same cursor options so clarify ENTER key event on SELECTOR.
// disable Enter Shift-Enter keys and bind to executeQuery for corresponding template
var
parentTemplateName
=
Template
.
getParentTemplateName
(
2
);
if
(
parentTemplateName
==
QUERY_TYPES
.
FIND
)
{
Template
.
initializeAceEditor
(
id
,
Template
.
find
.
executeQuery
);
}
else
if
(
parentTemplateName
==
QUERY_TYPES
.
FINDONE
)
{
Template
.
initializeAceEditor
(
id
,
Template
.
findOne
.
executeQuery
);
}
// disable Enter Shift-Enter keys and bind to executeQuery for corresponding template
var
name
=
Template
.
instance
().
parentTemplate
(
2
).
view
.
name
;
var
cleanName
=
name
.
substring
(
name
.
indexOf
(
'
.
'
)
+
1
);
if
(
cleanName
==
QUERY_TYPES
.
FIND
)
{
editor
.
commands
.
bindKey
(
"
Enter|Shift-Enter
"
,
Template
.
find
.
executeQuery
);
}
else
if
(
cleanName
==
QUERY_TYPES
.
FINDONE
)
{
editor
.
commands
.
bindKey
(
"
Enter|Shift-Enter
"
,
Template
.
findOne
.
executeQuery
);
}
});
};
\ No newline at end of file
client/views/query_templates/options/findone_modify_options/findone_modify_options.html
浏览文件 @
e4cf8981
...
...
@@ -13,24 +13,6 @@
{{/if}}
</template>
<template
name=
"project"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
project
</label>
<div
class=
"col-lg-11"
>
<pre
class=
"form-control"
id=
'aceProject'
></pre>
</div>
</div>
</template>
<template
name=
"sort"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
sort
</label>
<div
class=
"col-lg-11"
>
<pre
class=
"form-control"
id=
'aceSort'
></pre>
</div>
</div>
</template>
<template
name=
"upsert"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
upsert
</label>
...
...
client/views/query_templates/options/findone_modify_options/findone_modify_options.js
浏览文件 @
e4cf8981
/**
* Created by RSercan on 1.1.2016.
*/
Template
.
findOneModifyOptions
.
helpers
({
'
isSelected
'
:
function
(
option
)
{
return
$
.
inArray
(
option
,
Session
.
get
(
Template
.
strSessionSelectedOptions
))
!=
-
1
;
}
});
Template
.
project
.
onRendered
(
function
()
{
Template
.
findOneModifyOptions
.
initializeAceEditor
(
'
aceProject
'
);
});
Template
.
sort
.
onRendered
(
function
()
{
Template
.
findOneModifyOptions
.
initializeAceEditor
(
'
aceSort
'
);
});
Template
.
findOneModifyOptions
.
initializeAceEditor
=
function
(
id
)
{
AceEditor
.
instance
(
id
,
{
mode
:
"
javascript
"
,
theme
:
'
dawn
'
},
function
(
editor
)
{
editor
.
$blockScrolling
=
Infinity
;
editor
.
setOptions
({
fontSize
:
"
11pt
"
,
showPrintMargin
:
false
});
// remove newlines in pasted text
editor
.
on
(
"
paste
"
,
function
(
e
)
{
e
.
text
=
e
.
text
.
replace
(
/
[\r\n]
+/g
,
"
"
);
});
// make mouse position clipping nicer
editor
.
renderer
.
screenToTextCoordinates
=
function
(
x
,
y
)
{
var
pos
=
this
.
pixelToScreenCoordinates
(
x
,
y
);
return
this
.
session
.
screenToDocumentPosition
(
Math
.
min
(
this
.
session
.
getScreenLength
()
-
1
,
Math
.
max
(
pos
.
row
,
0
)),
Math
.
max
(
pos
.
column
,
0
)
);
};
// disable Enter Shift-Enter keys and bind to executeQuery for corresponding template
//var name = Template.instance().parentTemplate(2).view.name;
//var cleanName = name.substring(name.indexOf('.') + 1);
//if (cleanName == QUERY_TYPES.FIND) {
// editor.commands.bindKey("Enter|Shift-Enter", Template.find.executeQuery);
//}
//else if (cleanName == QUERY_TYPES.FINDONE) {
// editor.commands.bindKey("Enter|Shift-Enter", Template.findOne.executeQuery);
//}
});
};
\ No newline at end of file
*/
\ No newline at end of file
lib/methods.js
浏览文件 @
e4cf8981
...
...
@@ -18,6 +18,7 @@ Meteor.methods({
}
});
},
'
removeConnection
'
:
function
(
connectionId
)
{
Connections
.
remove
(
connectionId
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录