grat 0.1.0 → 0.1.1
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.
- data/Rakefile +1 -1
- data/grat.gemspec +1 -1
- data/lib/grat.rb +17 -1
- data/views/content_form.haml +1 -0
- metadata +1 -1
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
require 'rake'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new('grat', '0.1.
|
6
|
+
Echoe.new('grat', '0.1.1') do |p|
|
7
7
|
p.summary = "Minimal CMS for Rack and MongoDB."
|
8
8
|
p.description = "Basic interface for making webpages with Haml and Erb. Supports nested templates."
|
9
9
|
p.url = "http://samsm.com/"
|
data/grat.gemspec
CHANGED
data/lib/grat.rb
CHANGED
@@ -96,7 +96,23 @@ class Grat::Application < Sinatra::Base
|
|
96
96
|
|
97
97
|
post '/*' do
|
98
98
|
content.update_attributes(focus_params)
|
99
|
-
|
99
|
+
if params[:content][:submit].include? 'make'
|
100
|
+
redirect edit_path(next_content_url)
|
101
|
+
else
|
102
|
+
redirect edit_path(content.url)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def next_content_url
|
107
|
+
url = content.url
|
108
|
+
number = url[/\d*\Z/]
|
109
|
+
next_number = number.to_i + 1
|
110
|
+
url.sub!(/\d*\Z/, next_number.to_s)
|
111
|
+
if content.template_url
|
112
|
+
url + '?template=' + content.template_url
|
113
|
+
else
|
114
|
+
url
|
115
|
+
end
|
100
116
|
end
|
101
117
|
|
102
118
|
get '/*' do
|
data/views/content_form.haml
CHANGED
@@ -44,6 +44,7 @@
|
|
44
44
|
|
45
45
|
.submit
|
46
46
|
%input{:name => form_nest('submit'), :type => 'submit', :value => "Let's save this thing"}
|
47
|
+
%input{:name => form_nest('submit'), :type => 'submit', :value => "Save and make another"}
|
47
48
|
.defaults
|
48
49
|
%label{:for => form_nest('default_content_vars')} Default Content
|
49
50
|
%textarea{:id => 'default_content_vars', :name => form_nest('default_content_vars')}= content.default_content_vars.to_json
|