brightcontent-pages 2.0.26 → 2.0.27
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/Gemfile.lock +9 -6
- data/app/assets/javascripts/pages.js +5 -0
- data/app/assets/stylesheets/pages.css +5 -0
- data/app/controllers/brightcontent/page_base_controller.rb +23 -0
- data/app/controllers/brightcontent/pages_controller.rb +1 -11
- data/app/helpers/render_sortable_tree_helper.rb +62 -0
- data/app/models/brightcontent/page_core.rb +1 -1
- data/app/views/brightcontent/pages/index.html.erb +3 -0
- data/brightcontent-pages.gemspec +1 -0
- data/config/routes.rb +6 -1
- data/lib/brightcontent/pages.rb +1 -0
- data/spec/features/pages_index_spec.rb +2 -2
- metadata +28 -7
data/Gemfile.lock
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brightcontent-pages (2.0.
|
4
|
+
brightcontent-pages (2.0.27)
|
5
5
|
awesome_nested_set
|
6
|
-
brightcontent-attachments (= 2.0.
|
7
|
-
brightcontent-core (= 2.0.
|
6
|
+
brightcontent-attachments (= 2.0.27)
|
7
|
+
brightcontent-core (= 2.0.27)
|
8
|
+
the_sortable_tree (~> 2.3.0)
|
8
9
|
|
9
10
|
PATH
|
10
11
|
remote: ../attachments
|
11
12
|
specs:
|
12
|
-
brightcontent-attachments (2.0.
|
13
|
-
brightcontent-core (= 2.0.
|
13
|
+
brightcontent-attachments (2.0.27)
|
14
|
+
brightcontent-core (= 2.0.27)
|
14
15
|
jquery-fileupload-rails
|
15
16
|
paperclip
|
16
17
|
|
17
18
|
PATH
|
18
19
|
remote: ../core
|
19
20
|
specs:
|
20
|
-
brightcontent-core (2.0.
|
21
|
+
brightcontent-core (2.0.27)
|
21
22
|
bcrypt-ruby
|
22
23
|
bootstrap-wysihtml5-rails
|
23
24
|
has_scope
|
@@ -174,6 +175,8 @@ GEM
|
|
174
175
|
actionpack (~> 3.0)
|
175
176
|
activemodel (~> 3.0)
|
176
177
|
railties (~> 3.0)
|
178
|
+
the_sortable_tree (2.3.0)
|
179
|
+
rails (>= 3.1)
|
177
180
|
thor (0.17.0)
|
178
181
|
tilt (1.3.6)
|
179
182
|
treetop (1.4.12)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Brightcontent
|
2
|
+
class PageBaseController < BaseController
|
3
|
+
include TheSortableTreeController::Rebuild
|
4
|
+
helper TheSortableTree::Engine.helpers
|
5
|
+
|
6
|
+
per_page 99999
|
7
|
+
|
8
|
+
|
9
|
+
def form_fields
|
10
|
+
%w{name parent_id hidden body attachments}
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def sortable_model
|
16
|
+
Brightcontent::Page
|
17
|
+
end
|
18
|
+
|
19
|
+
def sortable_collection
|
20
|
+
"brightcontent_pages"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,16 +1,6 @@
|
|
1
1
|
require_dependency "brightcontent/application_controller"
|
2
2
|
|
3
3
|
module Brightcontent
|
4
|
-
class PagesController <
|
5
|
-
per_page 99999
|
6
|
-
|
7
|
-
def list_fields
|
8
|
-
%w{name}
|
9
|
-
end
|
10
|
-
|
11
|
-
def form_fields
|
12
|
-
%w{name parent_id hidden body attachments}
|
13
|
-
end
|
14
|
-
|
4
|
+
class PagesController < PageBaseController
|
15
5
|
end
|
16
6
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# DOC:
|
2
|
+
# We use Helper Methods for tree building,
|
3
|
+
# because it's faster than View Templates and Partials
|
4
|
+
|
5
|
+
# SECURITY note
|
6
|
+
# Prepare your data on server side for rendering
|
7
|
+
# or use h.html_escape(node.content)
|
8
|
+
# for escape potentially dangerous content
|
9
|
+
module RenderSortableTreeHelper
|
10
|
+
module Render
|
11
|
+
class << self
|
12
|
+
attr_accessor :h, :options
|
13
|
+
|
14
|
+
def render_node(h, options)
|
15
|
+
@h, @options = h, options
|
16
|
+
|
17
|
+
node = options[:node]
|
18
|
+
|
19
|
+
"
|
20
|
+
<li id='#{ node.id }_#{ options[:klass] }'>
|
21
|
+
<div class='item #{"page-hidden" if node.hidden? }'>
|
22
|
+
<i class='handle'></i>
|
23
|
+
#{ show_link }
|
24
|
+
#{ controls }
|
25
|
+
</div>
|
26
|
+
#{ children }
|
27
|
+
</li>
|
28
|
+
"
|
29
|
+
end
|
30
|
+
|
31
|
+
def show_link
|
32
|
+
node = options[:node]
|
33
|
+
ns = options[:namespace]
|
34
|
+
url = h.url_for(ns + [node])
|
35
|
+
title_field = options[:title]
|
36
|
+
|
37
|
+
"<h4>#{ h.link_to(node.send(title_field), url) }</h4>"
|
38
|
+
end
|
39
|
+
|
40
|
+
def controls
|
41
|
+
node = options[:node]
|
42
|
+
|
43
|
+
edit_path = h.url_for(:controller => options[:klass].pluralize, :action => :edit, :id => node)
|
44
|
+
show_path = h.url_for(:controller => options[:klass].pluralize, :action => :show, :id => node)
|
45
|
+
|
46
|
+
"
|
47
|
+
<div class='controls'>
|
48
|
+
#{ h.link_to '', edit_path, :class => :edit }
|
49
|
+
#{ h.link_to '', show_path, :class => :delete, :method => :delete, :data => { :confirm => 'Are you sure?' } }
|
50
|
+
</div>
|
51
|
+
"
|
52
|
+
end
|
53
|
+
|
54
|
+
def children
|
55
|
+
unless options[:children].blank?
|
56
|
+
"<ol class='nested_set'>#{ options[:children] }</ol>"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/brightcontent-pages.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency "brightcontent-core", version
|
19
19
|
s.add_dependency "brightcontent-attachments", version
|
20
20
|
s.add_dependency "awesome_nested_set"
|
21
|
+
s.add_dependency "the_sortable_tree", "~> 2.3.0"
|
21
22
|
|
22
23
|
s.add_development_dependency "sqlite3"
|
23
24
|
s.add_development_dependency "rspec-rails"
|
data/config/routes.rb
CHANGED
data/lib/brightcontent/pages.rb
CHANGED
@@ -9,13 +9,13 @@ feature "Pages index" do
|
|
9
9
|
|
10
10
|
scenario "click on edit page" do
|
11
11
|
click_link "Pages"
|
12
|
-
|
12
|
+
page.find(:css, '.controls .edit').click
|
13
13
|
page.should have_content "Edit page"
|
14
14
|
end
|
15
15
|
|
16
16
|
scenario "click on delete page" do
|
17
17
|
click_link "Pages"
|
18
|
-
|
18
|
+
page.find(:css, '.controls .delete').click
|
19
19
|
page.should_not have_content "Test page"
|
20
20
|
page.should have_content "successfully"
|
21
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightcontent-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.27
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
21
|
+
version: 2.0.27
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
29
|
+
version: 2.0.27
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: brightcontent-attachments
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - '='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.0.
|
37
|
+
version: 2.0.27
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - '='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.0.
|
45
|
+
version: 2.0.27
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: awesome_nested_set
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: the_sortable_tree
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.3.0
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.0
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
79
|
name: sqlite3
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,13 +166,18 @@ files:
|
|
150
166
|
- Gemfile.lock
|
151
167
|
- Rakefile
|
152
168
|
- app/assets/images/brightcontent/.gitkeep
|
169
|
+
- app/assets/javascripts/pages.js
|
170
|
+
- app/assets/stylesheets/pages.css
|
171
|
+
- app/controllers/brightcontent/page_base_controller.rb
|
153
172
|
- app/controllers/brightcontent/pages_controller.rb
|
154
173
|
- app/helpers/brightcontent/pages_helper.rb
|
174
|
+
- app/helpers/render_sortable_tree_helper.rb
|
155
175
|
- app/models/brightcontent/page.rb
|
156
176
|
- app/models/brightcontent/page_core.rb
|
157
177
|
- app/views/brightcontent/pages/_form_field_body.html.erb
|
158
178
|
- app/views/brightcontent/pages/_form_field_parent_id.html.erb
|
159
179
|
- app/views/brightcontent/pages/_list_field_name.html.erb
|
180
|
+
- app/views/brightcontent/pages/index.html.erb
|
160
181
|
- brightcontent-pages.gemspec
|
161
182
|
- config/routes.rb
|
162
183
|
- db/migrate/20121207132810_create_brightcontent_pages.rb
|
@@ -230,7 +251,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
251
|
version: '0'
|
231
252
|
segments:
|
232
253
|
- 0
|
233
|
-
hash:
|
254
|
+
hash: 1181802481775358288
|
234
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
256
|
none: false
|
236
257
|
requirements:
|
@@ -239,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
260
|
version: '0'
|
240
261
|
segments:
|
241
262
|
- 0
|
242
|
-
hash:
|
263
|
+
hash: 1181802481775358288
|
243
264
|
requirements: []
|
244
265
|
rubyforge_project:
|
245
266
|
rubygems_version: 1.8.24
|