Compare commits
98 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f233284e0c | ||
|
4f9dad26a4 | ||
|
c05989af61 | ||
|
31317a355b | ||
|
3fcb819881 | ||
|
e14af79691 | ||
|
9f2b6236a6 | ||
|
bc083c38c8 | ||
|
7eafdcab0e | ||
|
155f58500e | ||
|
86a4533435 | ||
|
02f43cea80 | ||
|
f82107ce21 | ||
|
602e90be57 | ||
|
c629422feb | ||
|
eaf6ae78c8 | ||
|
47a487126f | ||
|
36468d85bb | ||
|
4ad630c6ae | ||
|
5e2854d969 | ||
|
d199dc1892 | ||
|
e029d158d5 | ||
|
28da972b66 | ||
|
ce283c28fd | ||
|
eff726c6f4 | ||
|
bfe25af90a | ||
|
b3dbb60b39 | ||
|
160ec8e10b | ||
|
c85dade38e | ||
|
546498a14a | ||
|
1d4e2b6491 | ||
|
004e342fb0 | ||
|
5a19ffb822 | ||
|
60dcd0dd31 | ||
|
836a022704 | ||
|
aac7367d1d | ||
|
f7b751517a | ||
|
c9e0d54628 | ||
|
eac3fd0427 | ||
|
c164bdf73a | ||
|
0bdc88f4d8 | ||
|
e5e609a907 | ||
|
afab011240 | ||
|
b73cc23aea | ||
|
4531ec57d0 | ||
|
bedecc8deb | ||
|
91d1808c48 | ||
|
9c073cf2e0 | ||
|
c60b2b6cbd | ||
|
acefeb5f95 | ||
|
5a0e25b7dc | ||
|
0c0c7ec4b1 | ||
|
ad05927e61 | ||
|
9eb495c9fe | ||
|
66f031a101 | ||
|
99a5ee32a1 | ||
|
831cfe3734 | ||
|
c3ba307eba | ||
|
f4237ac077 | ||
|
1d9db1191d | ||
|
225b65f93e | ||
|
feb71e47a7 | ||
|
03f7d71c32 | ||
|
4956b39a62 | ||
|
333abd0a7e | ||
|
5c835e8ab0 | ||
|
d2f9fc3028 | ||
|
a1ed2dd9ae | ||
|
ab1035f738 | ||
|
6740cd98a9 | ||
|
cf60c5be7f | ||
|
1793e62d21 | ||
|
3c2816c961 | ||
|
555683b0b0 | ||
|
f121fc3a36 | ||
|
dd9197254f | ||
|
5651c33993 | ||
|
97cc49718c | ||
|
6e70972bb1 | ||
|
fdfd8ebd45 | ||
|
a676cbf717 | ||
|
5aba3471fe | ||
|
eac8e10471 | ||
|
1e6e6c95c7 | ||
|
4522be9767 | ||
|
ad1f35403d | ||
|
e84ba2b4e4 | ||
|
5baed41d16 | ||
|
aad1599396 | ||
|
297f910104 | ||
|
4a569d1dd1 | ||
|
182c749a5a | ||
|
8908dcc755 | ||
|
a991a8285e | ||
|
96d5cdcd27 | ||
|
3364a05340 | ||
|
209cf27e0a | ||
|
ebd052f004 |
15
.gitignore
vendored
15
.gitignore
vendored
@ -2,15 +2,24 @@
|
||||
capybara-*.html
|
||||
.rspec
|
||||
/log
|
||||
/node_modules
|
||||
/pkg
|
||||
/tmp
|
||||
/test/dummy/log
|
||||
/test/dummy/tmp
|
||||
/db/*.sqlite3
|
||||
/db/*.sqlite3-journal
|
||||
/test/dummy/db/*.sqlite3
|
||||
/test/dummy/db/*.sqlite3-journal
|
||||
/public/system
|
||||
/coverage/
|
||||
/spec/tmp
|
||||
**.orig
|
||||
rerun.txt
|
||||
pickle-email-*.html
|
||||
# Don't commit yarn.lock, to ensure that package.json is specific enough
|
||||
yarn.lock
|
||||
yarn-error.log
|
||||
|
||||
# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
|
||||
config/initializers/secret_token.rb
|
||||
@ -26,6 +35,7 @@ config/secrets.yml
|
||||
|
||||
# these should all be checked in to normalize the environment:
|
||||
# Gemfile.lock, .ruby-version, .ruby-gemset
|
||||
Gemfile.lock
|
||||
|
||||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||
.rvmrc
|
||||
@ -40,3 +50,8 @@ bower.json
|
||||
|
||||
# Ignore Byebug command history file.
|
||||
.byebug_history
|
||||
|
||||
.idea/
|
||||
/test/dummy/tmp/
|
||||
/test/dummy/log/
|
||||
.DS_Store
|
188
.rubocop.yml
Normal file
188
.rubocop.yml
Normal file
@ -0,0 +1,188 @@
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.3
|
||||
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
||||
# to ignore them, so only the ones explicitly set in this file are enabled.
|
||||
DisabledByDefault: true
|
||||
Exclude:
|
||||
- '**/templates/**/*'
|
||||
- '**/vendor/**/*'
|
||||
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
||||
- 'lib/templates/**/*'
|
||||
- 'db/**/*'
|
||||
- 'config/**/*'
|
||||
- 'vendor/**/*'
|
||||
|
||||
# Prefer &&/|| over and/or.
|
||||
Style/AndOr:
|
||||
Enabled: true
|
||||
|
||||
# Do not use braces for hash literals when they are the last argument of a
|
||||
# method call.
|
||||
Style/BracesAroundHashParameters:
|
||||
Enabled: true
|
||||
EnforcedStyle: context_dependent
|
||||
|
||||
# Align `when` with `case`.
|
||||
Layout/CaseIndentation:
|
||||
Enabled: true
|
||||
|
||||
# Align comments with method definitions.
|
||||
Layout/CommentIndentation:
|
||||
Enabled: true
|
||||
|
||||
Layout/EmptyLineAfterMagicComment:
|
||||
Enabled: true
|
||||
|
||||
Layout/EmptyLinesAroundBlockBody:
|
||||
Enabled: true
|
||||
|
||||
# In a regular class definition, no empty lines around the body.
|
||||
Layout/EmptyLinesAroundClassBody:
|
||||
Enabled: true
|
||||
|
||||
# In a regular method definition, no empty lines around the body.
|
||||
Layout/EmptyLinesAroundMethodBody:
|
||||
Enabled: true
|
||||
|
||||
# In a regular module definition, no empty lines around the body.
|
||||
Layout/EmptyLinesAroundModuleBody:
|
||||
Enabled: true
|
||||
|
||||
Layout/FirstParameterIndentation:
|
||||
Enabled: true
|
||||
|
||||
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
||||
Style/HashSyntax:
|
||||
Enabled: true
|
||||
|
||||
# Method definitions after `private` or `protected` isolated calls need one
|
||||
# extra level of indentation.
|
||||
Layout/IndentationConsistency:
|
||||
Enabled: true
|
||||
EnforcedStyle: rails
|
||||
|
||||
# Two spaces, no tabs (for indentation).
|
||||
Layout/IndentationWidth:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceAfterColon:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceAfterComma:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceAroundEqualsInParameterDefault:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceAroundKeyword:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceAroundOperators:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceBeforeFirstArg:
|
||||
Enabled: true
|
||||
|
||||
# Defining a method with parameters needs parentheses.
|
||||
Style/MethodDefParentheses:
|
||||
Enabled: true
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: true
|
||||
EnforcedStyle: always
|
||||
|
||||
# Use `foo {}` not `foo{}`.
|
||||
Layout/SpaceBeforeBlockBraces:
|
||||
Enabled: true
|
||||
|
||||
# Use `foo { bar }` not `foo {bar}`.
|
||||
Layout/SpaceInsideBlockBraces:
|
||||
Enabled: true
|
||||
|
||||
# Use `{ a: 1 }` not `{a:1}`.
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceInsideParens:
|
||||
Enabled: true
|
||||
|
||||
# Check quotes usage according to lint rule below.
|
||||
Style/StringLiterals:
|
||||
Enabled: true
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
# Detect hard tabs, no hard tabs.
|
||||
Layout/Tab:
|
||||
Enabled: true
|
||||
|
||||
# Blank lines should not have any spaces.
|
||||
Layout/TrailingBlankLines:
|
||||
Enabled: true
|
||||
|
||||
# No trailing whitespace.
|
||||
Layout/TrailingWhitespace:
|
||||
Enabled: true
|
||||
|
||||
# Use quotes for string literals when they are enough.
|
||||
Style/UnneededPercentQ:
|
||||
Enabled: true
|
||||
|
||||
# Align `end` with the matching keyword or starting expression except for
|
||||
# assignments, where it should be aligned with the LHS.
|
||||
Layout:
|
||||
Enabled: true
|
||||
EnforcedStyleAlignWith: keyword
|
||||
|
||||
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
||||
Lint/RequireParentheses:
|
||||
Enabled: true
|
||||
|
||||
# Don't warn until lines go beyond GitHub view limit
|
||||
Metrics/LineLength:
|
||||
Enabled: false
|
||||
|
||||
# Prefer the compact readable style
|
||||
Style/ClassAndModuleChildren:
|
||||
EnforcedStyle: compact
|
||||
|
||||
Style/FormatStringToken:
|
||||
EnforcedStyle: template
|
||||
|
||||
# Disable top-level documentation
|
||||
Documentation:
|
||||
Enabled: false
|
||||
|
||||
Metrics/MethodLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/CyclomaticComplexity:
|
||||
Enabled: false
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Enabled: false
|
||||
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ParameterLists:
|
||||
CountKeywordArgs: false
|
||||
|
||||
Style/RescueStandardError:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/BlockLength:
|
||||
Enabled: false
|
||||
|
||||
Naming/AccessorMethodName:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ClassLength:
|
||||
Enabled: false
|
||||
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
|
||||
# Ignore templates
|
1
.ruby-gemset
Normal file
1
.ruby-gemset
Normal file
@ -0,0 +1 @@
|
||||
walter
|
1
.ruby-version
Normal file
1
.ruby-version
Normal file
@ -0,0 +1 @@
|
||||
2.6.5
|
46
Gemfile
Normal file
46
Gemfile
Normal file
@ -0,0 +1,46 @@
|
||||
# frozen_string_literal: true
|
||||
source 'http://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'sassc-rails'
|
||||
end
|
||||
|
||||
# Set the Rails version. We have this switch so that we can test multiple
|
||||
# versions for Rails on Travis CI.
|
||||
# Inspired by http://aaronmiler.com/blog/testing-your-rails-engine-with-multiple-versions-of-rails/
|
||||
rails_version = ENV['RAILS_VERSION'] || 'default'
|
||||
rails = case rails_version
|
||||
when 'default'
|
||||
'~> 5.2'
|
||||
when 'master'
|
||||
{github: 'rails/rails'}
|
||||
else
|
||||
"~> #{rails_version}"
|
||||
end
|
||||
gem 'rails', rails
|
||||
|
||||
# Declare your gem's dependencies in walter.gemspec.
|
||||
# Bundler will treat runtime dependencies like base dependencies, and
|
||||
# development dependencies will be added by default to the :development group.
|
||||
gemspec
|
||||
|
||||
# Declare any dependencies that are still in development here instead of in
|
||||
# your gemspec. These might include edge Rails or gems from your path or
|
||||
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||
# your gem to rubygems.org.
|
||||
|
||||
# To use a debugger
|
||||
# gem 'byebug', group: [:development, :test]
|
||||
|
||||
group :development, :test do
|
||||
gem 'turbolinks'
|
||||
end
|
||||
|
||||
group :test do
|
||||
# Adds support for Capybara system testing and selenium driver
|
||||
gem 'capybara', '>= 2.15'
|
||||
gem 'selenium-webdriver'
|
||||
# Easy installation and use of web drivers to run system tests with browsers
|
||||
gem 'webdrivers'
|
||||
gem 'mocha'
|
||||
end
|
35
LICENSE
35
LICENSE
@ -1,21 +1,20 @@
|
||||
MIT License
|
||||
Copyright 2016 Jonathan Abbett
|
||||
|
||||
Copyright (c) 2016 ACT.md
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
201
README.md
201
README.md
@ -1,2 +1,199 @@
|
||||
# abraham
|
||||
Trackable application tours for Rails with i18n support
|
||||
# Walter
|
||||
|
||||
[](https://travis-ci.com/actmd/walter)
|
||||
|
||||
<p align="center">
|
||||
<i>Product tours like a badass.</i>
|
||||
<br/>
|
||||
<img src="https://img.icons8.com/doodle/240/000000/walter-white.png"/>
|
||||
<br/>
|
||||
<a style='font-size: 12px;' href="https://icons8.com/icon/5iWNvQRbAKx9/walter-white">Walter White icon by Icons8</a>
|
||||
</p>
|
||||
Walter makes it easy to show guided tours to users of your Rails application. When Walter shows a tour, it keeps track of whether the user has completed it (so it doesn't get shown again) or dismissed it for later (so it reappears in a future user session).
|
||||
|
||||
* Define tour content with simple YAML files, in any/many languages.
|
||||
* Organize tours by controller and action.
|
||||
* Trigger tours automatically on page load or manually via JavaScript method.
|
||||
* Built with the [Shepherd JS](https://shepherdjs.dev/) library. Plays nicely with Turbolinks.
|
||||
* Ships with two basic CSS themes (default & dark) — or write your own
|
||||
* Show video/html content in your
|
||||
|
||||
## Requirements
|
||||
|
||||
* Walter needs to know the current user to track tour views, e.g. `current_user` from Devise.
|
||||
* Walter is tested on Rails 5.2, 6.0, and 6.1
|
||||
|
||||
## Installation
|
||||
|
||||
Add `walter` to your Gemfile:
|
||||
|
||||
```
|
||||
gem 'walter'
|
||||
|
||||
```
|
||||
|
||||
Install the gem and run the installer:
|
||||
|
||||
```
|
||||
$ bundle install
|
||||
$ rails generate walter:install
|
||||
$ rails db:migrate
|
||||
```
|
||||
|
||||
Install the JavaScript dependencies:
|
||||
|
||||
```
|
||||
$ yarn add js-cookie@^2.2.0 shepherd.js@^6.0.0-beta
|
||||
```
|
||||
|
||||
Require `walter` in `app/assets/javascripts/application.js`
|
||||
|
||||
```
|
||||
//= require walter
|
||||
```
|
||||
|
||||
Require a CSS theme in `app/assets/stylesheets/application.scss`
|
||||
|
||||
```
|
||||
*= require walter/theme-default
|
||||
```
|
||||
|
||||
Walter provides the following themes:
|
||||
|
||||
- `theme-default`
|
||||
- `theme-dark`
|
||||
|
||||
Update `config/walter.yml` if you choose a different theme:
|
||||
|
||||
```
|
||||
defaults: &defaults
|
||||
:tour_options: '{ defaultStepOptions: { classes: "theme-dark" } }'
|
||||
```
|
||||
|
||||
You can also [write your own Shepherd theme](https://shepherdjs.dev/docs/tutorial-03-styling.html) based on Shepherd's [default CSS](https://github.com/shipshapecode/shepherd/releases/download/v6.0.0-beta.1/shepherd.css).
|
||||
|
||||
Tell Walter where to insert its generated JavaScript in `app/views/layouts/application.html.erb`, just before the closing `body` tag:
|
||||
|
||||
```erb
|
||||
<%= walter_tour %>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## Defining your tours
|
||||
|
||||
Define your tours in the `app/tours` directory corresponding to the views defined in your application. Its directory structure mirrors your application's controllers, and the tour files mirror your actions/views. (As of version 2.4.0, Walter respects controllers organized into modules.)
|
||||
|
||||
```
|
||||
app/
|
||||
└── tours/
|
||||
├── admin/
|
||||
│ └── articles/
|
||||
│ └── edit.en.yml
|
||||
├── blog/
|
||||
│ ├── show.en.yml
|
||||
│ └── show.es.yml
|
||||
└── articles/
|
||||
├── index.en.yml
|
||||
├── index.es.yml
|
||||
├── show.en.yml
|
||||
└── show.es.yml
|
||||
```
|
||||
|
||||
For example, per above, when a Spanish-speaking user visits `/articles/`, they'll see the tours defined by `config/tours/articles/index.es.yml`.
|
||||
|
||||
(Note: You must specify a locale in the filename, even if you're only supporting one language.)
|
||||
|
||||
### Tour content
|
||||
|
||||
Within a tour file, each tour is composed of a series of **steps**. A step may have a `title` and must have `text`. You may attach a step to a particular element on the page, and place the callout in a particular position.
|
||||
|
||||
In this example, we define a tour called "intro" with 3 steps:
|
||||
|
||||
```yaml
|
||||
intro:
|
||||
steps:
|
||||
1:
|
||||
text: "Welcome to your dashboard! This is where we'll highlight key information to manage your day."
|
||||
2:
|
||||
title: "Events"
|
||||
text: "If you're participating in any events today, we'll show that here."
|
||||
attachTo:
|
||||
element: ".dashboard-events"
|
||||
placement: "right"
|
||||
3:
|
||||
title: "Search"
|
||||
text: "You can find anything else by using the search bar."
|
||||
attachTo:
|
||||
element: ".navbar-primary form"
|
||||
placement: "bottom"
|
||||
```
|
||||
|
||||
Walter takes care of which buttons should appear with each step:
|
||||
|
||||
* "Later" and "Continue" buttons on the first step
|
||||
* "Exit", "Back" and "Continue" buttons on intermediate steps
|
||||
* "Done" button on the last step
|
||||
|
||||
When you specify an `attachTo` element, use the `placement` option to choose where the callout should appear relative to that element:
|
||||
|
||||
* `bottom` / `bottom center`
|
||||
* `bottom left`
|
||||
* `bottom right`
|
||||
* `center` / `middle` / `middle center`
|
||||
* `left` / `middle left`
|
||||
* `right` / `middle right`
|
||||
* `top` / `top center`
|
||||
* `top left`
|
||||
* `top right`
|
||||
|
||||
Walter tries to be helpful when your tour steps attach to page elements that are missing:
|
||||
|
||||
* If your first step is attached to a particular element, and that element is not present on the page, the tour won't start. ([#28](https://github.com/actmd/walter/issues/28))
|
||||
* If your tour has an intermediate step attached to a missing element, Walter will skip that step and automatically show the next. ([#6](https://github.com/actmd/walter/issues/6))
|
||||
|
||||
### Automatic vs. manual tours
|
||||
|
||||
By default, Walter will automatically start a tour that the current user hasn't seen yet.
|
||||
You can instead define a tour to be triggered manually using the `trigger` option:
|
||||
|
||||
```yml
|
||||
walkthrough:
|
||||
trigger: "manual"
|
||||
steps:
|
||||
1:
|
||||
text: "This walkthrough will show you how to..."
|
||||
```
|
||||
|
||||
This tour will not start automatically; instead, use the `Walter.startTour` method with the tour name:
|
||||
|
||||
```
|
||||
<button id="startTour">Start tour</button>
|
||||
|
||||
<script>
|
||||
document.querySelector("#startTour").addEventListener("click", function() {
|
||||
Walter.startTour("walkthrough"));
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
...or if you happen to use jQuery:
|
||||
|
||||
```
|
||||
<script>
|
||||
$("#startTour").on("click", function() { Walter.startTour('walkthrough'); })
|
||||
</script>
|
||||
```
|
||||
|
||||
### Testing your tours
|
||||
|
||||
Walter loads tour definitions once when you start your server. Restart your server to see tour changes.
|
||||
|
||||
If you'd like to run JavaScript integrations tests without the Walter tours getting in the way, clear the Walter configuration in your test helper, e.g.
|
||||
|
||||
```
|
||||
Rails.application.configure do
|
||||
config.walter.tours = {}
|
||||
end
|
||||
```
|
||||
|
||||
|
35
Rakefile
Normal file
35
Rakefile
Normal file
@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require "bundler/setup"
|
||||
rescue LoadError
|
||||
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
||||
end
|
||||
|
||||
require "rdoc/task"
|
||||
|
||||
RDoc::Task.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = "rdoc"
|
||||
rdoc.title = "Walter"
|
||||
rdoc.options << "--line-numbers"
|
||||
rdoc.rdoc_files.include("README.md")
|
||||
rdoc.rdoc_files.include("lib/**/*.rb")
|
||||
end
|
||||
|
||||
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
||||
load "rails/tasks/engine.rake"
|
||||
|
||||
load "rails/tasks/statistics.rake"
|
||||
|
||||
require "bundler/gem_tasks"
|
||||
|
||||
require "rake/testtask"
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << "test"
|
||||
t.pattern = "test/**/*_test.rb"
|
||||
t.verbose = false
|
||||
t.warning = false
|
||||
end
|
||||
|
||||
task default: :test
|
0
app/assets/config/walter_manifest.js
Normal file
0
app/assets/config/walter_manifest.js
Normal file
0
app/assets/javascripts/walter/.keep
Normal file
0
app/assets/javascripts/walter/.keep
Normal file
28
app/assets/javascripts/walter/index.js
Normal file
28
app/assets/javascripts/walter/index.js
Normal file
@ -0,0 +1,28 @@
|
||||
//= require js-cookie/src/js.cookie
|
||||
//= require shepherd.js/dist/js/shepherd
|
||||
|
||||
var Walter = new Object();
|
||||
|
||||
Walter.tours = {};
|
||||
Walter.incompleteTours = [];
|
||||
Walter.startTour = function(tourName) {
|
||||
if (!Shepherd.activeTour) {
|
||||
setTimeout(function(){Walter.tours[tourName].start()}, 300);
|
||||
}
|
||||
};
|
||||
Walter.startNextIncompleteTour = function() {
|
||||
if (Walter.incompleteTours.length) {
|
||||
Walter.tours[Walter.incompleteTours[0]].checkAndStart();
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("DOMContentLoaded", Walter.startNextIncompleteTour);
|
||||
document.addEventListener("turbolinks:load", Walter.startNextIncompleteTour);
|
||||
|
||||
document.addEventListener('turbolinks:before-cache', function() {
|
||||
// Remove visible product tours
|
||||
document.querySelectorAll(".shepherd-element").forEach(function(el) { el.remove() });
|
||||
// Clear Walter data
|
||||
Walter.tours = {};
|
||||
Walter.incompleteTours = [];
|
||||
});
|
0
app/assets/stylesheets/walter/.keep
Normal file
0
app/assets/stylesheets/walter/.keep
Normal file
194
app/assets/stylesheets/walter/_common.scss
Normal file
194
app/assets/stylesheets/walter/_common.scss
Normal file
@ -0,0 +1,194 @@
|
||||
.shepherd-button {
|
||||
background: #3288e6;
|
||||
border: 0;
|
||||
border-radius: 3px;
|
||||
color: hsla(0, 0%, 100%, .75);
|
||||
cursor: pointer;
|
||||
margin-right: .5rem;
|
||||
padding: .5rem 1.5rem;
|
||||
transition: all .5s ease;
|
||||
}
|
||||
|
||||
.shepherd-button:not(:disabled):hover {
|
||||
background: #196fcc;
|
||||
color: hsla(0, 0%, 100%, .75);
|
||||
}
|
||||
|
||||
.shepherd-button.shepherd-button-secondary {
|
||||
background: #f1f2f3;
|
||||
color: rgba(0, 0, 0, .75);
|
||||
}
|
||||
|
||||
.shepherd-button.shepherd-button-secondary:not(:disabled):hover {
|
||||
background: #d6d9db;
|
||||
color: rgba(0, 0, 0, .75);
|
||||
}
|
||||
|
||||
.shepherd-button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.shepherd-footer {
|
||||
border-bottom-left-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 0 1rem 1rem;
|
||||
}
|
||||
|
||||
.shepherd-footer .shepherd-button:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.shepherd-cancel-icon {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: hsla(0, 0%, 50.2%, .75);
|
||||
font-size: 2em;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
transition: color .5s ease;
|
||||
}
|
||||
|
||||
.shepherd-cancel-icon:hover {
|
||||
color: rgba(0, 0, 0, .75);
|
||||
}
|
||||
|
||||
.shepherd-has-title .shepherd-content .shepherd-cancel-icon {
|
||||
color: hsla(0, 0%, 50.2%, .75);
|
||||
}
|
||||
|
||||
.shepherd-has-title .shepherd-content .shepherd-cancel-icon:hover {
|
||||
color: rgba(0, 0, 0, .75);
|
||||
}
|
||||
|
||||
.shepherd-title {
|
||||
display: flex;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
flex: 1 0 auto;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.shepherd-header {
|
||||
align-items: center;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 0.5rem 0rem 0;
|
||||
}
|
||||
|
||||
.shepherd-has-title .shepherd-content .shepherd-header {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.shepherd-text {
|
||||
font-size: 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.shepherd-text p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.shepherd-text p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.shepherd-content {
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.shepherd-element {
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
|
||||
//max-width: 600px;
|
||||
outline: none;
|
||||
z-index: 9999;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.shepherd-element,
|
||||
.shepherd-element *,
|
||||
.shepherd-element :after,
|
||||
.shepherd-element :before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.shepherd-element .shepherd-arrow {
|
||||
border: 16px solid transparent;
|
||||
content: "";
|
||||
display: block;
|
||||
height: 16px;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.shepherd-element.shepherd-element-attached-bottom.shepherd-element-attached-center .shepherd-arrow,
|
||||
.shepherd-element.shepherd-pinned-top .shepherd-arrow {
|
||||
bottom: 0;
|
||||
border-top-color: #232323;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 100%);
|
||||
}
|
||||
|
||||
.shepherd-element.shepherd-element-attached-top.shepherd-element-attached-center .shepherd-arrow {
|
||||
border-bottom-color: #232323;
|
||||
left: 50%;
|
||||
top: 0;
|
||||
transform: translate(-50%, -100%);
|
||||
}
|
||||
|
||||
.shepherd-element.shepherd-element-attached-top.shepherd-element-attached-center.shepherd-has-title .shepherd-arrow {
|
||||
border-bottom-color: #303030;
|
||||
}
|
||||
|
||||
.shepherd-element.shepherd-element-attached-middle.shepherd-element-attached-left .shepherd-arrow,
|
||||
.shepherd-element.shepherd-pinned-right .shepherd-arrow {
|
||||
border-right-color: #232323;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translate(-100%, -50%);
|
||||
}
|
||||
|
||||
.shepherd-element.shepherd-element-attached-middle.shepherd-element-attached-right .shepherd-arrow,
|
||||
.shepherd-element.shepherd-pinned-left .shepherd-arrow {
|
||||
border-left-color: #232323;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translate(100%, -50%);
|
||||
}
|
||||
|
||||
.shepherd-modal-overlay-container {
|
||||
-ms-filter: progid:dximagetransform.microsoft.gradient.alpha(Opacity=50);
|
||||
filter: alpha(opacity=50);
|
||||
fill-rule: evenodd;
|
||||
height: 0;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
transition: all .3s ease-out, height 0ms .3s, opacity .3s 0ms;
|
||||
width: 100vw;
|
||||
z-index: 9997;
|
||||
}
|
||||
|
||||
.shepherd-modal-overlay-container.shepherd-modal-is-visible {
|
||||
height: 100vh;
|
||||
opacity: .5;
|
||||
transition: all .3s ease-out, height 0s 0s, opacity .3s 0s;
|
||||
}
|
||||
|
||||
.shepherd-modal-overlay-container.shepherd-modal-is-visible path {
|
||||
pointer-events: all;
|
||||
}
|
117
app/assets/stylesheets/walter/shepherd.css
Normal file
117
app/assets/stylesheets/walter/shepherd.css
Normal file
@ -0,0 +1,117 @@
|
||||
.shepherd-button:hover {
|
||||
background: #16202D;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.shepherd-button.shepherd-button-secondary {
|
||||
background: #CAD5D5;
|
||||
}
|
||||
|
||||
.shepherd-button.shepherd-button-secondary:hover {
|
||||
color: #CAD5D5;
|
||||
background: #16202D;
|
||||
}
|
||||
|
||||
.shepherd-cancel-icon {
|
||||
font-family: "GT Pressura", sans-serif;
|
||||
}
|
||||
|
||||
.shepherd-element {
|
||||
border: solid 4px #16202D;
|
||||
}
|
||||
|
||||
.shepherd-element,
|
||||
.shepherd-header,
|
||||
.shepherd-footer {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.shepherd-element .shepherd-arrow {
|
||||
border-width: 0;
|
||||
height: auto;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.shepherd-arrow::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.shepherd-element .shepherd-arrow:after {
|
||||
content: url('../assets/img/arrow.svg');
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='top'] .shepherd-arrow,
|
||||
.shepherd-element.shepherd-pinned-top .shepherd-arrow {
|
||||
bottom: -35px;
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='top'] .shepherd-arrow:after,
|
||||
.shepherd-element.shepherd-pinned-top .shepherd-arrow:after {
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='bottom'] .shepherd-arrow {
|
||||
top: -35px;
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='bottom'] .shepherd-arrow:after {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='left'] .shepherd-arrow,
|
||||
.shepherd-element.shepherd-pinned-left .shepherd-arrow {
|
||||
right: -35px;
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='left'] .shepherd-arrow:after,
|
||||
.shepherd-element.shepherd-pinned-left .shepherd-arrow:after {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.shepherd-element[data-popper-placement^='right'] .shepherd-arrow,
|
||||
.shepherd-element.shepherd-pinned-right .shepherd-arrow {
|
||||
left: -35px;
|
||||
}
|
||||
|
||||
.shepherd-footer {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.shepherd-footer button:not(:last-of-type) {
|
||||
border-right: solid 4px #16202D;
|
||||
}
|
||||
|
||||
.shepherd-has-title .shepherd-content .shepherd-cancel-icon {
|
||||
margin-top: -7px;
|
||||
}
|
||||
|
||||
.shepherd-has-title .shepherd-content .shepherd-header {
|
||||
background: transparent;
|
||||
font-family: "GT Pressura", sans-serif;
|
||||
padding-bottom: 0;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
.shepherd-has-title .shepherd-content .shepherd-header .shepherd-title {
|
||||
font-size: 1.2rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.shepherd-text {
|
||||
font-size: 1.2rem;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.shepherd-text a, .shepherd-text a:visited,
|
||||
.shepherd-text a:active {
|
||||
border-bottom: 1px dotted;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.75);
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.shepherd-text a:hover, .shepherd-text a:visited:hover,
|
||||
.shepherd-text a:active:hover {
|
||||
border-bottom-style: solid;
|
||||
}
|
40
app/assets/stylesheets/walter/theme-dark.scss
Executable file
40
app/assets/stylesheets/walter/theme-dark.scss
Executable file
@ -0,0 +1,40 @@
|
||||
@import "_common";
|
||||
|
||||
.theme-dark.shepherd-element {
|
||||
background: #232323;
|
||||
|
||||
.shepherd-text {
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.shepherd-title {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.shepherd-has-title .shepherd-content .shepherd-header {
|
||||
background: #303030;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-bottom.shepherd-element-attached-center .shepherd-arrow,
|
||||
&.shepherd-pinned-top .shepherd-arrow {
|
||||
border-top-color: #232323;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-top.shepherd-element-attached-center .shepherd-arrow {
|
||||
border-bottom-color: #232323;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-top.shepherd-element-attached-center.shepherd-has-title .shepherd-arrow {
|
||||
border-bottom-color: #303030;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-middle.shepherd-element-attached-left .shepherd-arrow,
|
||||
&.shepherd-pinned-right .shepherd-arrow {
|
||||
border-right-color: #232323;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-middle.shepherd-element-attached-right .shepherd-arrow,
|
||||
&.shepherd-pinned-left .shepherd-arrow {
|
||||
border-left-color: #232323;
|
||||
}
|
||||
}
|
40
app/assets/stylesheets/walter/theme-default.scss
Executable file
40
app/assets/stylesheets/walter/theme-default.scss
Executable file
@ -0,0 +1,40 @@
|
||||
@import "_common";
|
||||
|
||||
.theme-default.shepherd-element {
|
||||
background: #fff;
|
||||
|
||||
.shepherd-text {
|
||||
color: rgba(0, 0, 0, .75);
|
||||
}
|
||||
|
||||
.shepherd-title {
|
||||
color: rgba(0, 0, 0, .75);
|
||||
}
|
||||
|
||||
&.shepherd-has-title .shepherd-content .shepherd-header {
|
||||
background: #e6e6e6;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-bottom.shepherd-element-attached-center .shepherd-arrow,
|
||||
&.shepherd-pinned-top .shepherd-arrow {
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-top.shepherd-element-attached-center .shepherd-arrow {
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-top.shepherd-element-attached-center.shepherd-has-title .shepherd-arrow {
|
||||
border-bottom-color: #e6e6e6;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-middle.shepherd-element-attached-left .shepherd-arrow,
|
||||
&.shepherd-pinned-right .shepherd-arrow {
|
||||
border-right-color: #fff;
|
||||
}
|
||||
|
||||
&.shepherd-element-attached-middle.shepherd-element-attached-right .shepherd-arrow,
|
||||
&.shepherd-pinned-left .shepherd-arrow {
|
||||
border-left-color: #fff;
|
||||
}
|
||||
}
|
0
app/controllers/.keep
Normal file
0
app/controllers/.keep
Normal file
21
app/controllers/walter_histories_controller.rb
Normal file
21
app/controllers/walter_histories_controller.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WalterHistoriesController < ApplicationController
|
||||
def create
|
||||
@walter_history = WalterHistory.new(walter_history_params)
|
||||
@walter_history.creator_id = current_user.id
|
||||
respond_to do |format|
|
||||
if @walter_history.save
|
||||
format.json { render json: @walter_history, status: :created }
|
||||
else
|
||||
format.json { render json: @walter_history.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def walter_history_params
|
||||
params.require(:walter_history).permit(:controller_name, :action_name, :tour_name)
|
||||
end
|
||||
end
|
0
app/helpers/.keep
Normal file
0
app/helpers/.keep
Normal file
50
app/helpers/walter_helper.rb
Normal file
50
app/helpers/walter_helper.rb
Normal file
@ -0,0 +1,50 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WalterHelper
|
||||
def walter_tour
|
||||
# Do we have tours for this controller/action in the user's locale?
|
||||
tours = Walter.tours["#{controller_path}.#{action_name}.#{I18n.locale}"]
|
||||
# Otherwise, default to the default locale
|
||||
tours ||= Walter.tours["#{controller_path}.#{action_name}.#{I18n.default_locale}"]
|
||||
|
||||
if tours
|
||||
# Have any automatic tours been completed already?
|
||||
completed = WalterHistory.where(
|
||||
creator_id: current_user.id,
|
||||
controller_name: controller_path,
|
||||
action_name: action_name
|
||||
)
|
||||
|
||||
tour_keys_completed = completed.map(&:tour_name)
|
||||
tour_keys = tours.keys
|
||||
|
||||
tour_html = ''
|
||||
|
||||
tour_keys.each do |key|
|
||||
tour_html += (render(partial: "application/shepherd",
|
||||
locals: { tour_name: key,
|
||||
tour_completed: tour_keys_completed.include?(key),
|
||||
trigger: tours[key]["trigger"],
|
||||
tour_delay: tours[key]['delay']||500,
|
||||
steps: tours[key]["steps"] }))
|
||||
end
|
||||
tour_html.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def walter_cookie_prefix
|
||||
"walter-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{controller_path}-#{action_name}"
|
||||
end
|
||||
|
||||
def fetch_application_name
|
||||
if Module.method_defined?(:module_parent)
|
||||
Rails.application.class.module_parent
|
||||
else
|
||||
Rails.application.class.parent
|
||||
end
|
||||
end
|
||||
|
||||
def walter_domain
|
||||
request.host
|
||||
end
|
||||
end
|
0
app/models/.keep
Normal file
0
app/models/.keep
Normal file
5
app/models/application_record.rb
Normal file
5
app/models/application_record.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
4
app/models/walter_history.rb
Normal file
4
app/models/walter_history.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WalterHistory < ActiveRecord::Base
|
||||
end
|
0
app/views/.keep
Normal file
0
app/views/.keep
Normal file
77
app/views/application/_shepherd.html.erb
Normal file
77
app/views/application/_shepherd.html.erb
Normal file
@ -0,0 +1,77 @@
|
||||
<script>
|
||||
Walter.tours["<%= tour_name %>"] = new Shepherd.Tour(<%= Rails.configuration.walter.tour_options.html_safe unless Rails.configuration.walter.tour_options.nil? %>);
|
||||
|
||||
<% if trigger != 'manual' %>
|
||||
Walter.tours["<%= tour_name %>"].on("complete", function() {
|
||||
// Make AJAX call to save history of tour completion
|
||||
return fetch("/walter_histories/", {
|
||||
method: "POST",
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
authenticity_token: '<%= form_authenticity_token %>',
|
||||
controller_name: '<%= controller_path %>',
|
||||
action_name: '<%= action_name %>',
|
||||
tour_name: '<%= tour_name %>'
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Walter.tours["<%= tour_name %>"].on("cancel", function() {
|
||||
Cookies.set('<%= walter_cookie_prefix %>-<%= tour_name %>', 'later', { domain: '<%= walter_domain %>' });
|
||||
});
|
||||
<% end %>
|
||||
|
||||
<% steps.each_with_index do |(key, step), index| %>
|
||||
Walter.tours["<%= tour_name %>"].addStep({
|
||||
id: 'step-<%= key %>',
|
||||
<% if step.key?('title') %>
|
||||
title: "<%== step['title'] %>",
|
||||
<% end %>
|
||||
text: "<%== step['text'] %>",
|
||||
<% if step.key?('attachTo') %>
|
||||
attachTo: { element: "<%= step['attachTo']['element'] %>", on: "<%= step['attachTo']['placement'] %>" },
|
||||
showOn: function() {
|
||||
// Only display this step if its selector is present
|
||||
return document.querySelector("<%= step['attachTo']['element'] %>") ? true : false
|
||||
},
|
||||
<% end %>
|
||||
buttons: [
|
||||
<% if index == steps.size - 1 %>
|
||||
<% if steps.size > 1 %>
|
||||
{ text: '<%= t('walter.back') %>', action: Walter.tours["<%= tour_name %>"].back, classes: 'shepherd-button-secondary' },
|
||||
<% end %>
|
||||
{ text: '<%= t('walter.done') %>', action: Walter.tours["<%= tour_name %>"].complete },
|
||||
<% else %>
|
||||
<% if index == 0 %>
|
||||
{ text: '<%= t('walter.later') %>', action: Walter.tours["<%= tour_name %>"].cancel, classes: 'shepherd-button-secondary' },
|
||||
<% else %>
|
||||
{ text: '<%= t('walter.back') %>', action: Walter.tours["<%= tour_name %>"].back, classes: 'shepherd-button-secondary' },
|
||||
<% end %>
|
||||
{ text: '<%= t('walter.continue') %>', action: Walter.tours["<%= tour_name %>"].next },
|
||||
<% end %>
|
||||
]
|
||||
});
|
||||
<% end %>
|
||||
|
||||
<% if trigger != "manual" %>
|
||||
Walter.tours["<%= tour_name %>"].checkAndStart = function (start) {
|
||||
return function () {
|
||||
// Don't start the tour if the user dismissed it once this session
|
||||
var tourMayStart = !Cookies.get('<%= walter_cookie_prefix %>-<%= tour_name %>', {domain: '<%= walter_domain %>'});
|
||||
<% if steps.first[1]['attachTo'] %>
|
||||
// Don't start the tour if the first step's element is missing
|
||||
tourMayStart = tourMayStart && document.querySelector("<%= steps.first[1]['attachTo']['element'] %>");
|
||||
<% end %>
|
||||
|
||||
if (tourMayStart) {
|
||||
setTimeout(function(){start();}, <%= tour_delay %>); // need to delay this
|
||||
}
|
||||
}
|
||||
}(Walter.tours["<%= tour_name %>"].start)
|
||||
|
||||
<% if !tour_completed %>
|
||||
Walter.incompleteTours.push("<%= tour_name %>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</script>
|
15
bin/rails
Executable file
15
bin/rails
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This command will automatically be run when you run "rails" with Rails gems
|
||||
# installed from the root of your application.
|
||||
|
||||
ENGINE_ROOT = File.expand_path("..", __dir__)
|
||||
ENGINE_PATH = File.expand_path("../lib/walter/engine", __dir__)
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
||||
|
||||
require "rails/all"
|
||||
require "rails/engine/commands"
|
8
config/locales/en.yml
Normal file
8
config/locales/en.yml
Normal file
@ -0,0 +1,8 @@
|
||||
en:
|
||||
walter:
|
||||
later: "Later"
|
||||
continue: "Continue"
|
||||
exit: "Exit"
|
||||
done: "Done"
|
||||
next: "Next"
|
||||
back: "Back"
|
7
config/locales/es.yml
Normal file
7
config/locales/es.yml
Normal file
@ -0,0 +1,7 @@
|
||||
es:
|
||||
walter:
|
||||
later: "Luego"
|
||||
continue: "Continuar"
|
||||
exit: "Dejar"
|
||||
done: "Hecho"
|
||||
next: "Siguiente"
|
7
config/locales/fr.yml
Normal file
7
config/locales/fr.yml
Normal file
@ -0,0 +1,7 @@
|
||||
fr:
|
||||
walter:
|
||||
later: "Plus tard"
|
||||
continue: "Continuer"
|
||||
exit: "Quitter"
|
||||
done: "OK"
|
||||
next: "Suivant"
|
5
config/routes.rb
Normal file
5
config/routes.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.routes.draw do
|
||||
resources :walter_histories, only: :create
|
||||
end
|
37
lib/generators/walter/install_generator.rb
Normal file
37
lib/generators/walter/install_generator.rb
Normal file
@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails/generators"
|
||||
require "rails/generators/active_record"
|
||||
|
||||
module Walter
|
||||
module Generators
|
||||
class InstallGenerator < ActiveRecord::Generators::Base
|
||||
argument :name, type: :string, default: "random_name"
|
||||
|
||||
class_option :'skip-migration', type: :boolean, desc: "Don't generate a migration for the histories table"
|
||||
class_option :'skip-initializer', type: :boolean, desc: "Don't generate an initializer"
|
||||
class_option :'skip-config', type: :boolean, desc: "Don't generate a config file"
|
||||
|
||||
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
||||
|
||||
# Copies the migration template to db/migrate.
|
||||
def copy_files
|
||||
return if options["skip-migration"]
|
||||
|
||||
migration_template "migration.rb", "db/migrate/create_walter_histories.rb"
|
||||
end
|
||||
|
||||
def create_initializer
|
||||
return if options["skip-initializer"]
|
||||
|
||||
copy_file "initializer.rb", "config/initializers/walter.rb"
|
||||
end
|
||||
|
||||
def create_config
|
||||
return if options["skip-config"]
|
||||
|
||||
copy_file "walter.yml", "config/walter.yml"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
10
lib/generators/walter/templates/initializer.rb
Normal file
10
lib/generators/walter/templates/initializer.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
tours_path ="app/tours"
|
||||
walter_config = Rails.application.config_for :walter
|
||||
config.walter = ActiveSupport::OrderedOptions.new
|
||||
config.walter.tour_options = walter_config[:tour_options]
|
||||
config.walter.tours_path = tours_path
|
||||
Walter::Tourguide.load_tours(tours_path)
|
||||
end
|
14
lib/generators/walter/templates/migration.rb
Normal file
14
lib/generators/walter/templates/migration.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateWalterHistories < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :walter_histories do |t|
|
||||
t.string :controller_name
|
||||
t.string :action_name
|
||||
t.string :tour_name
|
||||
t.string :creator_id, null: false, index: true
|
||||
|
||||
t.timestamps index: true
|
||||
end
|
||||
end
|
||||
end
|
14
lib/generators/walter/templates/walter.yml
Normal file
14
lib/generators/walter/templates/walter.yml
Normal file
@ -0,0 +1,14 @@
|
||||
defaults: &defaults
|
||||
# Add any valid Shepherd.js configuration JSON here
|
||||
# and it will be passed into the `new Shepherd.Tour()`
|
||||
# initializer.
|
||||
:tour_options: '{ defaultStepOptions: { classes: "theme-default" } }'
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
|
||||
production:
|
||||
<<: *defaults
|
5
lib/tasks/abraham_tasks.rake
Normal file
5
lib/tasks/abraham_tasks.rake
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
# desc "Explaining what the task does"
|
||||
# task :walter do
|
||||
# # Task goes here
|
||||
# end
|
15
lib/walter.rb
Normal file
15
lib/walter.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "walter/engine"
|
||||
|
||||
module Walter
|
||||
require 'walter/tourguide'
|
||||
|
||||
def self.load_tours(tp=nil)
|
||||
Walter::Tourguide.instance.load_tours(tp)
|
||||
end
|
||||
|
||||
def self.tours
|
||||
Walter::Tourguide.instance.tours
|
||||
end
|
||||
end
|
8
lib/walter/engine.rb
Normal file
8
lib/walter/engine.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rubygems"
|
||||
|
||||
module Walter
|
||||
class Engine < ::Rails::Engine
|
||||
end
|
||||
end
|
39
lib/walter/tourguide.rb
Normal file
39
lib/walter/tourguide.rb
Normal file
@ -0,0 +1,39 @@
|
||||
module Walter
|
||||
class Tourguide
|
||||
include Singleton
|
||||
@tours = {}
|
||||
attr_accessor :reload
|
||||
|
||||
def initialize
|
||||
super
|
||||
@reload = true
|
||||
end
|
||||
|
||||
def tours
|
||||
load_tours
|
||||
@tours
|
||||
end
|
||||
|
||||
def load_tours(tours_path=nil)
|
||||
return unless @reload
|
||||
|
||||
@tours = {}
|
||||
tours_path ||= Rails.application.config.walter.tours_path
|
||||
tours_root = Pathname.new(Rails.root.join(tours_path))
|
||||
if Rails.root.join(tours_path).exist?
|
||||
Dir.glob(Rails.root.join("#{tours_path}/**/*.yml")).each do |yml|
|
||||
relative_filename = Pathname.new(yml).relative_path_from(tours_root)
|
||||
# `controller_path` is either "controller_name" or "module_name/controller_name"
|
||||
controller_path, filename = relative_filename.split
|
||||
file_parts = filename.to_s.split(".")
|
||||
action = file_parts[0]
|
||||
locale = file_parts[1]
|
||||
t = YAML.load_file(yml)
|
||||
@tours["#{controller_path}.#{action}.#{locale}"] = t
|
||||
end
|
||||
end
|
||||
puts "#{@tours.size} tours loaded"
|
||||
@reload = ENV['WALTER_RELOAD_TOURS'].present? || Rails.env.development?
|
||||
end
|
||||
end
|
||||
end
|
5
lib/walter/version.rb
Normal file
5
lib/walter/version.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Walter
|
||||
VERSION = "2.5"
|
||||
end
|
8
package.json
Normal file
8
package.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "walter",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"js-cookie": "^2.2.0",
|
||||
"shepherd.js": "^8.3.1"
|
||||
}
|
||||
}
|
9
test/abraham_test.rb
Normal file
9
test/abraham_test.rb
Normal file
@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "test_helper"
|
||||
|
||||
class Walter::Test < ActiveSupport::TestCase
|
||||
test "truth" do
|
||||
assert_kind_of Module, Walter
|
||||
end
|
||||
end
|
20
test/application_system_test_case.rb
Normal file
20
test/application_system_test_case.rb
Normal file
@ -0,0 +1,20 @@
|
||||
require "test_helper"
|
||||
require "webdrivers"
|
||||
|
||||
Capybara.server = :webrick
|
||||
|
||||
Capybara.register_driver(:headless_chrome) do |app|
|
||||
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
||||
chromeOptions: { args: %w[headless disable-gpu] }
|
||||
)
|
||||
|
||||
Capybara::Selenium::Driver.new(
|
||||
app,
|
||||
browser: :chrome,
|
||||
desired_capabilities: capabilities
|
||||
)
|
||||
end
|
||||
|
||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
|
||||
end
|
8
test/dummy/Rakefile
Normal file
8
test/dummy/Rakefile
Normal file
@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require_relative "config/application"
|
||||
|
||||
Rails.application.load_tasks
|
4
test/dummy/app/assets/config/manifest.js
Normal file
4
test/dummy/app/assets/config/manifest.js
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
//= link_tree ../images
|
||||
//= link_directory ../javascripts .js
|
||||
//= link_directory ../stylesheets .css
|
0
test/dummy/app/assets/images/.keep
Normal file
0
test/dummy/app/assets/images/.keep
Normal file
15
test/dummy/app/assets/javascripts/application.js
Normal file
15
test/dummy/app/assets/javascripts/application.js
Normal file
@ -0,0 +1,15 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require turbolinks
|
||||
//= require walter
|
||||
//= require_tree .
|
13
test/dummy/app/assets/javascripts/cable.js
Normal file
13
test/dummy/app/assets/javascripts/cable.js
Normal file
@ -0,0 +1,13 @@
|
||||
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
||||
//
|
||||
//= require action_cable
|
||||
//= require_self
|
||||
//= require_tree ./channels
|
||||
|
||||
(function() {
|
||||
this.App || (this.App = {});
|
||||
|
||||
App.cable = ActionCable.createConsumer();
|
||||
|
||||
}).call(this);
|
0
test/dummy/app/assets/javascripts/channels/.keep
Normal file
0
test/dummy/app/assets/javascripts/channels/.keep
Normal file
2
test/dummy/app/assets/javascripts/dashboard.js
Normal file
2
test/dummy/app/assets/javascripts/dashboard.js
Normal file
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
15
test/dummy/app/assets/stylesheets/application.scss
Normal file
15
test/dummy/app/assets/stylesheets/application.scss
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require walter/theme-default
|
||||
*= require_tree .
|
||||
*/
|
6
test/dummy/app/channels/application_cable/channel.rb
Normal file
6
test/dummy/app/channels/application_cable/channel.rb
Normal file
@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
end
|
6
test/dummy/app/channels/application_cable/connection.rb
Normal file
6
test/dummy/app/channels/application_cable/connection.rb
Normal file
@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
end
|
||||
end
|
10
test/dummy/app/controllers/application_controller.rb
Normal file
10
test/dummy/app/controllers/application_controller.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery with: :exception
|
||||
helper_method :current_user
|
||||
|
||||
def current_user
|
||||
OpenStruct.new(id: Random.rand(1..99_999))
|
||||
end
|
||||
end
|
0
test/dummy/app/controllers/concerns/.keep
Normal file
0
test/dummy/app/controllers/concerns/.keep
Normal file
8
test/dummy/app/controllers/dashboard_controller.rb
Normal file
8
test/dummy/app/controllers/dashboard_controller.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DashboardController < ApplicationController
|
||||
def home; end
|
||||
def other; end
|
||||
def placement; end
|
||||
def missing; end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Foobar::DashboardController < ApplicationController
|
||||
def home; end
|
||||
end
|
4
test/dummy/app/helpers/application_helper.rb
Normal file
4
test/dummy/app/helpers/application_helper.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationHelper
|
||||
end
|
4
test/dummy/app/helpers/dashboard_helper.rb
Normal file
4
test/dummy/app/helpers/dashboard_helper.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module DashboardHelper
|
||||
end
|
4
test/dummy/app/jobs/application_job.rb
Normal file
4
test/dummy/app/jobs/application_job.rb
Normal file
@ -0,0 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
end
|
6
test/dummy/app/mailers/application_mailer.rb
Normal file
6
test/dummy/app/mailers/application_mailer.rb
Normal file
@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: "from@example.com"
|
||||
layout "mailer"
|
||||
end
|
5
test/dummy/app/models/application_record.rb
Normal file
5
test/dummy/app/models/application_record.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
0
test/dummy/app/models/concerns/.keep
Normal file
0
test/dummy/app/models/concerns/.keep
Normal file
26
test/dummy/app/views/dashboard/home.html.erb
Normal file
26
test/dummy/app/views/dashboard/home.html.erb
Normal file
@ -0,0 +1,26 @@
|
||||
<h1>Dashboard#home</h1>
|
||||
<p>Find me in app/views/dashboard/home.html.erb</p>
|
||||
|
||||
<%= link_to "Other Page", dashboard_other_url %>
|
||||
|
||||
<div class="notice-me" style="width:300px;height:300px;background-color:whitesmoke;">
|
||||
a content element to notice
|
||||
</div>
|
||||
|
||||
<button id="restart_automatic">Restart the automatic tour</button>
|
||||
<button id="show_manual">Show manual tour</button>
|
||||
<button id="show_another_manual">Show ANOTHER manual tour</button>
|
||||
|
||||
<script>
|
||||
document.querySelector("#restart_automatic").addEventListener("click", function() {
|
||||
Walter.startTour("intro");
|
||||
});
|
||||
|
||||
document.querySelector("#show_manual").addEventListener("click", function() {
|
||||
Walter.startTour("a_manual_tour");
|
||||
});
|
||||
|
||||
document.querySelector("#show_another_manual").addEventListener("click", function() {
|
||||
Walter.startTour("another_manual_tour");
|
||||
});
|
||||
</script>
|
5
test/dummy/app/views/dashboard/missing.html.erb
Normal file
5
test/dummy/app/views/dashboard/missing.html.erb
Normal file
@ -0,0 +1,5 @@
|
||||
<h1>missing</h1>
|
||||
|
||||
This page does not have the first step attachTo element,
|
||||
so we would expect the tour not to start,
|
||||
even though the second step could be rendered.
|
4
test/dummy/app/views/dashboard/other.html.erb
Normal file
4
test/dummy/app/views/dashboard/other.html.erb
Normal file
@ -0,0 +1,4 @@
|
||||
<h1>Dashboard#other</h1>
|
||||
<p>Find me in app/views/dashboard/other.html.erb</p>
|
||||
|
||||
<%= link_to "Home Page", dashboard_home_url %>
|
22
test/dummy/app/views/dashboard/placement.html.erb
Normal file
22
test/dummy/app/views/dashboard/placement.html.erb
Normal file
@ -0,0 +1,22 @@
|
||||
<h1>Dashboard#placement</h1>
|
||||
<p>Find me in app/views/dashboard/placement.html.erb</p>
|
||||
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae leo sagittis, sodales ante tincidunt, tincidunt tellus. Integer rutrum id quam maximus pellentesque. Morbi non justo ac dui mollis commodo nec sit amet neque. Sed et nunc quis nibh sagittis facilisis. Vivamus pharetra mauris in leo pulvinar, hendrerit pharetra eros mattis. Praesent eleifend convallis purus in facilisis. Donec molestie turpis sed ligula hendrerit malesuada. Curabitur porttitor eros ex, mattis malesuada ligula ullamcorper a. Donec accumsan at turpis ac tristique. Fusce finibus metus at lacinia sollicitudin. In efficitur mauris ante, nec lacinia nunc fermentum sit amet.</p>
|
||||
|
||||
<p>Cras a ullamcorper nisl, sed vulputate nisi. In hac habitasse platea dictumst. Sed pulvinar diam ultricies leo accumsan efficitur. Nullam pharetra velit risus, in vestibulum tortor finibus eget. Phasellus varius, ante sed maximus placerat, lectus nisl tempus ligula, sed tincidunt nulla odio ut augue. Phasellus dignissim, lacus non faucibus cursus, purus quam euismod mi, eu porta mi dui quis diam. Pellentesque in vulputate sem, a suscipit nunc. Etiam non elementum felis. Suspendisse rutrum, odio finibus rutrum ornare, orci quam consectetur massa, id bibendum lorem sem ut nulla. Nunc euismod varius ipsum quis commodo. Maecenas massa arcu, gravida a odio sed, tristique placerat nisl. In eget ligula tempor, iaculis felis at, ultricies augue. Praesent ac tellus sed risus dignissim ornare a at erat. Donec id finibus tortor, eget semper ante. Cras sed erat ultricies, pellentesque arcu vel, egestas ex.</p>
|
||||
|
||||
<p>Proin viverra arcu ut purus maximus gravida. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras rhoncus leo sit amet lacus gravida, vitae viverra nunc aliquam. Suspendisse porttitor neque ac libero mollis, ac fermentum enim iaculis. Suspendisse malesuada, diam eget elementum maximus, ex dolor dapibus diam, sed scelerisque urna nisi luctus odio. Sed sed porttitor elit, et gravida sapien. Ut mattis vehicula iaculis. Sed pretium lorem id erat gravida dapibus. Etiam vitae faucibus arcu, ac fermentum lorem.</p>
|
||||
|
||||
<div class="notice-me" style="width: 300px; height: 300px; margin-left: 400px; background-color: whitesmoke;">
|
||||
a content with room for placement all around
|
||||
</div>
|
||||
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae leo sagittis, sodales ante tincidunt, tincidunt tellus. Integer rutrum id quam maximus pellentesque. Morbi non justo ac dui mollis commodo nec sit amet neque. Sed et nunc quis nibh sagittis facilisis. Vivamus pharetra mauris in leo pulvinar, hendrerit pharetra eros mattis. Praesent eleifend convallis purus in facilisis. Donec molestie turpis sed ligula hendrerit malesuada. Curabitur porttitor eros ex, mattis malesuada ligula ullamcorper a. Donec accumsan at turpis ac tristique. Fusce finibus metus at lacinia sollicitudin. In efficitur mauris ante, nec lacinia nunc fermentum sit amet.</p>
|
||||
|
||||
<p>Cras a ullamcorper nisl, sed vulputate nisi. In hac habitasse platea dictumst. Sed pulvinar diam ultricies leo accumsan efficitur. Nullam pharetra velit risus, in vestibulum tortor finibus eget. Phasellus varius, ante sed maximus placerat, lectus nisl tempus ligula, sed tincidunt nulla odio ut augue. Phasellus dignissim, lacus non faucibus cursus, purus quam euismod mi, eu porta mi dui quis diam. Pellentesque in vulputate sem, a suscipit nunc. Etiam non elementum felis. Suspendisse rutrum, odio finibus rutrum ornare, orci quam consectetur massa, id bibendum lorem sem ut nulla. Nunc euismod varius ipsum quis commodo. Maecenas massa arcu, gravida a odio sed, tristique placerat nisl. In eget ligula tempor, iaculis felis at, ultricies augue. Praesent ac tellus sed risus dignissim ornare a at erat. Donec id finibus tortor, eget semper ante. Cras sed erat ultricies, pellentesque arcu vel, egestas ex.</p>
|
||||
|
||||
<p>Proin viverra arcu ut purus maximus gravida. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras rhoncus leo sit amet lacus gravida, vitae viverra nunc aliquam. Suspendisse porttitor neque ac libero mollis, ac fermentum enim iaculis. Suspendisse malesuada, diam eget elementum maximus, ex dolor dapibus diam, sed scelerisque urna nisi luctus odio. Sed sed porttitor elit, et gravida sapien. Ut mattis vehicula iaculis. Sed pretium lorem id erat gravida dapibus. Etiam vitae faucibus arcu, ac fermentum lorem.</p>
|
||||
|
||||
<p>Sed mollis lectus a tellus interdum efficitur. Maecenas et mauris neque. Aliquam erat volutpat. Cras vehicula mollis varius. Aenean quis pretium libero, sit amet sodales urna. Maecenas a elementum neque. Maecenas quis pharetra ex. Maecenas at lorem odio. Etiam malesuada non justo non porta. Donec massa lectus, suscipit non leo nec, vulputate tincidunt turpis. Integer ullamcorper, diam id pharetra tempor, erat arcu semper ex, eu rhoncus libero mauris sed ipsum. Duis bibendum dui ipsum, at fringilla sapien gravida eget. Nam finibus blandit dui.</p>
|
||||
|
||||
<p>Integer accumsan enim eget leo placerat, at imperdiet libero porta. Nam in cursus sapien. Maecenas nunc enim, posuere a nulla bibendum, convallis aliquet odio. Curabitur a magna dolor. Vestibulum sed eros quis nisl aliquet condimentum. Phasellus ut odio a enim molestie gravida. Praesent sagittis mi sit amet lacus varius, vitae fermentum lorem iaculis. Ut fringilla turpis nec est fringilla finibus. Nullam accumsan tortor non massa tincidunt egestas. Nunc ac eros dignissim, mattis dui sed, mattis enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec purus dolor, consectetur in dui vitae, aliquet aliquam orci. Nulla iaculis lorem et sem gravida, in sollicitudin elit dictum. Vestibulum consectetur sapien sed vestibulum venenatis. Cras id libero vel risus ullamcorper cursus in sit amet erat. </p>
|
4
test/dummy/app/views/foobar/dashboard/home.html.erb
Normal file
4
test/dummy/app/views/foobar/dashboard/home.html.erb
Normal file
@ -0,0 +1,4 @@
|
||||
<h1>Foobar::Dashboard#home</h1>
|
||||
<p>Find me in app/views/foobar/dashboard/home.html.erb</p>
|
||||
|
||||
We should get a unique tour for this module, not the same one as Dashboard#home
|
20
test/dummy/app/views/layouts/application.html.erb
Normal file
20
test/dummy/app/views/layouts/application.html.erb
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Dummy</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
|
||||
<hr>
|
||||
|
||||
<p><em>current_user.id = <%= current_user.id %></em></p>
|
||||
|
||||
<%= walter_tour %>
|
||||
</body>
|
||||
</html>
|
13
test/dummy/app/views/layouts/mailer.html.erb
Normal file
13
test/dummy/app/views/layouts/mailer.html.erb
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
/* Email styles need to be inline */
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
1
test/dummy/app/views/layouts/mailer.text.erb
Normal file
1
test/dummy/app/views/layouts/mailer.text.erb
Normal file
@ -0,0 +1 @@
|
||||
<%= yield %>
|
5
test/dummy/bin/bundle
Executable file
5
test/dummy/bin/bundle
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
load Gem.bin_path("bundler", "bundle")
|
6
test/dummy/bin/rails
Executable file
6
test/dummy/bin/rails
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||
require_relative "../config/boot"
|
||||
require "rails/commands"
|
6
test/dummy/bin/rake
Executable file
6
test/dummy/bin/rake
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative "../config/boot"
|
||||
require "rake"
|
||||
Rake.application.run
|
36
test/dummy/bin/setup
Executable file
36
test/dummy/bin/setup
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "pathname"
|
||||
require "fileutils"
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path("..", __dir__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a starting point to setup your application.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system! "gem install bundler --conservative"
|
||||
system("bundle check") || system!("bundle install")
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! "bin/rails db:setup"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! "bin/rails log:clear tmp:clear"
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! "bin/rails restart"
|
||||
end
|
31
test/dummy/bin/update
Executable file
31
test/dummy/bin/update
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "pathname"
|
||||
require "fileutils"
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = Pathname.new File.expand_path("..", __dir__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
chdir APP_ROOT do
|
||||
# This script is a way to update your development environment automatically.
|
||||
# Add necessary update steps to this file.
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system! "gem install bundler --conservative"
|
||||
system("bundle check") || system!("bundle install")
|
||||
|
||||
puts "\n== Updating database =="
|
||||
system! "bin/rails db:migrate"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! "bin/rails log:clear tmp:clear"
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! "bin/rails restart"
|
||||
end
|
7
test/dummy/config.ru
Normal file
7
test/dummy/config.ru
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require_relative "config/environment"
|
||||
|
||||
run Rails.application
|
11
test/dummy/config/abraham.yml
Normal file
11
test/dummy/config/abraham.yml
Normal file
@ -0,0 +1,11 @@
|
||||
defaults: &defaults
|
||||
:tour_options: '{ defaultStepOptions: { classes: "theme-default" } }'
|
||||
|
||||
development:
|
||||
<<: *defaults
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
|
||||
production:
|
||||
<<: *defaults
|
21
test/dummy/config/application.rb
Normal file
21
test/dummy/config/application.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative "boot"
|
||||
|
||||
require "rails/all"
|
||||
|
||||
Bundler.require(*Rails.groups)
|
||||
require "walter"
|
||||
|
||||
module Dummy
|
||||
class Application < Rails::Application
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# For Rails 5.2 - 6.0, we need to set this configuration
|
||||
if (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1) || (Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR < 1)
|
||||
config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||
end
|
||||
end
|
||||
end
|
7
test/dummy/config/boot.rb
Normal file
7
test/dummy/config/boot.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
||||
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|
10
test/dummy/config/cable.yml
Normal file
10
test/dummy/config/cable.yml
Normal file
@ -0,0 +1,10 @@
|
||||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
channel_prefix: dummy_production
|
25
test/dummy/config/database.yml
Normal file
25
test/dummy/config/database.yml
Normal file
@ -0,0 +1,25 @@
|
||||
# SQLite version 3.x
|
||||
# gem install sqlite3
|
||||
#
|
||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||
# gem 'sqlite3'
|
||||
#
|
||||
default: &default
|
||||
adapter: sqlite3
|
||||
pool: 5
|
||||
timeout: 5000
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: db/development.sqlite3
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: db/test.sqlite3
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
database: db/production.sqlite3
|
7
test/dummy/config/environment.rb
Normal file
7
test/dummy/config/environment.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Load the Rails application.
|
||||
require_relative "application"
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
56
test/dummy/config/environments/development.rb
Normal file
56
test/dummy/config/environments/development.rb
Normal file
@ -0,0 +1,56 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Do not eager load code on boot.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
if Rails.root.join("tmp/caching-dev.txt").exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=172800"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Debug mode disables concatenation and preprocessing of assets.
|
||||
# This option may cause significant delays in view rendering with a large
|
||||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
# Suppress logger output for asset requests.
|
||||
config.assets.quiet = true
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
end
|
88
test/dummy/config/environments/production.rb
Normal file
88
test/dummy/config/environments/production.rb
Normal file
@ -0,0 +1,88 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [:request_id]
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment)
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
logger = ActiveSupport::Logger.new(STDOUT)
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
end
|
44
test/dummy/config/environments/test.rb
Normal file
44
test/dummy/config/environments/test.rb
Normal file
@ -0,0 +1,44 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
config.cache_classes = true
|
||||
|
||||
# Do not eager load code on boot. This avoids loading your whole application
|
||||
# just for the purpose of running a single test. If you are using a tool that
|
||||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=3600"
|
||||
}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
24
test/dummy/config/initializers/abraham.rb
Normal file
24
test/dummy/config/initializers/abraham.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.configure do
|
||||
tours = {}
|
||||
tours_root = Pathname.new(Rails.root.join("config/tours"))
|
||||
|
||||
if Rails.root.join("config/tours").exist?
|
||||
Dir.glob(Rails.root.join("config/tours/**/*.yml")).each do |yml|
|
||||
relative_filename = Pathname.new(yml).relative_path_from(tours_root)
|
||||
# `controller_path` is either "controller_name" or "module_name/controller_name"
|
||||
controller_path, filename = relative_filename.split
|
||||
file_parts = filename.to_s.split(".")
|
||||
action = file_parts[0]
|
||||
locale = file_parts[1]
|
||||
t = YAML.load_file(yml)
|
||||
tours["#{controller_path}.#{action}.#{locale}"] = t
|
||||
end
|
||||
end
|
||||
|
||||
walter_config = Rails.application.config_for :walter
|
||||
config.walter = ActiveSupport::OrderedOptions.new
|
||||
config.walter.tour_options = walter_config[:tour_options]
|
||||
config.walter.tours = tours
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
16
test/dummy/config/initializers/assets.rb
Normal file
16
test/dummy/config/initializers/assets.rb
Normal file
@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = "1.0"
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
|
||||
# Add Yarn node_modules folder to the asset load path.
|
||||
Rails.application.config.assets.paths << Rails.root.join('../../node_modules')
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
# Rails.application.config.assets.precompile += %w( search.js )
|
8
test/dummy/config/initializers/backtrace_silencers.rb
Normal file
8
test/dummy/config/initializers/backtrace_silencers.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
7
test/dummy/config/initializers/cookies_serializer.rb
Normal file
7
test/dummy/config/initializers/cookies_serializer.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :marshal
|
@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
Rails.application.config.filter_parameters += [:password]
|
17
test/dummy/config/initializers/inflections.rb
Normal file
17
test/dummy/config/initializers/inflections.rb
Normal file
@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
# are locale specific, and you may define rules for as many different
|
||||
# locales as you wish. All of these examples are active by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
5
test/dummy/config/initializers/mime_types.rb
Normal file
5
test/dummy/config/initializers/mime_types.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
23
test/dummy/config/initializers/new_framework_defaults.rb
Normal file
23
test/dummy/config/initializers/new_framework_defaults.rb
Normal file
@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file contains migration options to ease your Rails 5.0 upgrade.
|
||||
#
|
||||
# Read the Rails 5.0 release notes for more info on each option.
|
||||
|
||||
# Enable per-form CSRF tokens. Previous versions had false.
|
||||
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
||||
|
||||
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
||||
Rails.application.config.action_controller.forgery_protection_origin_check = true
|
||||
|
||||
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
||||
# Previous versions had false.
|
||||
ActiveSupport.to_time_preserves_timezone = true
|
||||
|
||||
# Require `belongs_to` associations by default. Previous versions had false.
|
||||
Rails.application.config.active_record.belongs_to_required_by_default = true
|
||||
|
||||
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
||||
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
5
test/dummy/config/initializers/session_store.rb
Normal file
5
test/dummy/config/initializers/session_store.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.session_store :cookie_store, key: "_dummy_session"
|
16
test/dummy/config/initializers/wrap_parameters.rb
Normal file
16
test/dummy/config/initializers/wrap_parameters.rb
Normal file
@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# end
|
33
test/dummy/config/locales/en.yml
Normal file
33
test/dummy/config/locales/en.yml
Normal file
@ -0,0 +1,33 @@
|
||||
# Files in the config/locales directory are used for internationalization
|
||||
# and are automatically loaded by Rails. If you want to use locales other
|
||||
# than English, add the necessary files in this directory.
|
||||
#
|
||||
# To use the locales, use `I18n.t`:
|
||||
#
|
||||
# I18n.t 'hello'
|
||||
#
|
||||
# In views, this is aliased to just `t`:
|
||||
#
|
||||
# <%= t('hello') %>
|
||||
#
|
||||
# To use a different locale, set it with `I18n.locale`:
|
||||
#
|
||||
# I18n.locale = :es
|
||||
#
|
||||
# This would use the information in config/locales/es.yml.
|
||||
#
|
||||
# The following keys must be escaped otherwise they will not be retrieved by
|
||||
# the default I18n backend:
|
||||
#
|
||||
# true, false, on, off, yes, no
|
||||
#
|
||||
# Instead, surround them with single quotes.
|
||||
#
|
||||
# en:
|
||||
# 'true': 'foo'
|
||||
#
|
||||
# To learn more, please read the Rails Internationalization guide
|
||||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
49
test/dummy/config/puma.rb
Normal file
49
test/dummy/config/puma.rb
Normal file
@ -0,0 +1,49 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum, this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT") { 3000 }
|
||||
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked webserver processes. If using threads and workers together
|
||||
# the concurrency of the application would be max `threads` * `workers`.
|
||||
# Workers do not work on JRuby or Windows (both of which do not support
|
||||
# processes).
|
||||
#
|
||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
# process behavior so workers use less memory. If you use this option
|
||||
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
||||
# block.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted this block will be run, if you are using `preload_app!`
|
||||
# option you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
14
test/dummy/config/routes.rb
Normal file
14
test/dummy/config/routes.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.routes.draw do
|
||||
get "dashboard/home"
|
||||
get "dashboard/other"
|
||||
get "dashboard/placement"
|
||||
get "dashboard/missing"
|
||||
|
||||
namespace :foobar do
|
||||
get "dashboard/home"
|
||||
end
|
||||
|
||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||
end
|
22
test/dummy/config/secrets.yml
Normal file
22
test/dummy/config/secrets.yml
Normal file
@ -0,0 +1,22 @@
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
# You can use `rails secret` to generate a secure secret key.
|
||||
|
||||
# Make sure the secrets in this file are kept private
|
||||
# if you're sharing your code publicly.
|
||||
|
||||
development:
|
||||
secret_key_base: a830d3039252eba2629e9e5aa1a598d1dabe6ed9f31072063abca5b7db2d99f073d86e773fa6a7eed256c33945a1451881d0e85b1efb56c1fdf957d1c8fb0a10
|
||||
|
||||
test:
|
||||
secret_key_base: f40f5e4311e123e88dc1d6aa3b6c19531a7c6eb1b1087f45ab0cefbec2fa5373ba8a75091efdbe98fcd0cbf85637b5dcdb6cf94c75070a848c925392d59c8b20
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user