comfortable_mexican_sofa 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/views/layouts/cms_admin.html.erb +1 -1
- data/comfortable_mexican_sofa.gemspec +6 -2
- data/lib/comfortable_mexican_sofa.rb +1 -0
- data/lib/comfortable_mexican_sofa/view_hooks.rb +25 -0
- data/lib/comfortable_mexican_sofa/view_methods.rb +5 -0
- data/public/stylesheets/comfortable_mexican_sofa/structure.css +26 -5
- data/test/fixtures/views/_nav_hook.html.erb +1 -0
- data/test/integration/view_hooks_test.rb +22 -0
- metadata +8 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<%= active_link_to 'Layouts', cms_admin_layouts_path %>
|
17
17
|
<%= active_link_to 'Pages', cms_admin_pages_path %>
|
18
18
|
<%= active_link_to 'Snippets', cms_admin_snippets_path %>
|
19
|
-
<%=
|
19
|
+
<%= hook :navigation %>
|
20
20
|
</div>
|
21
21
|
</div>
|
22
22
|
<div class='right_column'>
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-26}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -98,6 +98,7 @@ Gem::Specification.new do |s|
|
|
98
98
|
"lib/comfortable_mexican_sofa/form_builder.rb",
|
99
99
|
"lib/comfortable_mexican_sofa/http_auth.rb",
|
100
100
|
"lib/comfortable_mexican_sofa/rails_extensions.rb",
|
101
|
+
"lib/comfortable_mexican_sofa/view_hooks.rb",
|
101
102
|
"lib/comfortable_mexican_sofa/view_methods.rb",
|
102
103
|
"lib/generators/README",
|
103
104
|
"lib/generators/cms_generator.rb",
|
@@ -135,6 +136,7 @@ Gem::Specification.new do |s|
|
|
135
136
|
"test/fixtures/cms_uploads.yml",
|
136
137
|
"test/fixtures/files/invalid_file.gif",
|
137
138
|
"test/fixtures/files/valid_image.jpg",
|
139
|
+
"test/fixtures/views/_nav_hook.html.erb",
|
138
140
|
"test/functional/cms_admin/layouts_controller_test.rb",
|
139
141
|
"test/functional/cms_admin/pages_controller_test.rb",
|
140
142
|
"test/functional/cms_admin/sites_controller_test.rb",
|
@@ -145,6 +147,7 @@ Gem::Specification.new do |s|
|
|
145
147
|
"test/integration/render_cms_seed_test.rb",
|
146
148
|
"test/integration/render_cms_test.rb",
|
147
149
|
"test/integration/sites_test.rb",
|
150
|
+
"test/integration/view_hooks_test.rb",
|
148
151
|
"test/test_helper.rb",
|
149
152
|
"test/unit/cms_block_test.rb",
|
150
153
|
"test/unit/cms_configuration_test.rb",
|
@@ -182,6 +185,7 @@ Gem::Specification.new do |s|
|
|
182
185
|
"test/integration/render_cms_seed_test.rb",
|
183
186
|
"test/integration/render_cms_test.rb",
|
184
187
|
"test/integration/sites_test.rb",
|
188
|
+
"test/integration/view_hooks_test.rb",
|
185
189
|
"test/test_helper.rb",
|
186
190
|
"test/unit/cms_block_test.rb",
|
187
191
|
"test/unit/cms_configuration_test.rb",
|
@@ -7,6 +7,7 @@ end
|
|
7
7
|
'comfortable_mexican_sofa/http_auth',
|
8
8
|
'comfortable_mexican_sofa/rails_extensions',
|
9
9
|
'comfortable_mexican_sofa/controller_methods',
|
10
|
+
'comfortable_mexican_sofa/view_hooks',
|
10
11
|
'comfortable_mexican_sofa/view_methods',
|
11
12
|
'comfortable_mexican_sofa/form_builder',
|
12
13
|
'comfortable_mexican_sofa/acts_as_tree',
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module ComfortableMexicanSofa::ViewHooks
|
2
|
+
|
3
|
+
# Array of declared hooks
|
4
|
+
def self.hooks
|
5
|
+
@@hooks ||= { }
|
6
|
+
end
|
7
|
+
|
8
|
+
# Renders hook content
|
9
|
+
def self.render(name, template)
|
10
|
+
template.render :partial => self.hooks[name.to_sym] if self.hooks[name.to_sym]
|
11
|
+
end
|
12
|
+
|
13
|
+
# Will declare a partial that will be rendered for this hook
|
14
|
+
# Example:
|
15
|
+
# ComfortableMexicanSofa::ViewHooks.add(:navigation, 'shared/navigation')
|
16
|
+
def self.add(name, partial_path)
|
17
|
+
self.hooks[name.to_sym] = partial_path
|
18
|
+
end
|
19
|
+
|
20
|
+
# Removing previously declared hook
|
21
|
+
def self.remove(name)
|
22
|
+
self.hooks.delete(name)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -14,6 +14,11 @@ module ComfortableMexicanSofa::ViewMethods
|
|
14
14
|
def datetime_field_tag(name, value = nil, options = {})
|
15
15
|
text_field_tag(name, value, options.stringify_keys.update('type' => 'datetime'))
|
16
16
|
end
|
17
|
+
|
18
|
+
# Injects some content somewhere inside cms admin area
|
19
|
+
def hook(name)
|
20
|
+
ComfortableMexicanSofa::ViewHooks.render(name, self)
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
ActionView::Base.send :include, ComfortableMexicanSofa::ViewMethods
|
@@ -160,9 +160,12 @@ ul.list li .action_links {
|
|
160
160
|
float: right;
|
161
161
|
opacity: 0.1;
|
162
162
|
}
|
163
|
-
|
163
|
+
table.formatted td.action_links a {
|
164
|
+
opacity: 0.1;
|
165
|
+
}
|
166
|
+
ul.list .action_links a,
|
167
|
+
table.formatted td.action_links a {
|
164
168
|
margin-left: 3px;
|
165
|
-
float: left;
|
166
169
|
background-color: #272A2D;
|
167
170
|
color: #fff;
|
168
171
|
padding: 3px 5px;
|
@@ -171,11 +174,15 @@ ul.list .action_links a {
|
|
171
174
|
border-radius: 3px;
|
172
175
|
-moz-border-radius: 3px;
|
173
176
|
}
|
174
|
-
ul.list li .label
|
177
|
+
ul.list li .label,
|
178
|
+
table.formatted td .label {
|
175
179
|
margin-left: 35px;
|
176
180
|
font: 16px/18px Georgia, serif;
|
177
181
|
color: #1C1F22;
|
178
182
|
}
|
183
|
+
table.formatted td .label {
|
184
|
+
margin-left: 0px;
|
185
|
+
}
|
179
186
|
ul.list li .label .sublabel {
|
180
187
|
margin-left: 15px;
|
181
188
|
font: 11px/14px Arial, sans-serif;
|
@@ -184,9 +191,23 @@ ul.list li .label .sublabel {
|
|
184
191
|
ul.list li ul {
|
185
192
|
margin-left: 30px;
|
186
193
|
}
|
187
|
-
ul.list li .item:hover
|
194
|
+
ul.list li .item:hover,
|
195
|
+
table.formatted tr:hover td {
|
188
196
|
background-color: #fff;
|
189
197
|
}
|
190
|
-
ul.list li .item:hover .action_links
|
198
|
+
ul.list li .item:hover .action_links,
|
199
|
+
table.formatted tr:hover td.action_links a {
|
191
200
|
opacity: 1;
|
201
|
+
}
|
202
|
+
table.formatted th,
|
203
|
+
table.formatted td {
|
204
|
+
white-space: nowrap;
|
205
|
+
vertical-align: top;
|
206
|
+
padding: 5px;
|
207
|
+
border-bottom: 1px solid #fff;
|
208
|
+
}
|
209
|
+
table.formatted th.main,
|
210
|
+
table.formatted td.main {
|
211
|
+
width: 100%;
|
212
|
+
white-space: normal;
|
192
213
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
hook_content
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class ViewHooksTest < ActionDispatch::IntegrationTest
|
4
|
+
|
5
|
+
def test_hooks_rendering
|
6
|
+
CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
|
7
|
+
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook')
|
8
|
+
|
9
|
+
http_auth :get, cms_admin_sites_path
|
10
|
+
assert_response :success
|
11
|
+
assert_match /hook_content/, response.body
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_hooks_rendering_with_no_hook
|
15
|
+
ComfortableMexicanSofa::ViewHooks.remove(:navigation)
|
16
|
+
|
17
|
+
http_auth :get, cms_admin_sites_path
|
18
|
+
assert_response :success
|
19
|
+
assert_no_match /hook_content/, response.body
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Oleg Khabarov
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-26 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- lib/comfortable_mexican_sofa/form_builder.rb
|
159
159
|
- lib/comfortable_mexican_sofa/http_auth.rb
|
160
160
|
- lib/comfortable_mexican_sofa/rails_extensions.rb
|
161
|
+
- lib/comfortable_mexican_sofa/view_hooks.rb
|
161
162
|
- lib/comfortable_mexican_sofa/view_methods.rb
|
162
163
|
- lib/generators/README
|
163
164
|
- lib/generators/cms_generator.rb
|
@@ -195,6 +196,7 @@ files:
|
|
195
196
|
- test/fixtures/cms_uploads.yml
|
196
197
|
- test/fixtures/files/invalid_file.gif
|
197
198
|
- test/fixtures/files/valid_image.jpg
|
199
|
+
- test/fixtures/views/_nav_hook.html.erb
|
198
200
|
- test/functional/cms_admin/layouts_controller_test.rb
|
199
201
|
- test/functional/cms_admin/pages_controller_test.rb
|
200
202
|
- test/functional/cms_admin/sites_controller_test.rb
|
@@ -205,6 +207,7 @@ files:
|
|
205
207
|
- test/integration/render_cms_seed_test.rb
|
206
208
|
- test/integration/render_cms_test.rb
|
207
209
|
- test/integration/sites_test.rb
|
210
|
+
- test/integration/view_hooks_test.rb
|
208
211
|
- test/test_helper.rb
|
209
212
|
- test/unit/cms_block_test.rb
|
210
213
|
- test/unit/cms_configuration_test.rb
|
@@ -270,6 +273,7 @@ test_files:
|
|
270
273
|
- test/integration/render_cms_seed_test.rb
|
271
274
|
- test/integration/render_cms_test.rb
|
272
275
|
- test/integration/sites_test.rb
|
276
|
+
- test/integration/view_hooks_test.rb
|
273
277
|
- test/test_helper.rb
|
274
278
|
- test/unit/cms_block_test.rb
|
275
279
|
- test/unit/cms_configuration_test.rb
|