govuk_admin_template 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -9,6 +9,7 @@ This gem provides (via a Rails engine):
|
|
9
9
|
* A [lightweight javascript framework](JAVASCRIPT.md)
|
10
10
|
* Admin design patterns available from `/style-guide` (when routes are mounted)
|
11
11
|
* SASS variables for the admin theme
|
12
|
+
* GOV.UK user friendly date formats
|
12
13
|
|
13
14
|
## Usage
|
14
15
|
|
@@ -22,10 +23,19 @@ At the top of `application.scss` include the styles (this provides all the mixin
|
|
22
23
|
@import 'govuk_admin_template';
|
23
24
|
```
|
24
25
|
|
25
|
-
|
26
|
+
In `application.html.erb` after any content blocks you want to include, render the base template:
|
26
27
|
```erb
|
27
28
|
<%= render :template => 'layouts/govuk_admin_template' %>
|
28
29
|
```
|
30
|
+
|
31
|
+
The [base template](app/views/layouts/govuk_admin_template.html.erb) includes:
|
32
|
+
* Javascript and non-Javascript classes
|
33
|
+
* Mobile friendly viewport
|
34
|
+
* Bootstrap and jQuery javascript
|
35
|
+
* IE HTML5 and respondjs shims, and HTML classes
|
36
|
+
* header HTML
|
37
|
+
* footer HTML
|
38
|
+
|
29
39
|
You will also need to include your styles within the `<head>` of your HTML, do this using nested layouts:
|
30
40
|
```erb
|
31
41
|
<% content_for :head do %>
|
@@ -66,6 +76,18 @@ Example navbar_items:
|
|
66
76
|
<% end %>
|
67
77
|
```
|
68
78
|
|
79
|
+
### Date formats
|
80
|
+
|
81
|
+
The [gem includes](lib/govuk_admin_template/engine.rb) `:govuk_date` date and time formats which match the [recommended style](https://www.gov.uk/design-principles/style-guide/style-points#style-dates-and-times).
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
# 1 January 2013
|
85
|
+
date.to_s(:govuk_date)
|
86
|
+
|
87
|
+
# 1:15pm, 1 January 2013
|
88
|
+
time.to_s(:govuk_date)
|
89
|
+
```
|
90
|
+
|
69
91
|
## Development
|
70
92
|
|
71
93
|
Clone the repository and run `bundle`.
|
@@ -56,7 +56,6 @@
|
|
56
56
|
<a class="inherit" href="http://www.nationalarchives.gov.uk/information-management/our-services/crown-copyright.htm">© Crown Copyright</a>
|
57
57
|
<% if content_for?(:footer_version) %>
|
58
58
|
<span class="pull-right">Version: <%= yield :footer_version %></span>
|
59
|
-
</ul>
|
60
59
|
<% end %>
|
61
60
|
</footer>
|
62
61
|
</section>
|
@@ -6,5 +6,15 @@ module GovukAdminTemplate
|
|
6
6
|
initializer 'govuk_admin_template.assets.precompile' do |app|
|
7
7
|
app.config.assets.precompile += %w(lte-ie8.js govuk-admin-template.js)
|
8
8
|
end
|
9
|
+
|
10
|
+
# User friendly GOV.UK date formats, based on:
|
11
|
+
# https://www.gov.uk/design-principles/style-guide/style-points#style-dates-and-times
|
12
|
+
initializer 'govuk_admin_template.date_formats' do |app|
|
13
|
+
# 1 January 2013
|
14
|
+
Date::DATE_FORMATS[:govuk_date] = '%-e %B %Y'
|
15
|
+
|
16
|
+
# 1:15pm, 1 January 2013
|
17
|
+
Time::DATE_FORMATS[:govuk_date] = '%-I:%M%P, %-e %B %Y'
|
18
|
+
end
|
9
19
|
end
|
10
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_admin_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
segments:
|
194
194
|
- 0
|
195
|
-
hash:
|
195
|
+
hash: 603973172176467454
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
none: false
|
198
198
|
requirements:
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash:
|
204
|
+
hash: 603973172176467454
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
207
|
rubygems_version: 1.8.23
|