Buttons Module
Buttons Functions & Variables
The Buttons Module features the following functions:
$.fn.blockstrap.buttons.access
(button, e)$.fn.blockstrap.buttons.cancel
(button, mobile, menu, elements)$.fn.blockstrap.buttons.create_account
(button, e)$.fn.blockstrap.buttons.create_contact
(button, e)$.fn.blockstrap.buttons.create_credentials
(button, e)$.fn.blockstrap.buttons.edit
(button, e)$.fn.blockstrap.buttons.edit_object
(button, e)$.fn.blockstrap.buttons.import
(button, e)$.fn.blockstrap.buttons.login
(button, e)$.fn.blockstrap.buttons.logout
(button, e)$.fn.blockstrap.buttons.more_security
(button, e)$.fn.blockstrap.buttons.page
(button, e)$.fn.blockstrap.buttons.print
(button, e)$.fn.blockstrap.buttons.process
(slug, content, filtered_data, button, effect, direction, reverse_direxction, mobile, menu, elements)$.fn.blockstrap.buttons.refresh
(button, e)$.fn.blockstrap.buttons.remove
(button, e)$.fn.blockstrap.buttons.reset
(button, e)$.fn.blockstrap.buttons.send_money
(button, e)$.fn.blockstrap.buttons.set_credentials
(button, e)$.fn.blockstrap.buttons.setup
(button, e)$.fn.blockstrap.buttons.submit_import
(button, e)$.fn.blockstrap.buttons.submit_payment
(button, e)$.fn.blockstrap.buttons.submit_verification
(button, e)$.fn.blockstrap.buttons.toggle
(button, e)
buttons.access
(button, e) - back to top
This function opens a modal window containing a QR code with the address for the corresponding account_id
, and also provides a selection of actions that can then be performed on the account.
buttons.cancel
(button, mobile, menu, elements) - back to top
This function is used internally to close sidebars and navigation upon page transitions.
buttons.create_account
(button, e) - back to top
This function is used to activate the creation of a new account.
It uses the data-form
attribute of the clicked button
to find the form.
Each form-group
container within the form is then checked and used towards the compounding encryption.
The minimum required inputs include:
<input id="wallet_blockchain" />
<input id="wallet_name" />
<input id="wallet_password" />
Without these, it will not be able to call the required $.fn.blockstrap.accounts.new
function.
buttons.create_contact
(button, e) - back to top
This function is used to activate the creation of a new contact.
It uses the data-form
attribute of the clicked button
to find the form.
Each form-group
container within the form is then checked and used towards the contact creation.
The minimum required inputs include:
<input id="contact_name" />
<input id="contact_address" />
<input id="contact_blockchain" />
Without these, it will not be able to call the required $.fn.blockstrap.contacts.new
function.
buttons.create_credentials
(button, e) - back to top
This function opens the login-credentials-modal
if available.
buttons.edit
(button, e) - back to top
This function opens a modal window containing a form that allows you to edit contact details.
buttons.edit_object
(button, e) - back to top
This function is used in conjunction with buttons.edit
to perform the saving of edited information.
buttons.import
(button, e) - back to top
This function opens a modal window that provides instructions on importing device data.
buttons.login
(button, e) - back to top
This function provides login functionality that utilizes internally stored your_username
and your_password
options to confirm if the user should be allowed further access.
buttons.logout
(button, e) - back to top
This function will logout the current user.
buttons.more_security
(button, e) - back to top
This function toggles hidden content display within the account creation modal window.
buttons.page
(button, e) - back to top
This function is used to providing animated page transitions within the default theme.
buttons.print
(button, e) - back to top
This function is used to open a print-friendly window.
buttons.process
(slug, content, filtered_data, button, effect, direction, reverse_direxction, mobile, menu, elements) - back to top
This function is used in conjunction with buttons.page
to handle the injection of new content when switching pages.
buttons.refresh
(button, e) - back to top
This function is used to refresh specific content on the page using the following button
attributes:
- data-collection
- data-key
Currently, the only accepted collection is accounts
.
The corresponding key
is used as an account_id in order to update the details via an API call and then refresh the page content.
buttons.remove
(button, e) - back to top
This function is used to open a modal window the contains a form with the relevant information needed to perform $.fn.blockstrap.accounts.remove
.
The following button
data attributes are required:
- data-collection
- data-key
- data-confirm
- data-element
The data-collection
and data-key
are used to defined which item should be removed from localStorage, whilst the data-confirm
defines whether a confirmation modal should appear first. Upon successfuly removal, the data-element
will be used as an ID reference to findthe appropriate element within the DOM to remove.
buttons.reset
(button, e) - back to top
This function opens a confirmation modal asking if you want to reset your device, confirming which will then remove all Blockstrap related information from localStorage.
buttons.send_money
(button, e) - back to top
This function is used prior to $.fn.blockstrap.accounts.prepare
as a way to collect the required information. It uses the following button
data attributes:
- data-form-id
From which it then seeks the following inputs:
<input id="to" />
<input id="from" />
<input id="amount" />
buttons.set_credentials
(button, e) - back to top
This function opens a modal window with a form that allows you to set your user credentials.
It requires the following button
data attributes:
- data-form
- data-field-username
- data-field-password
- data-field-repeat
It uses the data-form
value to first define which form to then look for the three required fields.
buttons.setup
(button, e) - back to top
This function is a complete nightmare, and yet it is also central to the process and used for the most important task at hand, setting-up your device for the first time. It's a little like buttons.create_account
in its requirements for minimum input values (derived from data-form
).
However, it also allows you to define setup steps. Setup can consist of as many steps as added to the required steps.js
dependency. In themes/default/js/dependencies/steps.js
there are two steps, at which point the following button
data attributes also become important:
- data-steps
- data-step
The data-steps
should confirm the total number of setup steps whereas the `data-step should confirm the current step.
buttons.submit_import
(button, e) - back to top
This function is used in conjunction with buttons.import
.
It searches the DOM for form#import-device-data #import-data
expectings its value to be a JSON string, where it will then attempt to add the relevant records to localStorage. Once parsed, the JSON object looks for the following fields:
nw_accounts
arraynw_blockstrap
objectnw_contacts
arraynw_keys
object
buttons.submit_payment
(button, e) - back to top
This function is used to process information prior to sending a payment and uses the following button
data attributes:
- data-form-id
- data-account-id
- data-to-blockchain
- data-to-address
- data-to-amount
The data-form-id
is used to define which form within the DOM to use to find the validating information proving ownwership of the account, where as the data-account-id
is used to define which account to send the payment from, and the other three fields then define what to send to where.
The critical functions is must parse include:
buttons.submit_verification
(button, e) - back to top
This function is used in conjunction with $.fn.blockstrap.accounts.verify
to ensure that the current user has ownership of the relevant account. It requires the following button
data attributes:
- data-form-id
- data-account-id
The data-form-id
is used to define which form within the DOM to use to find the validating information proving ownwership of the account, where as the data-account-id
is used to define which account needs verifying.
buttons.toggle
(button, e) - back to top
This function is used to toggle UI elements within the ocntact creation modal window between an input form with a user icon floating to the right to a select box filled with current contacts and the ability to switch back to the manual input. If no contacts have yet been created and the button
is clicked, a new modal window will open informing the user that they do not yet have any contacts.
- Related Articles
- Back to Modules
- Accounts
- API
- Buttons
- Contacts
- Blockchains
- Data
- Filters
- Forms
- Security
- Styles
- Templates
- Table of Contents