Skip to content

Commit e31b12b

Browse files
authored
Merge pull request #556 from matestack/revert-551-dynamic_page_id
Revert "Add dynamic html id to Matestack pages"
2 parents fc3d532 + a324d47 commit e31b12b

File tree

3 files changed

+5
-55
lines changed

3 files changed

+5
-55
lines changed

docs/ui-in-pure-ruby/overview.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,6 @@ end
144144
```
145145
{% endcode %}
146146

147-
Both the controller and action names will be dynamically added to the `id` attribute of the page's root element, allowing CSS rules to directly target specific pages, and tests to easily locate the page's content.
148-
149-
For example, the above controller code will result in the following HTML markup:
150-
151-
```markup
152-
<div id="matestack-page-some-controller-overview" class="matestack-page-root">
153-
<!-- page content -->
154-
</div>
155-
```
156-
157147
Learn more about Pages:
158148

159149
{% page-ref page="pages/" %}

lib/matestack/ui/core/page.rb

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def create_children
1515

1616
def page
1717
if params[:only_page]
18-
div id: page_id, class: 'matestack-page-root' do
18+
div class: 'matestack-page-root' do
1919
yield
2020
end
2121
else
@@ -28,12 +28,12 @@ def page
2828
end
2929
div class: 'matestack-page-wrapper', 'v-bind:class': '{ "loading": loading === true }' do
3030
div 'v-if': 'asyncPageTemplate == null' do
31-
div id: page_id, class: 'matestack-page-root' do
31+
div class: 'matestack-page-root' do
3232
yield
3333
end
3434
end
3535
div 'v-if': 'asyncPageTemplate != null' do
36-
div id: page_id, class: 'matestack-page-root' do
36+
div class: 'matestack-page-root' do
3737
Base.new('v-runtime-template', ':template': 'asyncPageTemplate')
3838
end
3939
end
@@ -57,17 +57,6 @@ def component_attributes
5757
}
5858
end
5959

60-
def page_id
61-
controller = params[:controller]
62-
.parameterize
63-
.dasherize
64-
65-
action = params[:action]
66-
.underscore
67-
.dasherize
68-
69-
"matestack-page-#{controller}-#{action}"
70-
end
7160
end
7261
end
7362
end

spec/test/base/core/page/rendering_spec.rb

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,12 @@
66
before :all do
77
Rails.application.routes.append do
88
scope "page_rendering_components_spec" do
9-
get '/page_rendering_test', to: 'page_rendering_test#my_action'
9+
get '/page_test', to: 'page_test#my_action', as: 'rendering_page_test_action'
1010
end
1111
end
1212
Rails.application.reload_routes!
13-
14-
class ExamplePageRendering < Matestack::Ui::Page
15-
def response
16-
div do
17-
plain "ExamplePage"
18-
end
19-
end
20-
end
21-
22-
class PageRenderingTestController < ActionController::Base
23-
include Matestack::Ui::Core::Helper
24-
25-
def my_action
26-
render ExamplePageRendering
27-
end
28-
end
2913
end
3014

31-
before :each do
32-
visit "page_rendering_components_spec/page_rendering_test"
33-
end
34-
35-
it "wraps content with a specific dom structure" do
36-
expect(page).to have_xpath('//div[@id="matestack-ui"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]')
37-
end
15+
it "wraps page content with a specific dom structure"
3816

39-
it "renders its root element with a dynamic id composed of {controller} and {action}" do
40-
expect(page).to have_xpath('//div[@id="matestack-page-page-rendering-test-my-action"]')
41-
end
42-
43-
it "renders its root element with a specific class" do
44-
expect(page).to have_xpath('//div[@class="matestack-page-root"]')
45-
end
4617
end

0 commit comments

Comments
 (0)