merbiful-release 0.1.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/Rakefile +1 -3
  2. data/lib/merbiful-release/admin.rb +15 -11
  3. data/lib/merbiful-release/admin.rb~ +3 -275
  4. data/lib/merbiful-release/body.rb +10 -2
  5. data/lib/merbiful-release/body.rb~ +6 -27
  6. data/lib/merbiful-release/controller.rb~ +12 -0
  7. data/lib/merbiful-release/css.rb~ +5 -20
  8. data/lib/merbiful-release/erubis.rb~ +2 -4
  9. data/lib/merbiful-release/eruby.rb~ +11 -0
  10. data/lib/merbiful-release/filters.rb +4 -9
  11. data/lib/merbiful-release/haml.rb~ +1 -13
  12. data/lib/merbiful-release/js.rb~ +11 -25
  13. data/lib/merbiful-release/layout.rb~ +18 -46
  14. data/lib/merbiful-release/merbiful.rb~ +8 -0
  15. data/lib/merbiful-release/page.rb~ +24 -76
  16. data/lib/merbiful-release/relative_time.rb~ +78 -0
  17. data/lib/merbiful-release/routes.rb~ +4 -0
  18. data/lib/merbiful-release/version.rb~ +45 -0
  19. data/lib/merbiful-release.rb +0 -4
  20. data/lib/merbiful-release.rb~ +1 -28
  21. data/templates/admin.css +5 -0
  22. data/templates/admin.css~ +2 -13
  23. data/templates/admin_layout.html.haml~ +5 -6
  24. data/templates/admin_layout.html.rhtml~ +10 -0
  25. data/templates/css.html.haml~ +7 -10
  26. data/templates/index.html.haml~ +2 -0
  27. data/templates/js.html.haml~ +22 -22
  28. data/templates/layouts.html.haml~ +0 -26
  29. data/templates/page_form.html.haml~ +1 -41
  30. data/templates/pages.html.haml~ +3 -0
  31. metadata +35 -52
  32. data/lib/merbiful-release/erubis.rb +0 -13
  33. data/lib/merbiful-release/filters.rb~ +0 -22
  34. data/lib/merbiful-release/haml.rb +0 -23
  35. data/lib/merbiful-release/images.rb~ +0 -14
  36. data/lib/merbiful-release/string.rb~ +0 -16
  37. data/templates/css.html.haml.orig +0 -28
  38. data/templates/images.html.haml~ +0 -17
@@ -1,49 +1,21 @@
1
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
-
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
48
20
 
49
21
  end
@@ -0,0 +1,8 @@
1
+
2
+ class Merbiful < Application
3
+
4
+ def peek
5
+
6
+ end
7
+
8
+ end
@@ -8,100 +8,48 @@ module Merbiful
8
8
 
9
9
  include DataMapper::Resource
10
10
  include DataMapper::Validate
11
- extend Forwardable
11
+ include Merbiful::Body
12
12
 
13
- property :id, Serial
14
- property :parent_id, Integer, :index => true
13
+ validates_is_unique :version, :scope => [:path]
15
14
 
16
- property :path, DataMapper::Types::Text, :unique_index => true, :nullable => false
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
17
20
  property :position, Integer
18
- property :cached, Boolean, :default => true, :nullable => false
19
-
20
21
  property :created_at, DateTime
21
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
22
27
 
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
28
+ belongs_to :layout, :class_name => "Merbiful::Layout"
34
29
 
35
30
  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
36
37
  if self.position.nil?
37
- last_position = self.class.first(:parent_id => self.parent_id, :id.not => self.id)
38
+ last_position = self.class.first(:parent_path => self.parent_path, :path.not => self.path)
38
39
  if last_position.nil?
39
40
  self.position = 0
40
41
  else
41
42
  self.position = last_position.position + 1
42
43
  end
43
44
  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)
45
+ if self.path.nil?
46
+ self.path = "/"
99
47
  end
100
48
 
101
- def remove_js(js)
102
- js_nesses.first(:js_id => js.id).destroy
103
- end
49
+ end
104
50
 
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])
105
53
  end
106
54
 
107
55
  end
@@ -0,0 +1,78 @@
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
@@ -0,0 +1,4 @@
1
+ Merb.logger.info("Compiling merbiful routes...")
2
+ Merb::Router.prepare do |r|
3
+ r.match(/(.*)/).to(:controller => "merbiful", :action => "peek")
4
+ end
@@ -0,0 +1,45 @@
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
@@ -7,10 +7,8 @@ require 'dm-core'
7
7
  require 'dm-validations'
8
8
  require 'dm-timestamps'
9
9
  require 'dm-aggregates'
10
- require 'haml'
11
10
  require 'forwardable'
12
11
  require 'pathname'
13
- require 'erubis'
14
12
  require 'pp'
15
13
  require 'digest/sha1'
16
14
 
@@ -26,5 +24,3 @@ require File.join(File.dirname(__FILE__), 'merbiful-release', 'css.rb')
26
24
  require File.join(File.dirname(__FILE__), 'merbiful-release', 'js.rb')
27
25
  require File.join(File.dirname(__FILE__), 'merbiful-release', 'page.rb')
28
26
  require File.join(File.dirname(__FILE__), 'merbiful-release', 'layout.rb')
29
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'haml.rb')
30
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'erubis.rb')
@@ -1,29 +1,2 @@
1
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 'haml'
11
- require 'forwardable'
12
- require 'pathname'
13
- require 'erubis'
14
- require 'pp'
15
- require 'digest/sha1'
16
-
17
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'filters.rb')
18
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'relative_time.rb')
19
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'images.rb')
20
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'controller.rb')
21
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'body.rb')
22
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'admin.rb')
23
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'routes.rb')
24
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'css.rb')
25
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'js.rb')
26
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'page.rb')
27
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'layout.rb')
28
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'haml.rb')
29
- require File.join(File.dirname(__FILE__), 'merbiful-release', 'erubis.rb')
2
+ require File.join(File.dirname(__FILE__), 'merbiful-release', 'merbiful.rb')
data/templates/admin.css CHANGED
@@ -1,6 +1,11 @@
1
1
  ul.info {
2
2
  }
3
3
 
4
+ .error {
5
+ color: red;
6
+ font-weight: bold;
7
+ }
8
+
4
9
  a {
5
10
  text-decoration: none;
6
11
  }
data/templates/admin.css~ CHANGED
@@ -1,14 +1,3 @@
1
- ul.info {
1
+ ul {
2
+ background-color: red;
2
3
  }
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,10 +1,9 @@
1
1
  %html
2
- %link{:href => url(:merbiful_admin_css), :rel => 'Stylesheet', :type => 'text/css'}
3
2
  %body
4
- %h1= link_to("Merbiful Release Administration Interface", url(:merbiful_admin_index))
3
+ %h1 Merbiful Release Administration Interface
5
4
  %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"))
5
+ %li Pages
6
+ %li Layouts
7
+ %li Css
8
+ %li Js
10
9
  = catch_content :for_layout
@@ -0,0 +1,10 @@
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
@@ -6,27 +6,24 @@
6
6
  %a{:href => url(:merbiful_admin, :action => "css", :css_id => css.id)}
7
7
  %li{:class => "css_name"}= css.name
8
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."))
9
+ %li= link_to("-", url(:merbiful_admin, :action => "destroy_css", :css_id => css.id))
10
10
  - if params[:css_id].to_s == css.id.to_s
11
11
  %table.css
12
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
13
  %tr
17
- %td Name (not versioned)
14
+ %td Name
18
15
  %td= text_field(:name => "css[name]", :value => @form_css.name) + errors(@form_css, :name)
19
16
  %tr
20
17
  %td Body
21
- %td~ text_area(@form_version.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :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)
22
19
  %tr{:class => "filter"}
23
20
  %td Filter
24
- %td= select(:name => "version[filter]", :collection => Merbiful::Filter.filters, :selected => @form_version.filter) + errors(@form_version, :filter)
21
+ %td= select(:name => "version[filter]", :collection => Merbiful::filters, :selected => @form_css.latest.filter) + errors(@form_version, :filter)
25
22
  %tr
26
- %td Media (not versioned)
23
+ %td Media
27
24
  %td= text_field(:name => "css[media]", :value => @form_css.media) + errors(@form_css, :media)
28
25
  %tr{:class => "cached"}
29
- %td Cached (not versioned)
26
+ %td Cached
30
27
  %td= check_box(:name => "css[cached]", :checked => @form_css.cached) + errors(@form_css, :cached)
31
28
  %tr{:class => "submit"}
32
- %td{:colspan => "2"}= submit("Save as new version")
29
+ %td{:colspan => "2"}= submit("Save")
@@ -0,0 +1,2 @@
1
+ %p Welcome to the Merbiful Release Administration Interface
2
+ %p I am sure we will get along well.
@@ -1,29 +1,29 @@
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(", ")
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))
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"}
16
13
  %tr
17
- %td Name (not versioned)
18
- %td= text_field(:name => "js[name]", :value => @form_js.name) + errors(@form_js, :name)
14
+ %td Name
15
+ %td= text_field(:name => "css[name]", :value => @form_css.name) + errors(@form_css, :name)
19
16
  %tr
20
17
  %td Body
21
- %td~ text_area(@form_version.body, :name => "version[body]", :cols => 80, :rows => text_area_rows) + errors(@form_version, :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)
22
19
  %tr{:class => "filter"}
23
20
  %td Filter
24
- %td= select(:name => "version[filter]", :collection => Merbiful::Filter.filters, :selected => @form_version.filter) + errors(@form_version, :filter)
21
+ %td= select(:name => "version[filter]", :collection => Merbiful::filters, :selected => @form_css.latest.filter) + errors(@form_version, :filter)
22
+ %tr
23
+ %td Media
24
+ %td= text_field(:name => "css[media]", :value => @form_css.media) + errors(@form_css, :media)
25
25
  %tr{:class => "cached"}
26
- %td Cached (not versioned)
27
- %td= check_box(:name => "js[cached]", :checked => @form_js.cached) + errors(@form_js, :cached)
26
+ %td Cached
27
+ %td= check_box(:name => "css[cached]", :checked => @form_css.cached) + errors(@form_css, :cached)
28
28
  %tr{:class => "submit"}
29
- %td{:colspan => "2"}= submit("Save as new version")
29
+ %td{:colspan => "2"}= submit("Save")
@@ -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 +1 @@
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")
1
+ %p hej!
@@ -0,0 +1,3 @@
1
+ %ul
2
+ = render_page @root
3
+