New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

journea

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

journea

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Journea (Alpha)

Build Status Code Climate Test Coverage security Dependency Status Gem Version

Journea is a Ruby on Rails engine (tested on Rails 5 only) which you can use to define steps and the transitions between them. Each step (or page) is tracked in a state machine, Statesman.

Journea handles rendering the views you design and the transitions between them are defined in an initializer.

Installation

Add the gem to your gemfile.

Run the install generator and answer the questions

# Only use in new, fresh Rails projects
rails generate journea:install

Getting started

For each step you need to setup a state in the state machine

# config/initializers/journea.rb

Journea.configure_steps do
  step :import_or_export, initial: true
  step :company_type
  step :limited_company_details
  step :company_address
  step :finish

  transition from: :import_or_export,         to: :company_type
  transition from: :company_type,             to: [:limited_company_details, :company_address]
  transition from: :limited_company_details,  to: :company_address
  transition from: :company_address,          to: :finish

  guard_transition(to: :limited_company_details) do |journea|
    journea.data.is_limited_company?
  end

  after_transition(to: :finish) do |journea|
    Mailer.application_details(journea.data).deliver
  end
end

Each step can optionally have a step object, based on simple form object:

# app/steps/company_address_step.rb

class CompanyAddress < Journea::Step
  attribute :address_line1, :string
  attribute :address_line2, :string
  attribute :city, :string
  attribute :postcode, :string
  attribute :is_business_address, :boolean

  attribute :created_date, :datetime, default: Time.now

  validates :address_line1, :address_line2, presence: true
end

And each step needs a view


# app/views/layouts/application.html.haml

# Optional back link helper can be used anywhere

= render 'back_link'

# app/views/steps/company_address.html.haml

.grid-row
  .column-two-thirds
    = simple_form_for @form do |f|
      = render 'shared/error_messages'

      %h1.heading-large What is your company address?

      = f.input :address_line1
      = f.input :address_line2, hint: 'Optional'
      = f.input :city
      = f.input :postcode
      = f.input :is_business_address

      = f.button :submit, 'Continue'

You can access data stored against the journey object like so

  journey = Journea::Journey.find(1)
  puts journey.data.certifcate_type

  # or
  puts @journea.data.certifcate_type

Contributing to this project

If you have an idea you'd like to contribute please log an issue.

All contributions should be submitted via a pull request.

License

THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:

http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3

The following attribution statement MUST be cited in your products and applications when using this information.

Contains public sector information licensed under the Open Government license v3

About the license

The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.

It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.

FAQs

Package last updated on 22 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc