Skip to content

stepanjakl/apostrophe-read-only-field

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read-Only Schema Field Type For ApostropheCMS


License


This module adds a schema field type designed solely for displaying relevant data in read-only mode, without allowing any editing capability.


This module is used primarily in Apostrophe Stripe packages such as stripe-checkout or stripe-products.


Installation

Use your preferred package manager to install the module:

npm install read-only-field@npm:@stepanjakl/apostrophe-read-only-field

Usage

First, add the installed module to your configuration in the app.js root file:

require('apostrophe')({
  shortName: 'project-name',
  modules: {
    'read-only-field': {}
  }
});

Then, easily add the field type to any module that accepts the fields property. The schema field object accepts optional parameters such as copyToClipboard, openInNewTab, and openInNewTabPrepend. See the example below:

module.exports = {
  extend: '@apostrophecms/piece-type',
  fields: {
    add: {
      name: {
        type: 'readOnly',
        label: 'Name',
        copyToClipboard: true,
        openInNewTab: true,
        openInNewTabPrepend: `${process.env.STRIPE_DASHBOARD_BASE_URL}${process.env.STRIPE_TEST_MODE === 'false' ? '' : '/test'}/prices/`
      }
    }
  }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published