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 CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('grat', '0.1.0') do |p|
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{grat}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Schenkman-Moore"]
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
- redirect edit_path(content.url)
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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Schenkman-Moore