station 0.0.113 → 0.0.120
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +9 -7
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/docs/How-To-Use.md +2 -0
- data/lib/nexmo_developer/.nvmrc +1 -1
- data/lib/nexmo_developer/.ruby-version +1 -1
- data/lib/nexmo_developer/Gemfile +11 -12
- data/lib/nexmo_developer/Gemfile.lock +178 -117
- data/lib/nexmo_developer/Runbook.md +4 -4
- data/lib/nexmo_developer/app/controllers/jobs_controller.rb +7 -7
- data/lib/nexmo_developer/app/controllers/static_controller.rb +2 -13
- data/lib/nexmo_developer/app/models/feedback/feedback.rb +2 -0
- data/lib/nexmo_developer/app/models/tutorial/file_loader.rb +11 -7
- data/lib/nexmo_developer/app/models/tutorial/task.rb +27 -1
- data/lib/nexmo_developer/app/presenters/head.rb +5 -1
- data/lib/nexmo_developer/app/presenters/improve_page_presenter.rb +1 -1
- data/lib/nexmo_developer/app/services/orbit_feedback_notifier.rb +50 -0
- data/lib/nexmo_developer/app/services/translator/files_list_coordinator.rb +1 -1
- data/lib/nexmo_developer/app/views/contribute/guides/landing-pages.md +0 -10
- data/lib/nexmo_developer/app/views/contribute/guides/markdown-guide.md +3 -41
- data/lib/nexmo_developer/app/views/contribute/guides/platform.md +0 -1
- data/lib/nexmo_developer/app/views/layouts/documentation.html.erb +6 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_sidenav_subitem.html.erb +3 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/jwt_generator/JwtGenerator.vue +1 -1
- data/lib/nexmo_developer/app/webpacker/javascript/sidenav/index.js +17 -0
- data/lib/nexmo_developer/app/webpacker/packs/application.js +1 -5
- data/lib/nexmo_developer/app/webpacker/stylesheets/custom/_core.scss +9 -3
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_header.scss +3 -1
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_navigation.scss +21 -2
- data/lib/nexmo_developer/config/routes.rb +0 -2
- data/lib/nexmo_developer/lib/tasks/cache.rake +1 -1
- data/lib/nexmo_developer/lib/tasks/careers.rake +1 -1
- data/lib/nexmo_developer/lib/tasks/ci.rake +30 -8
- data/lib/nexmo_developer/lib/tasks/diff.rake +5 -5
- data/lib/nexmo_developer/lib/tasks/documentation.rake +1 -1
- data/lib/nexmo_developer/lib/tasks/generate_search_terms.rake +2 -2
- data/lib/nexmo_developer/lib/tasks/links.rake +6 -6
- data/lib/nexmo_developer/lib/tasks/smartling.rake +1 -1
- data/lib/nexmo_developer/version.rb +1 -1
- data/package.json +33 -33
- data/station.gemspec +13 -13
- data/yarn.lock +1186 -2909
- metadata +68 -75
- data/lib/nexmo_developer/.dockerignore +0 -1
- data/lib/nexmo_developer/Dockerfile +0 -28
- data/lib/nexmo_developer/app/screenshots/webhook-url-for-delivery-receipt.js +0 -44
- data/lib/nexmo_developer/app/screenshots/webhook-url-for-inbound-message.js +0 -44
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_submit_your_idea_form.html.erb +0 -58
- data/lib/nexmo_developer/app/webpacker/javascript/spotlight/index.js +0 -12
- data/lib/nexmo_developer/docker-compose.yml +0 -43
- data/lib/nexmo_developer/lib/tasks/screenshots.rake +0 -11
@@ -4,7 +4,7 @@ Nexmo Developer is a simple Rails application with a mounted Sinatra app that ha
|
|
4
4
|
|
5
5
|
# Deployment
|
6
6
|
|
7
|
-
NDP is hosted in Heroku and is automatically deployed every time a branch is merged into
|
7
|
+
NDP is hosted in Heroku and is automatically deployed every time a branch is merged into main via a Github integration.
|
8
8
|
In case you want to force a deploy, you can always deploy NDP from [Heroku's dashboard](https://dashboard.heroku.com/apps/nexmo-developer).
|
9
9
|
|
10
10
|
## Required Resources
|
@@ -39,7 +39,7 @@ In case NDP is Down:
|
|
39
39
|
|
40
40
|
* Check if [Heroku](https://status.heroku.com/) is having an outage. Unfortunately, if that is the case then there isn't much you can do about it (at least for now).
|
41
41
|
* Otherwise, check the [logs](#logs) or [Bugsnag](#error-monitoring-and-reporting) to see if any issues show up and try to reproduce it locally.
|
42
|
-
If the issue is related to the latest deploy, just revert the offending commits and the deploy again while you work on a fix. Once a fix is ready, open a Pull Request, make sure that it works in the corresponding Review App and finally after all the checks pass merge it into
|
42
|
+
If the issue is related to the latest deploy, just revert the offending commits and the deploy again while you work on a fix. Once a fix is ready, open a Pull Request, make sure that it works in the corresponding Review App and finally after all the checks pass merge it into main.
|
43
43
|
|
44
44
|
# Available configuration options
|
45
45
|
|
@@ -53,7 +53,7 @@ To enable the Search form locally, the `ALGOLIA_SEARCH_KEY` environment variable
|
|
53
53
|
|
54
54
|
# Common issues when running NDP locally
|
55
55
|
|
56
|
-
NDP can be run locally either directly or using Docker, for more information about how to run it see the [Readme](https://github.com/Nexmo/nexmo-developer/blob/
|
56
|
+
NDP can be run locally either directly or using Docker, for more information about how to run it see the [Readme](https://github.com/Nexmo/nexmo-developer/blob/main/README.md#running-locally). When using docker, re-building the image should fix the following issues
|
57
57
|
|
58
58
|
* `Could not find definition '<insert_file_here>' in '<path>'`: set the right `OAS_PATH` in `.env`, check `.env.example` for the default value.
|
59
59
|
|
@@ -66,4 +66,4 @@ NDP can be run locally either directly or using Docker, for more information abo
|
|
66
66
|
|
67
67
|
* Webpacker errors:
|
68
68
|
* `The engine "node" is incompatible with this module. Expected version...` We use [nvm](https://github.com/nvm-sh/nvm) as node's version manage, check that the right version of node is installed (specified in `.nvmrc`) and run `nvm use <version>`.
|
69
|
-
* Make sure that all the packages are
|
69
|
+
* Make sure that all the packages are installed by running `yarn install`
|
@@ -8,19 +8,19 @@ class JobsController < ApplicationController
|
|
8
8
|
if params['ref'] == 'refs/heads/master'
|
9
9
|
url = "https://api.travis-ci.org/repo/#{ENV['TRAVIS_REPO_ID']}/requests"
|
10
10
|
RestClient.post(url, {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
request: {
|
12
|
+
branch: 'master',
|
13
|
+
config: {
|
14
|
+
script: 'bundle exec rake diff:execute',
|
15
|
+
env: {
|
16
|
+
SSH_KEY_REQUIRED: true,
|
17
17
|
},
|
18
18
|
},
|
19
19
|
},
|
20
20
|
}.to_json, {
|
21
21
|
content_type: :json,
|
22
22
|
accept: :json,
|
23
|
-
|
23
|
+
Authorization: "token #{ENV['TRAVIS_TOKEN']}",
|
24
24
|
'Travis-API-Version': '3',
|
25
25
|
})
|
26
26
|
|
@@ -45,6 +45,8 @@ class StaticController < ApplicationController
|
|
45
45
|
migrate_tropo
|
46
46
|
end
|
47
47
|
|
48
|
+
@frontmatter = @landing_config
|
49
|
+
@document_title = @landing_config['title']
|
48
50
|
@navigation = yaml_name.to_sym
|
49
51
|
render layout: 'landing'
|
50
52
|
end
|
@@ -145,19 +147,6 @@ class StaticController < ApplicationController
|
|
145
147
|
end
|
146
148
|
end
|
147
149
|
|
148
|
-
def spotlight
|
149
|
-
response = RestClient.post(
|
150
|
-
'https://hooks.zapier.com/hooks/catch/1936493/oyzjr4i/',
|
151
|
-
params.permit(:name, :email_address, :background, :outline, :previous_content).to_h
|
152
|
-
)
|
153
|
-
|
154
|
-
if response.code == 200
|
155
|
-
head :ok
|
156
|
-
else
|
157
|
-
head :unprocessable_entity
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
150
|
def blog_cookie
|
162
151
|
# This is the first touch time so we only want to set it if it's not already set
|
163
152
|
set_utm_cookie('ft', Time.now.getutc.to_i) unless cookies[:ft]
|
@@ -9,13 +9,7 @@ class Tutorial::FileLoader
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def path
|
12
|
-
@path ||=
|
13
|
-
root: root,
|
14
|
-
document: doc_name,
|
15
|
-
language: ::I18n.locale,
|
16
|
-
code_language: code_language,
|
17
|
-
format: format
|
18
|
-
).path
|
12
|
+
@path ||= doc.path
|
19
13
|
end
|
20
14
|
|
21
15
|
def content
|
@@ -25,4 +19,14 @@ class Tutorial::FileLoader
|
|
25
19
|
def yaml
|
26
20
|
@yaml ||= YAML.safe_load(content)
|
27
21
|
end
|
22
|
+
|
23
|
+
def doc
|
24
|
+
@doc ||= Nexmo::Markdown::DocFinder.find(
|
25
|
+
root: root,
|
26
|
+
document: doc_name,
|
27
|
+
language: ::I18n.locale,
|
28
|
+
code_language: code_language,
|
29
|
+
format: format
|
30
|
+
)
|
31
|
+
end
|
28
32
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class Tutorial::Task
|
2
|
-
|
2
|
+
extend ActiveModel::Naming
|
3
|
+
|
4
|
+
attr_reader :name, :code_language, :current_step, :errors
|
3
5
|
|
4
6
|
delegate :yaml, :path, to: :@file_loader
|
5
7
|
|
@@ -10,6 +12,8 @@ class Tutorial::Task
|
|
10
12
|
@code_language = code_language
|
11
13
|
@current_step = current_step
|
12
14
|
@file_loader = load_file!
|
15
|
+
|
16
|
+
@errors = ActiveModel::Errors.new(self)
|
13
17
|
end
|
14
18
|
|
15
19
|
def load_file!
|
@@ -21,6 +25,14 @@ class Tutorial::Task
|
|
21
25
|
)
|
22
26
|
end
|
23
27
|
|
28
|
+
def validate!
|
29
|
+
unless ['introduction', 'conclusion', 'prerequisites'].include? name
|
30
|
+
path.present?
|
31
|
+
end
|
32
|
+
rescue ::Nexmo::Markdown::DocFinder::MissingDoc => _e
|
33
|
+
@errors.add(:name, message: "could not find the file: #{name}")
|
34
|
+
end
|
35
|
+
|
24
36
|
def active?
|
25
37
|
@name == @current_step
|
26
38
|
end
|
@@ -55,4 +67,18 @@ class Tutorial::Task
|
|
55
67
|
def description
|
56
68
|
@description || yaml['description']
|
57
69
|
end
|
70
|
+
|
71
|
+
# The following methods are needed for validation
|
72
|
+
|
73
|
+
def read_attribute_for_validation(attr)
|
74
|
+
send(attr)
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.human_attribute_name(attr, _options = {})
|
78
|
+
attr
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.lookup_ancestors
|
82
|
+
[self]
|
83
|
+
end
|
58
84
|
end
|
@@ -26,11 +26,15 @@ class Head
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def title
|
29
|
-
@title ||= config.fetch('title') do
|
29
|
+
@title ||= title_from_frontmatter || config.fetch('title') do
|
30
30
|
raise "You must provide a 'title' parameter in header_meta.yml"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def title_from_frontmatter
|
35
|
+
@frontmatter && (@frontmatter['meta_title'] || @frontmatter['title'])
|
36
|
+
end
|
37
|
+
|
34
38
|
def description
|
35
39
|
@description ||= Description.new(config: config, frontmatter: frontmatter).description
|
36
40
|
end
|
@@ -4,7 +4,7 @@ class ImprovePagePresenter
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def github_url
|
7
|
-
@github_url ||= "https://github.com/#{docs_repo}/blob/#{ENV.fetch('branch', '
|
7
|
+
@github_url ||= "https://github.com/#{docs_repo}/blob/#{ENV.fetch('branch', 'main')}/#{path_to_url}"
|
8
8
|
end
|
9
9
|
|
10
10
|
def docs_repo
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class OrbitFeedbackNotifier
|
2
|
+
def self.call(feedback)
|
3
|
+
new(feedback).post!
|
4
|
+
end
|
5
|
+
|
6
|
+
def initialize(feedback)
|
7
|
+
@feedback = feedback
|
8
|
+
end
|
9
|
+
|
10
|
+
def params
|
11
|
+
@params ||= {
|
12
|
+
id: @feedback.id,
|
13
|
+
email: @feedback.owner.email,
|
14
|
+
resource: "Offered #{@feedback.sentiment} feedback on #{@feedback.resource.uri}",
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def uri
|
19
|
+
@uri ||= URI("https://app.orbit.love/api/v1/#{ENV['ORBIT_WORKSPACE_ID']}/activities")
|
20
|
+
end
|
21
|
+
|
22
|
+
def post!
|
23
|
+
return unless ENV['ORBIT_WORKSPACE_ID']
|
24
|
+
|
25
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
26
|
+
http.use_ssl = true
|
27
|
+
req = Net::HTTP::Post.new(uri)
|
28
|
+
req['Accept'] = 'application/json'
|
29
|
+
req['Content-Type'] = 'application/json'
|
30
|
+
req['Authorization'] = "Bearer #{ENV['ORBIT_API_KEY']}"
|
31
|
+
|
32
|
+
req.body = {
|
33
|
+
activity: {
|
34
|
+
activity_type: 'adp:feedback',
|
35
|
+
key: "adp-feedback-#{params[:id]}",
|
36
|
+
title: 'Offered feedback on ADP',
|
37
|
+
description: params[:resource],
|
38
|
+
occurred_at: Time.zone.now.iso8601,
|
39
|
+
},
|
40
|
+
identity: {
|
41
|
+
source: 'email',
|
42
|
+
email: params[:email],
|
43
|
+
},
|
44
|
+
}
|
45
|
+
|
46
|
+
req.body = req.body.to_json
|
47
|
+
|
48
|
+
http.request(req)
|
49
|
+
end
|
50
|
+
end
|
@@ -13,7 +13,7 @@ module Translator
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def files
|
16
|
-
@files ||= `(git fetch origin
|
16
|
+
@files ||= `(git fetch origin main:main) && (git log --since="#{@days} days" --name-only --oneline --diff-filter=ACM --pretty=format: main #{Rails.configuration.docs_base_path}/_documentation/en #{Rails.configuration.docs_base_path}/_tutorials/en #{Rails.configuration.docs_base_path}/_use_cases/en) | uniq | awk 'NF'`.split("\n")
|
17
17
|
end
|
18
18
|
|
19
19
|
def process_files(files)
|
@@ -544,13 +544,3 @@ The `warning_callout` content block provides an element to render a warning mess
|
|
544
544
|
content: # Warning message goes here
|
545
545
|
|
546
546
|
```
|
547
|
-
|
548
|
-
### Write for Nexmo
|
549
|
-
|
550
|
-
The `write_for_nexmo` content block will provide a call to action element to Write for Nexmo with a Developer Spotlight graphic on the left-hand side and text advertising the Write for Nexmo program on the left-hand side.
|
551
|
-
|
552
|
-
```yaml
|
553
|
-
|
554
|
-
- type: write_for_nexmo
|
555
|
-
|
556
|
-
```
|
@@ -102,7 +102,7 @@ Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia od
|
|
102
102
|
|
103
103
|
**Inline styles**
|
104
104
|
|
105
|
-
Text can be **bold**,
|
105
|
+
Text can be **bold**, *italic* or ***bold and italic***. You could use ~~strikethrough~~ but please don't.
|
106
106
|
|
107
107
|
You can define inline `code block` with backticks.
|
108
108
|
|
@@ -122,7 +122,7 @@ They auto-magically color when you use verbs like [POST] or [DELETE]
|
|
122
122
|
|
|
123
123
|
| Here is some hidden content.
|
124
124
|
|
|
125
|
-
| Markdown
|
125
|
+
| Markdown *still* works `here`!
|
126
126
|
|
|
127
127
|
| Nullam id dolor id nibh ultricies vehicula ut id elit. Donec ullamcorper nulla non metus auctor fringilla. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
|
128
128
|
|
@@ -131,7 +131,7 @@ They auto-magically color when you use verbs like [POST] or [DELETE]
|
|
131
131
|
|
|
132
132
|
| Here is some hidden content.
|
133
133
|
|
|
134
|
-
| Markdown
|
134
|
+
| Markdown *still* works `here`!
|
135
135
|
|
|
136
136
|
| Nullam id dolor id nibh ultricies vehicula ut id elit. Donec ullamcorper nulla non metus auctor fringilla. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
|
137
137
|
````
|
@@ -359,44 +359,6 @@ If you are adding support for a changed header this would normally go above the
|
|
359
359
|
|
360
360
|
[Go to the anchor](#anchor-example). I've placed at the top of this document.
|
361
361
|
|
362
|
-
## Screenshots
|
363
|
-
|
364
|
-
Webpage screenshots can be scripted so that they only require sourcing once. Define a screenshot as such:
|
365
|
-
|
366
|
-
````
|
367
|
-
```screenshot
|
368
|
-
script: app/screenshots/webhook-url-for-delivery-receipt.js
|
369
|
-
```
|
370
|
-
````
|
371
|
-
|
372
|
-
Run the following command:
|
373
|
-
|
374
|
-
```
|
375
|
-
$ rake screenshots:new
|
376
|
-
```
|
377
|
-
|
378
|
-
This changes the original source document to add an `image` value pointing to the screenshot:
|
379
|
-
|
380
|
-
````
|
381
|
-
```screenshot
|
382
|
-
script: app/screenshots/webhook-url-for-delivery-receipt.js
|
383
|
-
image: public/assets/screenshots/da5f952d465355c19eb888fa1049844b31e090c2.png
|
384
|
-
```
|
385
|
-
````
|
386
|
-
|
387
|
-
You can also update all examples by running the following command:
|
388
|
-
|
389
|
-
```
|
390
|
-
$ rake screenshots:all
|
391
|
-
```
|
392
|
-
|
393
|
-
Here is the example of the final rendered output:
|
394
|
-
|
395
|
-
```screenshot
|
396
|
-
script: app/screenshots/webhook-url-for-delivery-receipt.js
|
397
|
-
image: public/assets/screenshots/da5f952d465355c19eb888fa1049844b31e090c2.png
|
398
|
-
```
|
399
|
-
|
400
362
|
## Audio (custom plugin)
|
401
363
|
|
402
364
|
The HTML `<audio>` element can be utilised in Markdown with the following syntax:
|
@@ -145,7 +145,6 @@ Frontmatter | No | [Implicit] | Strips frontmatter from documents
|
|
145
145
|
PHPInliner | No | [Implicit] | Fixes a quirk with our code parser that requires PHP code to have `<?php` at the start. This filter adds an option onto PHP code examples that makes this not required.
|
146
146
|
InlineEscape | No | [Extended] | Allows for escaping of inline code where normally the internals would be processes by the markdown. For example this isn't turned into a ``[label]`` when surrounded by two backticks.
|
147
147
|
BlockEscape | No | [Extended] | Allows for escaping of code fences where normally the internals would be processes by the markdown.
|
148
|
-
Screenshot | No | [Plugin] | Allows for screenshots be put into documentation that are captured by a headless browser so they can be easily refreshed.
|
149
148
|
Anchor | No | [Extended] | Useful for when a title changes, an explicit anchor can be added and renders a non-visible anchor link to the same content.
|
150
149
|
Audio | No | [Extended] | Used to embed audio examples using the `<audio>` element.
|
151
150
|
Tooltip | No | [Extended] | Allows for ^[Toolips](Hello world!) to be added with a markdown-style syntax.
|
@@ -5,6 +5,12 @@
|
|
5
5
|
<body class="Nxd-template" data-push-state-root="<%= canonical_path %>">
|
6
6
|
<%= render partial: 'layouts/partials/header' %>
|
7
7
|
<div id="Vlt-sidenav" class="Vlt-sidenav Nxd-sidenav Vlt-sidenav--animate Vlt-sidenav--rounded">
|
8
|
+
<div class="Vlt-sidenav__block Vlt-sidenav__block--logo">
|
9
|
+
<div id="Vlt-sidenav-collapse-trigger" class="Vlt-sidenav__collapse">
|
10
|
+
<svg class="Vlt-sidenav__collapse__close"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-chevron-left"></use></svg>
|
11
|
+
<svg class="Vlt-sidenav__collapse__open"><use xlink:href="/symbol/volta-icons.svg#Vlt-icon-menu"></use></svg>
|
12
|
+
</div>
|
13
|
+
</div>
|
8
14
|
<div class="Vlt-sidenav__scroll">
|
9
15
|
<nav class="sidenav" id="sidenav" data-active="<%= active_sidenav_item %>" aria-label="Documentation">
|
10
16
|
<% cache_unless params[:namespace].present?, ['sidenav', I18n.locale] do %>
|
@@ -14,6 +14,9 @@
|
|
14
14
|
<% end %>
|
15
15
|
<% elsif sidenav_subitem.collapsible? %>
|
16
16
|
<li class="js--collapsible navigation-item--<%= sidenav_subitem.title.parameterize %> navigation-item">
|
17
|
+
<% if sidenav_subitem.label? %>
|
18
|
+
<%= link_to(sidenav_subitem.label, sidenav_subitem.link_url, class: "#{sidenav_subitem.css_classes}", role: 'link') %>
|
19
|
+
<% end %>
|
17
20
|
<a class="Vlt-sidemenu__trigger" href="/concepts" role="link">
|
18
21
|
<span class="Vlt-sidemenu__label"><%= sidenav_subitem.title %></span>
|
19
22
|
</a>
|
@@ -146,7 +146,7 @@ export default {
|
|
146
146
|
} else if (this.applicationId) {
|
147
147
|
message = 'Next, provide a Private Key';
|
148
148
|
} else {
|
149
|
-
message = '<h4>Use your <code>private key</code> and <code>application_id</code> to create a JWT for your
|
149
|
+
message = '<h4>Use your <code>private key</code> and <code>application_id</code> to create a JWT for your Vonage Application</h4>The JWT is generated on the client-side so your private key <strong>never leaves your browser</strong>.';
|
150
150
|
}
|
151
151
|
return message;
|
152
152
|
},
|
@@ -170,6 +170,7 @@ export default class Sidenav {
|
|
170
170
|
this.domNode = document.getElementById('sidenav');
|
171
171
|
this.mobileTrigger = document.getElementById('Vlt-sidenav-mobile-trigger');
|
172
172
|
this.container = document.getElementById('Vlt-sidenav');
|
173
|
+
this.collapseTrigger = document.getElementById('Vlt-sidenav-collapse-trigger');
|
173
174
|
|
174
175
|
if (this.domNode) {
|
175
176
|
this.buildMenu();
|
@@ -185,6 +186,7 @@ export default class Sidenav {
|
|
185
186
|
this.domNode.addEventListener('menuClosed', this.closeOpenedMenu.bind(this));
|
186
187
|
this.mobileTrigger.addEventListener('click', this.mobileHandler.bind(this));
|
187
188
|
this.mobileTrigger.addEventListener('touchstart', this.mobileHandler.bind(this));
|
189
|
+
this.collapseTrigger.addEventListener('click', this.collapseHandler.bind(this));
|
188
190
|
|
189
191
|
document.querySelector('body').addEventListener('click', this.closeMobileMenu.bind(this));
|
190
192
|
document.querySelector('body').addEventListener('touchstart', this.closeMobileMenu.bind(this));
|
@@ -242,6 +244,21 @@ export default class Sidenav {
|
|
242
244
|
}
|
243
245
|
}
|
244
246
|
|
247
|
+
collapseHandler(event) {
|
248
|
+
event.preventDefault();
|
249
|
+
event.stopPropagation();
|
250
|
+
|
251
|
+
this.container.classList.add('Vlt-sidenav--animate');
|
252
|
+
|
253
|
+
if (this.container.classList.contains('Vlt-sidenav_visible')) {
|
254
|
+
this.container.classList.remove('Vlt-sidenav_visible');
|
255
|
+
} else if (this.container.classList.contains('Vlt-sidenav--collapsed')) {
|
256
|
+
this.container.classList.remove('Vlt-sidenav--collapsed');
|
257
|
+
} else {
|
258
|
+
this.container.classList.add('Vlt-sidenav--collapsed');
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
245
262
|
closeMobileMenu(event) {
|
246
263
|
if (!this.domNode.contains(event.target)) {
|
247
264
|
this.container.classList.remove('Vlt-sidenav_visible');
|
@@ -7,7 +7,6 @@
|
|
7
7
|
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
|
8
8
|
// layout file, like app/views/layouts/application.html.erb
|
9
9
|
|
10
|
-
import '@babel/polyfill'
|
11
10
|
import '@vonagevolta/volta2/js/addons/prism'
|
12
11
|
|
13
12
|
import Rails from "@rails/ujs"
|
@@ -20,8 +19,7 @@ require.context('../fonts', true);
|
|
20
19
|
require.context('@vonagevolta/volta2/images/logos', true)
|
21
20
|
require.context('@vonagevolta/volta2/dist/symbol', true)
|
22
21
|
|
23
|
-
require('chartkick');
|
24
|
-
require('chart.js');
|
22
|
+
require('chartkick/chart.js');
|
25
23
|
require('jquery');
|
26
24
|
require('clipboard');
|
27
25
|
require('underscore');
|
@@ -39,7 +37,6 @@ import GithubCards from '../javascript/github_cards'
|
|
39
37
|
import VoltaTabbedExamples from '../javascript/volta_tabbed_examples'
|
40
38
|
import Format from '../javascript/format'
|
41
39
|
import Scroll from '../javascript/scroll'
|
42
|
-
import Spotlight from '../javascript/spotlight'
|
43
40
|
import Notices from '../javascript/notices'
|
44
41
|
import Feedback from '../javascript/components/feedback/Feedback.vue'
|
45
42
|
import JwtGenerator from '../javascript/components/jwt_generator/JwtGenerator.vue'
|
@@ -62,7 +59,6 @@ $(document).ready(function() {
|
|
62
59
|
Scroll()
|
63
60
|
CodeSnippetEvents()
|
64
61
|
new Sidenav()
|
65
|
-
Spotlight()
|
66
62
|
new Careers
|
67
63
|
new LocaleSwitcher
|
68
64
|
|