noodall-ui 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/noodall/admin/assets_controller.rb +0 -1
- data/app/controllers/noodall/admin/base_controller.rb +2 -0
- data/app/helpers/noodall/admin/assets_helper.rb +0 -1
- data/app/helpers/noodall/admin/base_helper.rb +6 -4
- data/app/helpers/noodall/nodes_helper.rb +14 -21
- data/demo/views/layouts/application.html.erb +3 -1
- data/lib/generators/noodall/node/templates/factory.rb +1 -0
- data/lib/generators/noodall/node/templates/model.rb +10 -2
- data/lib/generators/noodall/node/templates/template.html.erb +1 -1
- data/lib/noodall/ui/version.rb +1 -1
- metadata +14 -13
@@ -1,5 +1,7 @@
|
|
1
1
|
module Noodall::Admin::BaseHelper
|
2
2
|
include Noodall::LayoutHelper
|
3
|
+
include SortableTable::App::Helpers::ApplicationHelper
|
4
|
+
|
3
5
|
def admin_page_title
|
4
6
|
@page_title ||= controller.controller_name.titleize +
|
5
7
|
(controller.action_name == 'index' ? ' ' : " | #{controller.action_name.titleize}" ) +
|
@@ -11,14 +13,14 @@ module Noodall::Admin::BaseHelper
|
|
11
13
|
content_tag :li, link_to( title, send(link) )
|
12
14
|
end.join.html_safe
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
# Monkey-patch for the thoughtbot/sortabletable headers, adding 'colspan' option
|
16
18
|
def sortable_table_header(opts = {})
|
17
19
|
raise ArgumentError if opts[:name].nil? || opts[:sort].nil?
|
18
20
|
anchor = opts[:anchor].blank? ? "" : "##{opts[:anchor]}"
|
19
|
-
content_tag :th,
|
20
|
-
link_to(opts[:name],
|
21
|
-
sortable_url(opts) + anchor,
|
21
|
+
content_tag :th,
|
22
|
+
link_to(opts[:name],
|
23
|
+
sortable_url(opts) + anchor,
|
22
24
|
:title => opts[:title]),
|
23
25
|
:class => sortable_table_header_classes(opts),
|
24
26
|
:colspan => opts[:colspan]
|
@@ -2,6 +2,20 @@ module Noodall
|
|
2
2
|
module NodesHelper
|
3
3
|
include Noodall::Permalinks
|
4
4
|
|
5
|
+
def published_roots
|
6
|
+
Noodall::Node.roots.published
|
7
|
+
end
|
8
|
+
|
9
|
+
def breadcrumb
|
10
|
+
return if @node.nil?
|
11
|
+
links = @node.ancestors.inject([]) do |l, n|
|
12
|
+
l << content_tag( :li, link_to(h(n.title), node_path(n)))
|
13
|
+
end
|
14
|
+
links << content_tag( :li, h(@node.title) )
|
15
|
+
end
|
16
|
+
|
17
|
+
# Site map related helpers
|
18
|
+
|
5
19
|
def sitemap(tree)
|
6
20
|
list_children(tree, nil, 'sitemap')
|
7
21
|
end
|
@@ -24,14 +38,6 @@ module Noodall
|
|
24
38
|
end
|
25
39
|
end
|
26
40
|
|
27
|
-
def breadcrumb
|
28
|
-
return if @node.nil?
|
29
|
-
links = @node.ancestors.inject([]) do |l, n|
|
30
|
-
l << content_tag( :li, link_to(h(n.title), node_path(n)))
|
31
|
-
end
|
32
|
-
links << content_tag( :li, h(@node.title) )
|
33
|
-
end
|
34
|
-
|
35
41
|
# get an organised grouped index of nodes for the primary nav
|
36
42
|
def node_tree
|
37
43
|
@node_tree ||= Node.all({:fields => "title, permalink, parent_id, _id, path, _type", :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }, :order => 'parent_id ASC, position ASC'}).group_by{|n| n.parent_id.to_s }
|
@@ -55,18 +61,5 @@ module Noodall
|
|
55
61
|
!(current_node.nil? or node_tree[current_node.root.id.to_s].nil?)
|
56
62
|
end
|
57
63
|
|
58
|
-
def related_content(ref_node, types =[], options = {})
|
59
|
-
options[:_type] = {'$in' => types} unless types.empty?
|
60
|
-
|
61
|
-
nodes = ref_node.related(options.merge(:order => 'published_at DESC', :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }))
|
62
|
-
|
63
|
-
return if nodes.empty?
|
64
|
-
|
65
|
-
content_tag('h2', 'Related Content') + content_tag('ul', :id => 'related-content') do
|
66
|
-
nodes.collect do |node|
|
67
|
-
content_tag('li', link_to(node.title, node_path(node)) + node.published_at.to_formatted_s(:short_dot))
|
68
|
-
end.join.html_safe
|
69
|
-
end
|
70
|
-
end
|
71
64
|
end
|
72
65
|
end
|
@@ -90,7 +90,9 @@ maximum-scale = 1.0 retains dimensions instead of zooming in if page width < dev
|
|
90
90
|
|
91
91
|
<!-- so:main-navigation -->
|
92
92
|
<ul class="nav" id="main-nav">
|
93
|
-
|
93
|
+
<% for root in published_roots %>
|
94
|
+
<li><%= link_to root.name, node_path(root) %></li>
|
95
|
+
<% end %>
|
94
96
|
</ul>
|
95
97
|
<!-- so:main-navigation -->
|
96
98
|
|
@@ -2,6 +2,7 @@ Factory.define :<%= file_name %> do |<%= file_name %>|
|
|
2
2
|
<%= file_name %>.title { Faker::Lorem.words(3).join(' ') }
|
3
3
|
<%= file_name %>.body { Faker::Lorem.paragraphs(6) }
|
4
4
|
<%= file_name %>.published_at { Time.now }
|
5
|
+
<%= file_name %>.publish true
|
5
6
|
<% for attribute in attributes -%>
|
6
7
|
<%= file_name %>.<%= attribute.name %> {Faker::Lorem.words(5).join(' ').titleize}
|
7
8
|
<% end -%>
|
@@ -1,11 +1,19 @@
|
|
1
1
|
class <%= class_name %> < Noodall::Node
|
2
|
-
#
|
2
|
+
# Define if this Node Template can be added as a root page in the top level of the tree
|
3
3
|
<%- if options.root? -%>
|
4
4
|
root_template!
|
5
|
+
<%- else -%>
|
6
|
+
# root_template!
|
5
7
|
<%- end -%>
|
6
8
|
|
7
|
-
#
|
9
|
+
# Define which Node Templates can be used as children of Nodes using this template
|
10
|
+
sub_templates <%= class_name %>
|
11
|
+
<%- if options.root? -%>
|
12
|
+
root_template!
|
13
|
+
<%- end -%>
|
8
14
|
|
15
|
+
# Define the number of each slot type this Node Template allows. Slots are defined in 'config/initializers/noodall.rb'
|
16
|
+
# small_slots 4
|
9
17
|
|
10
18
|
<% for attribute in attributes -%>
|
11
19
|
key :<%= attribute.name %>, <%= attribute.type.to_s.classify %>
|
data/lib/noodall/ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noodall-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Steve England
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-04 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -30,10 +30,10 @@ dependencies:
|
|
30
30
|
- 6
|
31
31
|
- 0
|
32
32
|
version: 0.6.0
|
33
|
-
type: :runtime
|
34
33
|
name: noodall-core
|
35
34
|
prerelease: false
|
36
35
|
version_requirements: *id001
|
36
|
+
type: :runtime
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -46,26 +46,27 @@ dependencies:
|
|
46
46
|
- 0
|
47
47
|
- 6
|
48
48
|
version: 0.0.6
|
49
|
-
type: :runtime
|
50
49
|
name: thoughtbot-sortable_table
|
51
50
|
prerelease: false
|
52
51
|
version_requirements: *id002
|
52
|
+
type: :runtime
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
56
56
|
requirements:
|
57
57
|
- - ~>
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
hash:
|
59
|
+
hash: 1923831917
|
60
60
|
segments:
|
61
61
|
- 3
|
62
62
|
- 0
|
63
|
-
-
|
63
|
+
- pre
|
64
|
+
- 2
|
64
65
|
version: 3.0.pre2
|
65
|
-
type: :runtime
|
66
66
|
name: will_paginate
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: *id003
|
69
|
+
type: :runtime
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
72
|
none: false
|
@@ -76,10 +77,10 @@ dependencies:
|
|
76
77
|
segments:
|
77
78
|
- 0
|
78
79
|
version: "0"
|
79
|
-
type: :runtime
|
80
80
|
name: dynamic_form
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: *id004
|
83
|
+
type: :runtime
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
85
|
requirement: &id005 !ruby/object:Gem::Requirement
|
85
86
|
none: false
|
@@ -92,10 +93,10 @@ dependencies:
|
|
92
93
|
- 0
|
93
94
|
- 0
|
94
95
|
version: 1.0.0
|
95
|
-
type: :development
|
96
96
|
name: bundler
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: *id005
|
99
|
+
type: :development
|
99
100
|
description: Noodall Rails User Interface Engine. Requires Noodall Core
|
100
101
|
email:
|
101
102
|
- steve@wearebeef.co.uk
|
@@ -680,7 +681,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
680
681
|
requirements: []
|
681
682
|
|
682
683
|
rubyforge_project:
|
683
|
-
rubygems_version: 1.
|
684
|
+
rubygems_version: 1.4.1
|
684
685
|
signing_key:
|
685
686
|
specification_version: 3
|
686
687
|
summary: Noodall Rails User Interface
|