govuk_publishing_components 0.7.0 → 0.8.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d6e8c64db9377403a1d1d92ff1e36c80eed72f4
4
- data.tar.gz: 6a32653dd76f97732c6d43d9bd639384d387c40d
3
+ metadata.gz: 3bf5761c0c773c5f6abace416855d386456fed61
4
+ data.tar.gz: 15b80e2a8b284e9c95a6e7e853e62023d30f7742
5
5
  SHA512:
6
- metadata.gz: '035988061f000562c4ded89a7176a8cccd03ce8239a9ad3d3920a9b31218ec68558b225c7a98b6a822a0a246cbf3dd48f7bb194eb2c5b4ab5b1d592c9128c309'
7
- data.tar.gz: 8cad4e9b7678162f364a76f07481d3412857c6e79b500ba8fc4ad3522b9f89e0b380144e33a6d871be06fa1fa7c02b2ffcbb51bce124b4a686f3c4540c016d29
6
+ metadata.gz: 4e6da7b5f1610be16187e09cc585e2e4e1e3a17b28153a4b2c36b66a9f9158abcc11250436602ff77670a4087df6ae6fb4bc0dcdfb13cd390ed75d137c30703e
7
+ data.tar.gz: 45c2210bbedb30961145bc5cdc35fa77bd4bdbaafd26e71991b8f261869b3058a447898830e0304879a757c7f3ac58346d8df1f4038fc64809519933512ed223
@@ -42,6 +42,10 @@ $border-color: #ccc;
42
42
  .component-doc-h2 {
43
43
  @include bold-27;
44
44
  margin: ($gutter * 1.5) 0 $gutter;
45
+
46
+ small {
47
+ @include bold-16;
48
+ }
45
49
  }
46
50
 
47
51
  .component-doc-h3 {
@@ -132,3 +136,34 @@ $border-color: #ccc;
132
136
  }
133
137
  }
134
138
  }
139
+
140
+ // Preview Page Styling
141
+ html {
142
+ background: $white;
143
+ }
144
+
145
+ .hide-header-and-footer {
146
+ // scss-lint:disable IdSelector
147
+ #global-header,
148
+ #global-header-bar,
149
+ #global-breadcrumb,
150
+ #footer {
151
+ display: none;
152
+ }
153
+ // scss-lint:enable IdSelector
154
+ }
155
+
156
+ .component-guide-preview-page {
157
+ padding: ($gutter * 1.5) 0;
158
+ position: relative;
159
+
160
+ .preview-title {
161
+ margin-bottom: 1em;
162
+ @include bold-16;
163
+
164
+ a {
165
+ color: $black;
166
+ }
167
+ }
168
+ }
169
+
@@ -23,6 +23,18 @@ module GovukPublishingComponents
23
23
  ]
24
24
  end
25
25
 
26
+ def preview
27
+ @component_fixtures = []
28
+ @component_doc = ComponentDoc.get(params[:component])
29
+ @preview = true
30
+
31
+ if params[:fixture].present?
32
+ @component_fixtures.push(@component_doc.fixtures.find { |f| f.id == params[:fixture] })
33
+ else
34
+ @component_fixtures = @component_doc.fixtures
35
+ end
36
+ end
37
+
26
38
  private
27
39
 
28
40
  def index_breadcrumb
@@ -0,0 +1,8 @@
1
+ <% @component_fixtures.each do |fixture| %>
2
+ <div class="component-guide-preview-page">
3
+ <% if @component_fixtures.length > 1 %>
4
+ <h2 class="preview-title"><a href="<%= component_fixture_path(@component_doc.id, fixture.id) %>"><%= fixture.name %></a></h2>
5
+ <% end %>
6
+ <%= render "components/#{@component_doc[:id]}", fixture.data %>
7
+ </div>
8
+ <% end %>
@@ -35,11 +35,14 @@
35
35
 
36
36
  <% if @component_doc.other_fixtures.any? %>
37
37
  <div class="fixtures">
38
- <h2 class="component-doc-h2">Other examples</h2>
38
+ <h2 class="component-doc-h2">Other examples
39
+ <small>(<a href="<%= component_preview_all_path(@component_doc.id) %>">preview all</a>)</small>
40
+ </h2>
39
41
  <% @component_doc.other_fixtures.each do |fixture| %>
40
42
  <div class="component-fixture">
41
43
  <h3 class="fixture-title">
42
44
  <a href="<%= component_fixture_path(@component_doc.id, fixture.id) %>"><%= fixture.name %></a>
45
+ <small>(<a href="<%= component_preview_path(@component_doc.id, fixture.id) %>">preview</a>)</small>
43
46
  </h3>
44
47
  <%= render "govuk_publishing_components/component_guide/component_doc/call", component_doc: @component_doc, fixture: fixture %>
45
48
  <%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, fixture: fixture %>
@@ -2,6 +2,12 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>
5
+ <% if @preview %>
6
+ <%= @component_doc.name %><% if @component_fixtures.length == 1 %>:
7
+ <%= @component_fixtures.first.name %>
8
+ <% end %>
9
+ preview -
10
+ <% end %>
5
11
  <%= yield :title %><% if content_for(:title) %> - <% end %><%= GovukPublishingComponents::Config.component_guide_title %>
6
12
  </title>
7
13
  <%= stylesheet_link_tag "govuk_publishing_components/application", media: "all" %>
@@ -14,19 +20,25 @@
14
20
  <%= javascript_include_tag "#{GovukPublishingComponents::Config.application_javascript}" %>
15
21
  <%= csrf_meta_tags %>
16
22
  </head>
17
- <body>
18
- <div class="header-proposition">
19
- <div class="content">
20
- <nav id="proposition-menu" role="navigation">
21
- <%= link_to GovukPublishingComponents::Config.component_guide_title, component_guide_path, id: 'proposition-name' %>
22
- </nav>
23
+ <body class="<%= 'hide-header-and-footer' if @preview %>">
24
+ <% unless @preview %>
25
+ <div class="header-proposition">
26
+ <div class="content">
27
+ <nav id="proposition-menu" role="navigation">
28
+ <%= link_to GovukPublishingComponents::Config.component_guide_title, component_guide_path, id: 'proposition-name' %>
29
+ </nav>
30
+ </div>
23
31
  </div>
24
- </div>
25
32
 
26
- <main id="wrapper" class="govuk-component-guide-wrapper">
33
+ <main id="wrapper" class="govuk-component-guide-wrapper">
27
34
  <%= render 'govuk_component/breadcrumbs', breadcrumbs: @guide_breadcrumbs %>
28
- <%= yield %>
29
- </main>
35
+ <% else %>
36
+ <main id="wrapper">
37
+ <% end %>
38
+
39
+ <%= yield %>
40
+ </main>
41
+
30
42
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/themes/prism.min.css" integrity="sha256-vtR0hSWRc3Tb26iuN2oZHt3KRUomwTufNIf5/4oeCyg=" crossorigin="anonymous" />
31
43
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/prism.min.js" integrity="sha256-Zb9yKJ/cfs+jG/zIOFL0QEuXr2CDKF7FR5YBJY3No+c=" crossorigin="anonymous"></script>
32
44
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/components/prism-ruby.min.js" integrity="sha256-e0SYaLys07GcwuYiWJ0aewa3AOR3hHFY1mNTppYPb34=" crossorigin="anonymous"></script>
data/config/routes.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  GovukPublishingComponents::Engine.routes.draw do
2
2
  root :to => 'component_guide#index', as: :component_guide
3
+ get ':component/preview' => 'component_guide#preview', as: :component_preview_all
4
+ get ':component/:fixture/preview' => 'component_guide#preview', as: :component_preview
3
5
  get ':component' => 'component_guide#show', as: :component_doc
4
6
  get ':component/:fixture' => 'component_guide#fixture', as: :component_fixture
5
7
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2017-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -159,6 +159,7 @@ files:
159
159
  - app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb
160
160
  - app/views/govuk_publishing_components/component_guide/fixture.html.erb
161
161
  - app/views/govuk_publishing_components/component_guide/index.html.erb
162
+ - app/views/govuk_publishing_components/component_guide/preview.html.erb
162
163
  - app/views/govuk_publishing_components/component_guide/show.html.erb
163
164
  - app/views/layouts/govuk_publishing_components/application.html.erb
164
165
  - config/routes.rb