merbiful-release 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,49 @@
1
1
 
2
- class Page
3
-
4
- include DataMapper::Resource
5
- include DataMapper::Validate
6
-
7
- property :id, Integer, :key => true, :serial => true
8
- property :version, Integer, :key => true
9
- property :body, DataMapper::Types::Text
10
- property :filter, DataMapper::Types::Text
11
- property :parent_id, Integer
12
- property :path, DataMapper::Types::Text, :key => true
13
- property :created_at, DateTime
14
- property :updated_at, DateTime
15
- property :position, Integer
16
- property :author, DataMapper::Types::Text
17
- property :layout, Integer
18
- property :title, DataMapper::Types::Text
19
- property :keywords, DataMapper::Types::Text
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
+
20
48
 
21
49
  end
@@ -26,6 +26,12 @@ module Merbiful
26
26
 
27
27
  validates_is_unique :path
28
28
 
29
+ before :destroy do
30
+ versions.each do |version|
31
+ version.destroy
32
+ end
33
+ end
34
+
29
35
  before :save do
30
36
  if self.position.nil?
31
37
  last_position = self.class.first(:parent_id => self.parent_id, :id.not => self.id)
@@ -66,17 +72,22 @@ module Merbiful
66
72
  belongs_to :layout, :class_name => "Merbiful::Layout"
67
73
 
68
74
  has n, :css_nesses, :class_name => "Merbiful::Css::Ness"
69
- has n, :csses, :through => :css_nesses, :class_name => "Merbiful::Css", :remote_name => :css
75
+ has n, :csses, :through => :css_nesses, :class_name => "Merbiful::Css", :remote_name => :css, :child_key => [:page_version_id]
70
76
 
71
77
  has n, :js_nesses, :class_name => "Merbiful::Js::Ness"
72
- has n, :jses, :through => :js_nesses, :class_name => "Merbiful::Js", :remote_name => :js
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
73
84
 
74
85
  before :save do
75
86
  clear_cache(page.path) if page.latest
76
87
  end
77
88
 
78
89
  def add_css(css)
79
- Merbiful::Css::Ness.new(:css => css, :page_version => self).save
90
+ Merbiful::Css::Ness.create(:css => css, :page_version => self)
80
91
  end
81
92
 
82
93
  def remove_css(css)
@@ -84,7 +95,7 @@ module Merbiful
84
95
  end
85
96
 
86
97
  def add_js(js)
87
- Merbiful::Js::Ness.new(:js => js, :page_version => self).save
98
+ Merbiful::Js::Ness.create(:js => js, :page_version => self)
88
99
  end
89
100
 
90
101
  def remove_js(js)
@@ -8,48 +8,89 @@ module Merbiful
8
8
 
9
9
  include DataMapper::Resource
10
10
  include DataMapper::Validate
11
- include Merbiful::Body
12
-
13
- validates_is_unique :version, :scope => [:path]
11
+ extend Forwardable
14
12
 
15
13
  property :id, Serial
16
- property :version, Integer, :index => true
17
- property :body, DataMapper::Types::Text
18
- property :filter, DataMapper::Types::Text
19
- property :path, DataMapper::Types::Text, :index => true
14
+ property :parent_id, Integer, :index => true
15
+
16
+ property :path, DataMapper::Types::Text, :unique_index => true, :nullable => false
20
17
  property :position, Integer
18
+ property :cached, Boolean, :default => true, :nullable => false
19
+
21
20
  property :created_at, DateTime
22
21
  property :updated_at, DateTime
23
- property :title, DataMapper::Types::Text
24
- property :keywords, DataMapper::Types::Text
25
- property :parent_path, DataMapper::Types::Text
26
- property :layout_id, Integer
27
22
 
28
- belongs_to :layout, :class_name => "Merbiful::Layout"
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
29
28
 
30
29
  before :save do
31
- last_version = self.class.first(:path => self.path, :order => [:version.desc])
32
- if last_version.nil?
33
- self.version = 0
34
- else
35
- self.version = last_version.version + 1
36
- end
37
30
  if self.position.nil?
38
- last_position = self.class.first(:parent_path => self.parent_path, :path.not => self.path)
31
+ last_position = self.class.first(:parent_id => self.parent_id, :id.not => self.id)
39
32
  if last_position.nil?
40
33
  self.position = 0
41
34
  else
42
35
  self.position = last_position.position + 1
43
36
  end
44
37
  end
45
- if self.path.nil?
46
- self.path = "/"
47
- end
38
+ end
48
39
 
40
+ def latest
41
+ versions.first(:page_id => self.id, :order => [:id.desc])
49
42
  end
50
43
 
51
- def children
52
- Page.find_by_sql(["SELECT id FROM merbiful_pages WHERE parent_path = ? GROUP BY path ORDER BY version DESC", self.path])
44
+ def_delegators :latest, :render, :layout, :csses, :add_css, :remove_css, :jses, :add_js, :remove_js, :body, :filter, :title, :keywords
45
+
46
+ class Version
47
+
48
+ include DataMapper::Resource
49
+ include DataMapper::Validate
50
+ include Merbiful::Body
51
+
52
+ property :id, Serial
53
+
54
+ property :page_id, Integer, :nullable => false, :index => true
55
+ property :layout_id, Integer, :index => true
56
+
57
+ property :body, DataMapper::Types::Text
58
+ property :filter, DataMapper::Types::Text
59
+ property :title, DataMapper::Types::Text
60
+ property :keywords, DataMapper::Types::Text
61
+
62
+ property :created_at, DateTime
63
+ property :updated_at, DateTime
64
+
65
+ belongs_to :page, :class_name => "Merbiful::Page"
66
+ belongs_to :layout, :class_name => "Merbiful::Layout"
67
+
68
+ has n, :css_nesses, :class_name => "Merbiful::Css::Ness"
69
+ has n, :csses, :through => :css_nesses, :class_name => "Merbiful::Css", :remote_name => :css
70
+
71
+ has n, :js_nesses, :class_name => "Merbiful::Js::Ness"
72
+ has n, :jses, :through => :js_nesses, :class_name => "Merbiful::Js", :remote_name => :js
73
+
74
+ before :save do
75
+ clear_cache(page.path) if page.latest
76
+ end
77
+
78
+ def add_css(css)
79
+ Merbiful::Css::Ness.new(:css => css, :page_version => self).save
80
+ end
81
+
82
+ def remove_css(css)
83
+ css_nesses.first(:css_id => css.id).destroy
84
+ end
85
+
86
+ def add_js(js)
87
+ Merbiful::Js::Ness.new(:js => js, :page_version => self).save
88
+ end
89
+
90
+ def remove_js(js)
91
+ js_nesses.first(:js_id => js.id).destroy
92
+ end
93
+
53
94
  end
54
95
 
55
96
  end
@@ -1,2 +1,40 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'merbiful.rb')
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 'haml'
11
+ require 'forwardable'
12
+ require 'pathname'
13
+ require 'erubis'
14
+ require 'pp'
15
+ require 'digest/sha1'
16
+
17
+ module Merbiful
18
+
19
+ FILTERS = []
20
+
21
+ def self.filters
22
+ FILTERS.inject([[nil, "Verbatim"]]) do |sum, filter|
23
+ filter_name = filter.name.gsub(/^Merbiful::/, "")
24
+ sum + [[filter_name, filter_name]]
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'relative_time.rb')
31
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'controller.rb')
32
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'body.rb')
33
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'admin.rb')
34
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'routes.rb')
35
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'css.rb')
36
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'js.rb')
37
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'page.rb')
38
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'layout.rb')
39
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'haml.rb')
40
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'erubis.rb')
data/templates/admin.css~ CHANGED
@@ -1,3 +1,14 @@
1
- ul {
2
- background-color: red;
1
+ ul.info {
3
2
  }
3
+
4
+ ul.info li {
5
+ list-style: none none inside;
6
+ display: inline;
7
+ margin: 1px;
8
+ padding: 1px;
9
+ }
10
+
11
+ li.page_title {
12
+ font-weight: bold;
13
+ }
14
+
@@ -1,9 +1,10 @@
1
1
  %html
2
+ %link{:href => url(:merbiful_admin_css), :rel => 'Stylesheet', :type => 'text/css'}
2
3
  %body
3
- %h1 Merbiful Release Administration Interface
4
+ %h1= link_to("Merbiful Release Administration Interface", url(:merbiful_admin_index))
4
5
  %ul.menu
5
- %li Pages
6
- %li Layouts
7
- %li Css
8
- %li Js
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"))
9
10
  = catch_content :for_layout
@@ -15,7 +15,7 @@
15
15
  %td= text_field(:name => "css[name]", :value => @form_css.name) + errors(@form_css, :name)
16
16
  %tr
17
17
  %td Body
18
- %td~ text_area(@form_css.body, :name => "version[body]", :cols => 80, :rows => (2 * @form_css.body.to_s.split(/\n/).size)) + errors(@form_version, :body)
18
+ %td~ text_area(@form_css.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :body)
19
19
  %tr{:class => "filter"}
20
20
  %td Filter
21
21
  %td= select(:name => "version[filter]", :collection => Merbiful::filters, :selected => @form_css.latest.filter) + errors(@form_version, :filter)
@@ -1,6 +1,5 @@
1
- %a{:href => url(:merbiful_admin, :action => "create_css")} New css
2
- %ul{:class => "css"}
3
- - Merbiful::Css.all.each do |css|
1
+ %ul{:class => "images"}
2
+ - Merbiful::Images.all.each do |css|
4
3
  %li{:class => "css"}
5
4
  %ul{:class => "css_info info"}
6
5
  %a{:href => url(:merbiful_admin, :action => "css", :css_id => css.id)}
@@ -15,7 +14,7 @@
15
14
  %td= text_field(:name => "css[name]", :value => @form_css.name) + errors(@form_css, :name)
16
15
  %tr
17
16
  %td Body
18
- %td~ text_area(@form_css.body, :name => "version[body]", :cols => 80, :rows => (2 * @form_css.body.to_s.split(/\n/).size)) + errors(@form_version, :body)
17
+ %td~ text_area(@form_css.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :body)
19
18
  %tr{:class => "filter"}
20
19
  %td Filter
21
20
  %td= select(:name => "version[filter]", :collection => Merbiful::filters, :selected => @form_css.latest.filter) + errors(@form_version, :filter)
@@ -1 +1,41 @@
1
- %p hej!
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")
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.0.2
4
+ version: 0.0.3
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: 2008-09-12 00:00:00 +02:00
12
+ date: 2008-09-13 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -43,53 +43,45 @@ extra_rdoc_files: []
43
43
  files:
44
44
  - Rakefile
45
45
  - lib/merbiful-release
46
- - lib/merbiful-release/page.rb~
47
- - lib/merbiful-release/layout.rb~
48
- - lib/merbiful-release/layout.rb
49
- - lib/merbiful-release/merbiful.rb~
50
- - lib/merbiful-release/routes.rb~
51
- - lib/merbiful-release/routes.rb
46
+ - lib/merbiful-release/admin.rb
52
47
  - lib/merbiful-release/admin.rb~
53
- - lib/merbiful-release/controller.rb~
54
- - lib/merbiful-release/controller.rb
55
- - lib/merbiful-release/haml.rb~
56
- - lib/merbiful-release/page.rb
57
- - lib/merbiful-release/version.rb~
58
- - lib/merbiful-release/body.rb~
59
48
  - lib/merbiful-release/body.rb
60
- - lib/merbiful-release/css.rb~
61
- - lib/merbiful-release/js.rb~
62
- - lib/merbiful-release/js.rb
63
- - lib/merbiful-release/eruby.rb~
64
- - lib/merbiful-release/erubis.rb~
65
- - lib/merbiful-release/relative_time.rb~
66
- - lib/merbiful-release/relative_time.rb
49
+ - lib/merbiful-release/body.rb~
50
+ - lib/merbiful-release/controller.rb
67
51
  - lib/merbiful-release/css.rb
68
- - lib/merbiful-release/admin.rb
52
+ - lib/merbiful-release/css.rb~
69
53
  - lib/merbiful-release/erubis.rb
54
+ - lib/merbiful-release/erubis.rb~
70
55
  - lib/merbiful-release/filters.rb
56
+ - lib/merbiful-release/filters.rb~
71
57
  - lib/merbiful-release/haml.rb
58
+ - lib/merbiful-release/haml.rb~
72
59
  - lib/merbiful-release/images.rb
73
- - lib/merbiful-release.rb~
60
+ - lib/merbiful-release/images.rb~
61
+ - lib/merbiful-release/js.rb
62
+ - lib/merbiful-release/js.rb~
63
+ - lib/merbiful-release/layout.rb
64
+ - lib/merbiful-release/layout.rb~
65
+ - lib/merbiful-release/page.rb
66
+ - lib/merbiful-release/page.rb~
67
+ - lib/merbiful-release/relative_time.rb
68
+ - lib/merbiful-release/routes.rb
74
69
  - lib/merbiful-release.rb
75
- - templates/index.html.haml~
76
- - templates/index.html.haml
77
- - templates/admin_layout.html.haml~
78
- - templates/pages.html.haml~
79
- - templates/admin.css~
80
- - templates/page_form.html.haml~
81
- - templates/layouts.html.haml~
82
- - templates/layouts.html.haml
83
- - templates/admin_layout.html.rhtml~
84
- - templates/css.html.haml~
85
- - templates/js.html.haml~
86
- - templates/js.html.haml
87
- - templates/css.html.haml
70
+ - lib/merbiful-release.rb~
88
71
  - templates/admin.css
72
+ - templates/admin.css~
89
73
  - templates/admin_layout.html.haml
74
+ - templates/admin_layout.html.haml~
75
+ - templates/css.html.haml
90
76
  - templates/css.html.haml.orig
77
+ - templates/css.html.haml~
91
78
  - templates/images.html.haml
79
+ - templates/images.html.haml~
80
+ - templates/index.html.haml
81
+ - templates/js.html.haml
82
+ - templates/layouts.html.haml
92
83
  - templates/page_form.html.haml
84
+ - templates/page_form.html.haml~
93
85
  has_rdoc: true
94
86
  homepage: ""
95
87
  post_install_message:
@@ -1,12 +0,0 @@
1
-
2
- module Merbiful
3
-
4
- class Controller < Merb::Controller
5
-
6
- def display(what)
7
- render what.inspect
8
- end
9
-
10
- end
11
-
12
- end
@@ -1,11 +0,0 @@
1
- module Merbiful
2
-
3
- class Eruby
4
-
5
- def render(text, scope)
6
- ::Haml::Engine.new(text).render(scope)
7
- end
8
-
9
- end
10
-
11
- end
@@ -1,8 +0,0 @@
1
-
2
- class Merbiful < Application
3
-
4
- def peek
5
-
6
- end
7
-
8
- end
@@ -1,78 +0,0 @@
1
- module Merbiful
2
-
3
- module RelativeTimeHelpers
4
- mattr_accessor :time_class
5
- mattr_accessor :time_output
6
-
7
- self.time_class = Time
8
- self.time_output = {
9
- :today => 'today',
10
- :yesterday => 'yesterday',
11
- :tomorrow => 'tomorrow',
12
- :initial_format => '%b %d',
13
- :year_format => ', %Y'
14
- }
15
-
16
- def relative_date(time)
17
- date = time.to_date
18
- today = time_class.now.to_date
19
- if date == today
20
- time_output[:today]
21
- elsif date == (today - 1)
22
- time_output[:yesterday]
23
- elsif date == (today + 1)
24
- time_output[:tomorrow]
25
- else
26
- fmt = time_output[:initial_format].dup
27
- fmt << time_output[:year_format] unless date.year == today.year
28
- time.strftime_ordinalized(fmt)
29
- end
30
- end
31
-
32
- def relative_date_span(times)
33
- times = [times.first, times.last].collect!(&:to_date)
34
- times.sort!
35
- if times.first == times.last
36
- relative_date(times.first)
37
- else
38
- first = times.first; last = times.last; now = time_class.now
39
- [first.strftime_ordinalized('%b %d')].tap do |arr|
40
- arr << ", #{first.year}" unless first.year == last.year
41
- arr << ' - '
42
- arr << last.strftime('%b') << ' ' unless first.year == last.year && first.month == last.month
43
- arr << last.day.ordinalize
44
- arr << ", #{last.year}" unless first.year == last.year && last.year == now.year
45
- end.to_s
46
- end
47
- end
48
-
49
- def relative_time_span(times)
50
- times = [times.first, times.last].collect!(&:to_time)
51
- times.sort!
52
- if times.first == times.last
53
- "#{prettier_time(times.first)} #{relative_date(times.first)}"
54
- elsif times.first.to_date == times.last.to_date
55
- same_half = (times.first.hour/12 == times.last.hour/12)
56
- "#{prettier_time(times.first, !same_half)} - #{prettier_time(times.last)} #{relative_date(times.first)}"
57
-
58
- else
59
- first = times.first; last = times.last; now = time_class.now
60
- [prettier_time(first)].tap do |arr|
61
- arr << ' '
62
- arr << first.strftime_ordinalized('%b %d')
63
- arr << ", #{first.year}" unless first.year == last.year
64
- arr << ' - '
65
- arr << prettier_time(last)
66
- arr << ' '
67
- arr << last.strftime('%b') << ' ' unless first.year == last.year && first.month == last.month
68
- arr << last.day.ordinalize
69
- arr << ", #{last.year}" unless first.year == last.year && last.year == now.year
70
- end.to_s
71
- end
72
- end
73
-
74
- def prettier_time(time, ampm=true)
75
- time.strftime("%I:%M#{" %p" if ampm}").sub(/^0/, '')
76
- end
77
- end
78
- end
@@ -1,4 +0,0 @@
1
- Merb.logger.info("Compiling merbiful routes...")
2
- Merb::Router.prepare do |r|
3
- r.match(/(.*)/).to(:controller => "merbiful", :action => "peek")
4
- end
@@ -1,45 +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
- include Merbiful::Body
12
-
13
- validates_is_unique :version, :scope => [:path]
14
-
15
- property :id, Serial
16
- property :version, Integer, :index => true
17
- property :body, DataMapper::Types::Text
18
- property :filter, DataMapper::Types::Text
19
- property :path, DataMapper::Types::Text, :index => true
20
- property :position, Integer
21
- property :created_at, DateTime
22
- property :updated_at, DateTime
23
- property :title, DataMapper::Types::Text
24
- property :keywords, DataMapper::Types::Text
25
- property :parent_path, DataMapper::Types::Text
26
- property :layout_id, Integer
27
-
28
- before :save do
29
- if self.position.nil?
30
- last_position = self.class.first(:parent_path => self.parent_path, :path.not => self.path)
31
- if last_position.nil?
32
- self.position = 0
33
- else
34
- self.position = last_position.position + 1
35
- end
36
- end
37
- if self.path.nil?
38
- self.path = "/"
39
- end
40
-
41
- end
42
-
43
- end
44
-
45
- end
@@ -1,10 +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
- = catch_content :for_layout
@@ -1,2 +0,0 @@
1
- %p Welcome to the Merbiful Release Administration Interface
2
- %p I am sure we will get along well.
File without changes
@@ -1,3 +0,0 @@
1
- %ul
2
- = render_page @root
3
-