milkode 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.ja.rdoc +11 -0
- data/HISTORY.rdoc +11 -0
- data/lib/milkode/cdweb/app.rb +3 -0
- data/lib/milkode/cdweb/cli_cdweb.rb +3 -2
- data/lib/milkode/cdweb/lib/database.rb +49 -2
- data/lib/milkode/cdweb/lib/package_list.rb +4 -0
- data/lib/milkode/cdweb/lib/search_files.rb +1 -1
- data/lib/milkode/cdweb/lib/web_setting.rb +2 -0
- data/lib/milkode/cdweb/locales/en.yml +4 -0
- data/lib/milkode/cdweb/locales/ja.yml +4 -0
- data/lib/milkode/cdweb/views/help.haml +6 -0
- data/lib/milkode/cdweb/views/index.haml +2 -2
- data/lib/milkode/cdweb/views/milkode.js +54 -6
- data/lib/milkode/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1caa99b674c764b9cb78ecdfc5688a43fb8f86c5
|
4
|
+
data.tar.gz: ec040b50c181f412068d76de6bfa1620fee18d62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d968bba17caf2f486dcd0a1e02f90eb8a4bd95f765cd87701130410a577461f88c8f28bfe15ed63ce1d9f28fe15190bceee275ef2377cb8f04ef52917452b3a
|
7
|
+
data.tar.gz: 8adfee92b44ef759fd07357f46c747bd7a8d82f928df341d80882a6f0128656ffbabc943ae39a1807ec2b4fc24726422825c612307c156faa898228e70ba04cd
|
data/HISTORY.ja.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 1.8.0 2014/06/26
|
2
|
+
|
3
|
+
* milk web
|
4
|
+
* Keyboard shortcuts
|
5
|
+
* 's' .. Focus search bar
|
6
|
+
* 'S' (Select text) .. Search using a selected text with new tab
|
7
|
+
* Add help of keyboard shortcut
|
8
|
+
* Hide the favorite list if it is empty
|
9
|
+
* Support for filtering by package name in 'f:*' search
|
10
|
+
* Support :home_font_size attribute in milkweb.yaml
|
11
|
+
|
1
12
|
=== 1.7.1 2014/06/17
|
2
13
|
|
3
14
|
* milk web
|
data/HISTORY.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 1.8.0 2014/06/26
|
2
|
+
|
3
|
+
* milk web
|
4
|
+
* Keyboard shortcuts
|
5
|
+
* 's' .. Focus search bar
|
6
|
+
* 'S' (Select text) .. Search using a selected text with new tab
|
7
|
+
* Add help of keyboard shortcut
|
8
|
+
* Hide the favorite list if it is empty
|
9
|
+
* Support for filtering by package name in 'f:*' search
|
10
|
+
* Support :home_font_size attribute in milkweb.yaml
|
11
|
+
|
1
12
|
=== 1.7.1 2014/06/17
|
2
13
|
|
3
14
|
* milk web
|
data/lib/milkode/cdweb/app.rb
CHANGED
@@ -19,6 +19,7 @@ require 'milkode/cdweb/lib/web_setting'
|
|
19
19
|
require 'milkode/cdweb/lib/package_list'
|
20
20
|
require 'milkode/cdweb/lib/info_home'
|
21
21
|
require 'milkode/cdweb/lib/info_package'
|
22
|
+
require 'milkode/version'
|
22
23
|
require 'sinatra/url_for'
|
23
24
|
|
24
25
|
I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'locales', '*.yml').to_s]
|
@@ -303,6 +304,8 @@ EOF
|
|
303
304
|
end
|
304
305
|
|
305
306
|
def create_favorite_list(package_list)
|
307
|
+
return "" if package_list.favorite_list_size == 0
|
308
|
+
|
306
309
|
<<EOF
|
307
310
|
<div class="favorite_list">
|
308
311
|
#{t(:favorite)}:
|
@@ -78,8 +78,9 @@ EOF
|
|
78
78
|
File.open(fname, "w") do |f|
|
79
79
|
f.write <<EOF
|
80
80
|
---
|
81
|
-
:home_title
|
82
|
-
:home_icon
|
81
|
+
:home_title : "Milkode"
|
82
|
+
:home_icon : "/images/MilkodeIcon135.png"
|
83
|
+
:home_font_size : "100%"
|
83
84
|
|
84
85
|
:header_title: "Milkode"
|
85
86
|
:header_icon : "/images/MilkodeIcon135.png"
|
@@ -113,8 +113,55 @@ module Milkode
|
|
113
113
|
return records.map{|r| DocumentRecord.new(r)}, total_records, result
|
114
114
|
end
|
115
115
|
|
116
|
-
def selectAll(offset, limit)
|
117
|
-
|
116
|
+
def selectAll(current_path, offset, limit)
|
117
|
+
if current_path == ''
|
118
|
+
return @documents.select_all_sort_by_shortpath(offset, limit)
|
119
|
+
end
|
120
|
+
|
121
|
+
paths = []
|
122
|
+
strict_packages = []
|
123
|
+
is_not_search = false
|
124
|
+
|
125
|
+
package, restpath = Util.divide_shortpath(current_path)
|
126
|
+
|
127
|
+
grn_package = @grndb.packages[package]
|
128
|
+
if grn_package
|
129
|
+
# package name
|
130
|
+
strict_packages << package
|
131
|
+
|
132
|
+
# file path
|
133
|
+
directory = grn_package.directory
|
134
|
+
if restpath
|
135
|
+
paths << File.join(directory, restpath)
|
136
|
+
else
|
137
|
+
paths << directory
|
138
|
+
end
|
139
|
+
else
|
140
|
+
is_not_search = true
|
141
|
+
end
|
142
|
+
|
143
|
+
# search
|
144
|
+
records, total_records, result = [], 0, nil
|
145
|
+
|
146
|
+
begin
|
147
|
+
unless is_not_search
|
148
|
+
records, total_records, result = @documents.search_with_match(
|
149
|
+
:paths => paths,
|
150
|
+
:strict_packages => strict_packages,
|
151
|
+
:offset => offset,
|
152
|
+
:limit => limit
|
153
|
+
)
|
154
|
+
end
|
155
|
+
rescue Groonga::TooLargeOffset
|
156
|
+
end
|
157
|
+
|
158
|
+
if (limit != -1)
|
159
|
+
records = records.sort_by{|record| DocumentRecord::shortpath(record).downcase }
|
160
|
+
else
|
161
|
+
records = records.sort_by{|record| DocumentRecord::shortpath(record).downcase }
|
162
|
+
end
|
163
|
+
|
164
|
+
return records, result.size
|
118
165
|
end
|
119
166
|
|
120
167
|
# レコード数を得る
|
@@ -27,7 +27,7 @@ module Milkode
|
|
27
27
|
@offset = params[:offset].to_i
|
28
28
|
|
29
29
|
if (@q.fpaths.include?("*"))
|
30
|
-
@records, @total_records = Database.instance.selectAll(@offset, DISP_NUM)
|
30
|
+
@records, @total_records = Database.instance.selectAll(path, @offset, DISP_NUM)
|
31
31
|
else
|
32
32
|
@records, @total_records = Database.instance.search(@q.keywords, @q.multi_match_keywords, @q.packages, path, @q.fpaths, @q.suffixs, @q.fpath_or_packages, @offset, DISP_NUM)
|
33
33
|
end
|
@@ -14,6 +14,7 @@ module Milkode
|
|
14
14
|
DEFAULT_SETTING = {
|
15
15
|
:home_title => "Milkode",
|
16
16
|
:home_icon => "/images/MilkodeIcon135.png",
|
17
|
+
:home_font_size => "100%",
|
17
18
|
|
18
19
|
:header_title => "Milkode",
|
19
20
|
:header_icon => "/images/MilkodeIcon135.png",
|
@@ -47,6 +48,7 @@ module Milkode
|
|
47
48
|
|
48
49
|
hash_method :home_title
|
49
50
|
hash_method :home_icon
|
51
|
+
hash_method :home_font_size
|
50
52
|
|
51
53
|
hash_method :header_title
|
52
54
|
hash_method :header_icon
|
@@ -56,5 +56,9 @@ en:
|
|
56
56
|
help_directpath_comment_03: You can pass more than one value if you separate them by blank
|
57
57
|
help_directpath_gif: Get by clicking the line number
|
58
58
|
help_emacs_milkode: Direct Path can work with <a href="https://github.com/ongaeshi/emacs-milkode">emacs-milkode</a>.
|
59
|
+
keyboard_shortcut: Keyboard Shortcut
|
60
|
+
keyboard_shortcut_s: Focus search bar
|
61
|
+
keyboard_shortcut_S: Search using a selected text with new tab
|
62
|
+
select_text: Select text
|
59
63
|
|
60
64
|
|
@@ -56,5 +56,9 @@ ja:
|
|
56
56
|
help_directpath_comment_03: 空白で区切れば複数個渡せる
|
57
57
|
help_directpath_gif: ファイルモードで行番号をクリックすると取得可能
|
58
58
|
help_emacs_milkode: <a href="https://github.com/ongaeshi/emacs-milkode">emacs-milkode</a>との連携にも使う
|
59
|
+
keyboard_shortcut: キーボードショートカット
|
60
|
+
keyboard_shortcut_s: 検索バーに移動
|
61
|
+
keyboard_shortcut_S: 選択したテキストを使って新しいタブで検索
|
62
|
+
select_text: テキスト選択
|
59
63
|
|
60
64
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
%ol
|
8
8
|
%li <a href="#search">#{t(:help_search_by_keyword)}</a>
|
9
9
|
%li <a href="#refine">#{t(:filter_options)}</a>
|
10
|
+
%li <a href="#keyboard_shortcut">#{t(:keyboard_shortcut)}</a>
|
10
11
|
%li <a href="#directpath">#{t(:help_directpath)}</a>
|
11
12
|
|
12
13
|
%h2#search #{t(:help_search_by_keyword)}
|
@@ -58,6 +59,11 @@
|
|
58
59
|
w:7 read write <span class="comment"># #{t(:help_wide_search_comment_01)}</span>
|
59
60
|
w:0 read write <span class="comment"># #{t(:help_wide_search_comment_02)}</span>
|
60
61
|
|
62
|
+
%h2#keyboard_shortcut #{t(:keyboard_shortcut)}
|
63
|
+
%ul
|
64
|
+
%li <b>s</b> .. #{t(:keyboard_shortcut_s)}
|
65
|
+
%li <b>S</b> (#{t(:select_text)}) .. #{t(:keyboard_shortcut_S)}
|
66
|
+
|
61
67
|
%h2#directpath #{t(:help_directpath)}
|
62
68
|
%p
|
63
69
|
#{t(:help_directpath_description)}
|
@@ -18,13 +18,13 @@
|
|
18
18
|
.container#toppage
|
19
19
|
.row
|
20
20
|
.span12.text-center
|
21
|
-
%h1 <a href="#{url_for '/'}"><img src=#{url_for @setting.home_icon} alt="milkode-icon" border="0" height="135px" /></a> #{@setting.home_title} <font class="version">#{@version}</font>
|
21
|
+
%h1 <a href="#{url_for '/'}"><img src=#{url_for @setting.home_icon} alt="milkode-icon" border="0" height="135px" /></a> <span style="font-size: #{@setting.home_font_size}">#{@setting.home_title}</span> <font class="version">#{@version}</font>
|
22
22
|
|
23
23
|
.row
|
24
24
|
.span12.text-center
|
25
25
|
.form
|
26
26
|
%form(method="post" action="#{url_for '/search'}")
|
27
|
-
%input(name="query" type="text" style="width: 419px;")
|
27
|
+
%input#query(name="query" type="text" style="width: 419px;")
|
28
28
|
%input(type="submit" value="#{t(:search)}")
|
29
29
|
%input(name='pathname' type='hidden' value='#{url_for '/home'}')
|
30
30
|
<a href="#{url_for '/help'}">#{t(:help)}</a>
|
@@ -7,6 +7,19 @@ function escapeHTML(str) {
|
|
7
7
|
return str.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
8
8
|
}
|
9
9
|
|
10
|
+
function divideURL(url) {
|
11
|
+
var found = url.match(/^(.+?):\/\/([A-Za-z\d\-.]+?):?(\d+)?(\/.*)?$/);
|
12
|
+
|
13
|
+
var head = found[1] + "://" + found[2];
|
14
|
+
if (found[3]) {
|
15
|
+
head += ":" + found[3];
|
16
|
+
}
|
17
|
+
|
18
|
+
var path = found[4];
|
19
|
+
|
20
|
+
return [head, path];
|
21
|
+
}
|
22
|
+
|
10
23
|
function replace_query_param(url, value) {
|
11
24
|
var url_s = url.split("?");
|
12
25
|
|
@@ -40,7 +53,7 @@ function topic_path(id) {
|
|
40
53
|
document.getElementById(id).href = url;
|
41
54
|
}
|
42
55
|
|
43
|
-
function
|
56
|
+
function replace_package_name(url, package_name) {
|
44
57
|
var url_s = url.split("?");
|
45
58
|
url = url_s[0].replace(/\/home(\/.*)?/, "/home/" + package_name); // home以下をパッケージ名に置き換え
|
46
59
|
return url;
|
@@ -53,7 +66,7 @@ function select_package() {
|
|
53
66
|
if (name == '---')
|
54
67
|
name = "";
|
55
68
|
|
56
|
-
url =
|
69
|
+
url = replace_package_name(url, name);
|
57
70
|
url = replace_query_param(url, document.searchform.query.value);
|
58
71
|
document.location = url;
|
59
72
|
}
|
@@ -146,6 +159,20 @@ function open_newtab() {
|
|
146
159
|
window.open(replace_query_param(document.URL, document.searchform.query.value));
|
147
160
|
}
|
148
161
|
|
162
|
+
function open_newtab_query(query) {
|
163
|
+
var dividedURL = divideURL(document.URL);
|
164
|
+
var url = dividedURL[0];
|
165
|
+
|
166
|
+
var paths = dividedURL[1].split("/"); // /home/pacakge_name/path/to/..
|
167
|
+
url += "/home"; // Support root
|
168
|
+
|
169
|
+
if (paths[2]) {
|
170
|
+
url += "/" + paths[2];
|
171
|
+
}
|
172
|
+
|
173
|
+
window.open(replace_query_param(url, query));
|
174
|
+
}
|
175
|
+
|
149
176
|
$(document).ready(function() {
|
150
177
|
$("select#package").multiselect({
|
151
178
|
multiple: false,
|
@@ -170,12 +197,13 @@ $(document).ready(function() {
|
|
170
197
|
if ( match ) {
|
171
198
|
$(match[1]).addClass("select-line");
|
172
199
|
} else {
|
173
|
-
$("#query").
|
200
|
+
$("#query").focus();
|
201
|
+
// $("#query").select();
|
174
202
|
}
|
175
203
|
|
176
|
-
$('#query').click(function(){
|
177
|
-
|
178
|
-
});
|
204
|
+
// $('#query').click(function(){
|
205
|
+
// $(this).select();
|
206
|
+
// });
|
179
207
|
|
180
208
|
$('#shead').change(function(){
|
181
209
|
$('#search').click();
|
@@ -203,4 +231,24 @@ $(document).ready(function() {
|
|
203
231
|
}
|
204
232
|
);
|
205
233
|
});
|
234
|
+
|
235
|
+
$('body').keypress(function (e) {
|
236
|
+
var k = e.which;
|
237
|
+
var isFocused = $('#query').is(':focus');
|
238
|
+
|
239
|
+
// s .. Focus search bar
|
240
|
+
if (!isFocused && k == 115) {
|
241
|
+
$("#query").focus();
|
242
|
+
e.preventDefault();
|
243
|
+
}
|
244
|
+
|
245
|
+
// S .. Search using a selected text (New tab)
|
246
|
+
var selectText = window.getSelection().toString(); // @todo Support IE
|
247
|
+
if (!isFocused && k == 83 && selectText != '') { // S .. 83, d .. 100
|
248
|
+
open_newtab_query(selectText);
|
249
|
+
e.preventDefault();
|
250
|
+
}
|
251
|
+
|
252
|
+
// $('body').html(k);
|
253
|
+
});
|
206
254
|
});
|
data/lib/milkode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milkode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ongaeshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|