rwiki 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +3 -3
- data/VERSION +1 -1
- data/features/create_page.feature +2 -1
- data/features/display_page.feature +3 -8
- data/features/editor.feature +6 -2
- data/features/history.feature +6 -1
- data/features/rename_page.feature +7 -3
- data/features/step_definitions/common_steps.rb +8 -0
- data/lib/rwiki/app.rb +8 -0
- data/lib/rwiki/models/node.rb +2 -2
- data/lib/rwiki/models/page.rb +7 -4
- data/public/javascripts/Rwiki/TabPanel.js +13 -0
- data/public/stylesheets/style.css +4 -0
- data/rwiki.gemspec +4 -3
- data/views/layout.erb +1 -1
- data/views/print.erb +24 -0
- metadata +5 -4
data/README.textile
CHANGED
@@ -22,15 +22,15 @@ h2. Screenshots
|
|
22
22
|
|
23
23
|
h3. Browsing pages
|
24
24
|
|
25
|
-
!http://
|
25
|
+
!http://img534.imageshack.us/img534/9779/rwikishowpage.png(test)!
|
26
26
|
|
27
27
|
h3. Editing a page
|
28
28
|
|
29
|
-
!http://
|
29
|
+
!http://img17.imageshack.us/img17/5865/rwikieditingpage.png(test)!
|
30
30
|
|
31
31
|
h3. FuzzyFinder
|
32
32
|
|
33
|
-
!http://
|
33
|
+
!http://img197.imageshack.us/img197/107/rwikifuzzyfinder.png(test)!
|
34
34
|
|
35
35
|
h2. Note on Patches/Pull Requests
|
36
36
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
@@ -22,6 +22,7 @@ Feature: Create page
|
|
22
22
|
| The new page |
|
23
23
|
And I should see page title "Rwiki ./folder/The new page.txt"
|
24
24
|
And I should see "The new page" within "h1"
|
25
|
+
And I should see generated content for the node with path "./folder/The new page.txt"
|
25
26
|
|
26
27
|
@javascript
|
27
28
|
Scenario: Create an existing page
|
@@ -38,7 +39,7 @@ Feature: Create page
|
|
38
39
|
Then I should see the node titled "test"
|
39
40
|
|
40
41
|
When I click the node with path "./folder/test.txt"
|
41
|
-
Then I should see
|
42
|
+
Then I should see generated content for the node with path "./folder/test.txt"
|
42
43
|
|
43
44
|
@javascript
|
44
45
|
Scenario: Create a folder
|
@@ -10,9 +10,7 @@ Feature: Display a page
|
|
10
10
|
Then I should have the following open tabs:
|
11
11
|
| home |
|
12
12
|
And I should see page title "Rwiki ./home.txt"
|
13
|
-
And I should see
|
14
|
-
And I should see "Lorem ipsum.."
|
15
|
-
And I should see "Sample section" within "h2"
|
13
|
+
And I should see generated content for the node with path "./home.txt"
|
16
14
|
|
17
15
|
@javascript
|
18
16
|
Scenario: Display the ./folder/test.txt page
|
@@ -22,11 +20,7 @@ Feature: Display a page
|
|
22
20
|
Then I should have the following open tabs:
|
23
21
|
| test |
|
24
22
|
And I should see page title "Rwiki ./folder/test.txt"
|
25
|
-
And I should see
|
26
|
-
And I should see "Item one"
|
27
|
-
And I should see "Item two"
|
28
|
-
And I should see "Item three"
|
29
|
-
And I should see "Last item"
|
23
|
+
And I should see generated content for the node with path "./folder/test.txt"
|
30
24
|
|
31
25
|
@javascript
|
32
26
|
Scenario: Display the several page
|
@@ -38,3 +32,4 @@ Feature: Display a page
|
|
38
32
|
| home |
|
39
33
|
| test |
|
40
34
|
And I should see page title "Rwiki ./folder/test.txt"
|
35
|
+
And I should see generated content for the node with path "./folder/test.txt"
|
data/features/editor.feature
CHANGED
@@ -19,9 +19,11 @@ Feature: Editing a page
|
|
19
19
|
And I press "Save"
|
20
20
|
Then I should not see the window
|
21
21
|
And I should see "A new page header" within "h1"
|
22
|
+
And I should see generated content for the node with path "./home.txt"
|
22
23
|
|
23
24
|
When I reload the application
|
24
25
|
Then I should see "A new page header" within "h1"
|
26
|
+
And I should see generated content for the node with path "./home.txt"
|
25
27
|
|
26
28
|
@javascript
|
27
29
|
Scenario: Edit and Save and continue
|
@@ -31,8 +33,9 @@ Feature: Editing a page
|
|
31
33
|
|
32
34
|
When I fill in "editor" with "h1. A new page header"
|
33
35
|
And I press "Save and continue"
|
34
|
-
Then I should see
|
35
|
-
|
36
|
+
Then I should see the window titled "Editing page ./home.txt"
|
37
|
+
And I should see "A new page header" within "h1"
|
38
|
+
And I should see generated content for the node with path "./home.txt"
|
36
39
|
|
37
40
|
@javascript
|
38
41
|
Scenario: Edit and Cancel
|
@@ -43,3 +46,4 @@ Feature: Editing a page
|
|
43
46
|
When I fill in "editor" with "h1. A new page header"
|
44
47
|
And I press "Cancel"
|
45
48
|
Then I should see "Sample page" within "h1"
|
49
|
+
And I should see generated content for the node with path "./home.txt"
|
data/features/history.feature
CHANGED
@@ -11,6 +11,7 @@ Feature: History
|
|
11
11
|
| home |
|
12
12
|
And the node with path "./home.txt" should be selected
|
13
13
|
Then I should see "Sample page" within "h1"
|
14
|
+
And I should see generated content for the node with path "./home.txt"
|
14
15
|
|
15
16
|
@javascript
|
16
17
|
Scenario: After reload the application last opened page should be loaded
|
@@ -21,7 +22,7 @@ Feature: History
|
|
21
22
|
Then I should have the following open tabs:
|
22
23
|
| test |
|
23
24
|
And I should see page title "Rwiki ./folder/test.txt"
|
24
|
-
And I should see
|
25
|
+
And I should see generated content for the node with path "./folder/test.txt"
|
25
26
|
And the node with path "./folder/test.txt" should be selected
|
26
27
|
|
27
28
|
@javascript
|
@@ -33,14 +34,18 @@ Feature: History
|
|
33
34
|
|
34
35
|
When I press the browser back button
|
35
36
|
Then the node with path "./test.txt" should be selected
|
37
|
+
And I should see generated content for the node with path "./test.txt"
|
36
38
|
|
37
39
|
When I press the browser back button
|
38
40
|
Then the node with path "./folder/test.txt" should be selected
|
41
|
+
And I should see generated content for the node with path "./folder/test.txt"
|
39
42
|
|
40
43
|
When I press the browser forward button
|
41
44
|
Then the node with path "./test.txt" should be selected
|
45
|
+
And I should see generated content for the node with path "./test.txt"
|
42
46
|
|
43
47
|
When I create a new page title "A new page" for the node with path "./Info"
|
44
48
|
And I press the browser back button
|
45
49
|
And I press the browser forward button
|
46
50
|
Then the node with path "./Info/A new page.txt" should be selected
|
51
|
+
And I should see generated content for the node with path "./Info/A new page.txt"
|
@@ -18,6 +18,7 @@ Feature: Rename a node
|
|
18
18
|
|
19
19
|
When I click the node with path "./The new home.txt"
|
20
20
|
Then I should see "Sample page" within "h1"
|
21
|
+
And I should see generated content for the node with path "./The new home.txt"
|
21
22
|
|
22
23
|
@javascript
|
23
24
|
Scenario: Rename a page to existing name
|
@@ -33,9 +34,10 @@ Feature: Rename a node
|
|
33
34
|
|
34
35
|
When I click the node with path "./home.txt"
|
35
36
|
Then I should see "Sample page" within "h1"
|
37
|
+
And I should see generated content for the node with path "./home.txt"
|
36
38
|
|
37
39
|
When I click the node with path "./test.txt"
|
38
|
-
Then I should see
|
40
|
+
Then I should see generated content for the node with path "./test.txt"
|
39
41
|
And I should see page title "Rwiki ./test.txt"
|
40
42
|
And I should have the following open tabs:
|
41
43
|
| home |
|
@@ -58,6 +60,7 @@ Feature: Rename a node
|
|
58
60
|
| test |
|
59
61
|
| The new home |
|
60
62
|
And I should see page title "Rwiki ./The new home.txt"
|
63
|
+
And I should see generated content for the node with path "./The new home.txt"
|
61
64
|
|
62
65
|
@javascript
|
63
66
|
Scenario: Rename a folder
|
@@ -76,11 +79,12 @@ Feature: Rename a node
|
|
76
79
|
|
77
80
|
When I double click the node with path "./The new folder name"
|
78
81
|
And I click the node with path "./The new folder name/test.txt"
|
79
|
-
|
82
|
+
And I should see generated content for the node with path "./The new folder name/test.txt"
|
80
83
|
|
81
84
|
When I reload the application
|
82
85
|
Then I should see the node titled "The new folder name"
|
83
86
|
And I double click the node with path "./The new folder name"
|
84
87
|
And I click the node with path "./The new folder name/test.txt"
|
85
|
-
|
88
|
+
And I should see generated content for the node with path "./The new folder name/test.txt"
|
89
|
+
|
86
90
|
|
@@ -34,3 +34,11 @@ When /^I create a new page title "([^"]*)" for the node with path "([^"]*)"$/ do
|
|
34
34
|
And %{I press "OK" within the dialog box}
|
35
35
|
Then %{I should see the node titled "#{title}"}
|
36
36
|
end
|
37
|
+
|
38
|
+
Then /^I should see generated content for the node with path "([^"]*)"$/ do |path|
|
39
|
+
# TODO refactor this code
|
40
|
+
wiki_page_html = Rwiki::Models::Page.new(path).to_html.gsub(/([^>]*)(?=<[^>]*?>)/im, '')
|
41
|
+
page_html = Nokogiri::HTML(page.body).css('div.page-container:not(.x-hide-display)').first.inner_html.gsub(/([^>]*)(?=<[^>]*?>)/im, '')
|
42
|
+
|
43
|
+
page_html.should == wiki_page_html
|
44
|
+
end
|
data/lib/rwiki/app.rb
CHANGED
@@ -31,6 +31,14 @@ module Rwiki
|
|
31
31
|
page.to_json
|
32
32
|
end
|
33
33
|
|
34
|
+
get '/node/print' do
|
35
|
+
path = params[:path].strip
|
36
|
+
page = Page.new(path)
|
37
|
+
@html = page.to_html
|
38
|
+
|
39
|
+
erb :print, :layout => false
|
40
|
+
end
|
41
|
+
|
34
42
|
# update page content
|
35
43
|
put '/node' do
|
36
44
|
path = params[:path].strip
|
data/lib/rwiki/models/node.rb
CHANGED
@@ -17,8 +17,8 @@ module Rwiki::Models
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def fuzzy_finder(query)
|
20
|
-
|
21
|
-
matches =
|
20
|
+
finder = FuzzyFileFinder.new(full_path_for('.'))
|
21
|
+
matches = finder.find(query).sort_by { |m| [-m[:score], m[:path]] }
|
22
22
|
matches.each do |m|
|
23
23
|
m[:path] = '.' + m[:path].gsub(full_path_for('.'), '')
|
24
24
|
end
|
data/lib/rwiki/models/page.rb
CHANGED
@@ -14,6 +14,7 @@ module Rwiki::Models
|
|
14
14
|
def raw_content
|
15
15
|
@raw_content ||= read_file
|
16
16
|
end
|
17
|
+
alias :to_textile :raw_content
|
17
18
|
|
18
19
|
def raw_content=(raw)
|
19
20
|
@raw_content = raw
|
@@ -23,6 +24,7 @@ module Rwiki::Models
|
|
23
24
|
def html_content
|
24
25
|
@html_content ||= parse_content
|
25
26
|
end
|
27
|
+
alias :to_html :html_content
|
26
28
|
|
27
29
|
def title
|
28
30
|
base_name.gsub(/#{PAGE_FILE_EXTENSION}$/, '')
|
@@ -43,7 +45,7 @@ module Rwiki::Models
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def to_hash
|
46
|
-
super.merge({ :rawContent =>
|
48
|
+
super.merge({ :rawContent => to_textile, :htmlContent => to_html })
|
47
49
|
end
|
48
50
|
|
49
51
|
private
|
@@ -55,10 +57,11 @@ module Rwiki::Models
|
|
55
57
|
def parse_content
|
56
58
|
coderay!
|
57
59
|
|
58
|
-
toc = generate_toc
|
59
|
-
add_anchors_to_headers!
|
60
|
+
# toc = generate_toc
|
61
|
+
# add_anchors_to_headers!
|
60
62
|
|
61
|
-
return toc + RedCloth.new(raw_content).to_html
|
63
|
+
# return toc + RedCloth.new(raw_content).to_html
|
64
|
+
return RedCloth.new(raw_content).to_html
|
62
65
|
end
|
63
66
|
|
64
67
|
def coderay!
|
@@ -16,6 +16,11 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
16
16
|
iconCls: 'icon-edit',
|
17
17
|
scope: this,
|
18
18
|
handler: this.onEditPage
|
19
|
+
}, {
|
20
|
+
text: 'Print page',
|
21
|
+
iconCls: 'icon-print',
|
22
|
+
scope: this,
|
23
|
+
handler: this.onPrint
|
19
24
|
}, {
|
20
25
|
text: 'Find page',
|
21
26
|
iconCls: 'icon-search',
|
@@ -164,5 +169,13 @@ Rwiki.TabPanel = Ext.extend(Ext.TabPanel, {
|
|
164
169
|
onFuzzyFinder: function() {
|
165
170
|
var fuzzyFinder = new Rwiki.FuzzyFinderDialog();
|
166
171
|
fuzzyFinder.show();
|
172
|
+
},
|
173
|
+
|
174
|
+
onPrint: function() {
|
175
|
+
var currentTab = this.getActiveTab();
|
176
|
+
if (currentTab) {
|
177
|
+
var path = currentTab.getPagePath();
|
178
|
+
window.open('/node/print?path=' + path, 'mywindow', 'width=800,height=600')
|
179
|
+
}
|
167
180
|
}
|
168
181
|
});
|
data/rwiki.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rwiki}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Łukasz Bandzarewicz"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-24}
|
13
13
|
s.default_executable = %q{rwiki}
|
14
14
|
s.description = %q{Personal wiki based on ExtJS}
|
15
15
|
s.email = %q{lucassus@gmail.com}
|
@@ -2091,7 +2091,8 @@ Gem::Specification.new do |s|
|
|
2091
2091
|
"tmp/fssm_test.rb",
|
2092
2092
|
"vendor/.gitkeep",
|
2093
2093
|
"views/index.erb",
|
2094
|
-
"views/layout.erb"
|
2094
|
+
"views/layout.erb",
|
2095
|
+
"views/print.erb"
|
2095
2096
|
]
|
2096
2097
|
s.homepage = %q{http://github.com/lucassus/rwiki}
|
2097
2098
|
s.licenses = ["MIT"]
|
data/views/layout.erb
CHANGED
data/views/print.erb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8"/>
|
5
|
+
<title>Rwiki</title>
|
6
|
+
|
7
|
+
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css"/>
|
8
|
+
<link rel="stylesheet" type="text/css" href="/stylesheets/page.css"/>
|
9
|
+
<link rel="stylesheet" type="text/css" href="/stylesheets/coderay.css"/>
|
10
|
+
|
11
|
+
<script language="Javascript1.2">
|
12
|
+
<!--
|
13
|
+
function printpage() {
|
14
|
+
window.print();
|
15
|
+
}
|
16
|
+
//-->
|
17
|
+
</script>
|
18
|
+
</head>
|
19
|
+
|
20
|
+
<body onload="printpage();">
|
21
|
+
<%= @html %>
|
22
|
+
</body>
|
23
|
+
|
24
|
+
</html>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "\xC5\x81ukasz Bandzarewicz"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-24 00:00:00 +01:00
|
18
18
|
default_executable: rwiki
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -2334,6 +2334,7 @@ files:
|
|
2334
2334
|
- vendor/.gitkeep
|
2335
2335
|
- views/index.erb
|
2336
2336
|
- views/layout.erb
|
2337
|
+
- views/print.erb
|
2337
2338
|
has_rdoc: true
|
2338
2339
|
homepage: http://github.com/lucassus/rwiki
|
2339
2340
|
licenses:
|
@@ -2348,7 +2349,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2348
2349
|
requirements:
|
2349
2350
|
- - ">="
|
2350
2351
|
- !ruby/object:Gem::Version
|
2351
|
-
hash:
|
2352
|
+
hash: 1194724360297676042
|
2352
2353
|
segments:
|
2353
2354
|
- 0
|
2354
2355
|
version: "0"
|