3.9.5 • Published 7 months ago

@bigbinary/neeto-form-frontend v3.9.5

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
7 months ago

neeto-form-nano

The neeto-form-nano allows us to build forms within neeto applications. This nano exports @bigbinary/neeto-form-frontend NPM package and neeto-form-engine Rails engine.

Contents

  1. Development with Host Application
  2. Instructions for Publishing

Development with Host Application

Engine

The engine adds setup for form on backend and allows us to attach forms to any model. It also stores submissions.

Installation

  1. Add this line to your application's Gemfile:

    source "NEETO_GEM_SERVER_URL" do
      # ...existing gems
    
      gem 'neeto-form-engine'
    end
  2. And then execute:

    bundle install
  3. Install the migrations

    bundle exec rails neeto_form_engine:install:migrations
  4. Run the migrations

    bundle exec rails db:migrate
  5. Add this line to your application's config/routes.rb file (replace at to your desired route):

    mount NeetoFormEngine::Engine, at: "/neeto_form_engine"
  6. Create file neeto_form_engine.rb under config/initializers to provide the owner_class information

    NeetoFormEngine.owner_class = "Organization"
  7. Configure models to add below association to the provided owner class

    has_many :forms, class_name: "::NeetoFormEngine::Form", as: :owner
  8. Configure models to add below association to scope submission records (optional)

    has_one :submission, class_name: "::NeetoFormEngine::Submission", as: :record
  9. Configure model to add below association to attach form (optional)

    has_one :form, class_name: "::NeetoFormEngine::Form", as: :attachable

Customizability

NeetoFormEngine::Customizable::Forms::Createable

The engine supports customizing the default behavior of Forms::CreateService by overriding the supported methods in this concern.

Available methods:

  1. create_default_questions!: If you want to use custom logic to create default questions, you can specify them using this method. owner, form and params will be available globally.
  2. additional_form_params: If you want to include additional attributes while creating forms, you can specify them using this method. It takes one argument params which will be the form parameters passed from the front-end.

    NeetoFormEngine::Customizable::Questions::Createable

    The engine supports customizing the default behavior of Questions::CreateService by overriding the supported methods in this concern.

    Available methods:

  3. create_question!: This method receives one argument params that contains the question parameters passed from the front-end.

  4. additional_question_params: If you want to include additional attributes while creating questions, you can specify them using this method. It takes one argument params which will be the question parameters passed from the front-end.

    NeetoFormEngine::Customizable::Questions::Updateable

    The engine supports customizing the default behavior of Questions::UpdateService by overriding the supported constants in this concern.

    Available constants:

  5. EXCLUDED_UPDATE_PARAMS: If you have included extra parameters other than kind for additional use cases that are not valid entity attributes, they need to be specified as EXCLUDED_UPDATE_PARAMS.

    NeetoFormEngine::Customizable::QuestionResponses::Createable

    The engine supports customizing the default behavior of QuestionResponses::CreateService by overriding the supported methods in this concern.

    Available methods:

  6. additional_initialization_logic: If you want to initialize additional variables, you can specify them using this method.

  7. additional_process_actions: If you want to perform any additional actions outside the transaction block, you can override this method.
  8. additional_create_submission_actions: You can use this method to specify any additional logic that needs to be executed after creating submissions.
  9. additional_create_response_actions: If you want to perform some additional actions on each of the responses, you can specify them using this method. This method receives question and response_param passed from the front-end as arguments.

    Set up Google reCAPTCHA

  10. Sign up for an API key pair from the official website.

  11. Configure the following environment variables and secrets with suitable values

    • Under .env file:

      FORM_NANO_RECAPTCHA_V2_SITE_KEY=# Value from Google cloud console
      FORM_NANO_RECAPTCHA_V2_SECRET_KEY=# Value from Google cloud console
    • Under secrets.yml file:

      form_nano:
        recaptcha_v2:
          site_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SITE_KEY"] %>
          secret_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SECRET_KEY"] %>
  12. Include the site key in global_props

    module ApplicationHelper
      def get_client_props
        # other variables
        custom_props = {
          # other props
          form_nano_recaptcha_v2_site_key: Rails.application.secrets.form_nano.dig(:recaptcha_v2, :site_key)
        }
      end
    end

Frontend package

The frontend package allows us to create forms across neeto products.

Installation

  1. Install the NPM package

    yarn add @bigbinary/neeto-form-frontend
  2. The frontend package has a few peer dependencies that are required for the proper functioning of the package. Install all the peer dependencies using the below command:

    yarn add @bigbinary/neetoui @bigbinary/neeto-icons ramda@^0.28.0 classnames@^2.3.1 formik@2.2.9 @bigbinary/neeto-commons-frontend react-google-recaptcha
  3. Import stylesheet from the following location:

    @import "@bigbinary/neeto-form-frontend/dist/main.css";

Instructions for development

Check the Frontend package development guide for step-by-step instructions to develop the frontend package.

Usage

You can learn more about the usage here: 1. Components 2. Hooks

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.

3.9.5

7 months ago

3.9.4

8 months ago

3.9.3

8 months ago

3.9.2

8 months ago

3.9.1

8 months ago

3.9.0

9 months ago

3.8.0

9 months ago

3.8.3

9 months ago

3.8.2

9 months ago

3.8.1

9 months ago

3.7.1

9 months ago

3.7.0

9 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.1

1 year ago

3.2.2

10 months ago

3.2.1

10 months ago

3.2.0

10 months ago

2.2.0-beta2

12 months ago

2.2.0-beta1

1 year ago

2.2.0-beta4

12 months ago

2.2.0-beta3

12 months ago

3.1.0

10 months ago

3.5.0

10 months ago

3.4.0

10 months ago

3.0.4

11 months ago

3.0.3

11 months ago

3.0.2

11 months ago

3.0.1

11 months ago

3.0.8

10 months ago

3.0.7

10 months ago

3.4.2

10 months ago

3.0.6

10 months ago

3.4.1

10 months ago

3.0.5

11 months ago

3.0.0

11 months ago

2.1.1

1 year ago

2.1.0

1 year ago

3.3.1

10 months ago

3.3.0

10 months ago

3.3.2

10 months ago

2.0.0

1 year ago

1.3.3

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.56

1 year ago

1.2.55

1 year ago

1.2.54

1 year ago

1.2.53

1 year ago

1.2.52

1 year ago

1.2.50

1 year ago

1.2.51

1 year ago

1.2.49

1 year ago

1.2.48

1 year ago

1.2.47

1 year ago

1.2.46

1 year ago

1.2.45

1 year ago

1.2.44

1 year ago

1.2.43

1 year ago

1.2.42

1 year ago

1.2.41

1 year ago

1.2.40

1 year ago

1.2.39

1 year ago

1.2.38

1 year ago

1.2.37

1 year ago

1.2.34

1 year ago

1.2.35

1 year ago

1.2.36

1 year ago

1.2.33

1 year ago

1.2.32

1 year ago

1.2.31

1 year ago

1.2.29

1 year ago

1.2.30

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.25

1 year ago

1.2.26

1 year ago

1.2.24

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.18

1 year ago

1.2.19

1 year ago

1.2.20

1 year ago

1.2.21

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.2.15

1 year ago

1.2.13

1 year ago

1.2.14

1 year ago

1.2.12

1 year ago

1.2.10

2 years ago

1.2.11

2 years ago

1.2.8

2 years ago

1.2.9

2 years ago

1.2.0

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.1.13

2 years ago

1.0.49

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.52

2 years ago

1.0.40

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.45

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.29

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.19

2 years ago

1.0.2

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago