Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
-布谷鸟-
nosqlclient
提交
5f12ea2e
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 搜索 >>
提交
5f12ea2e
编写于
12月 31, 2015
作者:
S
Sercan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cursor options
上级
8170a1e7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
89 addition
and
25 deletion
+89
-25
client/common.js
client/common.js
+11
-0
client/views/query_templates/find/find.html
client/views/query_templates/find/find.html
+11
-0
client/views/query_templates/find/find.js
client/views/query_templates/find/find.js
+58
-25
lib/enums.js
lib/enums.js
+9
-0
public/chosen-sprite.png
public/chosen-sprite.png
+0
-0
public/chosen-sprite@2x.png
public/chosen-sprite@2x.png
+0
-0
未找到文件。
client/common.js
浏览文件 @
5f12ea2e
...
...
@@ -12,6 +12,17 @@ clearSessions = function () {
Session
.
set
(
strSessionSelectedCollection
,
undefined
);
};
Array
.
prototype
.
remove
=
function
()
{
var
what
,
a
=
arguments
,
L
=
a
.
length
,
ax
;
while
(
L
&&
this
.
length
)
{
what
=
a
[
--
L
];
while
((
ax
=
this
.
indexOf
(
what
))
!==
-
1
)
{
this
.
splice
(
ax
,
1
);
}
}
return
this
;
};
Template
.
registerHelper
(
'
getConnection
'
,
function
()
{
if
(
Session
.
get
(
strSessionConnection
))
{
return
Connections
.
findOne
({
_id
:
Session
.
get
(
strSessionConnection
)});
...
...
client/views/query_templates/find/find.html
浏览文件 @
5f12ea2e
...
...
@@ -7,4 +7,15 @@
HH:mm:ss
</strong></span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-1 control-label"
>
Options
</label>
<div
class=
"col-lg-11"
>
<select
id=
"cmbCursorOptions"
data-placeholder=
"Choose one or more options.."
multiple=
"true"
class=
"chosen-select form-control"
tabindex=
"-1"
>
</select>
</div>
</div>
</template>
\ No newline at end of file
client/views/query_templates/find/find.js
浏览文件 @
5f12ea2e
/**
* Created by sercan on 30.12.2015.
*/
var
strSessionSelectedOptions
=
"
selectedCursorOptions
"
;
Template
.
find
.
onRendered
(
function
()
{
// set ace editor
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
"
,
executeQuery
);
});
initializeAceEditor
();
initializeOptions
();
initializeSessionVariable
();
});
Template
.
browseCollection
.
events
({
...
...
@@ -107,4 +87,57 @@ executeQuery = function () {
// stop loading animation
l
.
ladda
(
'
stop
'
);
});
}
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
"
,
executeQuery
);
});
}
initializeOptions
=
function
()
{
var
cmb
=
$
(
'
#cmbCursorOptions
'
);
$
.
each
(
CURSOR_OPTIONS
,
function
(
key
,
value
)
{
cmb
.
append
(
$
(
"
<option></option>
"
)
.
attr
(
"
value
"
,
key
)
.
text
(
value
));
});
cmb
.
chosen
();
cmb
.
on
(
'
change
'
,
function
(
evt
,
params
)
{
var
array
=
Session
.
get
(
strSessionSelectedOptions
);
if
(
params
.
deselected
)
{
array
.
remove
(
params
.
deselected
);
}
else
{
array
.
push
(
params
.
selected
);
}
Session
.
set
(
strSessionSelectedOptions
,
array
);
});
}
initializeSessionVariable
=
function
()
{
Session
.
set
(
strSessionSelectedOptions
,
[]);
}
\ No newline at end of file
lib/
query_type
s.js
→
lib/
enum
s.js
浏览文件 @
5f12ea2e
...
...
@@ -10,4 +10,13 @@ QUERY_TYPES = {
FINDONE_AND_REPLACE
:
"
findOneAndReplace
"
,
FINDONE_AND_UPDATE
:
"
findOneAndUpdate
"
}
CURSOR_OPTIONS
=
{
PROJECT
:
"
project
"
,
SKIP
:
"
skip
"
,
LIMIT
:
"
limit
"
,
MAX
:
"
max
"
,
MIN
:
"
min
"
,
SORT
:
"
sort
"
}
\ No newline at end of file
public/chosen-sprite.png
0 → 100644
浏览文件 @
5f12ea2e
646 字节
public/chosen-sprite@2x.png
0 → 100644
浏览文件 @
5f12ea2e
872 字节
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录