aaf-lipstick 1.1.0 → 2.0.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.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Lipstick
2
3
  module Images
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rmagick'
2
3
 
3
4
  module Lipstick
@@ -36,7 +37,7 @@ module Lipstick
36
37
  canvas = Magick::ImageList.new
37
38
  canvas.new_image(WIDTH, HEIGHT) do |f|
38
39
  f.format = 'PNG'
39
- f.background_color = '#495666'
40
+ f.background_color = '#2A3685'
40
41
  end
41
42
 
42
43
  annotate_title(canvas)
@@ -72,18 +73,22 @@ module Lipstick
72
73
  end
73
74
  end
74
75
 
76
+ def blank_environment?
77
+ !@environment&.present?
78
+ end
79
+
75
80
  def annotate_title(canvas)
76
81
  title_format.annotate(canvas, 0, 0, title_x, title_y, @title)
77
82
  end
78
83
 
79
84
  def annotate_environment(canvas)
85
+ return if blank_environment?
80
86
  environment_format.annotate(canvas, 0, 0, env_x, env_y, @environment)
81
87
  end
82
88
 
83
89
  def logo
84
- asset = Rails.application.assets.find_asset(@image)
85
- @logo ||= Magick::Image.read(asset.pathname.to_s).first
86
- .resize_to_fill(150, 80)
90
+ @logo ||= Magick::Image.read(@image.pathname.to_s).first
91
+ .resize_to_fill(78, 78)
87
92
  end
88
93
 
89
94
  def gap
@@ -108,6 +113,7 @@ module Lipstick
108
113
  end
109
114
 
110
115
  def env_metrics
116
+ return OpenStruct.new(width: 0, height: 0) if blank_environment?
111
117
  environment_format.get_type_metrics(@environment)
112
118
  end
113
119
 
@@ -1,8 +1,10 @@
1
- require 'sprockets/processor'
1
+ # frozen_string_literal: true
2
+
3
+ require 'tilt'
2
4
 
3
5
  module Lipstick
4
6
  module Images
5
- class Processor < Sprockets::Processor
7
+ class Processor < ::Tilt::Template
6
8
  class DSL
7
9
  def initialize(context)
8
10
  @context = context
@@ -14,11 +16,15 @@ module Lipstick
14
16
 
15
17
  def email_banner(image: 'logo.png', title:, environment:)
16
18
  @context.depend_on_asset(image)
17
- EmailBanner.new(image: image, title: title, environment: environment)
18
- .to_png
19
+ asset = @context.environment.find_asset(image)
20
+ EmailBanner.new(image: asset, title: title, environment: environment)
21
+ .to_png
19
22
  end
20
23
  end
21
24
 
25
+ def prepare
26
+ end
27
+
22
28
  def evaluate(context, _locals)
23
29
  DSL.new(context).run(data)
24
30
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ require 'sass'
3
+
4
+ module Lipstick
5
+ module SprocketsAssetDataURL
6
+ def asset_data_url(path)
7
+ ::Sass::Script::String.new(
8
+ "url(#{sprockets_context.asset_data_uri(path.value)})"
9
+ )
10
+ end
11
+ end
12
+
13
+ ::Sass::Script::Functions.send(:include, SprocketsAssetDataURL)
14
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Lipstick
2
- VERSION = '1.1.0'
3
+ VERSION = '2.0.0'
3
4
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aaf-lipstick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun Mangelsdorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-15 00:00:00.000000000 Z
11
+ date: 2016-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: actionview
14
+ name: erubis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.1'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: kramdown
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.12'
61
+ version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.12'
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tilt
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: will_paginate
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: nokogiri
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +136,20 @@ dependencies:
108
136
  - - ">="
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: sqlite3
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: tilt
113
155
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +206,20 @@ dependencies:
164
206
  - - ">="
165
207
  - !ruby/object:Gem::Version
166
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: codeclimate-test-reporter
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
167
223
  - !ruby/object:Gem::Dependency
168
224
  name: guard
169
225
  requirement: !ruby/object:Gem::Requirement
@@ -228,25 +284,30 @@ extensions: []
228
284
  extra_rdoc_files: []
229
285
  files:
230
286
  - Rakefile
287
+ - app/assets/images/aaf-icon.png
231
288
  - app/assets/images/favicon.png
232
289
  - app/assets/images/logo.png
233
- - app/assets/javascripts/aaf-layout.js
234
- - app/assets/stylesheets/aaf-layout.css.scss
290
+ - app/assets/javascripts/aaf-lipstick.js
291
+ - app/assets/stylesheets/aaf-lipstick.css.scss
235
292
  - app/views/layouts/email_branding.html.erb
236
293
  - lib/aaf-lipstick.rb
237
294
  - lib/lipstick.rb
238
- - lib/lipstick/action_view_tilt_template.rb
239
295
  - lib/lipstick/auto_validation.rb
240
296
  - lib/lipstick/email_message.rb
241
297
  - lib/lipstick/engine.rb
298
+ - lib/lipstick/filterable.rb
242
299
  - lib/lipstick/helpers.rb
300
+ - lib/lipstick/helpers/bootstrap_form_builder.rb
301
+ - lib/lipstick/helpers/compatibility_hacks.rb
243
302
  - lib/lipstick/helpers/form_helper.rb
303
+ - lib/lipstick/helpers/form_validation_builder.rb
244
304
  - lib/lipstick/helpers/layout_helper.rb
245
305
  - lib/lipstick/helpers/nav_helper.rb
246
- - lib/lipstick/helpers/semantic_form_builder.rb
306
+ - lib/lipstick/helpers/pagination_link_renderer.rb
247
307
  - lib/lipstick/images.rb
248
308
  - lib/lipstick/images/email_banner.rb
249
309
  - lib/lipstick/images/processor.rb
310
+ - lib/lipstick/sprockets_asset_data_url_helper.rb
250
311
  - lib/lipstick/version.rb
251
312
  homepage: https://github.com/ausaccessfed/aaf-lipstick
252
313
  licenses:
@@ -268,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
329
  version: '0'
269
330
  requirements: []
270
331
  rubyforge_project:
271
- rubygems_version: 2.2.2
332
+ rubygems_version: 2.5.1
272
333
  signing_key:
273
334
  specification_version: 4
274
335
  summary: A gem for applying AAF branding to our services
@@ -1,35 +0,0 @@
1
- jQuery(function($) {
2
- $('.nav.collapsing.button .open.button').click(function() {
3
- $(this).parents('.collapsing.nav.parent').toggleClass('expanded');
4
- return false;
5
- });
6
-
7
- $('.field-help-text').popup({
8
- "inline": true,
9
- "position": "right center"
10
- });
11
-
12
- $('.ui.dropdown:not(.simple)').dropdown();
13
-
14
- /* Our nav menu has a layout bug; the same as reported at:
15
- * https://github.com/Semantic-Org/Semantic-UI/issues/839
16
- *
17
- * The suggested fix on that issue did not correct it.
18
- *
19
- * We can detect the bug when the window.load event fires, by checking the
20
- * relative positioning of the right menu. Using a hide/show forces the
21
- * browser to recalculate, which corrects the layout.
22
- */
23
- $('.aaf-header nav > .ui.menu').each(function() {
24
- var e = this;
25
- $(window).load(function() {
26
- var bar_pos = $(e).position();
27
- var right_menu_pos = $(e).find('.right.menu').position();
28
-
29
- if (bar_pos.top < right_menu_pos.top) {
30
- $(e).attr('style', 'display: none !important');
31
- setTimeout(function() { $(e).attr('style', 'display: block'); }, 0);
32
- }
33
- });
34
- });
35
- });
@@ -1,204 +0,0 @@
1
- @mixin no-header-margins() {
2
- h1, h2, h3, h4, h5, h6 {
3
- margin: 0px;
4
- }
5
- }
6
-
7
- @mixin responsive-min-gutter($width, $gutter) {
8
- @media only screen and (max-width: $width) {
9
- padding-left: $gutter;
10
- padding-right: $gutter;
11
- }
12
- }
13
-
14
- @mixin responsive-gutter($width, $gutter) {
15
- @media only screen and (min-width: $width) {
16
- padding-left: $gutter;
17
- padding-right: $gutter;
18
- }
19
- }
20
-
21
- @mixin responsive-fixed($screen, $content) {
22
- @media only screen and (min-width: $screen) {
23
- width: $content;
24
- margin-left: auto;
25
- margin-right: auto;
26
- }
27
- }
28
-
29
- @mixin responsive-width {
30
- @include responsive-min-gutter(959px, 5px);
31
- @include responsive-gutter(960px, 50px);
32
- @include responsive-gutter(1280px, 100px);
33
- @include responsive-fixed(1560px, 1360px);
34
- }
35
-
36
- body {
37
- margin: 0px;
38
- padding: 0px;
39
-
40
- font-size: 14px;
41
- font-family: "Open Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
42
- color: black;
43
- background: white;
44
- }
45
-
46
- section.content {
47
- @include responsive-width;
48
- }
49
-
50
- main {
51
- margin-top: 1em;
52
-
53
- a {
54
- text-decoration: none;
55
- color: #08c;
56
- }
57
-
58
- a:hover {
59
- text-decoration: underline;
60
- }
61
-
62
- table {
63
- text-align: left;
64
- }
65
-
66
- .ui.error.message ul.list li {
67
- list-style-type: circle;
68
- }
69
- }
70
-
71
- footer {
72
- @include responsive-width;
73
-
74
- font-size: 12px;
75
- color: #aaaaaa;
76
- line-height: 1.6em;
77
-
78
- a {
79
- text-decoration: none;
80
- color: inherit;
81
- }
82
-
83
- a:hover {
84
- color: initial;
85
- }
86
- }
87
-
88
- .aaf-header {
89
- $background: #495666;
90
-
91
- background-color: $background;
92
- min-height: 80px;
93
- letter-spacing: 0.5px;
94
-
95
- .ui.header {
96
- font-weight: normal;
97
-
98
- img {
99
- width: 138px;
100
- height: 80px;
101
- }
102
- }
103
-
104
- nav {
105
- @include responsive-width;
106
-
107
- .ui.menu {
108
- background-color: darken($background, 7%);
109
-
110
- a.item:hover, div.dropdown.item:hover {
111
- background-color: rgba(0, 0, 0, .15);
112
- }
113
-
114
- .dropdown.item .menu {
115
- background-color: $background;
116
-
117
- .item {
118
- color: white !important;
119
- }
120
-
121
- .item:hover {
122
- background-color: rgba(0, 0, 0, .15);
123
- }
124
- }
125
- }
126
-
127
- .collapsing.nav.button .open.button {
128
- display: none;
129
- }
130
-
131
- @media only screen and (max-width: 560px) {
132
- .ui.menu .item {
133
- display: block;
134
- }
135
-
136
- .collapsing.nav.button .open.button {
137
- display: block;
138
- float: right;
139
- margin: 5px;
140
- position: relative;
141
- z-index: 5;
142
- }
143
-
144
- .collapsing.nav.content {
145
- display: none;
146
- }
147
-
148
- .collapsing.nav.parent.expanded .collapsing.nav.content {
149
- display: block;
150
-
151
- .item { display: block; }
152
- .ui.simple.dropdown {
153
- .menu {
154
- position: relative;
155
- top: 0.6em !important;
156
- height: auto;
157
- opacity: inherit;
158
- }
159
- }
160
- .menu.right { float: none; }
161
- }
162
- }
163
- }
164
-
165
- .banner {
166
- @include no-header-margins;
167
- @include responsive-width;
168
-
169
- .content, .environment {
170
- height: 80px;
171
- line-height: 80px;
172
- vertical-align: middle;
173
- }
174
-
175
- .environment {
176
- float: right;
177
- font-size: 130%;
178
- color: #dd7727;
179
- margin-right: 5px;
180
- }
181
-
182
- @media only screen and (max-width: 560px) {
183
- .environment {
184
- float: none;
185
- text-align: right;
186
- line-height: 1em;
187
- position: absolute;
188
- right: 5px;
189
- top: 5px;
190
- }
191
- }
192
-
193
- .logo {
194
- float: left;
195
- margin-right: 28px;
196
- }
197
- }
198
- }
199
-
200
- .clearfix:after {
201
- content: "";
202
- display: table;
203
- clear: both;
204
- }