Skip to content

Commit 2f6a137

Browse files
committed
Split out views into files
1 parent 62c61ac commit 2f6a137

File tree

5 files changed

+34
-44
lines changed

5 files changed

+34
-44
lines changed

git-wiki.rb

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def save!(data)
6969
end
7070

7171
set :haml, :format => :html5, :attr_wrapper => '"'
72-
enable :inline_templates
7372

7473
get "/" do
7574
redirect "/" + GitWiki.homepage
@@ -95,46 +94,3 @@ def save!(data)
9594
@page.save!(params[:body])
9695
redirect "/#{@page}"
9796
end
98-
99-
__END__
100-
@@ layout
101-
!!!
102-
%html
103-
%head
104-
%title= title
105-
%body
106-
%ul
107-
%li
108-
%a{ :href => "/#{GitWiki.homepage}" } Home
109-
%li
110-
%a{ :href => "/pages" } All pages
111-
#content= yield
112-
113-
@@ show
114-
- title @page.name
115-
#edit
116-
%a{:href => "/#{@page}/edit"} Edit this page
117-
%h1= title
118-
#content
119-
~"#{@page.to_html}"
120-
121-
@@ edit
122-
- title "Editing #{@page.name}"
123-
%h1= title
124-
%form{:method => 'POST', :action => "/#{@page}"}
125-
%p
126-
%textarea{:name => 'body', :rows => 30, :style => "width: 100%"}= @page.content
127-
%p
128-
%input.submit{:type => :submit, :value => "Save as the newest version"}
129-
or
130-
%a.cancel{:href=>"/#{@page}"} cancel
131-
132-
@@ list
133-
- title "Listing pages"
134-
%h1 All pages
135-
- if @pages.empty?
136-
%p No pages found.
137-
- else
138-
%ul#list
139-
- @pages.each do |page|
140-
%li= list_item(page)

views/edit.haml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- title "Editing #{@page.name}"
2+
%h1= title
3+
%form{:method => 'POST', :action => "/#{@page}"}
4+
%p
5+
%textarea{:name => 'body', :rows => 30, :style => "width: 100%"}= @page.content
6+
%p
7+
%input.submit{:type => :submit, :value => "Save as the newest version"}
8+
or
9+
%a.cancel{:href=>"/#{@page}"} cancel

views/layout.haml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
!!!
2+
%html
3+
%head
4+
%title= title
5+
%body
6+
%ul
7+
%li
8+
%a{ :href => "/#{GitWiki.homepage}" } Home
9+
%li
10+
%a{ :href => "/pages" } All pages
11+
#content= yield

views/list.haml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- title "Listing pages"
2+
%h1 All pages
3+
- if @pages.empty?
4+
%p No pages found.
5+
- else
6+
%ul#list
7+
- @pages.each do |page|
8+
%li= list_item(page)

views/show.haml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- title @page.name
2+
#edit
3+
%a{:href => "/#{@page}/edit"} Edit this page
4+
%h1= title
5+
#content
6+
~"#{@page.to_html}"

0 commit comments

Comments
 (0)