merbiful-release 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/merbiful-release/layout.rb +4 -0
- data/templates/page_form.html.haml +1 -1
- metadata +7 -27
- data/lib/merbiful-release.rb~ +0 -26
- data/lib/merbiful-release/admin.rb~ +0 -313
- data/lib/merbiful-release/body.rb~ +0 -48
- data/lib/merbiful-release/controller.rb~ +0 -61
- data/lib/merbiful-release/css.rb~ +0 -77
- data/lib/merbiful-release/erubis.rb~ +0 -13
- data/lib/merbiful-release/filters.rb~ +0 -22
- data/lib/merbiful-release/haml.rb~ +0 -23
- data/lib/merbiful-release/images.rb~ +0 -14
- data/lib/merbiful-release/js.rb~ +0 -76
- data/lib/merbiful-release/layout.rb~ +0 -49
- data/lib/merbiful-release/page.rb~ +0 -109
- data/lib/merbiful-release/routes.rb~ +0 -42
- data/lib/merbiful-release/string.rb~ +0 -16
- data/templates/admin.css~ +0 -14
- data/templates/admin_layout.html.haml~ +0 -11
- data/templates/css.html.haml~ +0 -32
- data/templates/images.html.haml~ +0 -17
- data/templates/js.html.haml~ +0 -29
- data/templates/layouts.html.haml~ +0 -26
- data/templates/page_form.html.haml~ +0 -41
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
%td= select(:name => "version[filter]", :collection => Merbiful::Filter.filters, :selected => @form_version.filter) + errors(@form_version, :filter)
|
21
21
|
%tr{:class => "layout"}
|
22
22
|
%td Layout
|
23
|
-
%td= select(:name => "version[layout_id]", :collection => Merbiful::Layout.all, :include_blank => true, :text_method => :name, :value_method => :
|
23
|
+
%td= select(:name => "version[layout_id]", :collection => Merbiful::Layout.all, :include_blank => true, :text_method => :name, :value_method => :id_to_s, :selected => @form_version.layout_id.to_s) + errors(@form_version, :layout)
|
24
24
|
%tr{:class => "cached"}
|
25
25
|
%td Cached (not versioned)
|
26
26
|
%td= check_box(:name => "page[cached]", :checked => @form_page.cached) + errors(@form_page, :cached)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merbiful-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Kihlgren
|
@@ -9,7 +9,7 @@ autorequire: merbiful-release
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-31 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,51 +24,31 @@ extra_rdoc_files: []
|
|
24
24
|
files:
|
25
25
|
- Rakefile
|
26
26
|
- LICENSE
|
27
|
-
- lib/merbiful-release
|
27
|
+
- lib/merbiful-release.rb
|
28
28
|
- lib/merbiful-release/admin.rb
|
29
|
-
- lib/merbiful-release/admin.rb~
|
30
29
|
- lib/merbiful-release/body.rb
|
31
|
-
- lib/merbiful-release/body.rb~
|
32
30
|
- lib/merbiful-release/controller.rb
|
33
|
-
- lib/merbiful-release/controller.rb~
|
34
31
|
- lib/merbiful-release/css.rb
|
35
|
-
- lib/merbiful-release/css.rb~
|
36
|
-
- lib/merbiful-release/erubis.rb~
|
37
32
|
- lib/merbiful-release/filters.rb
|
38
|
-
- lib/merbiful-release/filters.rb~
|
39
|
-
- lib/merbiful-release/haml.rb~
|
40
33
|
- lib/merbiful-release/images.rb
|
41
|
-
- lib/merbiful-release/images.rb~
|
42
34
|
- lib/merbiful-release/js.rb
|
43
|
-
- lib/merbiful-release/js.rb~
|
44
35
|
- lib/merbiful-release/layout.rb
|
45
|
-
- lib/merbiful-release/layout.rb~
|
46
36
|
- lib/merbiful-release/page.rb
|
47
|
-
- lib/merbiful-release/page.rb~
|
48
37
|
- lib/merbiful-release/relative_time.rb
|
49
38
|
- lib/merbiful-release/routes.rb
|
50
|
-
- lib/merbiful-release/routes.rb~
|
51
39
|
- lib/merbiful-release/string.rb
|
52
|
-
- lib/merbiful-release/string.rb~
|
53
|
-
- lib/merbiful-release.rb
|
54
|
-
- lib/merbiful-release.rb~
|
55
40
|
- templates/admin.css
|
56
|
-
- templates/admin.css~
|
57
41
|
- templates/admin_layout.html.haml
|
58
|
-
- templates/admin_layout.html.haml~
|
59
42
|
- templates/css.html.haml
|
60
|
-
- templates/css.html.haml~
|
61
43
|
- templates/images.html.haml
|
62
|
-
- templates/images.html.haml~
|
63
44
|
- templates/index.html.haml
|
64
45
|
- templates/js.html.haml
|
65
|
-
- templates/js.html.haml~
|
66
46
|
- templates/layouts.html.haml
|
67
|
-
- templates/layouts.html.haml~
|
68
47
|
- templates/page_form.html.haml
|
69
|
-
- templates/page_form.html.haml~
|
70
48
|
has_rdoc: true
|
71
49
|
homepage: ""
|
50
|
+
licenses: []
|
51
|
+
|
72
52
|
post_install_message:
|
73
53
|
rdoc_options: []
|
74
54
|
|
@@ -89,9 +69,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
69
|
requirements: []
|
90
70
|
|
91
71
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 1.3.4
|
93
73
|
signing_key:
|
94
|
-
specification_version:
|
74
|
+
specification_version: 3
|
95
75
|
summary: Merb plugin that provides a simple CMS
|
96
76
|
test_files: []
|
97
77
|
|
data/lib/merbiful-release.rb~
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'merb-core'
|
3
|
-
require 'merb-action-args'
|
4
|
-
require 'merb_helpers'
|
5
|
-
require 'merb-assets'
|
6
|
-
require 'dm-core'
|
7
|
-
require 'dm-validations'
|
8
|
-
require 'dm-timestamps'
|
9
|
-
require 'dm-aggregates'
|
10
|
-
require 'forwardable'
|
11
|
-
require 'pathname'
|
12
|
-
require 'pp'
|
13
|
-
require 'digest/sha1'
|
14
|
-
|
15
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'filters.rb')
|
16
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'string.rb')
|
17
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'relative_time.rb')
|
18
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'images.rb')
|
19
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'controller.rb')
|
20
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'body.rb')
|
21
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'admin.rb')
|
22
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'routes.rb')
|
23
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'css.rb')
|
24
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'js.rb')
|
25
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'page.rb')
|
26
|
-
require File.join(File.dirname(__FILE__), 'merbiful-release', 'layout.rb')
|
@@ -1,313 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Admin < Merb::Controller
|
5
|
-
|
6
|
-
include RelativeTimeHelpers
|
7
|
-
|
8
|
-
before :authorize!
|
9
|
-
|
10
|
-
def authorize!
|
11
|
-
unless authorized?
|
12
|
-
redirect login_url
|
13
|
-
throw :halt, "Access denied"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def logged_in_user
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
|
21
|
-
def login_url
|
22
|
-
""
|
23
|
-
end
|
24
|
-
|
25
|
-
def logout_url
|
26
|
-
""
|
27
|
-
end
|
28
|
-
|
29
|
-
def authorized?
|
30
|
-
true
|
31
|
-
end
|
32
|
-
|
33
|
-
def index
|
34
|
-
render_template_with_layout("index.html.haml")
|
35
|
-
end
|
36
|
-
|
37
|
-
def layouts
|
38
|
-
@form_layout = Layout.get(params[:layout_id])
|
39
|
-
if request.post?
|
40
|
-
@form_layout.update_attributes(params[:layout])
|
41
|
-
if @form_layout.valid?
|
42
|
-
@form_layout.save
|
43
|
-
@form_version = Layout::Version.new(params[:version].merge(:layout => @form_layout))
|
44
|
-
if @form_version.valid?
|
45
|
-
@form_version.save
|
46
|
-
redirect url(:merbiful_admin, :action => "layouts", :layout_id => @form_layout.id)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
else
|
50
|
-
if @form_layout
|
51
|
-
@form_version = Layout::Version.get(params[:version_id])
|
52
|
-
@form_version = @form_layout.latest unless @form_version
|
53
|
-
end
|
54
|
-
end
|
55
|
-
render_template_with_layout("layouts.html.haml")
|
56
|
-
end
|
57
|
-
|
58
|
-
def js
|
59
|
-
@form_js = Js.get(params[:js_id])
|
60
|
-
if request.post?
|
61
|
-
params[:js][:cached] = !!params[:js][:cached]
|
62
|
-
@form_js.update_attributes(params[:js])
|
63
|
-
if @form_js.valid?
|
64
|
-
@form_js.save
|
65
|
-
@form_version = Js::Version.new(params[:version].merge(:js => @form_js))
|
66
|
-
if @form_version.valid?
|
67
|
-
@form_version.save
|
68
|
-
redirect url(:merbiful_admin, :action => "js", :js_id => @form_js.id)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
else
|
72
|
-
if @form_js
|
73
|
-
@form_version = Js::Version.get(params[:version_id])
|
74
|
-
@form_version = @form_js.latest unless @form_version
|
75
|
-
end
|
76
|
-
end
|
77
|
-
render_template_with_layout("js.html.haml")
|
78
|
-
end
|
79
|
-
|
80
|
-
def images
|
81
|
-
if request.post?
|
82
|
-
end
|
83
|
-
render_template_with_layout("images.html.haml")
|
84
|
-
end
|
85
|
-
|
86
|
-
def css
|
87
|
-
@form_css = Css.get(params[:css_id])
|
88
|
-
if request.post?
|
89
|
-
params[:css][:cached] = !!params[:css][:cached]
|
90
|
-
@form_css.update_attributes(params[:css])
|
91
|
-
if @form_css.valid?
|
92
|
-
@form_css.save
|
93
|
-
@form_version = Css::Version.new(params[:version].merge(:css => @form_css))
|
94
|
-
if @form_version.valid?
|
95
|
-
@form_version.save
|
96
|
-
redirect url(:merbiful_admin, :action => "css", :css_id => @form_css.id)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
else
|
100
|
-
if @form_css
|
101
|
-
@form_version = Css::Version.get(params[:version_id])
|
102
|
-
@form_version = @form_css.latest unless @form_version
|
103
|
-
end
|
104
|
-
end
|
105
|
-
render_template_with_layout("css.html.haml")
|
106
|
-
end
|
107
|
-
|
108
|
-
def pages
|
109
|
-
if Page.count == 0
|
110
|
-
new_root = Page.create(:path => "/")
|
111
|
-
new_root_version = Page::Version.create(:page => new_root, :body => "Here be Dagon")
|
112
|
-
end
|
113
|
-
@form_page = Page.get(params[:page_id])
|
114
|
-
if request.post?
|
115
|
-
params[:page][:cached] = !!params[:page][:cached]
|
116
|
-
|
117
|
-
@form_page.update_attributes(params[:page])
|
118
|
-
|
119
|
-
version_csses = params[:version].delete(:css)
|
120
|
-
version_jses = params[:version].delete(:js)
|
121
|
-
|
122
|
-
@form_version = Page::Version.new(params[:version].merge(:page => @form_page))
|
123
|
-
|
124
|
-
version_csses.each do |css|
|
125
|
-
@form_version.add_css(Css.get(css))
|
126
|
-
end if version_csses
|
127
|
-
version_jses.each do |js|
|
128
|
-
@form_version.add_js(Js.get(js))
|
129
|
-
end if version_jses
|
130
|
-
|
131
|
-
if @form_page.valid?
|
132
|
-
@form_page.save
|
133
|
-
if @form_version.valid?
|
134
|
-
@form_version.save
|
135
|
-
redirect url(:merbiful_admin, :action => "pages", :page_id => @form_page.id)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
else
|
139
|
-
if @form_page
|
140
|
-
@form_version = Page::Version.get(params[:version_id])
|
141
|
-
@form_version = @form_page.latest unless @form_version
|
142
|
-
end
|
143
|
-
end
|
144
|
-
render_with_layout(Page.all(:parent_id => nil).collect do |page|
|
145
|
-
"<ul class='root'>\n#{render_page(page)}\n</ul>"
|
146
|
-
end.join("\n"))
|
147
|
-
end
|
148
|
-
|
149
|
-
def render_css
|
150
|
-
read_template("admin.css")
|
151
|
-
end
|
152
|
-
|
153
|
-
def destroy_page
|
154
|
-
page = Page.get(params[:page_id])
|
155
|
-
page.destroy
|
156
|
-
redirect url(:merbiful_admin, :action => "pages")
|
157
|
-
end
|
158
|
-
|
159
|
-
def upload_image
|
160
|
-
path = Pathname.new(File.join(Merb.root, "public", "images", File.basename(params[:image][:filename])))
|
161
|
-
raise "H4xx0r" unless path.to_s.index(Pathname.new(Merb.root).expand_path.to_s) == 0
|
162
|
-
Pathname.new(params[:image][:tempfile].path).rename(path)
|
163
|
-
redirect url(:merbiful_admin, :action => "images")
|
164
|
-
end
|
165
|
-
|
166
|
-
def delete_image
|
167
|
-
path = Pathname.new(File.join(Merb.root, "public", params[:path])).expand_path
|
168
|
-
raise "H4xx0r" unless path.to_s.index(Pathname.new(Merb.root).expand_path.to_s) == 0
|
169
|
-
path.unlink
|
170
|
-
redirect url(:merbiful_admin, :action => "images")
|
171
|
-
end
|
172
|
-
|
173
|
-
def destroy_layout
|
174
|
-
layout = Layout.get(params[:layout_id])
|
175
|
-
layout.destroy
|
176
|
-
redirect url(:merbiful_admin, :action => "layouts")
|
177
|
-
end
|
178
|
-
|
179
|
-
def destroy_css
|
180
|
-
css = Css.get(params[:css_id])
|
181
|
-
css.destroy
|
182
|
-
redirect url(:merbiful_admin, :action => "css")
|
183
|
-
end
|
184
|
-
|
185
|
-
def destroy_js
|
186
|
-
js = Js.get(params[:js_id])
|
187
|
-
js.destroy
|
188
|
-
redirect url(:merbiful_admin, :action => "js")
|
189
|
-
end
|
190
|
-
|
191
|
-
def create_page
|
192
|
-
parent = Page.get(params[:parent_id])
|
193
|
-
new_page = Page.create(:parent => parent, :path => next_path(parent.path))
|
194
|
-
new_page_version = Page::Version.create(:page => new_page)
|
195
|
-
redirect url(:merbiful_admin, :action => "pages", :page_id => new_page.id)
|
196
|
-
end
|
197
|
-
|
198
|
-
def create_css
|
199
|
-
new_css = Css.create(:name => next_name(Css))
|
200
|
-
new_css_version = Css::Version.create(:css => new_css)
|
201
|
-
redirect url(:merbiful_admin, :action => 'css', :css_id => new_css.id)
|
202
|
-
end
|
203
|
-
|
204
|
-
def create_js
|
205
|
-
new_js = Js.create(:name => next_name(Js))
|
206
|
-
new_js_version = Js::Version.create(:js => new_js)
|
207
|
-
redirect url(:merbiful_admin, :action => 'js', :js_id => new_js.id)
|
208
|
-
end
|
209
|
-
|
210
|
-
def create_layout
|
211
|
-
new_layout = Layout.create(:name => next_name(Layout))
|
212
|
-
new_layout_version = Layout::Version.create(:layout => new_layout)
|
213
|
-
redirect url(:merbiful_admin, :action => 'layouts', :layout_id => new_layout.id)
|
214
|
-
end
|
215
|
-
|
216
|
-
def move_page_up
|
217
|
-
page = Page.get(params[:page_id])
|
218
|
-
page.position -= 1
|
219
|
-
page.save
|
220
|
-
redirect url(:merbiful_admin, :action => "pages")
|
221
|
-
end
|
222
|
-
|
223
|
-
def move_page_down
|
224
|
-
page = Page.get(params[:page_id])
|
225
|
-
page.position += 1
|
226
|
-
page.save
|
227
|
-
redirect url(:merbiful_admin, :action => "pages")
|
228
|
-
end
|
229
|
-
|
230
|
-
private
|
231
|
-
|
232
|
-
def confirm(message)
|
233
|
-
"return confirm('#{message}');"
|
234
|
-
end
|
235
|
-
|
236
|
-
def text_area_rows
|
237
|
-
20
|
238
|
-
end
|
239
|
-
|
240
|
-
def next_path(parent_path)
|
241
|
-
index = 0
|
242
|
-
while Page.first(:path => File.join(parent_path, index.to_s))
|
243
|
-
index += 1
|
244
|
-
end
|
245
|
-
return File.join(parent_path, index.to_s)
|
246
|
-
end
|
247
|
-
|
248
|
-
def next_name(klass)
|
249
|
-
index = 0
|
250
|
-
while klass.first(:name => index.to_s)
|
251
|
-
index += 1
|
252
|
-
end
|
253
|
-
return index.to_s
|
254
|
-
end
|
255
|
-
|
256
|
-
def errors(obj, meth)
|
257
|
-
if obj.errors.on(meth)
|
258
|
-
"<div class='error'>#{obj.errors.on(meth).join(", ")}</div>"
|
259
|
-
else
|
260
|
-
""
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
def render_children(page, ind = "")
|
265
|
-
rval = []
|
266
|
-
rval << "<ul class='children'>"
|
267
|
-
page.children(:order => [:position, :id]).each do |child|
|
268
|
-
rval << render_page(child, ind + " ")
|
269
|
-
end
|
270
|
-
rval << "</ul>"
|
271
|
-
return rval.collect do |line| ind + line end.join("\n")
|
272
|
-
end
|
273
|
-
|
274
|
-
def render_page(page, ind = "")
|
275
|
-
rval = []
|
276
|
-
rval << "<li class='page'>"
|
277
|
-
rval << "<ul class='page_info info'>"
|
278
|
-
rval << "<a href='#{url(:merbiful_admin, :action => 'pages', :page_id => page.id)}'>"
|
279
|
-
rval << "<li class='page_path'>#{page.path}</li>"
|
280
|
-
rval << "<li class='page_title'>#{page.title || "untitled"}</li>"
|
281
|
-
rval << "<li class='page_version'>ver##{page.latest.id} (#{time_ago_in_words(page.latest.created_at)} ago)</li>"
|
282
|
-
rval << "</a>"
|
283
|
-
rval << "<li class='up'><a href='#{url(:merbiful_admin, :action => 'move_page_up', :page_id => page.id)}'>↑</a></li>"
|
284
|
-
rval << "<li class='down'><a href='#{url(:merbiful_admin, :action => 'move_page_down', :page_id => page.id)}'>↓</a></li>"
|
285
|
-
rval << "<li class='remove'><a href='#{url(:merbiful_admin, :action => 'destroy_page', :page_id => page.id)}' onclick=\"#{confirm("Are you absolutely certain that you want to destroy the page at #{page.path}? All versions will be irreversibly destroyed.")}\">-</a></li>" unless page.parent_id.nil?
|
286
|
-
rval << "<li class='append'><a href='#{url(:merbiful_admin, :action => 'create_page', :parent_id => page.id)}'>+</a></li>"
|
287
|
-
rval << "</ul>"
|
288
|
-
rval << render_template_without_layout("page_form.html.haml") if params[:page_id].to_s == page.id.to_s
|
289
|
-
rval << render_children(page, ind) unless page.children.empty?
|
290
|
-
rval << "</li>"
|
291
|
-
return rval.collect do |line| ind + line end.join("\n")
|
292
|
-
end
|
293
|
-
|
294
|
-
def read_template(template)
|
295
|
-
Pathname.new(__FILE__).parent.parent.parent.join("templates").join(template).read
|
296
|
-
end
|
297
|
-
|
298
|
-
def render_with_layout(text)
|
299
|
-
throw_content :for_layout, text
|
300
|
-
::Haml::Engine.new(read_template("admin_layout.html.haml")).render(self)
|
301
|
-
end
|
302
|
-
|
303
|
-
def render_template_with_layout(template)
|
304
|
-
render_with_layout(::Haml::Engine.new(read_template(template)).render(self))
|
305
|
-
end
|
306
|
-
|
307
|
-
def render_template_without_layout(template)
|
308
|
-
::Haml::Engine.new(read_template(template)).render(self)
|
309
|
-
end
|
310
|
-
|
311
|
-
end
|
312
|
-
|
313
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
module Body
|
5
|
-
|
6
|
-
FAKE_IO_CLASS = Struct.new(:read, :path)
|
7
|
-
|
8
|
-
def render_id
|
9
|
-
Merb::Template.template_name("#{self.class}##{self.id}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def render(controller, caches = {})
|
13
|
-
rval = if self.filter.blank?
|
14
|
-
self.body
|
15
|
-
else
|
16
|
-
controller.send(Merb::Template::METHOD_LIST[render_id] ||=
|
17
|
-
begin
|
18
|
-
filter = Merb::Template::EXTENSIONS[self.filter]
|
19
|
-
if filter.method(:compile_template).arity == 3
|
20
|
-
Merb::Template::EXTENSIONS[self.filter].compile_template(FAKE_IO_CLASS.new(self.body, render_id),
|
21
|
-
render_id,
|
22
|
-
Merb::InlineTemplates)
|
23
|
-
elsif filter.method(:compile_template).arity == 4
|
24
|
-
Merb::Template::EXTENSIONS[self.filter].compile_template(FAKE_IO_CLASS.new(self.body, render_id),
|
25
|
-
render_id,
|
26
|
-
[],
|
27
|
-
Merb::InlineTemplates)
|
28
|
-
end
|
29
|
-
end)
|
30
|
-
end
|
31
|
-
unless Merb.environment == "development"
|
32
|
-
caches.each do |destination, to_cache|
|
33
|
-
if to_cache
|
34
|
-
path = destination.cached_path
|
35
|
-
Merb.logger.info("Flushing to #{path.inspect}")
|
36
|
-
path.parent.mkpath
|
37
|
-
path.open("w") do |out|
|
38
|
-
out.write(rval)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
return rval
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Controller < Merb::Controller
|
5
|
-
|
6
|
-
class MissingPageError < RuntimeError
|
7
|
-
end
|
8
|
-
|
9
|
-
class MissingLayoutError < RuntimeError
|
10
|
-
end
|
11
|
-
|
12
|
-
class MissingCssError < RuntimeError
|
13
|
-
end
|
14
|
-
|
15
|
-
class MissingJsError < RuntimeError
|
16
|
-
end
|
17
|
-
|
18
|
-
def root
|
19
|
-
Page.root
|
20
|
-
end
|
21
|
-
|
22
|
-
def css(id)
|
23
|
-
css_version = Css::Version.get(id)
|
24
|
-
raise MissingCssError.new(id) unless css_version
|
25
|
-
headers["Content-Type"] = "text/css"
|
26
|
-
css_version.render(self, css_version.css.path => css_version.css.cached)
|
27
|
-
end
|
28
|
-
|
29
|
-
def js(id)
|
30
|
-
js_version = Js::Version.get(id)
|
31
|
-
raise MissingJsError.new(id) unless js_version
|
32
|
-
headers["Content-Type"] = "text/javascript"
|
33
|
-
js_version.render(self, js_version.js.path => js_version.js.cached)
|
34
|
-
end
|
35
|
-
|
36
|
-
def plur(what)
|
37
|
-
@page = Page.first(:path => what)
|
38
|
-
raise NotFound.new(what.inspect) unless @page
|
39
|
-
unless @page.jses.empty?
|
40
|
-
throw_content(:for_js, @page.jses.inject([]) do |sum, frozen_js|
|
41
|
-
js = Js.get(frozen_js.id)
|
42
|
-
sum << "<script src='#{js.path}' type='text/javascript'></script>"
|
43
|
-
end.join("\n"))
|
44
|
-
end
|
45
|
-
unless @page.csses.empty?
|
46
|
-
throw_content(:for_css, @page.csses.inject([]) do |sum, frozen_css|
|
47
|
-
css = Css.get(frozen_css.id)
|
48
|
-
sum << "<link href='#{css.path}' #{css.media.blank? ? "" : "media='#{css.media}' "}rel='Stylesheet' type='text/css' />"
|
49
|
-
end.join("\n"))
|
50
|
-
end
|
51
|
-
if @page.layout
|
52
|
-
throw_content :for_layout, @page.render(self)
|
53
|
-
@page.layout.render(self, @page.path => @page.cached)
|
54
|
-
else
|
55
|
-
@page.render(self, @page.path => @page.cached)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Css
|
5
|
-
|
6
|
-
include DataMapper::Resource
|
7
|
-
include DataMapper::Validate
|
8
|
-
extend Forwardable
|
9
|
-
|
10
|
-
property :id, Serial
|
11
|
-
|
12
|
-
property :name, DataMapper::Types::Text, :nullable => false
|
13
|
-
property :media, DataMapper::Types::Text
|
14
|
-
property :cached, Boolean, :default => true, :nullable => false
|
15
|
-
|
16
|
-
property :created_at, DateTime
|
17
|
-
property :updated_at, DateTime
|
18
|
-
|
19
|
-
has n, :css_nesses, :class_name => "Merbiful::Css::Ness"
|
20
|
-
has n, :page_versions, :through => :css_nesses, :class_name => "Merbiful::Page::Version", :child_key => [:css_id]
|
21
|
-
has n, :css_versions, :class_name => "Merbiful::Css::Version"
|
22
|
-
|
23
|
-
before :destroy do
|
24
|
-
css_nesses.destroy!
|
25
|
-
css_versions.destroy!
|
26
|
-
end
|
27
|
-
|
28
|
-
def latest
|
29
|
-
css_versions.first(:css_id => self.id, :order => [:id.desc])
|
30
|
-
end
|
31
|
-
|
32
|
-
def_delegators :latest, :render, :body, :filter
|
33
|
-
|
34
|
-
def path
|
35
|
-
"/stylesheets/#{latest.id}"
|
36
|
-
end
|
37
|
-
|
38
|
-
class Ness
|
39
|
-
include DataMapper::Resource
|
40
|
-
include DataMapper::Validate
|
41
|
-
|
42
|
-
property :id, Serial
|
43
|
-
property :page_version_id, Integer
|
44
|
-
property :css_id, Integer
|
45
|
-
|
46
|
-
belongs_to :css, :class_name => "Merbiful::Css", :child_key => [:css_id]
|
47
|
-
belongs_to :page_version, :class_name => "Merbiful::Page::Version", :child_key => [:page_version_id]
|
48
|
-
end
|
49
|
-
|
50
|
-
class Version
|
51
|
-
|
52
|
-
include DataMapper::Resource
|
53
|
-
include DataMapper::Validate
|
54
|
-
include Merbiful::Body
|
55
|
-
|
56
|
-
property :id, Serial
|
57
|
-
|
58
|
-
property :css_id, Integer, :index => true, :nullable => false
|
59
|
-
|
60
|
-
property :body, DataMapper::Types::Text
|
61
|
-
property :filter, DataMapper::Types::Text
|
62
|
-
|
63
|
-
property :created_at, DateTime
|
64
|
-
property :updated_at, DateTime
|
65
|
-
|
66
|
-
belongs_to :css, :class_name => "Merbiful::Css"
|
67
|
-
|
68
|
-
before :save do
|
69
|
-
css.path.clear_cache! if css.latest
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
module Filter
|
5
|
-
|
6
|
-
@filters = []
|
7
|
-
|
8
|
-
def self.register_filter(filter)
|
9
|
-
@filters << filter
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.filters
|
13
|
-
@filters.inject([[nil, "Verbatim"]]) do |sum, filter|
|
14
|
-
filter_name = filter.name.gsub(/^Merbiful::/, "")
|
15
|
-
sum + [[filter_name, filter_name]]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
@@ -1,23 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Haml
|
5
|
-
|
6
|
-
def render(text, scope)
|
7
|
-
::Haml::Engine.new(text).render(scope)
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
class Sass
|
13
|
-
|
14
|
-
def render(text, scope)
|
15
|
-
::Sass::Engine.new(text).render
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
FILTERS << Haml
|
21
|
-
FILTERS << Sass
|
22
|
-
|
23
|
-
end
|
data/lib/merbiful-release/js.rb~
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Js
|
5
|
-
|
6
|
-
include DataMapper::Resource
|
7
|
-
include DataMapper::Validate
|
8
|
-
extend Forwardable
|
9
|
-
|
10
|
-
property :id, Serial
|
11
|
-
|
12
|
-
property :name, DataMapper::Types::Text, :nullable => false
|
13
|
-
property :cached, Boolean, :default => true, :nullable => false
|
14
|
-
|
15
|
-
property :created_at, DateTime
|
16
|
-
property :updated_at, DateTime
|
17
|
-
|
18
|
-
has n, :js_nesses, :class_name => "Merbiful::Js::Ness"
|
19
|
-
has n, :page_versions, :through => :js_nesses, :class_name => "Merbiful::Page::Version", :child_key => [:js_id]
|
20
|
-
has n, :js_versions, :class_name => "Merbiful::Js::Version"
|
21
|
-
|
22
|
-
before :destroy do
|
23
|
-
js_nesses.destroy!
|
24
|
-
js_versions.destroy!
|
25
|
-
end
|
26
|
-
|
27
|
-
def latest
|
28
|
-
js_versions.first(:js_id => self.id, :order => [:id.desc])
|
29
|
-
end
|
30
|
-
|
31
|
-
def_delegators :latest, :render, :body, :filter
|
32
|
-
|
33
|
-
def path
|
34
|
-
"/javascripts/#{latest.id}"
|
35
|
-
end
|
36
|
-
|
37
|
-
class Ness
|
38
|
-
include DataMapper::Resource
|
39
|
-
include DataMapper::Validate
|
40
|
-
|
41
|
-
property :id, Serial
|
42
|
-
property :page_version_id, Integer
|
43
|
-
property :js_id, Integer
|
44
|
-
|
45
|
-
belongs_to :js, :class_name => "Merbiful::Js", :child_key => [:js_id]
|
46
|
-
belongs_to :page_version, :class_name => "Merbiful::Page::Version", :child_key => [:page_version_id]
|
47
|
-
end
|
48
|
-
|
49
|
-
class Version
|
50
|
-
|
51
|
-
include DataMapper::Resource
|
52
|
-
include DataMapper::Validate
|
53
|
-
include Merbiful::Body
|
54
|
-
|
55
|
-
property :id, Serial
|
56
|
-
|
57
|
-
property :js_id, Integer, :index => true, :nullable => false
|
58
|
-
|
59
|
-
property :body, DataMapper::Types::Text
|
60
|
-
property :filter, DataMapper::Types::Text
|
61
|
-
|
62
|
-
property :created_at, DateTime
|
63
|
-
property :updated_at, DateTime
|
64
|
-
|
65
|
-
belongs_to :js, :class_name => "Merbiful::Js"
|
66
|
-
|
67
|
-
before :save do
|
68
|
-
js.path.clear_cache! if js.latest
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Layout
|
5
|
-
|
6
|
-
include DataMapper::Resource
|
7
|
-
include DataMapper::Validate
|
8
|
-
extend Forwardable
|
9
|
-
|
10
|
-
property :id, Serial
|
11
|
-
|
12
|
-
property :name, DataMapper::Types::Text, :nullable => false
|
13
|
-
|
14
|
-
property :created_at, DateTime
|
15
|
-
property :updated_at, DateTime
|
16
|
-
|
17
|
-
has n, :layout_versions, :class_name => "Merbiful::Layout::Version"
|
18
|
-
has n, :page_versions, :class_name => "Merbiful::Page::Version"
|
19
|
-
|
20
|
-
def latest
|
21
|
-
layout_versions.first(:layout_id => self.id, :order => [:id.desc])
|
22
|
-
end
|
23
|
-
|
24
|
-
def_delegators :latest, :render, :body, :filter
|
25
|
-
|
26
|
-
class Version
|
27
|
-
|
28
|
-
include DataMapper::Resource
|
29
|
-
include DataMapper::Validate
|
30
|
-
include Merbiful::Body
|
31
|
-
|
32
|
-
property :id, Serial
|
33
|
-
|
34
|
-
property :layout_id, Integer, :index => true, :nullable => false
|
35
|
-
|
36
|
-
property :body, DataMapper::Types::Text
|
37
|
-
property :filter, DataMapper::Types::Text
|
38
|
-
|
39
|
-
property :created_at, DateTime
|
40
|
-
property :updated_at, DateTime
|
41
|
-
|
42
|
-
belongs_to :layout, :class_name => "Merbiful::Layout"
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
|
2
|
-
module Merbiful
|
3
|
-
|
4
|
-
class Page
|
5
|
-
|
6
|
-
class NoSuchFilterError < RuntimeError
|
7
|
-
end
|
8
|
-
|
9
|
-
include DataMapper::Resource
|
10
|
-
include DataMapper::Validate
|
11
|
-
extend Forwardable
|
12
|
-
|
13
|
-
property :id, Serial
|
14
|
-
property :parent_id, Integer, :index => true
|
15
|
-
|
16
|
-
property :path, DataMapper::Types::Text, :unique_index => true, :nullable => false
|
17
|
-
property :position, Integer
|
18
|
-
property :cached, Boolean, :default => true, :nullable => false
|
19
|
-
|
20
|
-
property :created_at, DateTime
|
21
|
-
property :updated_at, DateTime
|
22
|
-
|
23
|
-
belongs_to :parent, :class_name => "Merbiful::Page", :child_key => [:parent_id]
|
24
|
-
has n, :children, :class_name => "Merbiful::Page", :child_key => [:parent_id]
|
25
|
-
has n, :versions, :class_name => "Merbiful::Page::Version"
|
26
|
-
|
27
|
-
validates_is_unique :path
|
28
|
-
|
29
|
-
before :destroy do
|
30
|
-
versions.each do |version|
|
31
|
-
version.destroy
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
before :save do
|
36
|
-
if self.position.nil?
|
37
|
-
last_position = self.class.first(:parent_id => self.parent_id, :id.not => self.id)
|
38
|
-
if last_position.nil?
|
39
|
-
self.position = 0
|
40
|
-
else
|
41
|
-
self.position = last_position.position + 1
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def latest
|
47
|
-
versions.first(:page_id => self.id, :order => [:id.desc])
|
48
|
-
end
|
49
|
-
|
50
|
-
def_delegators :latest, :render, :layout, :csses, :add_css, :remove_css, :jses, :add_js, :remove_js, :body, :filter, :title, :keywords
|
51
|
-
|
52
|
-
class Version
|
53
|
-
|
54
|
-
include DataMapper::Resource
|
55
|
-
include DataMapper::Validate
|
56
|
-
include Merbiful::Body
|
57
|
-
|
58
|
-
property :id, Serial
|
59
|
-
|
60
|
-
property :page_id, Integer, :nullable => false, :index => true
|
61
|
-
property :layout_id, Integer, :index => true
|
62
|
-
|
63
|
-
property :body, DataMapper::Types::Text
|
64
|
-
property :filter, DataMapper::Types::Text
|
65
|
-
property :title, DataMapper::Types::Text
|
66
|
-
property :keywords, DataMapper::Types::Text
|
67
|
-
|
68
|
-
property :created_at, DateTime
|
69
|
-
property :updated_at, DateTime
|
70
|
-
|
71
|
-
belongs_to :page, :class_name => "Merbiful::Page"
|
72
|
-
belongs_to :layout, :class_name => "Merbiful::Layout"
|
73
|
-
|
74
|
-
has n, :css_nesses, :class_name => "Merbiful::Css::Ness"
|
75
|
-
has n, :csses, :through => :css_nesses, :class_name => "Merbiful::Css", :remote_name => :css, :child_key => [:page_version_id]
|
76
|
-
|
77
|
-
has n, :js_nesses, :class_name => "Merbiful::Js::Ness"
|
78
|
-
has n, :jses, :through => :js_nesses, :class_name => "Merbiful::Js", :remote_name => :js, :child_key => [:page_version_id]
|
79
|
-
|
80
|
-
before :destroy do
|
81
|
-
css_nesses.destroy!
|
82
|
-
js_nesses.destroy!
|
83
|
-
end
|
84
|
-
|
85
|
-
before :save do
|
86
|
-
clear_cache(page.path) if page.latest
|
87
|
-
end
|
88
|
-
|
89
|
-
def add_css(css)
|
90
|
-
Merbiful::Css::Ness.create(:css => css, :page_version => self)
|
91
|
-
end
|
92
|
-
|
93
|
-
def remove_css(css)
|
94
|
-
css_nesses.first(:css_id => css.id).destroy
|
95
|
-
end
|
96
|
-
|
97
|
-
def add_js(js)
|
98
|
-
Merbiful::Js::Ness.create(:js => js, :page_version => self)
|
99
|
-
end
|
100
|
-
|
101
|
-
def remove_js(js)
|
102
|
-
js_nesses.first(:js_id => js.id).destroy
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
|
2
|
-
Merb.logger.info("Compiling merbiful routes...")
|
3
|
-
Merb::Router.append do |r|
|
4
|
-
r.match("/merbiful_admin").to(:controller => "admin", :namespace => "merbiful", :action => "index").name(:merbiful_admin_index)
|
5
|
-
r.match("/merbiful_admin/:action").to(:controller => "admin", :namespace => "merbiful").name(:merbiful_admin)
|
6
|
-
r.match("/stylesheets/admin").to(:controller => "admin", :namespace => "merbiful", :action => "render_css").name(:merbiful_admin_css)
|
7
|
-
r.match("/stylesheets/:id.css").to(:controller => "controller", :namespace => "merbiful", :action => "css")
|
8
|
-
r.match("/javascripts/:id.js").to(:controller => "controller", :namespace => "merbiful", :action => "js")
|
9
|
-
r.match(/(.*)/).to(:controller => "controller", :namespace => "merbiful", :action => "page", :what => "[1]")
|
10
|
-
end
|
11
|
-
|
12
|
-
module Merbiful
|
13
|
-
|
14
|
-
PREPEND_ROUTES = Merb::Router.routes[0..4]
|
15
|
-
APPEND_ROUTES = Merb::Router.routes[5..-1]
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
module Merb
|
20
|
-
|
21
|
-
class Router
|
22
|
-
|
23
|
-
class << self
|
24
|
-
|
25
|
-
alias :merbiful_old_prepare :prepare
|
26
|
-
|
27
|
-
def prepare(first = [], last = [], &block)
|
28
|
-
merbiful_old_prepare(first + ::Merbiful::PREPEND_ROUTES, last + ::Merbiful::APPEND_ROUTES, &block)
|
29
|
-
end
|
30
|
-
|
31
|
-
alias :merbiful_old_compile :compile
|
32
|
-
|
33
|
-
def compile
|
34
|
-
merbiful_old_compile unless compiled_statement.blank?
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
String.class_eval do
|
3
|
-
|
4
|
-
def cached_path
|
5
|
-
path = Pathname.new(File.join(Merb.root, "public", self))
|
6
|
-
raise "H4xx0r" unless path.to_s.index(Pathname.new(Merb.root).join("public").expand_path.to_s) == 0
|
7
|
-
if path.parent.file?
|
8
|
-
path.parent.unlink
|
9
|
-
elsif path.directory?
|
10
|
-
path = path.join("index.html")
|
11
|
-
end
|
12
|
-
path
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
end
|
data/templates/admin.css~
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
%html
|
2
|
-
%link{:href => url(:merbiful_admin_css), :rel => 'Stylesheet', :type => 'text/css'}
|
3
|
-
%body
|
4
|
-
%h1= link_to("Merbiful Release Administration Interface", url(:merbiful_admin_index))
|
5
|
-
%ul.menu
|
6
|
-
%li= link_to("Pages", url(:merbiful_admin, :action => "pages"))
|
7
|
-
%li= link_to("Layouts", url(:merbiful_admin, :action => "layouts"))
|
8
|
-
%li= link_to("Css", url(:merbiful_admin, :action => "css"))
|
9
|
-
%li= link_to("Js", url(:merbiful_admin, :action => "js"))
|
10
|
-
%li= link_to("Images", url(:merbiful_admin, :action => "images"))
|
11
|
-
= catch_content :for_layout
|
data/templates/css.html.haml~
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
%a{:href => url(:merbiful_admin, :action => "create_css")} New css
|
2
|
-
%ul{:class => "css"}
|
3
|
-
- Merbiful::Css.all.each do |css|
|
4
|
-
%li{:class => "css"}
|
5
|
-
%ul{:class => "css_info info"}
|
6
|
-
%a{:href => url(:merbiful_admin, :action => "css", :css_id => css.id)}
|
7
|
-
%li{:class => "css_name"}= css.name
|
8
|
-
%li{:class => "css_version"}= "ver##{css.latest.id} (#{time_ago_in_words(css.latest.created_at)} ago)"
|
9
|
-
%li= link_to("-", url(:merbiful_admin, :action => "destroy_css", :css_id => css.id), :onclick => confirm("Are you absolutely certain that you want to destroy the css named #{css.name}? All versions will be irreversibly destroyed."))
|
10
|
-
- if params[:css_id].to_s == css.id.to_s
|
11
|
-
%table.css
|
12
|
-
%form{:action => url(:merbiful_admin, :action => "css", :css_id => css.id), :method => "post"}
|
13
|
-
%tr{:class => "version"}
|
14
|
-
%td Viewing version
|
15
|
-
%td= @form_css.css_versions(:order => [:id.desc]).collect do |v| "<a class='#{v.id == @form_version.id ? 'active' : 'inactive'}' href='#{url(:merbiful_admin, :action => "css", :css_id => @form_css.id, :version_id => v.id)}'>#{v.id}</a>" end.join(", ")
|
16
|
-
%tr
|
17
|
-
%td Name (not versioned)
|
18
|
-
%td= text_field(:name => "css[name]", :value => @form_css.name) + errors(@form_css, :name)
|
19
|
-
%tr
|
20
|
-
%td Body
|
21
|
-
%td~ text_area(@form_version.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :body)
|
22
|
-
%tr{:class => "filter"}
|
23
|
-
%td Filter
|
24
|
-
%td= select(:name => "version[filter]", :collection => Merbiful::Filter.filters, :selected => @form_version.filter) + errors(@form_version, :filter)
|
25
|
-
%tr
|
26
|
-
%td Media (not versioned)
|
27
|
-
%td= text_field(:name => "css[media]", :value => @form_css.media) + errors(@form_css, :media)
|
28
|
-
%tr{:class => "cached"}
|
29
|
-
%td Cached (not versioned)
|
30
|
-
%td= check_box(:name => "css[cached]", :checked => @form_css.cached) + errors(@form_css, :cached)
|
31
|
-
%tr{:class => "submit"}
|
32
|
-
%td{:colspan => "2"}= submit("Save as new version")
|
data/templates/images.html.haml~
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
- if Merbiful::Images.upload_possible?
|
2
|
-
%form{:action => url(:merbiful_admin, :action => "upload_image"), :enctype => "multipart/form-data", :method => "post"}
|
3
|
-
Upload new image
|
4
|
-
%input{:name => "image", :size => "30", :type => "file"}
|
5
|
-
%input{:type => "submit", :value => "Upload"}
|
6
|
-
- else
|
7
|
-
%p Upload seems to be impossible, perhaps the 'public/images' directory is not writable?
|
8
|
-
%ul{:class => "images"}
|
9
|
-
- Merbiful::Images.images.each do |image|
|
10
|
-
%li{:class => "image"}
|
11
|
-
%ul{:class => "image_info info"}
|
12
|
-
%a{:href => image}
|
13
|
-
%li{:class => "picture"}
|
14
|
-
%img{:height => 20, :src => image.to_s, :alt => image.to_s}
|
15
|
-
%li{:class => "path"}= image
|
16
|
-
- if Merbiful::Images.delete_possible?(image)
|
17
|
-
%a{:href => url(:merbiful_admin, :action => "delete_image", :path => image)} -
|
data/templates/js.html.haml~
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
%a{:href => url(:merbiful_admin, :action => "create_js")} New js
|
2
|
-
%ul{:class => "js"}
|
3
|
-
- Merbiful::Js.all.each do |js|
|
4
|
-
%li{:class => "js"}
|
5
|
-
%ul{:class => "js_info info"}
|
6
|
-
%a{:href => url(:merbiful_admin, :action => "js", :js_id => js.id)}
|
7
|
-
%li{:class => "js_name"}= js.name
|
8
|
-
%li{:class => "js_version"}= "ver##{js.latest.id} (#{time_ago_in_words(js.latest.created_at)} ago)"
|
9
|
-
%li= link_to("-", url(:merbiful_admin, :action => "destroy_js", :js_id => js.id))
|
10
|
-
- if params[:js_id].to_s == js.id.to_s
|
11
|
-
%table.js
|
12
|
-
%form{:action => url(:merbiful_admin, :action => "js", :js_id => js.id), :method => "post"}
|
13
|
-
%tr{:class => "version"}
|
14
|
-
%td Viewing version
|
15
|
-
%td= @form_js.js_versions(:order => [:id.desc]).collect do |v| "<a class='#{v.id == @form_version.id ? 'active' : 'inactive'}' href='#{url(:merbiful_admin, :action => "js", :js_id => @form_js.id, :version_id => v.id)}'>#{v.id}</a>" end.join(", ")
|
16
|
-
%tr
|
17
|
-
%td Name (not versioned)
|
18
|
-
%td= text_field(:name => "js[name]", :value => @form_js.name) + errors(@form_js, :name)
|
19
|
-
%tr
|
20
|
-
%td Body
|
21
|
-
%td~ text_area(@form_version.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :body)
|
22
|
-
%tr{:class => "filter"}
|
23
|
-
%td Filter
|
24
|
-
%td= select(:name => "version[filter]", :collection => Merbiful::Filter.filters, :selected => @form_version.filter) + errors(@form_version, :filter)
|
25
|
-
%tr{:class => "cached"}
|
26
|
-
%td Cached (not versioned)
|
27
|
-
%td= check_box(:name => "js[cached]", :checked => @form_js.cached) + errors(@form_js, :cached)
|
28
|
-
%tr{:class => "submit"}
|
29
|
-
%td{:colspan => "2"}= submit("Save as new version")
|
@@ -1,26 +0,0 @@
|
|
1
|
-
%a{:href => url(:merbiful_admin, :action => "create_layout")} New layout
|
2
|
-
%ul{:class => "layouts"}
|
3
|
-
- Merbiful::Layout.all.each do |layout|
|
4
|
-
%li{:class => "layout"}
|
5
|
-
%ul{:class => "layout_info info"}
|
6
|
-
%a{:href => url(:merbiful_admin, :action => "layouts", :layout_id => layout.id)}
|
7
|
-
%li{:class => "layout_name"}= layout.name
|
8
|
-
%li{:class => "layout_version"}= "ver##{layout.latest.id} (#{time_ago_in_words(layout.latest.created_at)} ago)"
|
9
|
-
%li= link_to("-", url(:merbiful_admin, :action => "destroy_layout", :layout_id => layout.id))
|
10
|
-
- if params[:layout_id].to_s == layout.id.to_s
|
11
|
-
%table.layout
|
12
|
-
%form{:action => url(:merbiful_admin, :action => "layouts", :layout_id => layout.id), :method => "post"}
|
13
|
-
%tr{:class => "version"}
|
14
|
-
%td Viewing version
|
15
|
-
%td= @form_layout.layout_versions(:order => [:id.desc]).collect do |v| "<a class='#{v.id == @form_version.id ? 'active' : 'inactive'}' href='#{url(:merbiful_admin, :action => "layouts", :layout_id => @form_layout.id, :version_id => v.id)}'>#{v.id}</a>" end.join(", ")
|
16
|
-
%tr
|
17
|
-
%td Name (not versioned)
|
18
|
-
%td= text_field(:name => "layout[name]", :value => @form_layout.name) + errors(@form_layout, :name)
|
19
|
-
%tr
|
20
|
-
%td Body
|
21
|
-
%td~ text_area(@form_version.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :body)
|
22
|
-
%tr{:class => "filter"}
|
23
|
-
%td Filter
|
24
|
-
%td= select(:name => "version[filter]", :collection => Merbiful::Filter.filters, :selected => @form_version.filter) + errors(@form_version, :filter)
|
25
|
-
%tr{:class => "submit"}
|
26
|
-
%td{:colspan => "2"}= submit("Save as new version")
|
@@ -1,41 +0,0 @@
|
|
1
|
-
%table.page
|
2
|
-
%form{:action => url(:merbiful_admin, :action => "pages", :page_id => @form_page.id), :method => "post"}
|
3
|
-
%tr{:class => "path"}
|
4
|
-
%td Path
|
5
|
-
%td= text_field(:name => "page[path]", :value => @form_page.path) + errors(@form_page, :path)
|
6
|
-
%tr{:class => "title"}
|
7
|
-
%td Title
|
8
|
-
%td= text_field(:name => "version[title]", :value => @form_page.title) + errors(@form_version, :title)
|
9
|
-
%tr{:class => "keywords"}
|
10
|
-
%td Keywords
|
11
|
-
%td= text_field(:name => "version[keywords]", :value => @form_page.keywords) + errors(@form_version, :keywords)
|
12
|
-
%tr{:class => "body"}
|
13
|
-
%td Body
|
14
|
-
%td~ text_area(@form_page.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :body)
|
15
|
-
%tr{:class => "filter"}
|
16
|
-
%td Filter
|
17
|
-
%td= select(:name => "version[filter]", :collection => Merbiful::filters, :selected => @form_page.latest.filter) + errors(@form_version, :filter)
|
18
|
-
%tr{:class => "layout"}
|
19
|
-
%td Layout
|
20
|
-
%td= select(:name => "version[layout_id]", :collection => Merbiful::Layout.all, :include_blank => true, :text_method => :name, :value_method => :id, :selected => @form_page.latest.layout_id) + errors(@form_version, :layout)
|
21
|
-
%tr{:class => "cached"}
|
22
|
-
%td Cached
|
23
|
-
%td= check_box(:name => "page[cached]", :checked => @form_page.cached) + errors(@form_page, :cached)
|
24
|
-
- Merbiful::Css.all.each_with_index do |css, index|
|
25
|
-
- if index == 0
|
26
|
-
%tr{:class => "css"}
|
27
|
-
%td{:rowspan => Merbiful::Css.count, :valign => "top"} Css
|
28
|
-
%td= check_box(:name => "version[css][]", :value => css.id, :checked => @form_page.csses.include?(css)) + css.name
|
29
|
-
- else
|
30
|
-
%tr{:class => "css"}
|
31
|
-
%td= check_box(:name => "version[css][]", :value => css.id, :checked => @form_page.csses.include?(css)) + css.name
|
32
|
-
- Merbiful::Js.all.each_with_index do |js, index|
|
33
|
-
- if index == 0
|
34
|
-
%tr{:class => "js"}
|
35
|
-
%td{:rowspan => Merbiful::Js.count, :valign => "top"} Js
|
36
|
-
%td= check_box(:name => "version[js][]", :value => js.id, :checked => @form_page.jses.include?(js)) + js.name
|
37
|
-
- else
|
38
|
-
%tr{:class => "js"}
|
39
|
-
%td= check_box(:name => "version[js][]", :value => js.id, :checked => @form_page.jses.include?(js)) + js.name
|
40
|
-
%tr{:class => "submit"}
|
41
|
-
%td{:colspan => 2}= submit("Save")
|