2016-10-05 23:45:20 +08:00
|
|
|
|
class Constants
|
|
|
|
|
#=============================================================================
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# String lengths
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
# Min characters for short text fields
|
|
|
|
|
NAME_MIN_LENGTH = 2
|
|
|
|
|
# Max characters for short text fields
|
|
|
|
|
NAME_MAX_LENGTH = 255
|
|
|
|
|
# Max characters for short text fields, after which they get truncated
|
|
|
|
|
NAME_TRUNCATION_LENGTH = 25
|
2018-05-03 20:24:23 +08:00
|
|
|
|
# Max edge length
|
|
|
|
|
MAX_EDGE_LENGTH = 75
|
|
|
|
|
# Max character for listing projects in dropdown
|
|
|
|
|
MAX_NAME_TRUNCATION = 150
|
2016-12-13 21:54:37 +08:00
|
|
|
|
# Max characters for short text fields, in dropdownList
|
|
|
|
|
NAME_TRUNCATION_LENGTH_DROPDOWN = 20
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# Max characters for long text fields
|
|
|
|
|
TEXT_MAX_LENGTH = 10000
|
2016-11-11 18:42:16 +08:00
|
|
|
|
# Max characters for rich text fields (in html format)
|
2023-04-05 21:34:48 +08:00
|
|
|
|
RICH_TEXT_MAX_LENGTH = 1000000
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# Max characters for color field (given in HEX format)
|
|
|
|
|
COLOR_MAX_LENGTH = 7
|
|
|
|
|
# Max characters for text in dropdown list element
|
|
|
|
|
DROPDOWN_TEXT_MAX_LENGTH = 15
|
2020-01-14 18:13:19 +08:00
|
|
|
|
# Max characters for text in modal list element
|
|
|
|
|
MODAL_TEXT_MAX_LENGTH = 55
|
2019-05-11 00:18:26 +08:00
|
|
|
|
# Max characters limit for (on most operating systems, it's ~255 characters,
|
|
|
|
|
# but this is with a bit more safety margin)
|
|
|
|
|
FILENAME_MAX_LENGTH = 100
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# Max characters for filenames, after which they get truncated
|
|
|
|
|
FILENAME_TRUNCATION_LENGTH = 50
|
2018-10-15 07:12:25 +08:00
|
|
|
|
# Max characters for names of exported files and folders, after which they get
|
2018-10-12 02:26:42 +08:00
|
|
|
|
# truncated
|
|
|
|
|
EXPORTED_FILENAME_TRUNCATION_LENGTH = 20
|
2016-10-05 23:45:20 +08:00
|
|
|
|
|
|
|
|
|
USER_INITIALS_MAX_LENGTH = 4
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# Password 'key stretching' factor
|
|
|
|
|
PASSWORD_STRETCH_FACTOR = 10
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# Standard max length for email
|
|
|
|
|
EMAIL_MAX_LENGTH = 254
|
2016-10-17 19:52:33 +08:00
|
|
|
|
# Some big value which is still supported by all databases, no matter what
|
|
|
|
|
# data type is used
|
2023-07-27 22:59:41 +08:00
|
|
|
|
INFINITY = ((2**32) / 2) - 1
|
2016-10-13 17:05:11 +08:00
|
|
|
|
|
2023-01-31 00:07:27 +08:00
|
|
|
|
# Prevents integer overflow for reminder delta seconds
|
2022-04-04 18:09:41 +08:00
|
|
|
|
MAX_NUMBER_OF_REMINDER_WEEKS = 816
|
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
# Query/display limits
|
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
# General limited/unlimited query/display elements for pages
|
|
|
|
|
SEARCH_LIMIT = 20
|
|
|
|
|
SEARCH_NO_LIMIT = -1
|
|
|
|
|
# General limited query/display elements for popup modals
|
|
|
|
|
MODAL_SEARCH_LIMIT = 5
|
|
|
|
|
# Comments limited query/display elements for pages
|
|
|
|
|
COMMENTS_SEARCH_LIMIT = 10
|
|
|
|
|
# Activity limited query/display elements for pages
|
2018-06-07 15:29:47 +08:00
|
|
|
|
ACTIVITY_AND_NOTIF_SEARCH_LIMIT = 20
|
2020-03-02 23:11:14 +08:00
|
|
|
|
# Infinite Scroll load limit (elements per page)
|
|
|
|
|
INFINITE_SCROLL_LIMIT = 20
|
2016-11-06 18:29:00 +08:00
|
|
|
|
# Maximum number of users that can be invited in a single action
|
|
|
|
|
INVITE_USERS_LIMIT = 20
|
2017-01-04 17:54:02 +08:00
|
|
|
|
# Maximum nr. of search results for atwho (smart annotations)
|
2020-09-07 16:46:51 +08:00
|
|
|
|
ATWHO_SEARCH_LIMIT = 10
|
2018-04-03 02:38:56 +08:00
|
|
|
|
# Max characters for repository name in Atwho modal
|
|
|
|
|
ATWHO_REP_NAME_LIMIT = 16
|
2020-07-17 17:12:39 +08:00
|
|
|
|
# Results limited query/display elements for pages
|
2020-07-23 17:35:22 +08:00
|
|
|
|
RESULTS_PER_PAGE_LIMIT = 10
|
2021-02-16 19:42:09 +08:00
|
|
|
|
#Experiments more button appears
|
|
|
|
|
EXPERIMENT_LONG_DESCRIPTION = 80
|
2022-04-12 21:03:06 +08:00
|
|
|
|
# Infinite scroll default elements per page
|
|
|
|
|
DEFAULT_ELEMENTS_PER_PAGE = 20
|
2023-10-12 20:40:13 +08:00
|
|
|
|
# Default navigator width
|
|
|
|
|
DEFAULT_NAV_WIDTH = 208
|
2019-06-13 21:47:29 +08:00
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
# File and data memory size
|
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
# Max table JSON size in MB
|
|
|
|
|
TABLE_JSON_MAX_SIZE_MB = 20
|
|
|
|
|
# Max uploaded user picture avatar size in MB
|
|
|
|
|
AVATAR_MAX_SIZE_MB = 0.2
|
2020-12-22 22:25:30 +08:00
|
|
|
|
# PDF preview file limit in MB
|
|
|
|
|
PDF_PREVIEW_MAX_SIZE_MB = 10
|
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
|
|
|
|
|
#=============================================================================
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# Application space
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
|
2017-01-25 19:30:11 +08:00
|
|
|
|
# Minimal space needed for team (in B)
|
|
|
|
|
MINIMAL_TEAM_SPACE_TAKEN = 1.megabyte
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# Additional space of each file is added to its estimated size to account for
|
|
|
|
|
# DB indexes size etc.
|
|
|
|
|
ASSET_ESTIMATED_SIZE_FACTOR = 1.1
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Format sizes
|
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
# Picture size formats
|
2019-09-12 23:21:48 +08:00
|
|
|
|
LARGE_PIC_FORMAT = [800, 600].freeze
|
|
|
|
|
MEDIUM_PIC_FORMAT = [300, 300].freeze
|
|
|
|
|
THUMB_PIC_FORMAT = [100, 100].freeze
|
|
|
|
|
ICON_PIC_FORMAT = [40, 40].freeze
|
|
|
|
|
ICON_SMALL_PIC_FORMAT = [30, 30].freeze
|
2016-10-05 23:45:20 +08:00
|
|
|
|
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# Hands-on-table number of starting columns and rows
|
|
|
|
|
HANDSONTABLE_INIT_COLS_CNT = 5
|
|
|
|
|
HANDSONTABLE_INIT_ROWS_CNT = 5
|
|
|
|
|
|
2019-07-01 16:14:16 +08:00
|
|
|
|
# Word reports format. All units in Twips.
|
|
|
|
|
# A twip is 1/20 of a point. Word documents are printed at 72dpi. 1in == 72pt == 1440 twips.
|
|
|
|
|
# Here is default A4
|
|
|
|
|
REPORT_DOCX_WIDTH = 12240
|
|
|
|
|
REPORT_DOCX_HEIGHT = 15840
|
|
|
|
|
REPORT_DOCX_MARGIN_TOP = 720
|
|
|
|
|
REPORT_DOCX_MARGIN_RIGHT = 720
|
|
|
|
|
REPORT_DOCX_MARGIN_BOTTOM = 720
|
|
|
|
|
REPORT_DOCX_MARGIN_LEFT = 720
|
|
|
|
|
|
2019-07-08 18:51:26 +08:00
|
|
|
|
# Word borders in eighth point units.
|
|
|
|
|
# A eighth point is 1/8 of a point. A border size of 4 is equivalent to 0.5pt.
|
|
|
|
|
REPORT_DOCX_TABLE_BORDER_SIZE = 4
|
|
|
|
|
|
2019-07-12 19:48:14 +08:00
|
|
|
|
# All font size in half points
|
2022-07-13 18:52:56 +08:00
|
|
|
|
REPORT_DOCX_REPORT_TITLE_SIZE = 36
|
|
|
|
|
REPORT_DOCX_EXPERIMENT_TITLE_SIZE = 32
|
|
|
|
|
REPORT_DOCX_MY_MODULE_TITLE_SIZE = 28
|
2019-07-12 19:48:14 +08:00
|
|
|
|
REPORT_DOCX_STEP_TITLE_SIZE = 22
|
|
|
|
|
REPORT_DOCX_STEP_ELEMENTS_TITLE_SIZE = 20
|
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
# Styling
|
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
# Dropdown top offset from the parent
|
|
|
|
|
DROPDOWN_TOP_OFFSET_PX = 20
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
2017-04-25 22:36:52 +08:00
|
|
|
|
# Date and time
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
# URL expire time, used for presigned file URLs, because outsiders shouldn't
|
|
|
|
|
# have access to them, but some buffer time is needed for file to be loaded
|
|
|
|
|
URL_SHORT_EXPIRE_TIME = 30
|
|
|
|
|
# Same as URL_EXPIRE_TIME, except for cases where the URL migth be used in
|
|
|
|
|
# another page, and hence the URL mustn't expire by then (e.g. when generating
|
|
|
|
|
# report and than using same HTML code in PDF, and consequently same file
|
|
|
|
|
# URL); it expires in exactly one day
|
|
|
|
|
URL_LONG_EXPIRE_TIME = 86_400
|
|
|
|
|
|
2018-11-09 22:58:08 +08:00
|
|
|
|
DEFAULT_DATE_FORMAT = '%m/%d/%Y'.freeze
|
|
|
|
|
|
|
|
|
|
SUPPORTED_DATE_FORMATS = [
|
|
|
|
|
# US formats
|
|
|
|
|
'%m/%d/%Y', '%m.%d.%Y', '%m. %d. %Y', '%m-%d-%Y', '%-m/%-d/%Y',
|
|
|
|
|
'%-m.%-d.%Y', '%-m. %-d. %Y', '%-m-%-d-%Y',
|
|
|
|
|
# European formats
|
|
|
|
|
'%d/%m/%Y', '%d.%m.%Y', '%d. %m. %Y', '%d-%b-%Y', '%Y-%m-%d',
|
|
|
|
|
'%d.%b.%Y', '%Y/%b/%d', '%d, %B, %Y', '%B, %d, %Y', '%-d/%-m/%Y',
|
|
|
|
|
'%-d.%-m.%Y', '%-d. %-m. %Y', '%d-%m-%Y', '%Y-%-m-%-d', '%-d-%b-%Y',
|
2019-11-20 21:57:53 +08:00
|
|
|
|
'%Y-%b-%-d', '%-d, %B, %Y', '%B, %-d, %Y'
|
2018-11-09 22:58:08 +08:00
|
|
|
|
].freeze
|
2017-04-25 22:36:52 +08:00
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# Application colors
|
2016-10-13 20:41:34 +08:00
|
|
|
|
#
|
|
|
|
|
# NOTE: Don't use shortened syntax, e.g. #000 for #000000, as some Gems need
|
|
|
|
|
# full syntax!
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
|
2023-05-11 19:02:41 +08:00
|
|
|
|
TAG_COLORS = %i(
|
2023-11-17 20:17:51 +08:00
|
|
|
|
#C4D3A0
|
2023-05-11 19:02:41 +08:00
|
|
|
|
#5EC66F
|
|
|
|
|
#46C3C8
|
2023-11-17 20:17:51 +08:00
|
|
|
|
#A3CCE4
|
2023-05-11 19:02:41 +08:00
|
|
|
|
#3B99FD
|
2023-11-10 21:00:18 +08:00
|
|
|
|
#104DA9
|
|
|
|
|
#6F2DC1
|
|
|
|
|
#FF69B4
|
|
|
|
|
#DF3562
|
|
|
|
|
#AD0015
|
|
|
|
|
#FF5C00
|
|
|
|
|
#E9A845
|
|
|
|
|
#B06500
|
|
|
|
|
#663300
|
|
|
|
|
#1D2939
|
2023-05-11 19:02:41 +08:00
|
|
|
|
#98A2B3
|
2023-11-17 20:17:51 +08:00
|
|
|
|
#DCE0E7
|
2023-05-11 19:02:41 +08:00
|
|
|
|
).freeze
|
2016-10-05 23:45:20 +08:00
|
|
|
|
|
2016-10-13 16:00:36 +08:00
|
|
|
|
# Theme colors
|
2020-01-21 16:38:08 +08:00
|
|
|
|
BRAND_PRIMARY = '#104da9'.freeze # $brand-primary
|
2016-10-13 16:00:36 +08:00
|
|
|
|
|
|
|
|
|
# Grayscale colors
|
2016-10-13 20:41:34 +08:00
|
|
|
|
COLOR_WHITE = '#ffffff'.freeze # $color-white
|
2020-01-21 16:38:08 +08:00
|
|
|
|
COLOR_CONCRETE = '#f0f0f6'.freeze # $color-concrete
|
|
|
|
|
COLOR_ALTO = '#d0d0d8'.freeze # $color-alto
|
|
|
|
|
COLOR_SILVER_CHALICE = '#a0a0a8'.freeze # $color-silver-chalice
|
|
|
|
|
COLOR_VOLCANO = '#404048'.freeze # $color-volcano
|
|
|
|
|
COLOR_BLACK = '#231f20'.freeze # $color-black
|
|
|
|
|
|
|
|
|
|
# Fonts
|
2023-05-11 19:37:29 +08:00
|
|
|
|
FONT_FAMILY_BASE = 'Inter,"Open Sans",Arial,Helvetica,sans-serif;'.freeze # $font-family-base
|
2016-10-13 16:00:36 +08:00
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# External URLs
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
|
|
HTTP = 'http://'.freeze
|
2023-02-25 00:57:10 +08:00
|
|
|
|
TUTORIALS_URL = ENV.fetch('VIDEO_TUTORIALS_URL', "#{HTTP}goo.gl/YH3fXA").freeze
|
|
|
|
|
SUPPORT_URL = ENV.fetch('KNOWLEDGE_CENTER_URL', 'https://scinote-3850750.hs-sites.com/en/knowledge').freeze
|
2023-07-27 22:59:41 +08:00
|
|
|
|
FREE_TRIAL_URL = 'https://www.scinote.net/free-trial/?utm_source=SciNoteShare&utm_medium=FreeTrialButton&utm_campaign=Q3_2023'.freeze
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# Default user picture avatar
|
2023-06-15 21:12:51 +08:00
|
|
|
|
DEFAULT_AVATAR_URL = '/images/:style/missing.svg'.freeze
|
2016-10-05 23:45:20 +08:00
|
|
|
|
|
2019-07-12 17:15:34 +08:00
|
|
|
|
ACADEMY_BL_LINK = 'https://scinote.net/academy/?utm_source=SciNote%20software%20BL&utm_medium=SciNote%20software%20BL'.freeze
|
|
|
|
|
|
2020-10-21 20:56:20 +08:00
|
|
|
|
PWA_URL = 'https://:pwa_domain/teams/:team_id/projects/:project_id/experiments/:experiment_id/tasks/:task_id/protocol/:protocol_id/:step_id?domain=:domain'.freeze
|
2020-10-19 18:17:03 +08:00
|
|
|
|
|
2020-07-07 21:59:02 +08:00
|
|
|
|
TWO_FACTOR_URL = {
|
|
|
|
|
google: {
|
|
|
|
|
android: 'https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2',
|
|
|
|
|
ios: 'https://apps.apple.com/us/app/google-authenticator/id388497605'
|
|
|
|
|
},
|
|
|
|
|
microsoft: {
|
|
|
|
|
android: 'https://play.google.com/store/apps/details?id=com.azure.authenticator',
|
|
|
|
|
ios: 'https://apps.apple.com/us/app/microsoft-authenticator/id983156458'
|
|
|
|
|
},
|
|
|
|
|
two_fa: {
|
|
|
|
|
android: 'https://play.google.com/store/apps/details?id=com.twofasapp',
|
|
|
|
|
ios: 'https://apps.apple.com/us/app/2fa-authenticator-2fas/id1217793794'
|
|
|
|
|
},
|
|
|
|
|
}
|
2021-08-16 16:51:46 +08:00
|
|
|
|
|
|
|
|
|
SCINOTE_FLUICS_URL = 'https://www.scinote.net/fluics/'.freeze
|
2022-10-25 17:44:50 +08:00
|
|
|
|
SCINOTE_ZEBRA_DOWNLOAD_URL = 'https://www.zebra.com/us/en/products/software/barcode-printers/link-os/browser-print.html'.freeze
|
|
|
|
|
SCINOTE_ZEBRA_BLOG_URL = 'https://www.scinote.net/blog/connect-zebra-printers/'.freeze
|
|
|
|
|
SCINOTE_ZEBRA_SUPPORT_URL = 'https://www.zebra.com/us/en/about-zebra/contact-zebra/contact-tech-support.html'.freeze
|
2020-07-09 23:01:00 +08:00
|
|
|
|
TWO_FACTOR_RECOVERY_CODE_COUNT = 6
|
|
|
|
|
TWO_FACTOR_RECOVERY_CODE_LENGTH = 12
|
2020-07-07 21:59:02 +08:00
|
|
|
|
|
2019-04-30 16:15:56 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
# Protocol importers
|
|
|
|
|
#=============================================================================
|
|
|
|
|
|
2019-05-31 02:24:11 +08:00
|
|
|
|
PROTOCOLS_ENDPOINTS = {
|
|
|
|
|
protocolsio: {
|
2019-09-12 23:21:48 +08:00
|
|
|
|
v3: 'ProtocolsIo::V3'
|
2019-05-31 02:24:11 +08:00
|
|
|
|
}
|
|
|
|
|
}.freeze
|
|
|
|
|
|
2019-07-15 01:24:53 +08:00
|
|
|
|
PROTOCOLS_IO_URL = 'https://www.protocols.io/'.freeze
|
|
|
|
|
|
2019-04-30 16:15:56 +08:00
|
|
|
|
PROTOCOLS_IO_V3_API = {
|
|
|
|
|
base_uri: 'https://www.protocols.io/api/v3/',
|
|
|
|
|
default_timeout: 10,
|
|
|
|
|
debug_level: :debug,
|
2019-06-28 04:48:56 +08:00
|
|
|
|
sort_mappings: {
|
2019-07-02 23:42:55 +08:00
|
|
|
|
alpha_asc: { order_field: :name, order_dir: :asc },
|
|
|
|
|
alpha_desc: { order_field: :name, order_dir: :desc },
|
2019-06-28 04:48:56 +08:00
|
|
|
|
newest: { order_field: :date, order_dir: :desc },
|
|
|
|
|
oldest: { order_field: :date, order_dir: :asc }
|
|
|
|
|
},
|
2019-04-30 16:15:56 +08:00
|
|
|
|
endpoints: {
|
|
|
|
|
protocols: {
|
|
|
|
|
default_query_params: {
|
|
|
|
|
filter: :public,
|
|
|
|
|
key: '',
|
|
|
|
|
order_field: :activity,
|
|
|
|
|
order_dir: :desc,
|
2019-07-04 21:35:18 +08:00
|
|
|
|
page_size: 50,
|
2023-04-18 18:43:56 +08:00
|
|
|
|
page_id: 0,
|
2019-07-09 19:28:43 +08:00
|
|
|
|
fields: 'id,title,authors,created_on,uri,stats,published_on'
|
2019-04-30 16:15:56 +08:00
|
|
|
|
}
|
2019-07-15 01:24:53 +08:00
|
|
|
|
},
|
|
|
|
|
publications: {
|
|
|
|
|
default_query_params: {
|
2023-04-11 16:30:58 +08:00
|
|
|
|
latest: 20
|
2019-07-15 01:24:53 +08:00
|
|
|
|
}
|
2019-04-30 16:15:56 +08:00
|
|
|
|
}
|
2019-05-16 21:55:04 +08:00
|
|
|
|
},
|
|
|
|
|
source_id: 'protocolsio/v3'
|
2019-04-30 16:15:56 +08:00
|
|
|
|
}.freeze
|
|
|
|
|
|
2019-06-18 23:47:08 +08:00
|
|
|
|
PROTOCOLS_DESC_TAGS = %w(a img i br).freeze
|
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
#=============================================================================
|
|
|
|
|
# Other
|
|
|
|
|
#=============================================================================
|
|
|
|
|
|
2019-01-01 01:10:12 +08:00
|
|
|
|
FILE_TEXT_FORMATS = %w(doc docm docx dot dotm dotx odt rtf).freeze
|
|
|
|
|
|
|
|
|
|
FILE_TABLE_FORMATS = %w(csv ods xls xlsb xlsm xlsx).freeze
|
|
|
|
|
|
|
|
|
|
FILE_PRESENTATION_FORMATS =
|
|
|
|
|
%w(odp pot potm potx pps ppsm ppsx ppt pptm pptx).freeze
|
|
|
|
|
|
|
|
|
|
WOPI_EDITABLE_FORMATS = %w(
|
|
|
|
|
docx docm odt xlsx xlsm xlsb ods pptx ppsx odp
|
|
|
|
|
).freeze
|
|
|
|
|
|
2016-10-13 16:00:36 +08:00
|
|
|
|
TEXT_EXTRACT_FILE_TYPES = [
|
2018-05-31 00:18:09 +08:00
|
|
|
|
'application/msword',
|
2018-05-31 15:42:57 +08:00
|
|
|
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
2016-10-13 16:00:36 +08:00
|
|
|
|
'application/pdf',
|
|
|
|
|
'application/rtf',
|
|
|
|
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
|
|
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
|
|
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
|
|
|
'application/vnd.oasis.opendocument.presentation',
|
|
|
|
|
'application/vnd.oasis.opendocument.spreadsheet',
|
|
|
|
|
'application/vnd.oasis.opendocument.text',
|
|
|
|
|
'application/vnd.ms-excel',
|
|
|
|
|
'application/vnd.ms-powerpoint',
|
|
|
|
|
'application/vnd.ms-word',
|
|
|
|
|
'text/plain'
|
|
|
|
|
].freeze
|
|
|
|
|
|
2019-06-05 18:52:43 +08:00
|
|
|
|
PREVIEWABLE_FILE_TYPES = TEXT_EXTRACT_FILE_TYPES
|
|
|
|
|
|
2016-11-28 18:13:20 +08:00
|
|
|
|
WHITELISTED_IMAGE_TYPES = [
|
2021-03-02 22:04:43 +08:00
|
|
|
|
'gif', 'jpeg', 'pjpeg', 'png', 'x-png', 'svg+xml', 'bmp', 'tiff', 'jpg'
|
2016-11-28 18:13:20 +08:00
|
|
|
|
].freeze
|
2016-11-25 23:12:43 +08:00
|
|
|
|
|
2019-03-19 20:52:57 +08:00
|
|
|
|
WHITELISTED_IMAGE_TYPES_EDITABLE = %w(
|
2019-04-03 22:31:56 +08:00
|
|
|
|
jpeg pjpeg png
|
2019-03-19 20:52:57 +08:00
|
|
|
|
).freeze
|
|
|
|
|
|
2023-03-09 18:38:47 +08:00
|
|
|
|
config = Sanitize::Config::RELAXED.deep_dup
|
2023-03-17 01:17:18 +08:00
|
|
|
|
config[:attributes][:all] << 'id'
|
|
|
|
|
config[:attributes][:all] << 'contenteditable'
|
2023-09-29 16:49:53 +08:00
|
|
|
|
config[:attributes]['img'] << 'data-mce-token'
|
2023-10-24 22:31:20 +08:00
|
|
|
|
config[:attributes]['img'] << 'data-source-type'
|
2023-11-10 21:33:50 +08:00
|
|
|
|
config[:attributes]['a'] << 'data-turbolinks'
|
2023-10-10 20:26:06 +08:00
|
|
|
|
config[:protocols]['img']['src'] << 'data'
|
2023-03-09 18:38:47 +08:00
|
|
|
|
INPUT_SANITIZE_CONFIG = Sanitize::Config.freeze_config(config)
|
2017-05-11 17:36:47 +08:00
|
|
|
|
|
2020-11-11 00:24:04 +08:00
|
|
|
|
REPOSITORY_DEFAULT_PAGE_SIZE = 10
|
|
|
|
|
REPOSITORY_LIST_ITEMS_PER_COLUMN = 500
|
|
|
|
|
REPOSITORY_CHECKLIST_ITEMS_PER_COLUMN = 50
|
2022-01-18 20:17:05 +08:00
|
|
|
|
REPOSITORY_STOCK_UNIT_ITEMS_PER_COLUMN = 50
|
2020-11-11 00:24:04 +08:00
|
|
|
|
REPOSITORY_NUMBER_TYPE_DEFAULT_DECIMALS = 2
|
|
|
|
|
REPOSITORY_NUMBER_TYPE_MAX_DECIMALS = 10
|
|
|
|
|
|
2022-04-07 18:27:21 +08:00
|
|
|
|
REPOSITORY_DATETIME_REMINDER_PRESET = 10
|
|
|
|
|
|
2018-03-09 21:22:00 +08:00
|
|
|
|
# Repository default table state
|
|
|
|
|
REPOSITORY_TABLE_DEFAULT_STATE = {
|
2019-11-19 17:33:51 +08:00
|
|
|
|
'time' => 0,
|
|
|
|
|
'start' => 0,
|
2020-11-11 00:24:04 +08:00
|
|
|
|
'length' => REPOSITORY_DEFAULT_PAGE_SIZE,
|
2023-01-25 23:11:33 +08:00
|
|
|
|
'order' => [[3, 'asc']], # Default sorting by 'name' column
|
2019-11-19 17:33:51 +08:00
|
|
|
|
'columns' => [],
|
|
|
|
|
'assigned' => 'assigned',
|
2020-06-11 18:48:31 +08:00
|
|
|
|
'ColReorder' => [*0..7]
|
2018-03-09 21:22:00 +08:00
|
|
|
|
}
|
2020-06-11 18:48:31 +08:00
|
|
|
|
8.times do |i|
|
2019-11-19 17:33:51 +08:00
|
|
|
|
REPOSITORY_TABLE_DEFAULT_STATE['columns'] << {
|
2020-06-11 18:48:31 +08:00
|
|
|
|
'visible' => (i < 6),
|
2019-11-19 17:33:51 +08:00
|
|
|
|
'searchable' => (i >= 1), # Checkboxes column is not searchable
|
|
|
|
|
'search' => { 'search' => '',
|
|
|
|
|
'smart' => true,
|
|
|
|
|
'regex' => false,
|
|
|
|
|
'caseInsensitive' => true }
|
2018-03-09 21:22:00 +08:00
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
REPOSITORY_TABLE_DEFAULT_STATE.freeze
|
2020-04-21 20:49:36 +08:00
|
|
|
|
|
|
|
|
|
# Repository default table state
|
|
|
|
|
REPOSITORY_SNAPSHOT_TABLE_DEFAULT_STATE = {
|
|
|
|
|
'time' => 0,
|
|
|
|
|
'start' => 0,
|
2020-11-11 00:24:04 +08:00
|
|
|
|
'length' => REPOSITORY_DEFAULT_PAGE_SIZE,
|
2020-04-21 20:49:36 +08:00
|
|
|
|
'order' => [[1, 'asc']], # Default sorting by 'ID' column
|
|
|
|
|
'columns' => [],
|
|
|
|
|
'assigned' => 'assigned',
|
|
|
|
|
'ColReorder' => [*0..4]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
REPOSITORY_SNAPSHOT_TABLE_DEFAULT_STATE['columns'] = REPOSITORY_TABLE_DEFAULT_STATE['columns'][0..4]
|
|
|
|
|
|
|
|
|
|
REPOSITORY_SNAPSHOT_TABLE_DEFAULT_STATE.freeze
|
|
|
|
|
|
2018-04-20 15:47:59 +08:00
|
|
|
|
# For default custom column template, any searchable default
|
|
|
|
|
# column can be reused
|
2018-04-18 19:21:30 +08:00
|
|
|
|
REPOSITORY_TABLE_STATE_CUSTOM_COLUMN_TEMPLATE =
|
2019-11-19 17:33:51 +08:00
|
|
|
|
REPOSITORY_TABLE_DEFAULT_STATE['columns'][1].deep_dup
|
|
|
|
|
.freeze
|
2018-03-09 21:22:00 +08:00
|
|
|
|
|
2017-04-04 16:16:54 +08:00
|
|
|
|
EXPORTABLE_ZIP_EXPIRATION_DAYS = 7
|
|
|
|
|
|
2019-11-06 18:29:00 +08:00
|
|
|
|
REPOSITORY_LIST_ITEMS_DELIMITERS_MAP = {
|
|
|
|
|
return: "\n",
|
|
|
|
|
comma: ',',
|
|
|
|
|
semicolon: ';',
|
|
|
|
|
space: ' '
|
|
|
|
|
}.freeze
|
2020-01-20 21:26:17 +08:00
|
|
|
|
|
|
|
|
|
REPOSITORY_LIST_ITEMS_DELIMITERS_ICON_MAP = {
|
|
|
|
|
auto: "*",
|
|
|
|
|
return: "↵",
|
|
|
|
|
comma: ',',
|
|
|
|
|
semicolon: ';',
|
|
|
|
|
space: '⎵'
|
|
|
|
|
}.freeze
|
2019-11-05 22:33:04 +08:00
|
|
|
|
|
2018-05-31 16:45:31 +08:00
|
|
|
|
IMPORT_REPOSITORY_ITEMS_LIMIT = 2000
|
|
|
|
|
|
2020-02-21 21:40:17 +08:00
|
|
|
|
DEFAULT_TEAM_REPOSITORIES_LIMIT = 6
|
|
|
|
|
|
2016-11-06 18:29:00 +08:00
|
|
|
|
# Very basic regex to check for validity of emails
|
2016-11-26 00:37:27 +08:00
|
|
|
|
BASIC_EMAIL_REGEX = URI::MailTo::EMAIL_REGEXP
|
2016-11-06 18:29:00 +08:00
|
|
|
|
|
2019-04-19 20:44:40 +08:00
|
|
|
|
TINY_MCE_ASSET_REGEX = /data-mce-token="(\w+)"/
|
2017-11-25 00:04:01 +08:00
|
|
|
|
|
2017-01-25 19:30:11 +08:00
|
|
|
|
# Team name for default admin user
|
|
|
|
|
DEFAULT_PRIVATE_TEAM_NAME = 'My projects'.freeze
|
2016-10-13 16:00:36 +08:00
|
|
|
|
|
2019-01-25 17:50:08 +08:00
|
|
|
|
TEMPLATES_PROJECT_NAME = 'Templates'.freeze
|
|
|
|
|
|
2023-09-14 22:21:17 +08:00
|
|
|
|
# Interval time for polling status state
|
|
|
|
|
FAST_STATUS_POLLING_INTERVAL = 5000
|
|
|
|
|
SLOW_STATUS_POLLING_INTERVAL = 10000
|
|
|
|
|
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# ) \ / (
|
|
|
|
|
# /|\ )\_/( /|\
|
|
|
|
|
# * / | \ (/\|/\) / | \ *
|
|
|
|
|
# |`.____________________/__|__o____\`|'/___o__|__\___________________.'|
|
|
|
|
|
# | '^` \|/ '^` |
|
|
|
|
|
# | V |
|
|
|
|
|
# | _____ _ _ __ |
|
|
|
|
|
# | |_ _| |__ __ _ _ __ | | __ _ _ ___ _ _ ( | |
|
|
|
|
|
# | | | | '_ \ / _` | '_ \| |/ / | | | |/ _ \| | | | | ) |
|
|
|
|
|
# | | | | | | | (_| | | | | < | |_| | ( | | |_| | \_/ |
|
|
|
|
|
# | |_| |_| |_|\__,_|_| |_|_|\_\ \__, |\___/ \_,|_| _ |
|
|
|
|
|
# | |___/ (_) |
|
|
|
|
|
# | |
|
2018-05-21 21:11:12 +08:00
|
|
|
|
# | Special Thank You for supporting SciNote on Kicstarter goes |
|
2016-10-05 23:45:20 +08:00
|
|
|
|
# | to the following supporters |
|
|
|
|
|
# | ._________________________________________________________________. |
|
|
|
|
|
# |' l /\ / \\ \ /\ l `|
|
|
|
|
|
# * l / V )) V \ l *
|
|
|
|
|
# l/ // \I
|
|
|
|
|
KICKSTARTER_SUPPORTERS = [
|
|
|
|
|
'Manuela Lanzafame',
|
|
|
|
|
'Fluckiger Rudolf',
|
|
|
|
|
'Emily Gleason',
|
|
|
|
|
'Benjamin E Doremus',
|
|
|
|
|
'Chord Pet Wearable',
|
|
|
|
|
'Chris Taylor',
|
|
|
|
|
'Abraham White',
|
|
|
|
|
'Ryotaro Eguchi',
|
|
|
|
|
'Simon Waldherr',
|
|
|
|
|
'Isaac Sandaljian',
|
|
|
|
|
'Markus Rademacher'
|
|
|
|
|
].freeze
|
|
|
|
|
end
|