.
9 |
10 | .list-group {
11 | // No need to set list-style: none; since .list-group-item is block level
12 | margin-bottom: 20px;
13 | padding-left: 0; // reset padding because ul and ol
14 | }
15 |
16 |
17 | // Individual list items
18 | //
19 | // Use on `li`s or `div`s within the `.list-group` parent.
20 |
21 | .list-group-item {
22 | position: relative;
23 | display: block;
24 | padding: 10px 15px;
25 | // Place the border on the list items and negative margin up for better styling
26 | margin-bottom: -1px;
27 | background-color: $list-group-bg;
28 | border: 1px solid $list-group-border;
29 |
30 | // Round the first and last items
31 | &:first-child {
32 | @include border-top-radius($list-group-border-radius);
33 | }
34 | &:last-child {
35 | margin-bottom: 0;
36 | @include border-bottom-radius($list-group-border-radius);
37 | }
38 | }
39 |
40 |
41 | // Interactive list items
42 | //
43 | // Use anchor or button elements instead of `li`s or `div`s to create interactive items.
44 | // Includes an extra `.active` modifier class for showing selected items.
45 |
46 | a.list-group-item,
47 | button.list-group-item {
48 | color: $list-group-link-color;
49 |
50 | .list-group-item-heading {
51 | color: $list-group-link-heading-color;
52 | }
53 |
54 | // Hover state
55 | &:hover,
56 | &:focus {
57 | text-decoration: none;
58 | color: $list-group-link-hover-color;
59 | background-color: $list-group-hover-bg;
60 | }
61 | }
62 |
63 | button.list-group-item {
64 | width: 100%;
65 | text-align: left;
66 | }
67 |
68 | .list-group-item {
69 | // Disabled state
70 | &.disabled,
71 | &.disabled:hover,
72 | &.disabled:focus {
73 | background-color: $list-group-disabled-bg;
74 | color: $list-group-disabled-color;
75 | cursor: $cursor-disabled;
76 |
77 | // Force color to inherit for custom content
78 | .list-group-item-heading {
79 | color: inherit;
80 | }
81 | .list-group-item-text {
82 | color: $list-group-disabled-text-color;
83 | }
84 | }
85 |
86 | // Active class on item itself, not parent
87 | &.active,
88 | &.active:hover,
89 | &.active:focus {
90 | z-index: 2; // Place active items above their siblings for proper border styling
91 | color: $list-group-active-color;
92 | background-color: $list-group-active-bg;
93 | border-color: $list-group-active-border;
94 |
95 | // Force color to inherit for custom content
96 | .list-group-item-heading,
97 | .list-group-item-heading > small,
98 | .list-group-item-heading > .small {
99 | color: inherit;
100 | }
101 | .list-group-item-text {
102 | color: $list-group-active-text-color;
103 | }
104 | }
105 | }
106 |
107 |
108 | // Contextual variants
109 | //
110 | // Add modifier classes to change text and background color on individual items.
111 | // Organizationally, this must come after the `:hover` states.
112 |
113 | @include list-group-item-variant(success, $state-success-bg, $state-success-text);
114 | @include list-group-item-variant(info, $state-info-bg, $state-info-text);
115 | @include list-group-item-variant(warning, $state-warning-bg, $state-warning-text);
116 | @include list-group-item-variant(danger, $state-danger-bg, $state-danger-text);
117 |
118 |
119 | // Custom content options
120 | //
121 | // Extra classes for creating well-formatted content within `.list-group-item`s.
122 |
123 | .list-group-item-heading {
124 | margin-top: 0;
125 | margin-bottom: 5px;
126 | }
127 | .list-group-item-text {
128 | margin-bottom: 0;
129 | line-height: 1.3;
130 | }
131 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_scaffolding.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Scaffolding
3 | // --------------------------------------------------
4 |
5 |
6 | // Reset the box-sizing
7 | //
8 | // Heads up! This reset may cause conflicts with some third-party widgets.
9 | // For recommendations on resolving such conflicts, see
10 | // http://getbootstrap.com/getting-started/#third-box-sizing
11 | * {
12 | @include box-sizing(border-box);
13 | }
14 | *:before,
15 | *:after {
16 | @include box-sizing(border-box);
17 | }
18 |
19 |
20 | // Body reset
21 |
22 | html {
23 | font-size: 10px;
24 | -webkit-tap-highlight-color: rgba(0,0,0,0);
25 | }
26 |
27 | body {
28 | font-family: $font-family-base;
29 | font-size: $font-size-base;
30 | line-height: $line-height-base;
31 | color: $text-color;
32 | background-color: $body-bg;
33 | }
34 |
35 | // Reset fonts for relevant elements
36 | input,
37 | button,
38 | select,
39 | textarea {
40 | font-family: inherit;
41 | font-size: inherit;
42 | line-height: inherit;
43 | }
44 |
45 |
46 | // Links
47 |
48 | a {
49 | color: $link-color;
50 | text-decoration: none;
51 |
52 | &:hover,
53 | &:focus {
54 | color: $link-hover-color;
55 | text-decoration: $link-hover-decoration;
56 | }
57 |
58 | &:focus {
59 | @include tab-focus;
60 | }
61 | }
62 |
63 |
64 | // Figures
65 | //
66 | // We reset this here because previously Normalize had no `figure` margins. This
67 | // ensures we don't break anyone's use of the element.
68 |
69 | figure {
70 | margin: 0;
71 | }
72 |
73 |
74 | // Images
75 |
76 | img {
77 | vertical-align: middle;
78 | }
79 |
80 | // Responsive images (ensure images don't scale beyond their parents)
81 | .img-responsive {
82 | @include img-responsive;
83 | }
84 |
85 | // Rounded corners
86 | .img-rounded {
87 | border-radius: $border-radius-large;
88 | }
89 |
90 | // Image thumbnails
91 | //
92 | // Heads up! This is mixin-ed into thumbnails.less for `.thumbnail`.
93 | .img-thumbnail {
94 | padding: $thumbnail-padding;
95 | line-height: $line-height-base;
96 | background-color: $thumbnail-bg;
97 | border: 1px solid $thumbnail-border;
98 | border-radius: $thumbnail-border-radius;
99 | @include transition(all .2s ease-in-out);
100 |
101 | // Keep them at most 100% wide
102 | @include img-responsive(inline-block);
103 | }
104 |
105 | // Perfect circle
106 | .img-circle {
107 | border-radius: 50%; // set radius in percents
108 | }
109 |
110 |
111 | // Horizontal rules
112 |
113 | hr {
114 | margin-top: $line-height-computed;
115 | margin-bottom: $line-height-computed;
116 | border: 0;
117 | border-top: 1px solid $hr-border;
118 | }
119 |
120 |
121 | // Only display content to screen readers
122 | //
123 | // See: http://a11yproject.com/posts/how-to-hide-content
124 |
125 | .sr-only {
126 | position: absolute;
127 | width: 1px;
128 | height: 1px;
129 | margin: -1px;
130 | padding: 0;
131 | overflow: hidden;
132 | clip: rect(0,0,0,0);
133 | border: 0;
134 | }
135 |
136 | // Use in conjunction with .sr-only to only display content when it's focused.
137 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
138 | // Credit: HTML5 Boilerplate
139 |
140 | .sr-only-focusable {
141 | &:active,
142 | &:focus {
143 | position: static;
144 | width: auto;
145 | height: auto;
146 | margin: 0;
147 | overflow: visible;
148 | clip: auto;
149 | }
150 | }
151 |
152 |
153 | // iOS "clickable elements" fix for role="button"
154 | //
155 | // Fixes "clickability" issue (and more generally, the firing of events such as focus as well)
156 | // for traditionally non-focusable elements with role="button"
157 | // see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
158 |
159 | [role="button"] {
160 | cursor: pointer;
161 | }
162 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_popovers.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Popovers
3 | // --------------------------------------------------
4 |
5 |
6 | .popover {
7 | position: absolute;
8 | top: 0;
9 | left: 0;
10 | z-index: $zindex-popover;
11 | display: none;
12 | max-width: $popover-max-width;
13 | padding: 1px;
14 | // Our parent element can be arbitrary since popovers are by default inserted as a sibling of their target element.
15 | // So reset our font and text properties to avoid inheriting weird values.
16 | @include reset-text;
17 | font-size: $font-size-base;
18 |
19 | background-color: $popover-bg;
20 | background-clip: padding-box;
21 | border: 1px solid $popover-fallback-border-color;
22 | border: 1px solid $popover-border-color;
23 | border-radius: $border-radius-large;
24 | @include box-shadow(0 5px 10px rgba(0,0,0,.2));
25 |
26 | // Offset the popover to account for the popover arrow
27 | &.top { margin-top: -$popover-arrow-width; }
28 | &.right { margin-left: $popover-arrow-width; }
29 | &.bottom { margin-top: $popover-arrow-width; }
30 | &.left { margin-left: -$popover-arrow-width; }
31 | }
32 |
33 | .popover-title {
34 | margin: 0; // reset heading margin
35 | padding: 8px 14px;
36 | font-size: $font-size-base;
37 | background-color: $popover-title-bg;
38 | border-bottom: 1px solid darken($popover-title-bg, 5%);
39 | border-radius: ($border-radius-large - 1) ($border-radius-large - 1) 0 0;
40 | }
41 |
42 | .popover-content {
43 | padding: 9px 14px;
44 | }
45 |
46 | // Arrows
47 | //
48 | // .arrow is outer, .arrow:after is inner
49 |
50 | .popover > .arrow {
51 | &,
52 | &:after {
53 | position: absolute;
54 | display: block;
55 | width: 0;
56 | height: 0;
57 | border-color: transparent;
58 | border-style: solid;
59 | }
60 | }
61 | .popover > .arrow {
62 | border-width: $popover-arrow-outer-width;
63 | }
64 | .popover > .arrow:after {
65 | border-width: $popover-arrow-width;
66 | content: "";
67 | }
68 |
69 | .popover {
70 | &.top > .arrow {
71 | left: 50%;
72 | margin-left: -$popover-arrow-outer-width;
73 | border-bottom-width: 0;
74 | border-top-color: $popover-arrow-outer-fallback-color; // IE8 fallback
75 | border-top-color: $popover-arrow-outer-color;
76 | bottom: -$popover-arrow-outer-width;
77 | &:after {
78 | content: " ";
79 | bottom: 1px;
80 | margin-left: -$popover-arrow-width;
81 | border-bottom-width: 0;
82 | border-top-color: $popover-arrow-color;
83 | }
84 | }
85 | &.right > .arrow {
86 | top: 50%;
87 | left: -$popover-arrow-outer-width;
88 | margin-top: -$popover-arrow-outer-width;
89 | border-left-width: 0;
90 | border-right-color: $popover-arrow-outer-fallback-color; // IE8 fallback
91 | border-right-color: $popover-arrow-outer-color;
92 | &:after {
93 | content: " ";
94 | left: 1px;
95 | bottom: -$popover-arrow-width;
96 | border-left-width: 0;
97 | border-right-color: $popover-arrow-color;
98 | }
99 | }
100 | &.bottom > .arrow {
101 | left: 50%;
102 | margin-left: -$popover-arrow-outer-width;
103 | border-top-width: 0;
104 | border-bottom-color: $popover-arrow-outer-fallback-color; // IE8 fallback
105 | border-bottom-color: $popover-arrow-outer-color;
106 | top: -$popover-arrow-outer-width;
107 | &:after {
108 | content: " ";
109 | top: 1px;
110 | margin-left: -$popover-arrow-width;
111 | border-top-width: 0;
112 | border-bottom-color: $popover-arrow-color;
113 | }
114 | }
115 |
116 | &.left > .arrow {
117 | top: 50%;
118 | right: -$popover-arrow-outer-width;
119 | margin-top: -$popover-arrow-outer-width;
120 | border-right-width: 0;
121 | border-left-color: $popover-arrow-outer-fallback-color; // IE8 fallback
122 | border-left-color: $popover-arrow-outer-color;
123 | &:after {
124 | content: " ";
125 | right: 1px;
126 | border-right-width: 0;
127 | border-left-color: $popover-arrow-color;
128 | bottom: -$popover-arrow-width;
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/main/utils/markdown.js:
--------------------------------------------------------------------------------
1 | const sanitizeHtml = require('sanitize-html')
2 | const removeMd = require('remove-markdown')
3 |
4 |
5 | /**
6 | * Markdown processor with our custom settings
7 | */
8 | const hljs = require('highlight.js')
9 | module.exports.md = require('markdown-it')({
10 | html: true,
11 | linkify: true,
12 | typographer: true,
13 | highlight: function (str, lang) {
14 | if (lang && hljs.getLanguage(lang)) {
15 | try {
16 | return '
' +
17 | hljs.highlight(lang, str, true).value +
18 | '
';
19 | } catch (__) {}
20 | }
21 |
22 | return '
' + module.exports.md.utils.escapeHtml(str) + '
';
23 | }
24 | })
25 | .use(require('markdown-it-anchor'), {
26 | permalink: true,
27 | permalinkSymbol: '
'
28 | })
29 | .use(require('markdown-it-table-of-contents'), {
30 | includeLevel: [1, 2, 3, 4, 5, 6]
31 | })
32 | .use(require('markdown-it-container'), 'info')
33 | .use(require('markdown-it-container'), 'cli-output', {
34 | marker: '`'
35 | })
36 |
37 |
38 | /**
39 | * This method takes a readme and data package descriptor as arguments. If
40 | * there is dp variables in readme, it returns readme with datapackage json
41 | * embed into it. Dp variables must be wrapped in double curly braces and can
42 | * be one of: datapackage.json, datapackage, dp.json, dp.
43 | */
44 | module.exports.dpInReadme = (readme, dp) => {
45 | const regex = /({{ ?)(datapackage(\.json)?|dp(\.json)?)( ?}})/
46 | const dpClone = Object.assign({}, dp)
47 |
48 | const markdowned = '\n```json\n' + JSON.stringify(dpClone, null, 2) + '\n```\n'
49 | const readmeWithDp = readme.replace(regex, markdowned)
50 | return readmeWithDp
51 | }
52 |
53 |
54 | /**
55 | * This method takes any text and sanitizes it from unsafe html tags.
56 | * Then it converts any markdown syntax into html and returns the result.
57 | */
58 | module.exports.textToMarkdown = text => {
59 | const allowedTags = [
60 | 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'h8', 'br', 'b', 'i', 'span',
61 | 'strong', 'em', 'a', 'pre', 'code', 'img', 'tt', 'div', 'ins', 'del',
62 | 'sup', 'sub', 'p', 'ol', 'ul', 'table', 'thead', 'tbody', 'tfoot',
63 | 'blockquote', 'dl', 'dt', 'dd', 'kbd', 'q', 'samp', 'var', 'hr', 'ruby', 'rt',
64 | 'rp', 'li', 'tr', 'td', 'th', 's', 'strike', 'summary', 'details', 'input'
65 | ]
66 | const allowedAttributes = {
67 | '*': [
68 | 'abbr', 'accept', 'accept-charset', 'accesskey', 'action',
69 | 'align', 'alt', 'axis', 'border', 'cellpadding', 'cellspacing',
70 | 'char', 'charoff', 'charset', 'checked', 'clear', 'cols',
71 | 'colspan', 'color', 'compact', 'coords', 'datetime', 'dir',
72 | 'disabled', 'enctype', 'for', 'frame', 'headers', 'height',
73 | 'hreflang', 'hspace', 'ismap', 'label', 'lang', 'maxlength',
74 | 'media', 'method', 'multiple', 'name', 'nohref', 'noshade',
75 | 'nowrap', 'open', 'prompt', 'readonly', 'rel', 'rev', 'rows',
76 | 'rowspan', 'rules', 'scope', 'selected', 'shape', 'size',
77 | 'span', 'start', 'summary', 'tabindex', 'target', 'title',
78 | 'type', 'usemap', 'valign', 'value', 'vspace', 'width',
79 | 'itemprop', 'class', 'checkbox'
80 | ],
81 | a: ['href'],
82 | img: ['src', 'longdesc'],
83 | div: ['itemscope', 'itemtype'],
84 | blockquote: ['cite'],
85 | del: ['cite'],
86 | ins: ['cite'],
87 | q: ['cite']
88 | }
89 | const markdownToHtml = module.exports.md.render(text)
90 | const sanitizedHtml = sanitizeHtml(markdownToHtml, {
91 | allowedTags,
92 | allowedAttributes
93 | })
94 |
95 | return sanitizedHtml
96 | }
97 |
98 |
99 | /**
100 | * This method takes html text and returns first 200 chars of it's plain text
101 | */
102 | module.exports.makeSmallReadme = readme => {
103 | if (!readme) {
104 | return null
105 | }
106 | const plainText = removeMd(readme)
107 | if (plainText.leng <= 300) {
108 | return plainText
109 | }
110 | const wordList = plainText.substring(0, 300).split(' ')
111 | wordList.pop()
112 | return wordList.join(' ')
113 | }
114 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_modals.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Modals
3 | // --------------------------------------------------
4 |
5 | // .modal-open - body class for killing the scroll
6 | // .modal - container to scroll within
7 | // .modal-dialog - positioning shell for the actual modal
8 | // .modal-content - actual modal w/ bg and corners and shit
9 |
10 | // Kill the scroll on the body
11 | .modal-open {
12 | overflow: hidden;
13 | }
14 |
15 | // Container that the modal scrolls within
16 | .modal {
17 | display: none;
18 | overflow: hidden;
19 | position: fixed;
20 | top: 0;
21 | right: 0;
22 | bottom: 0;
23 | left: 0;
24 | z-index: $zindex-modal;
25 | -webkit-overflow-scrolling: touch;
26 |
27 | // Prevent Chrome on Windows from adding a focus outline. For details, see
28 | // https://github.com/twbs/bootstrap/pull/10951.
29 | outline: 0;
30 |
31 | // When fading in the modal, animate it to slide down
32 | &.fade .modal-dialog {
33 | @include translate(0, -25%);
34 | @include transition-transform(0.3s ease-out);
35 | }
36 | &.in .modal-dialog { @include translate(0, 0) }
37 | }
38 | .modal-open .modal {
39 | overflow-x: hidden;
40 | overflow-y: auto;
41 | }
42 |
43 | // Shell div to position the modal with bottom padding
44 | .modal-dialog {
45 | position: relative;
46 | width: auto;
47 | margin: 10px;
48 | }
49 |
50 | // Actual modal
51 | .modal-content {
52 | position: relative;
53 | background-color: $modal-content-bg;
54 | border: 1px solid $modal-content-fallback-border-color; //old browsers fallback (ie8 etc)
55 | border: 1px solid $modal-content-border-color;
56 | border-radius: $border-radius-large;
57 | @include box-shadow(0 3px 9px rgba(0,0,0,.5));
58 | background-clip: padding-box;
59 | // Remove focus outline from opened modal
60 | outline: 0;
61 | }
62 |
63 | // Modal background
64 | .modal-backdrop {
65 | position: fixed;
66 | top: 0;
67 | right: 0;
68 | bottom: 0;
69 | left: 0;
70 | z-index: $zindex-modal-background;
71 | background-color: $modal-backdrop-bg;
72 | // Fade for backdrop
73 | &.fade { @include opacity(0); }
74 | &.in { @include opacity($modal-backdrop-opacity); }
75 | }
76 |
77 | // Modal header
78 | // Top section of the modal w/ title and dismiss
79 | .modal-header {
80 | padding: $modal-title-padding;
81 | border-bottom: 1px solid $modal-header-border-color;
82 | @include clearfix;
83 | }
84 | // Close icon
85 | .modal-header .close {
86 | margin-top: -2px;
87 | }
88 |
89 | // Title text within header
90 | .modal-title {
91 | margin: 0;
92 | line-height: $modal-title-line-height;
93 | }
94 |
95 | // Modal body
96 | // Where all modal content resides (sibling of .modal-header and .modal-footer)
97 | .modal-body {
98 | position: relative;
99 | padding: $modal-inner-padding;
100 | }
101 |
102 | // Footer (for actions)
103 | .modal-footer {
104 | padding: $modal-inner-padding;
105 | text-align: right; // right align buttons
106 | border-top: 1px solid $modal-footer-border-color;
107 | @include clearfix; // clear it in case folks use .pull-* classes on buttons
108 |
109 | // Properly space out buttons
110 | .btn + .btn {
111 | margin-left: 5px;
112 | margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
113 | }
114 | // but override that for button groups
115 | .btn-group .btn + .btn {
116 | margin-left: -1px;
117 | }
118 | // and override it for block buttons as well
119 | .btn-block + .btn-block {
120 | margin-left: 0;
121 | }
122 | }
123 |
124 | // Measure scrollbar width for padding body during modal show/hide
125 | .modal-scrollbar-measure {
126 | position: absolute;
127 | top: -9999px;
128 | width: 50px;
129 | height: 50px;
130 | overflow: scroll;
131 | }
132 |
133 | // Scale up the modal
134 | @media (min-width: $screen-sm-min) {
135 | // Automatically set modal's width for larger viewports
136 | .modal-dialog {
137 | width: $modal-md;
138 | margin: 30px auto;
139 | }
140 | .modal-content {
141 | @include box-shadow(0 5px 15px rgba(0,0,0,.5));
142 | }
143 |
144 | // Modal sizes
145 | .modal-sm { width: $modal-sm; }
146 | }
147 |
148 | @media (min-width: $screen-md-min) {
149 | .modal-lg { width: $modal-lg; }
150 | }
151 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/javascripts/bootstrap/button.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: button.js v3.3.7
3 | * http://getbootstrap.com/javascript/#buttons
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // BUTTON PUBLIC CLASS DEFINITION
14 | // ==============================
15 |
16 | var Button = function (element, options) {
17 | this.$element = $(element)
18 | this.options = $.extend({}, Button.DEFAULTS, options)
19 | this.isLoading = false
20 | }
21 |
22 | Button.VERSION = '3.3.7'
23 |
24 | Button.DEFAULTS = {
25 | loadingText: 'loading...'
26 | }
27 |
28 | Button.prototype.setState = function (state) {
29 | var d = 'disabled'
30 | var $el = this.$element
31 | var val = $el.is('input') ? 'val' : 'html'
32 | var data = $el.data()
33 |
34 | state += 'Text'
35 |
36 | if (data.resetText == null) $el.data('resetText', $el[val]())
37 |
38 | // push to event loop to allow forms to submit
39 | setTimeout($.proxy(function () {
40 | $el[val](data[state] == null ? this.options[state] : data[state])
41 |
42 | if (state == 'loadingText') {
43 | this.isLoading = true
44 | $el.addClass(d).attr(d, d).prop(d, true)
45 | } else if (this.isLoading) {
46 | this.isLoading = false
47 | $el.removeClass(d).removeAttr(d).prop(d, false)
48 | }
49 | }, this), 0)
50 | }
51 |
52 | Button.prototype.toggle = function () {
53 | var changed = true
54 | var $parent = this.$element.closest('[data-toggle="buttons"]')
55 |
56 | if ($parent.length) {
57 | var $input = this.$element.find('input')
58 | if ($input.prop('type') == 'radio') {
59 | if ($input.prop('checked')) changed = false
60 | $parent.find('.active').removeClass('active')
61 | this.$element.addClass('active')
62 | } else if ($input.prop('type') == 'checkbox') {
63 | if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
64 | this.$element.toggleClass('active')
65 | }
66 | $input.prop('checked', this.$element.hasClass('active'))
67 | if (changed) $input.trigger('change')
68 | } else {
69 | this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
70 | this.$element.toggleClass('active')
71 | }
72 | }
73 |
74 |
75 | // BUTTON PLUGIN DEFINITION
76 | // ========================
77 |
78 | function Plugin(option) {
79 | return this.each(function () {
80 | var $this = $(this)
81 | var data = $this.data('bs.button')
82 | var options = typeof option == 'object' && option
83 |
84 | if (!data) $this.data('bs.button', (data = new Button(this, options)))
85 |
86 | if (option == 'toggle') data.toggle()
87 | else if (option) data.setState(option)
88 | })
89 | }
90 |
91 | var old = $.fn.button
92 |
93 | $.fn.button = Plugin
94 | $.fn.button.Constructor = Button
95 |
96 |
97 | // BUTTON NO CONFLICT
98 | // ==================
99 |
100 | $.fn.button.noConflict = function () {
101 | $.fn.button = old
102 | return this
103 | }
104 |
105 |
106 | // BUTTON DATA-API
107 | // ===============
108 |
109 | $(document)
110 | .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
111 | var $btn = $(e.target).closest('.btn')
112 | Plugin.call($btn, 'toggle')
113 | if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
114 | // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
115 | e.preventDefault()
116 | // The target component still receive the focus
117 | if ($btn.is('input,button')) $btn.trigger('focus')
118 | else $btn.find('input:visible,button:visible').first().trigger('focus')
119 | }
120 | })
121 | .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
122 | $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
123 | })
124 |
125 | }(jQuery);
126 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/mixins/_gradients.scss:
--------------------------------------------------------------------------------
1 | // Gradients
2 |
3 |
4 |
5 | // Horizontal gradient, from left to right
6 | //
7 | // Creates two color stops, start and end, by specifying a color and position for each color stop.
8 | // Color stops are not available in IE9 and below.
9 | @mixin gradient-horizontal($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
10 | background-image: -webkit-linear-gradient(left, $start-color $start-percent, $end-color $end-percent); // Safari 5.1-6, Chrome 10+
11 | background-image: -o-linear-gradient(left, $start-color $start-percent, $end-color $end-percent); // Opera 12
12 | background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
13 | background-repeat: repeat-x;
14 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=1); // IE9 and down
15 | }
16 |
17 | // Vertical gradient, from top to bottom
18 | //
19 | // Creates two color stops, start and end, by specifying a color and position for each color stop.
20 | // Color stops are not available in IE9 and below.
21 | @mixin gradient-vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
22 | background-image: -webkit-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Safari 5.1-6, Chrome 10+
23 | background-image: -o-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Opera 12
24 | background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
25 | background-repeat: repeat-x;
26 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down
27 | }
28 |
29 | @mixin gradient-directional($start-color: #555, $end-color: #333, $deg: 45deg) {
30 | background-repeat: repeat-x;
31 | background-image: -webkit-linear-gradient($deg, $start-color, $end-color); // Safari 5.1-6, Chrome 10+
32 | background-image: -o-linear-gradient($deg, $start-color, $end-color); // Opera 12
33 | background-image: linear-gradient($deg, $start-color, $end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
34 | }
35 | @mixin gradient-horizontal-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
36 | background-image: -webkit-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color);
37 | background-image: -o-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color);
38 | background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
39 | background-repeat: no-repeat;
40 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=1); // IE9 and down, gets no color-stop at all for proper fallback
41 | }
42 | @mixin gradient-vertical-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
43 | background-image: -webkit-linear-gradient($start-color, $mid-color $color-stop, $end-color);
44 | background-image: -o-linear-gradient($start-color, $mid-color $color-stop, $end-color);
45 | background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
46 | background-repeat: no-repeat;
47 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down, gets no color-stop at all for proper fallback
48 | }
49 | @mixin gradient-radial($inner-color: #555, $outer-color: #333) {
50 | background-image: -webkit-radial-gradient(circle, $inner-color, $outer-color);
51 | background-image: radial-gradient(circle, $inner-color, $outer-color);
52 | background-repeat: no-repeat;
53 | }
54 | @mixin gradient-striped($color: rgba(255,255,255,.15), $angle: 45deg) {
55 | background-image: -webkit-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
56 | background-image: -o-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
57 | background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
58 | }
59 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_buttons.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Buttons
3 | // --------------------------------------------------
4 |
5 |
6 | // Base styles
7 | // --------------------------------------------------
8 |
9 | .btn {
10 | display: inline-block;
11 | margin-bottom: 0; // For input.btn
12 | font-weight: $btn-font-weight;
13 | text-align: center;
14 | vertical-align: middle;
15 | touch-action: manipulation;
16 | cursor: pointer;
17 | background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
18 | border: 1px solid transparent;
19 | white-space: nowrap;
20 | @include button-size($padding-base-vertical, $padding-base-horizontal, $font-size-base, $line-height-base, $btn-border-radius-base);
21 | @include user-select(none);
22 |
23 | &,
24 | &:active,
25 | &.active {
26 | &:focus,
27 | &.focus {
28 | @include tab-focus;
29 | }
30 | }
31 |
32 | &:hover,
33 | &:focus,
34 | &.focus {
35 | color: $btn-default-color;
36 | text-decoration: none;
37 | }
38 |
39 | &:active,
40 | &.active {
41 | outline: 0;
42 | background-image: none;
43 | @include box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
44 | }
45 |
46 | &.disabled,
47 | &[disabled],
48 | fieldset[disabled] & {
49 | cursor: $cursor-disabled;
50 | @include opacity(.65);
51 | @include box-shadow(none);
52 | }
53 |
54 | // [converter] extracted a& to a.btn
55 | }
56 |
57 | a.btn {
58 | &.disabled,
59 | fieldset[disabled] & {
60 | pointer-events: none; // Future-proof disabling of clicks on `
` elements
61 | }
62 | }
63 |
64 |
65 | // Alternate buttons
66 | // --------------------------------------------------
67 |
68 | .btn-default {
69 | @include button-variant($btn-default-color, $btn-default-bg, $btn-default-border);
70 | }
71 | .btn-primary {
72 | @include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border);
73 | }
74 | // Success appears as green
75 | .btn-success {
76 | @include button-variant($btn-success-color, $btn-success-bg, $btn-success-border);
77 | }
78 | // Info appears as blue-green
79 | .btn-info {
80 | @include button-variant($btn-info-color, $btn-info-bg, $btn-info-border);
81 | }
82 | // Warning appears as orange
83 | .btn-warning {
84 | @include button-variant($btn-warning-color, $btn-warning-bg, $btn-warning-border);
85 | }
86 | // Danger and error appear as red
87 | .btn-danger {
88 | @include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border);
89 | }
90 |
91 |
92 | // Link buttons
93 | // -------------------------
94 |
95 | // Make a button look and behave like a link
96 | .btn-link {
97 | color: $link-color;
98 | font-weight: normal;
99 | border-radius: 0;
100 |
101 | &,
102 | &:active,
103 | &.active,
104 | &[disabled],
105 | fieldset[disabled] & {
106 | background-color: transparent;
107 | @include box-shadow(none);
108 | }
109 | &,
110 | &:hover,
111 | &:focus,
112 | &:active {
113 | border-color: transparent;
114 | }
115 | &:hover,
116 | &:focus {
117 | color: $link-hover-color;
118 | text-decoration: $link-hover-decoration;
119 | background-color: transparent;
120 | }
121 | &[disabled],
122 | fieldset[disabled] & {
123 | &:hover,
124 | &:focus {
125 | color: $btn-link-disabled-color;
126 | text-decoration: none;
127 | }
128 | }
129 | }
130 |
131 |
132 | // Button Sizes
133 | // --------------------------------------------------
134 |
135 | .btn-lg {
136 | // line-height: ensure even-numbered height of button next to large input
137 | @include button-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $btn-border-radius-large);
138 | }
139 | .btn-sm {
140 | // line-height: ensure proper height of button next to small input
141 | @include button-size($padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
142 | }
143 | .btn-xs {
144 | @include button-size($padding-xs-vertical, $padding-xs-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
145 | }
146 |
147 |
148 | // Block button
149 | // --------------------------------------------------
150 |
151 | .btn-block {
152 | display: block;
153 | width: 100%;
154 | }
155 |
156 | // Vertically space out multiple block buttons
157 | .btn-block + .btn-block {
158 | margin-top: 5px;
159 | }
160 |
161 | // Specificity overrides
162 | input[type="submit"],
163 | input[type="reset"],
164 | input[type="button"] {
165 | &.btn-block {
166 | width: 100%;
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/javascripts/bootstrap/tab.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: tab.js v3.3.7
3 | * http://getbootstrap.com/javascript/#tabs
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // TAB CLASS DEFINITION
14 | // ====================
15 |
16 | var Tab = function (element) {
17 | // jscs:disable requireDollarBeforejQueryAssignment
18 | this.element = $(element)
19 | // jscs:enable requireDollarBeforejQueryAssignment
20 | }
21 |
22 | Tab.VERSION = '3.3.7'
23 |
24 | Tab.TRANSITION_DURATION = 150
25 |
26 | Tab.prototype.show = function () {
27 | var $this = this.element
28 | var $ul = $this.closest('ul:not(.dropdown-menu)')
29 | var selector = $this.data('target')
30 |
31 | if (!selector) {
32 | selector = $this.attr('href')
33 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
34 | }
35 |
36 | if ($this.parent('li').hasClass('active')) return
37 |
38 | var $previous = $ul.find('.active:last a')
39 | var hideEvent = $.Event('hide.bs.tab', {
40 | relatedTarget: $this[0]
41 | })
42 | var showEvent = $.Event('show.bs.tab', {
43 | relatedTarget: $previous[0]
44 | })
45 |
46 | $previous.trigger(hideEvent)
47 | $this.trigger(showEvent)
48 |
49 | if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
50 |
51 | var $target = $(selector)
52 |
53 | this.activate($this.closest('li'), $ul)
54 | this.activate($target, $target.parent(), function () {
55 | $previous.trigger({
56 | type: 'hidden.bs.tab',
57 | relatedTarget: $this[0]
58 | })
59 | $this.trigger({
60 | type: 'shown.bs.tab',
61 | relatedTarget: $previous[0]
62 | })
63 | })
64 | }
65 |
66 | Tab.prototype.activate = function (element, container, callback) {
67 | var $active = container.find('> .active')
68 | var transition = callback
69 | && $.support.transition
70 | && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
71 |
72 | function next() {
73 | $active
74 | .removeClass('active')
75 | .find('> .dropdown-menu > .active')
76 | .removeClass('active')
77 | .end()
78 | .find('[data-toggle="tab"]')
79 | .attr('aria-expanded', false)
80 |
81 | element
82 | .addClass('active')
83 | .find('[data-toggle="tab"]')
84 | .attr('aria-expanded', true)
85 |
86 | if (transition) {
87 | element[0].offsetWidth // reflow for transition
88 | element.addClass('in')
89 | } else {
90 | element.removeClass('fade')
91 | }
92 |
93 | if (element.parent('.dropdown-menu').length) {
94 | element
95 | .closest('li.dropdown')
96 | .addClass('active')
97 | .end()
98 | .find('[data-toggle="tab"]')
99 | .attr('aria-expanded', true)
100 | }
101 |
102 | callback && callback()
103 | }
104 |
105 | $active.length && transition ?
106 | $active
107 | .one('bsTransitionEnd', next)
108 | .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
109 | next()
110 |
111 | $active.removeClass('in')
112 | }
113 |
114 |
115 | // TAB PLUGIN DEFINITION
116 | // =====================
117 |
118 | function Plugin(option) {
119 | return this.each(function () {
120 | var $this = $(this)
121 | var data = $this.data('bs.tab')
122 |
123 | if (!data) $this.data('bs.tab', (data = new Tab(this)))
124 | if (typeof option == 'string') data[option]()
125 | })
126 | }
127 |
128 | var old = $.fn.tab
129 |
130 | $.fn.tab = Plugin
131 | $.fn.tab.Constructor = Tab
132 |
133 |
134 | // TAB NO CONFLICT
135 | // ===============
136 |
137 | $.fn.tab.noConflict = function () {
138 | $.fn.tab = old
139 | return this
140 | }
141 |
142 |
143 | // TAB DATA-API
144 | // ============
145 |
146 | var clickHandler = function (e) {
147 | e.preventDefault()
148 | Plugin.call($(this), 'show')
149 | }
150 |
151 | $(document)
152 | .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
153 | .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
154 |
155 | }(jQuery);
156 |
--------------------------------------------------------------------------------
/main/utils/showcase.js:
--------------------------------------------------------------------------------
1 | // Native
2 | const path = require('path')
3 |
4 | // Packages
5 | const electron = require('electron')
6 | const ejse = require('ejs-electron')
7 | const fs = require('fs-extra')
8 | const {Dataset} = require('data.js')
9 | const { resolve: resolvePath } = require('app-root-path')
10 | const toArray = require('stream-to-array')
11 | const {config, validate} = require('datahub-client')
12 |
13 | // Utils
14 | const prepareDatasetFromFile = require('./prepare')
15 | const { error: showError } = require('../dialogs')
16 | const toggleWindow = require('./frames/toggle')
17 | const {dpInReadme, textToMarkdown, makeSmallReadme} = require('./markdown')
18 |
19 |
20 | module.exports = async (files) => {
21 | if (files.length === 1) {
22 | const path_ = files[0]
23 | if (fs.lstatSync(path_).isFile()) {
24 | // If it is "datapackage.json" then use it, otherwise generate one from data file:
25 | const pathParts = path.parse(path_)
26 | let dataset
27 | try {
28 | if (pathParts.base === 'datapackage.json') {
29 | dataset = await Dataset.load(path_)
30 | } else {
31 | dataset = await prepareDatasetFromFile(path_)
32 | }
33 | } catch (err) {
34 | showError(err.message)
35 | return
36 | }
37 | // Validate metadata before rendering the showcase page:
38 | try {
39 | await validate.validateMetadata(dataset.descriptor)
40 | } catch (err) {
41 | // If invalid, show the first error:
42 | showError(err[0].message)
43 | return
44 | }
45 | // Making a copy of dp to use in the compiled README
46 | const initialDp = Object.assign({}, dataset.descriptor)
47 | // Add previews for CSV files:
48 | dataset.descriptor.views = dataset.descriptor.views || []
49 | dataset.descriptor.resources.forEach(resource => {
50 | if (resource.format === 'csv') {
51 | const preview = {
52 | "datahub": {
53 | "type": "preview"
54 | },
55 | "resources": [resource.name],
56 | "specType": "table"
57 | }
58 | dataset.descriptor.views.push(preview)
59 | }
60 | })
61 | // Add base path:
62 | dataset.descriptor.path = path_.replace('/datapackage.json', '')
63 | // Make resources with inlined data so we don't need `fs` module in browser:
64 | for (let i = 0; i < dataset.resources.length; i++) {
65 | if (dataset.resources[i].descriptor.format === 'csv') {
66 | const rows = await dataset.resources[i].rows()
67 | dataset.descriptor.resources[i].data = await toArray(rows)
68 | } else {
69 | const buffer = await dataset.resources[i].buffer
70 | dataset.descriptor.resources[i].data = JSON.parse(buffer.toString())
71 | }
72 | }
73 | // If readme exists then convert md to html:
74 | if (dataset.descriptor.readme) {
75 | const readmeCompiled = dpInReadme(dataset.descriptor.readme, initialDp)
76 | dataset.descriptor.readmeHtml = textToMarkdown(readmeCompiled)
77 | dataset.descriptor.readmeSnippet = makeSmallReadme(dataset.descriptor.readme)
78 | }
79 | // Set variables for rendering the showcase page:
80 | ejse.data('dataset', dataset.descriptor)
81 | ejse.data('dpId', JSON.stringify(dataset.descriptor).replace(/\\/g, '\\\\').replace(/\'/g, "\\'"))
82 | ejse.data('originalPath', path_)
83 | ejse.data('owner', config.get('profile').username)
84 | ejse.data('initialDp', initialDp)
85 | ejse.data('fieldTypes', [
86 | 'string', 'number', 'integer', 'boolean', 'object', 'array', 'date',
87 | 'time', 'datetime', 'year', 'yearmonth', 'duration', 'geopoint',
88 | 'geojson', 'any'
89 | ])
90 | // Initialize and toggle the window:
91 | const win = new electron.BrowserWindow({
92 | width: 1000,
93 | height: 700,
94 | title: 'Welcome to DataHub',
95 | resizable: false,
96 | center: true,
97 | show: false,
98 | fullscreenable: false,
99 | maximizable: false,
100 | webPreferences: {
101 | backgroundThrottling: false,
102 | devTools: true
103 | }
104 | })
105 | win.loadURL('file://' + resolvePath('./main/pages/showcase.ejs'))
106 | toggleWindow(null, win)
107 | } else {
108 | showError('Sorry, currently you can drop in a single file. Directory support is coming!')
109 | }
110 | } else if (files.length > 1) {
111 | showError('Sorry, currently you can drop in a single file. Multiple files support is coming!')
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/main/updates.js:
--------------------------------------------------------------------------------
1 | // Native
2 | const path = require('path')
3 | const url = require('url')
4 | const { homedir } = require('os')
5 |
6 | // Packages
7 | const {ipcMain} = require('electron')
8 | const isDev = require('electron-is-dev')
9 | const ms = require('ms')
10 | const semVer = require('semver')
11 | const trimWhitespace = require('trim')
12 | const exists = require('path-exists')
13 | const { exec } = require('child-process-promise')
14 |
15 | // Utilities
16 | const { version } = require('../package')
17 | const notify = require('./notify')
18 | const binaryUtils = require('./utils/binary')
19 |
20 | const localBinaryVersion = async () => {
21 | // We need to modify the `cwd` to prevent the app itself (Now.exe) to be
22 | // executed on Windows. On other platforms this shouldn't produce side effects.
23 | const fullPath = binaryUtils.getFile()
24 | const cmd = await exec(`${fullPath} --version`, { cwd: homedir() })
25 |
26 | if (!cmd.stdout) {
27 | throw new Error('Not version tag received from `now -v`')
28 | }
29 |
30 | // Make version tag parsable
31 | const output = trimWhitespace(cmd.stdout.toString())
32 |
33 | if (semVer.valid(output)) {
34 | return output
35 | }
36 | }
37 |
38 |
39 | const updateBinary = async (win) => {
40 | if (process.env.CONNECTION === 'offline') {
41 | return
42 | }
43 |
44 | const fullPath = binaryUtils.getFile()
45 | if (isDev) {
46 | console.log('Full path to local binary file: ' + fullPath)
47 | }
48 |
49 | console.log('Checking for binary updates at remote...')
50 | const remote = await binaryUtils.getURL()
51 |
52 | if (await exists(fullPath)) {
53 | const currentRemote = remote.version
54 | const currentLocal = await localBinaryVersion()
55 |
56 | if (isDev) {
57 | console.log('Current remote version: ' + currentRemote)
58 | console.log('Current local version: ' + currentLocal)
59 | }
60 |
61 | // Force an update if "data --version" fails
62 | if (currentLocal) {
63 | const comparison = semVer.compare(currentLocal, currentRemote)
64 |
65 | if (comparison !== -1) {
66 | // Notify user that no updates available
67 | win.webContents.send('binaryUpdate', {currentLocal})
68 | console.log('No updates found for binary')
69 | return
70 | }
71 | // Notify user what is current version and what will be downloaded:
72 | win.webContents.send('binaryUpdate', {currentLocal, currentRemote})
73 | console.log('Found an update for binary! Downloading...')
74 | }
75 | } else {
76 | // Notify user that binary is not found locally so it'll be installed
77 | win.webContents.send('binaryUpdate', {})
78 | console.log('No binary exists locally. Installing the binary...')
79 | }
80 |
81 | const updateFile = await binaryUtils.download(remote.url, remote.binaryName, (percantage) => {
82 | win.webContents.send('progress', percantage)
83 | })
84 |
85 | // Check if the binary is working before moving it into place
86 | try {
87 | await binaryUtils.testBinary(updateFile.path)
88 | } catch (err) {
89 | console.log('The downloaded binary is broken')
90 | updateFile.cleanup()
91 |
92 | throw err
93 | }
94 |
95 | // Make sure there's no existing binary in the way
96 | await binaryUtils.handleExisting(updateFile.path)
97 |
98 | // Remove temporary directory that contained the update
99 | updateFile.cleanup()
100 |
101 | // Check the version of the installed binary
102 | const newVersion = await localBinaryVersion()
103 |
104 | notify({
105 | title: 'Updated DataHub CLI to Version ' + newVersion,
106 | body:
107 | 'Feel free to try it in your terminal or click to see what has changed!',
108 | url: 'https://github.com/datahq/datahub-cli/releases/tag/v' + newVersion
109 | })
110 | }
111 |
112 |
113 | const startBinaryUpdates = (win) => {
114 | const binaryUpdateTimer = time =>
115 | setTimeout(async () => {
116 | try {
117 | await updateBinary(win)
118 | if (isDev) {
119 | console.log('Finished binary updates... Next check in 10m')
120 | }
121 | setTimeout(() => {
122 | win.loadURL(url.format({
123 | pathname: path.join(__dirname, 'pages/done.ejs'),
124 | protocol: 'file:',
125 | slashes: true
126 | }))
127 | }, 3000)
128 | binaryUpdateTimer(ms('10m'))
129 | } catch (err) {
130 | console.log(err)
131 | win.loadURL(url.format({
132 | pathname: path.join(__dirname, 'pages/error.ejs'),
133 | protocol: 'file:',
134 | slashes: true
135 | }))
136 | binaryUpdateTimer(ms('1m'))
137 | }
138 | }, time)
139 |
140 | binaryUpdateTimer(ms('2s'))
141 | }
142 |
143 |
144 | module.exports = (win) => {
145 | if (process.platform === 'linux') {
146 | return
147 | }
148 |
149 | if (isDev) {
150 | console.log('Starting binary updates...')
151 | }
152 |
153 | startBinaryUpdates(win)
154 | }
155 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_input-groups.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Input groups
3 | // --------------------------------------------------
4 |
5 | // Base styles
6 | // -------------------------
7 | .input-group {
8 | position: relative; // For dropdowns
9 | display: table;
10 | border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table
11 |
12 | // Undo padding and float of grid classes
13 | &[class*="col-"] {
14 | float: none;
15 | padding-left: 0;
16 | padding-right: 0;
17 | }
18 |
19 | .form-control {
20 | // Ensure that the input is always above the *appended* addon button for
21 | // proper border colors.
22 | position: relative;
23 | z-index: 2;
24 |
25 | // IE9 fubars the placeholder attribute in text inputs and the arrows on
26 | // select elements in input groups. To fix it, we float the input. Details:
27 | // https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855
28 | float: left;
29 |
30 | width: 100%;
31 | margin-bottom: 0;
32 |
33 | &:focus {
34 | z-index: 3;
35 | }
36 | }
37 | }
38 |
39 | // Sizing options
40 | //
41 | // Remix the default form control sizing classes into new ones for easier
42 | // manipulation.
43 |
44 | .input-group-lg > .form-control,
45 | .input-group-lg > .input-group-addon,
46 | .input-group-lg > .input-group-btn > .btn {
47 | @extend .input-lg;
48 | }
49 | .input-group-sm > .form-control,
50 | .input-group-sm > .input-group-addon,
51 | .input-group-sm > .input-group-btn > .btn {
52 | @extend .input-sm;
53 | }
54 |
55 |
56 | // Display as table-cell
57 | // -------------------------
58 | .input-group-addon,
59 | .input-group-btn,
60 | .input-group .form-control {
61 | display: table-cell;
62 |
63 | &:not(:first-child):not(:last-child) {
64 | border-radius: 0;
65 | }
66 | }
67 | // Addon and addon wrapper for buttons
68 | .input-group-addon,
69 | .input-group-btn {
70 | width: 1%;
71 | white-space: nowrap;
72 | vertical-align: middle; // Match the inputs
73 | }
74 |
75 | // Text input groups
76 | // -------------------------
77 | .input-group-addon {
78 | padding: $padding-base-vertical $padding-base-horizontal;
79 | font-size: $font-size-base;
80 | font-weight: normal;
81 | line-height: 1;
82 | color: $input-color;
83 | text-align: center;
84 | background-color: $input-group-addon-bg;
85 | border: 1px solid $input-group-addon-border-color;
86 | border-radius: $input-border-radius;
87 |
88 | // Sizing
89 | &.input-sm {
90 | padding: $padding-small-vertical $padding-small-horizontal;
91 | font-size: $font-size-small;
92 | border-radius: $input-border-radius-small;
93 | }
94 | &.input-lg {
95 | padding: $padding-large-vertical $padding-large-horizontal;
96 | font-size: $font-size-large;
97 | border-radius: $input-border-radius-large;
98 | }
99 |
100 | // Nuke default margins from checkboxes and radios to vertically center within.
101 | input[type="radio"],
102 | input[type="checkbox"] {
103 | margin-top: 0;
104 | }
105 | }
106 |
107 | // Reset rounded corners
108 | .input-group .form-control:first-child,
109 | .input-group-addon:first-child,
110 | .input-group-btn:first-child > .btn,
111 | .input-group-btn:first-child > .btn-group > .btn,
112 | .input-group-btn:first-child > .dropdown-toggle,
113 | .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
114 | .input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
115 | @include border-right-radius(0);
116 | }
117 | .input-group-addon:first-child {
118 | border-right: 0;
119 | }
120 | .input-group .form-control:last-child,
121 | .input-group-addon:last-child,
122 | .input-group-btn:last-child > .btn,
123 | .input-group-btn:last-child > .btn-group > .btn,
124 | .input-group-btn:last-child > .dropdown-toggle,
125 | .input-group-btn:first-child > .btn:not(:first-child),
126 | .input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
127 | @include border-left-radius(0);
128 | }
129 | .input-group-addon:last-child {
130 | border-left: 0;
131 | }
132 |
133 | // Button input groups
134 | // -------------------------
135 | .input-group-btn {
136 | position: relative;
137 | // Jankily prevent input button groups from wrapping with `white-space` and
138 | // `font-size` in combination with `inline-block` on buttons.
139 | font-size: 0;
140 | white-space: nowrap;
141 |
142 | // Negative margin for spacing, position for bringing hovered/focused/actived
143 | // element above the siblings.
144 | > .btn {
145 | position: relative;
146 | + .btn {
147 | margin-left: -1px;
148 | }
149 | // Bring the "active" button to the front
150 | &:hover,
151 | &:focus,
152 | &:active {
153 | z-index: 2;
154 | }
155 | }
156 |
157 | // Negative margin to only have a 1px border between the two
158 | &:first-child {
159 | > .btn,
160 | > .btn-group {
161 | margin-right: -1px;
162 | }
163 | }
164 | &:last-child {
165 | > .btn,
166 | > .btn-group {
167 | z-index: 2;
168 | margin-left: -1px;
169 | }
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/main/utils/frames/list.js:
--------------------------------------------------------------------------------
1 | // Native
2 | const path = require('path')
3 | const url = require('url')
4 |
5 | // Packages
6 | const electron = require('electron')
7 | const isDev = require('electron-is-dev')
8 | const { resolve } = require('app-root-path')
9 |
10 | // Utilities
11 | const attachTrayState = require('../highlight')
12 | const positionWindow = require('./position')
13 |
14 | // Check if Windows
15 | const isWinOS = process.platform === 'win32'
16 |
17 | const windowURL = page => {
18 | return url.format({
19 | pathname: path.join(__dirname, `../../pages/${page}.ejs`),
20 | protocol: 'file:',
21 | slashes: true
22 | })
23 | }
24 |
25 | exports.tutorialWindow = tray => {
26 | const win = new electron.BrowserWindow({
27 | width: 650,
28 | height: 430,
29 | title: 'Welcome to DataHub',
30 | resizable: false,
31 | center: true,
32 | frame: false,
33 | show: false,
34 | fullscreenable: false,
35 | maximizable: false,
36 | titleBarStyle: 'hidden-inset',
37 | backgroundColor: '#000',
38 | webPreferences: {
39 | backgroundThrottling: false,
40 | devTools: true
41 | }
42 | })
43 |
44 | win.loadURL(windowURL('tutorial'))
45 | attachTrayState(win, tray)
46 |
47 | const emitTrayClick = aboutWindow => {
48 | const emitClick = () => {
49 | if (aboutWindow && aboutWindow.isVisible()) {
50 | return
51 | }
52 |
53 | // Automatically open the context menu
54 | if (tray) {
55 | tray.emit('click')
56 | }
57 |
58 | win.removeListener('hide', emitClick)
59 | }
60 |
61 | win.on('hide', emitClick)
62 | win.close()
63 | }
64 |
65 | win.on('open-tray', emitTrayClick)
66 |
67 | // Just hand it back
68 | return win
69 | }
70 |
71 |
72 | exports.loginWindow = tray => {
73 | let windowHeight = 382
74 |
75 | if (isWinOS) {
76 | windowHeight -= 12
77 | }
78 |
79 | const win = new electron.BrowserWindow({
80 | width: 330,
81 | height: windowHeight,
82 | title: 'Now',
83 | resizable: false,
84 | show: false,
85 | fullscreenable: false,
86 | maximizable: false,
87 | minimizable: false,
88 | transparent: true,
89 | frame: false,
90 | movable: false,
91 | webPreferences: {
92 | backgroundThrottling: false,
93 | devTools: true
94 | }
95 | })
96 |
97 | positionWindow(tray, win)
98 |
99 | win.loadURL(windowURL('login'))
100 | attachTrayState(win, tray)
101 |
102 | // Hide window if it's not focused anymore
103 | // This can only happen if the dev tools are not open
104 | // Otherwise, we won't be able to debug the renderer
105 | win.on('blur', () => {
106 | if (win.webContents.isDevToolsOpened()) {
107 | return
108 | }
109 |
110 | if (!isWinOS) {
111 | win.close()
112 | return
113 | }
114 |
115 | const { screen } = electron
116 | const cursor = screen.getCursorScreenPoint()
117 | const trayBounds = global.tray.getBounds()
118 |
119 | const xAfter = cursor.x <= trayBounds.x + trayBounds.width
120 | const x = cursor.x >= trayBounds.x && xAfter
121 | const yAfter = trayBounds.y + trayBounds.height
122 | const y = cursor.y >= trayBounds.y && cursor.y <= yAfter
123 |
124 | // Don't close the window on click on the tray icon
125 | // Because that will already toogle the window
126 | if (x && y) {
127 | return
128 | }
129 |
130 | win.close()
131 | })
132 |
133 | return win
134 | }
135 |
136 |
137 | exports.mainWindow = tray => {
138 | let windowHeight = 382
139 |
140 | if (isWinOS) {
141 | windowHeight -= 12
142 | }
143 |
144 | const win = new electron.BrowserWindow({
145 | width: 330,
146 | height: windowHeight,
147 | title: 'Now',
148 | resizable: false,
149 | show: false,
150 | fullscreenable: false,
151 | maximizable: false,
152 | minimizable: false,
153 | transparent: true,
154 | frame: false,
155 | movable: false,
156 | webPreferences: {
157 | backgroundThrottling: false,
158 | devTools: true
159 | }
160 | })
161 |
162 | positionWindow(tray, win)
163 |
164 | win.loadURL(windowURL('home'))
165 | attachTrayState(win, tray)
166 |
167 | // Hide window if it's not focused anymore
168 | // This can only happen if the dev tools are not open
169 | // Otherwise, we won't be able to debug the renderer
170 | win.on('blur', () => {
171 | if (win.webContents.isDevToolsOpened()) {
172 | return
173 | }
174 |
175 | if (!isWinOS) {
176 | win.close()
177 | return
178 | }
179 |
180 | const { screen } = electron
181 | const cursor = screen.getCursorScreenPoint()
182 | const trayBounds = global.tray.getBounds()
183 |
184 | const xAfter = cursor.x <= trayBounds.x + trayBounds.width
185 | const x = cursor.x >= trayBounds.x && xAfter
186 | const yAfter = trayBounds.y + trayBounds.height
187 | const y = cursor.y >= trayBounds.y && cursor.y <= yAfter
188 |
189 | // Don't close the window on click on the tray icon
190 | // Because that will already toogle the window
191 | if (x && y) {
192 | return
193 | }
194 |
195 | win.close()
196 | })
197 |
198 | return win
199 | }
200 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_responsive-utilities.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Responsive: Utility classes
3 | // --------------------------------------------------
4 |
5 |
6 | // IE10 in Windows (Phone) 8
7 | //
8 | // Support for responsive views via media queries is kind of borked in IE10, for
9 | // Surface/desktop in split view and for Windows Phone 8. This particular fix
10 | // must be accompanied by a snippet of JavaScript to sniff the user agent and
11 | // apply some conditional CSS to *only* the Surface/desktop Windows 8. Look at
12 | // our Getting Started page for more information on this bug.
13 | //
14 | // For more information, see the following:
15 | //
16 | // Issue: https://github.com/twbs/bootstrap/issues/10497
17 | // Docs: http://getbootstrap.com/getting-started/#support-ie10-width
18 | // Source: http://timkadlec.com/2013/01/windows-phone-8-and-device-width/
19 | // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/
20 |
21 | @at-root {
22 | @-ms-viewport {
23 | width: device-width;
24 | }
25 | }
26 |
27 |
28 | // Visibility utilities
29 | // Note: Deprecated .visible-xs, .visible-sm, .visible-md, and .visible-lg as of v3.2.0
30 |
31 | @include responsive-invisibility('.visible-xs');
32 | @include responsive-invisibility('.visible-sm');
33 | @include responsive-invisibility('.visible-md');
34 | @include responsive-invisibility('.visible-lg');
35 |
36 | .visible-xs-block,
37 | .visible-xs-inline,
38 | .visible-xs-inline-block,
39 | .visible-sm-block,
40 | .visible-sm-inline,
41 | .visible-sm-inline-block,
42 | .visible-md-block,
43 | .visible-md-inline,
44 | .visible-md-inline-block,
45 | .visible-lg-block,
46 | .visible-lg-inline,
47 | .visible-lg-inline-block {
48 | display: none !important;
49 | }
50 |
51 | @media (max-width: $screen-xs-max) {
52 | @include responsive-visibility('.visible-xs');
53 | }
54 | .visible-xs-block {
55 | @media (max-width: $screen-xs-max) {
56 | display: block !important;
57 | }
58 | }
59 | .visible-xs-inline {
60 | @media (max-width: $screen-xs-max) {
61 | display: inline !important;
62 | }
63 | }
64 | .visible-xs-inline-block {
65 | @media (max-width: $screen-xs-max) {
66 | display: inline-block !important;
67 | }
68 | }
69 |
70 | @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
71 | @include responsive-visibility('.visible-sm');
72 | }
73 | .visible-sm-block {
74 | @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
75 | display: block !important;
76 | }
77 | }
78 | .visible-sm-inline {
79 | @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
80 | display: inline !important;
81 | }
82 | }
83 | .visible-sm-inline-block {
84 | @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
85 | display: inline-block !important;
86 | }
87 | }
88 |
89 | @media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
90 | @include responsive-visibility('.visible-md');
91 | }
92 | .visible-md-block {
93 | @media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
94 | display: block !important;
95 | }
96 | }
97 | .visible-md-inline {
98 | @media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
99 | display: inline !important;
100 | }
101 | }
102 | .visible-md-inline-block {
103 | @media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
104 | display: inline-block !important;
105 | }
106 | }
107 |
108 | @media (min-width: $screen-lg-min) {
109 | @include responsive-visibility('.visible-lg');
110 | }
111 | .visible-lg-block {
112 | @media (min-width: $screen-lg-min) {
113 | display: block !important;
114 | }
115 | }
116 | .visible-lg-inline {
117 | @media (min-width: $screen-lg-min) {
118 | display: inline !important;
119 | }
120 | }
121 | .visible-lg-inline-block {
122 | @media (min-width: $screen-lg-min) {
123 | display: inline-block !important;
124 | }
125 | }
126 |
127 | @media (max-width: $screen-xs-max) {
128 | @include responsive-invisibility('.hidden-xs');
129 | }
130 |
131 | @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
132 | @include responsive-invisibility('.hidden-sm');
133 | }
134 |
135 | @media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
136 | @include responsive-invisibility('.hidden-md');
137 | }
138 |
139 | @media (min-width: $screen-lg-min) {
140 | @include responsive-invisibility('.hidden-lg');
141 | }
142 |
143 |
144 | // Print utilities
145 | //
146 | // Media queries are placed on the inside to be mixin-friendly.
147 |
148 | // Note: Deprecated .visible-print as of v3.2.0
149 |
150 | @include responsive-invisibility('.visible-print');
151 |
152 | @media print {
153 | @include responsive-visibility('.visible-print');
154 | }
155 | .visible-print-block {
156 | display: none !important;
157 |
158 | @media print {
159 | display: block !important;
160 | }
161 | }
162 | .visible-print-inline {
163 | display: none !important;
164 |
165 | @media print {
166 | display: inline !important;
167 | }
168 | }
169 | .visible-print-inline-block {
170 | display: none !important;
171 |
172 | @media print {
173 | display: inline-block !important;
174 | }
175 | }
176 |
177 | @media print {
178 | @include responsive-invisibility('.hidden-print');
179 | }
180 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/javascripts/bootstrap/dropdown.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: dropdown.js v3.3.7
3 | * http://getbootstrap.com/javascript/#dropdowns
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // DROPDOWN CLASS DEFINITION
14 | // =========================
15 |
16 | var backdrop = '.dropdown-backdrop'
17 | var toggle = '[data-toggle="dropdown"]'
18 | var Dropdown = function (element) {
19 | $(element).on('click.bs.dropdown', this.toggle)
20 | }
21 |
22 | Dropdown.VERSION = '3.3.7'
23 |
24 | function getParent($this) {
25 | var selector = $this.attr('data-target')
26 |
27 | if (!selector) {
28 | selector = $this.attr('href')
29 | selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
30 | }
31 |
32 | var $parent = selector && $(selector)
33 |
34 | return $parent && $parent.length ? $parent : $this.parent()
35 | }
36 |
37 | function clearMenus(e) {
38 | if (e && e.which === 3) return
39 | $(backdrop).remove()
40 | $(toggle).each(function () {
41 | var $this = $(this)
42 | var $parent = getParent($this)
43 | var relatedTarget = { relatedTarget: this }
44 |
45 | if (!$parent.hasClass('open')) return
46 |
47 | if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
48 |
49 | $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
50 |
51 | if (e.isDefaultPrevented()) return
52 |
53 | $this.attr('aria-expanded', 'false')
54 | $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
55 | })
56 | }
57 |
58 | Dropdown.prototype.toggle = function (e) {
59 | var $this = $(this)
60 |
61 | if ($this.is('.disabled, :disabled')) return
62 |
63 | var $parent = getParent($this)
64 | var isActive = $parent.hasClass('open')
65 |
66 | clearMenus()
67 |
68 | if (!isActive) {
69 | if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
70 | // if mobile we use a backdrop because click events don't delegate
71 | $(document.createElement('div'))
72 | .addClass('dropdown-backdrop')
73 | .insertAfter($(this))
74 | .on('click', clearMenus)
75 | }
76 |
77 | var relatedTarget = { relatedTarget: this }
78 | $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
79 |
80 | if (e.isDefaultPrevented()) return
81 |
82 | $this
83 | .trigger('focus')
84 | .attr('aria-expanded', 'true')
85 |
86 | $parent
87 | .toggleClass('open')
88 | .trigger($.Event('shown.bs.dropdown', relatedTarget))
89 | }
90 |
91 | return false
92 | }
93 |
94 | Dropdown.prototype.keydown = function (e) {
95 | if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
96 |
97 | var $this = $(this)
98 |
99 | e.preventDefault()
100 | e.stopPropagation()
101 |
102 | if ($this.is('.disabled, :disabled')) return
103 |
104 | var $parent = getParent($this)
105 | var isActive = $parent.hasClass('open')
106 |
107 | if (!isActive && e.which != 27 || isActive && e.which == 27) {
108 | if (e.which == 27) $parent.find(toggle).trigger('focus')
109 | return $this.trigger('click')
110 | }
111 |
112 | var desc = ' li:not(.disabled):visible a'
113 | var $items = $parent.find('.dropdown-menu' + desc)
114 |
115 | if (!$items.length) return
116 |
117 | var index = $items.index(e.target)
118 |
119 | if (e.which == 38 && index > 0) index-- // up
120 | if (e.which == 40 && index < $items.length - 1) index++ // down
121 | if (!~index) index = 0
122 |
123 | $items.eq(index).trigger('focus')
124 | }
125 |
126 |
127 | // DROPDOWN PLUGIN DEFINITION
128 | // ==========================
129 |
130 | function Plugin(option) {
131 | return this.each(function () {
132 | var $this = $(this)
133 | var data = $this.data('bs.dropdown')
134 |
135 | if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
136 | if (typeof option == 'string') data[option].call($this)
137 | })
138 | }
139 |
140 | var old = $.fn.dropdown
141 |
142 | $.fn.dropdown = Plugin
143 | $.fn.dropdown.Constructor = Dropdown
144 |
145 |
146 | // DROPDOWN NO CONFLICT
147 | // ====================
148 |
149 | $.fn.dropdown.noConflict = function () {
150 | $.fn.dropdown = old
151 | return this
152 | }
153 |
154 |
155 | // APPLY TO STANDARD DROPDOWN ELEMENTS
156 | // ===================================
157 |
158 | $(document)
159 | .on('click.bs.dropdown.data-api', clearMenus)
160 | .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
161 | .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
162 | .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
163 | .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
164 |
165 | }(jQuery);
166 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/javascripts/bootstrap/scrollspy.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: scrollspy.js v3.3.7
3 | * http://getbootstrap.com/javascript/#scrollspy
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // SCROLLSPY CLASS DEFINITION
14 | // ==========================
15 |
16 | function ScrollSpy(element, options) {
17 | this.$body = $(document.body)
18 | this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
19 | this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
20 | this.selector = (this.options.target || '') + ' .nav li > a'
21 | this.offsets = []
22 | this.targets = []
23 | this.activeTarget = null
24 | this.scrollHeight = 0
25 |
26 | this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
27 | this.refresh()
28 | this.process()
29 | }
30 |
31 | ScrollSpy.VERSION = '3.3.7'
32 |
33 | ScrollSpy.DEFAULTS = {
34 | offset: 10
35 | }
36 |
37 | ScrollSpy.prototype.getScrollHeight = function () {
38 | return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
39 | }
40 |
41 | ScrollSpy.prototype.refresh = function () {
42 | var that = this
43 | var offsetMethod = 'offset'
44 | var offsetBase = 0
45 |
46 | this.offsets = []
47 | this.targets = []
48 | this.scrollHeight = this.getScrollHeight()
49 |
50 | if (!$.isWindow(this.$scrollElement[0])) {
51 | offsetMethod = 'position'
52 | offsetBase = this.$scrollElement.scrollTop()
53 | }
54 |
55 | this.$body
56 | .find(this.selector)
57 | .map(function () {
58 | var $el = $(this)
59 | var href = $el.data('target') || $el.attr('href')
60 | var $href = /^#./.test(href) && $(href)
61 |
62 | return ($href
63 | && $href.length
64 | && $href.is(':visible')
65 | && [[$href[offsetMethod]().top + offsetBase, href]]) || null
66 | })
67 | .sort(function (a, b) { return a[0] - b[0] })
68 | .each(function () {
69 | that.offsets.push(this[0])
70 | that.targets.push(this[1])
71 | })
72 | }
73 |
74 | ScrollSpy.prototype.process = function () {
75 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
76 | var scrollHeight = this.getScrollHeight()
77 | var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
78 | var offsets = this.offsets
79 | var targets = this.targets
80 | var activeTarget = this.activeTarget
81 | var i
82 |
83 | if (this.scrollHeight != scrollHeight) {
84 | this.refresh()
85 | }
86 |
87 | if (scrollTop >= maxScroll) {
88 | return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
89 | }
90 |
91 | if (activeTarget && scrollTop < offsets[0]) {
92 | this.activeTarget = null
93 | return this.clear()
94 | }
95 |
96 | for (i = offsets.length; i--;) {
97 | activeTarget != targets[i]
98 | && scrollTop >= offsets[i]
99 | && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
100 | && this.activate(targets[i])
101 | }
102 | }
103 |
104 | ScrollSpy.prototype.activate = function (target) {
105 | this.activeTarget = target
106 |
107 | this.clear()
108 |
109 | var selector = this.selector +
110 | '[data-target="' + target + '"],' +
111 | this.selector + '[href="' + target + '"]'
112 |
113 | var active = $(selector)
114 | .parents('li')
115 | .addClass('active')
116 |
117 | if (active.parent('.dropdown-menu').length) {
118 | active = active
119 | .closest('li.dropdown')
120 | .addClass('active')
121 | }
122 |
123 | active.trigger('activate.bs.scrollspy')
124 | }
125 |
126 | ScrollSpy.prototype.clear = function () {
127 | $(this.selector)
128 | .parentsUntil(this.options.target, '.active')
129 | .removeClass('active')
130 | }
131 |
132 |
133 | // SCROLLSPY PLUGIN DEFINITION
134 | // ===========================
135 |
136 | function Plugin(option) {
137 | return this.each(function () {
138 | var $this = $(this)
139 | var data = $this.data('bs.scrollspy')
140 | var options = typeof option == 'object' && option
141 |
142 | if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
143 | if (typeof option == 'string') data[option]()
144 | })
145 | }
146 |
147 | var old = $.fn.scrollspy
148 |
149 | $.fn.scrollspy = Plugin
150 | $.fn.scrollspy.Constructor = ScrollSpy
151 |
152 |
153 | // SCROLLSPY NO CONFLICT
154 | // =====================
155 |
156 | $.fn.scrollspy.noConflict = function () {
157 | $.fn.scrollspy = old
158 | return this
159 | }
160 |
161 |
162 | // SCROLLSPY DATA-API
163 | // ==================
164 |
165 | $(window).on('load.bs.scrollspy.data-api', function () {
166 | $('[data-spy="scroll"]').each(function () {
167 | var $spy = $(this)
168 | Plugin.call($spy, $spy.data())
169 | })
170 | })
171 |
172 | }(jQuery);
173 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/javascripts/bootstrap/affix.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: affix.js v3.3.7
3 | * http://getbootstrap.com/javascript/#affix
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // AFFIX CLASS DEFINITION
14 | // ======================
15 |
16 | var Affix = function (element, options) {
17 | this.options = $.extend({}, Affix.DEFAULTS, options)
18 |
19 | this.$target = $(this.options.target)
20 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
21 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
22 |
23 | this.$element = $(element)
24 | this.affixed = null
25 | this.unpin = null
26 | this.pinnedOffset = null
27 |
28 | this.checkPosition()
29 | }
30 |
31 | Affix.VERSION = '3.3.7'
32 |
33 | Affix.RESET = 'affix affix-top affix-bottom'
34 |
35 | Affix.DEFAULTS = {
36 | offset: 0,
37 | target: window
38 | }
39 |
40 | Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
41 | var scrollTop = this.$target.scrollTop()
42 | var position = this.$element.offset()
43 | var targetHeight = this.$target.height()
44 |
45 | if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
46 |
47 | if (this.affixed == 'bottom') {
48 | if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
49 | return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
50 | }
51 |
52 | var initializing = this.affixed == null
53 | var colliderTop = initializing ? scrollTop : position.top
54 | var colliderHeight = initializing ? targetHeight : height
55 |
56 | if (offsetTop != null && scrollTop <= offsetTop) return 'top'
57 | if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
58 |
59 | return false
60 | }
61 |
62 | Affix.prototype.getPinnedOffset = function () {
63 | if (this.pinnedOffset) return this.pinnedOffset
64 | this.$element.removeClass(Affix.RESET).addClass('affix')
65 | var scrollTop = this.$target.scrollTop()
66 | var position = this.$element.offset()
67 | return (this.pinnedOffset = position.top - scrollTop)
68 | }
69 |
70 | Affix.prototype.checkPositionWithEventLoop = function () {
71 | setTimeout($.proxy(this.checkPosition, this), 1)
72 | }
73 |
74 | Affix.prototype.checkPosition = function () {
75 | if (!this.$element.is(':visible')) return
76 |
77 | var height = this.$element.height()
78 | var offset = this.options.offset
79 | var offsetTop = offset.top
80 | var offsetBottom = offset.bottom
81 | var scrollHeight = Math.max($(document).height(), $(document.body).height())
82 |
83 | if (typeof offset != 'object') offsetBottom = offsetTop = offset
84 | if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
85 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
86 |
87 | var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
88 |
89 | if (this.affixed != affix) {
90 | if (this.unpin != null) this.$element.css('top', '')
91 |
92 | var affixType = 'affix' + (affix ? '-' + affix : '')
93 | var e = $.Event(affixType + '.bs.affix')
94 |
95 | this.$element.trigger(e)
96 |
97 | if (e.isDefaultPrevented()) return
98 |
99 | this.affixed = affix
100 | this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
101 |
102 | this.$element
103 | .removeClass(Affix.RESET)
104 | .addClass(affixType)
105 | .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
106 | }
107 |
108 | if (affix == 'bottom') {
109 | this.$element.offset({
110 | top: scrollHeight - height - offsetBottom
111 | })
112 | }
113 | }
114 |
115 |
116 | // AFFIX PLUGIN DEFINITION
117 | // =======================
118 |
119 | function Plugin(option) {
120 | return this.each(function () {
121 | var $this = $(this)
122 | var data = $this.data('bs.affix')
123 | var options = typeof option == 'object' && option
124 |
125 | if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
126 | if (typeof option == 'string') data[option]()
127 | })
128 | }
129 |
130 | var old = $.fn.affix
131 |
132 | $.fn.affix = Plugin
133 | $.fn.affix.Constructor = Affix
134 |
135 |
136 | // AFFIX NO CONFLICT
137 | // =================
138 |
139 | $.fn.affix.noConflict = function () {
140 | $.fn.affix = old
141 | return this
142 | }
143 |
144 |
145 | // AFFIX DATA-API
146 | // ==============
147 |
148 | $(window).on('load', function () {
149 | $('[data-spy="affix"]').each(function () {
150 | var $spy = $(this)
151 | var data = $spy.data()
152 |
153 | data.offset = data.offset || {}
154 |
155 | if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
156 | if (data.offsetTop != null) data.offset.top = data.offsetTop
157 |
158 | Plugin.call($spy, data)
159 | })
160 | })
161 |
162 | }(jQuery);
163 |
--------------------------------------------------------------------------------
/main/static/sass/_dataset.scss:
--------------------------------------------------------------------------------
1 | .showcase {
2 | max-width: 100%;
3 | @media (max-width: $screen-xs-min) {
4 | margin-bottom: 3em;
5 | }
6 | a.btn {
7 | padding: 8px 25px;
8 |
9 | }
10 |
11 | .input-group-addon {
12 | text-align: left;
13 | background-color: white;
14 | color: $black;
15 | }
16 |
17 | .input-group-btn {
18 | button {
19 | padding-left: 50px;
20 | padding-right: 50px;
21 | }
22 | }
23 |
24 | p.info {
25 | color: $gray;
26 | font-size: 10px;
27 | margin: 0;
28 | }
29 |
30 | .path {
31 | color: $brand-warning;
32 | font-weight: 100;
33 | }
34 |
35 | .edit-schema {
36 | padding: 0 14px;
37 | margin-left: 6px;
38 | }
39 |
40 | .resource-summary {
41 | input {
42 | width: 100%;
43 | &:disabled {
44 | background-color: transparent;
45 | border: 0;
46 | padding: 3px;
47 | }
48 | }
49 | }
50 |
51 | .findability {
52 | margin-top: 10px;
53 | text-align: center;
54 | input {
55 | margin-left: 10px;
56 | }
57 | }
58 | }
59 | h1 {
60 | margin-bottom: 0;
61 | input {
62 | width: 100%;
63 | border: 0;
64 | padding-bottom: 2px;
65 | border-bottom: 1px;
66 | border-style: inset;
67 | border-color: initial;
68 | border-image: initial;
69 | }
70 | span {
71 | vertical-align: middle !important;
72 | font-size: 14px !important;
73 | }
74 | }
75 | blockquote {
76 | font-size: inherit;
77 | }
78 | .avatar {
79 | width: 20px;
80 | display: inline-block;
81 | margin-right: 5px;
82 | }
83 | .info {
84 | table-layout: fixed;
85 | thead tr th {
86 | position: relative;
87 | font-size: 1.15em;
88 | border-bottom: 0;
89 | }
90 | tbody tr td {
91 | border-top: 0;
92 | overflow: hidden;
93 | white-space: nowrap;
94 | text-overflow: ellipsis;
95 | }
96 | }
97 | .resource-listing {
98 | table-layout: fixed;
99 | thead tr th {
100 | position: relative;
101 | border-bottom: 0;
102 | }
103 | tbody tr td {
104 | border-top: 0;
105 | overflow: hidden;
106 | white-space: nowrap;
107 | text-overflow: ellipsis;
108 | }
109 | }
110 | .readme-snippet {
111 | margin-bottom: 2em;
112 | }
113 | .side-bar {
114 | background-color: $brand-success;
115 | }
116 | .side-img {
117 | padding: 3% 4% 0 4%;
118 | }
119 | .side-section {
120 | margin: 50px 2vw 0 4vw;
121 | overflow-wrap: break-word;
122 | .btn-group a.btn {
123 | border: 0;
124 | }
125 | }
126 | .header {
127 | max-width: 700px;
128 | margin: auto;
129 | }
130 | .row-eq-height {
131 | max-width: 100vw;
132 | display: -webkit-box;
133 | display: -webkit-flex;
134 | display: -ms-flexbox;
135 | display: flex;
136 | }
137 | h2.publisher {
138 | font-style: italic;
139 | font-size: 1.8em;
140 | }
141 | .publisher {
142 | margin: 20px 0 20px 0;
143 | }
144 | .dataset {
145 | .main-img {
146 | padding: 10%;
147 | }
148 | .info {
149 | padding-top: 5%;
150 | }
151 | h2 {
152 | font-size: 1.5em;
153 | }
154 | h2.section-title {
155 | font-size: 1.9em;
156 | color: $brand-primary;
157 | a i {
158 | font-size: 0.7em;
159 | }
160 | }
161 | h3 {
162 | font-size: 1.3em;
163 | }
164 | .side-section h3 {
165 | font-size: 1.3em;
166 | margin-bottom: 0.8em;
167 | color: $black;
168 | @media (min-width: $screen-sm-min) {
169 | font-size: 1.3em;
170 | }
171 |
172 | @media (min-width: $screen-md-min) {
173 | font-size: 1.7em;
174 | }
175 | }
176 | .actions .row {
177 | margin-bottom: 2em;
178 | }
179 | .react-me {
180 | text-align: center;
181 | max-width: 100%;
182 | }
183 | .part {
184 | margin-bottom: 4em;
185 | }
186 | .notice {
187 | margin: 1em 0 4em;
188 | color: $gray;
189 | font-size: 12px;
190 | }
191 | .btn-group {
192 | margin-bottom: 10px;
193 | }
194 | .side-section {
195 | .table-bordered {
196 | border-color: darken($gray, 20%);
197 | th, td {
198 | border-color: darken($gray, 20%);
199 | }
200 | }
201 | }
202 | }
203 |
204 | .text-cube {
205 | margin: 0;
206 | padding: 2% 0;
207 | }
208 | .left-cube {
209 | padding-right: 0;
210 | }
211 | .right-cube {
212 | padding-left: 0;
213 | }
214 |
215 | .handsontable {
216 | height: 432px;
217 | overflow: hidden;
218 | }
219 | #hTable0, #hTable1, #hTable2, #hTable3, #hTable4, #hTable5,
220 | #hTable6, #hTable7, #hTable8, #hTable9, #hTable10,
221 | #hTable0v, #hTable1v, #hTable2v, #hTable3v {
222 | border-bottom: 1px solid #ccc;
223 | }
224 | #hTable0v, #hTable1v, #hTable2v, #hTable3v {
225 | margin-bottom: 30px;
226 | }
227 | .main-section {
228 | padding-left: calc(2vw + 15px);
229 | }
230 | .download {
231 | margin: 20px 0 4em 0;
232 | padding-right: 0;
233 | }
234 | .nav li.active a {
235 | color: white;
236 | &:hover, &:focus {
237 | color: white;
238 | }
239 | }
240 | .nav-pills li a {
241 | border: 1px solid #eee;
242 | }
243 | .tab-content {
244 | margin-top: 20px;
245 | }
246 |
247 | .logs {
248 | width: 100%;
249 | height: calc(100vh - 345px);
250 | }
251 | div.readme {
252 | img {
253 | max-width: 100%;
254 | }
255 |
256 | div.info {
257 | border: 1px solid $gray-light;
258 | border-radius: 2px;
259 | margin: 40px 0;
260 | padding: 20px;
261 | background-color: $gray-very-light;
262 | color: $gray;
263 | p {
264 | margin: 0;
265 | }
266 | }
267 |
268 | .header-anchor {
269 | i {
270 | font-size: 16px;
271 | color: $gray-light;
272 | padding: 0 6px;
273 | }
274 | }
275 | }
276 |
--------------------------------------------------------------------------------
/main/static/bootstrap/assets/stylesheets/bootstrap/_tables.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Tables
3 | // --------------------------------------------------
4 |
5 |
6 | table {
7 | background-color: $table-bg;
8 | }
9 | caption {
10 | padding-top: $table-cell-padding;
11 | padding-bottom: $table-cell-padding;
12 | color: $text-muted;
13 | text-align: left;
14 | }
15 | th {
16 | text-align: left;
17 | }
18 |
19 |
20 | // Baseline styles
21 |
22 | .table {
23 | width: 100%;
24 | max-width: 100%;
25 | margin-bottom: $line-height-computed;
26 | // Cells
27 | > thead,
28 | > tbody,
29 | > tfoot {
30 | > tr {
31 | > th,
32 | > td {
33 | padding: $table-cell-padding;
34 | line-height: $line-height-base;
35 | vertical-align: top;
36 | border-top: 1px solid $table-border-color;
37 | }
38 | }
39 | }
40 | // Bottom align for column headings
41 | > thead > tr > th {
42 | vertical-align: bottom;
43 | border-bottom: 2px solid $table-border-color;
44 | }
45 | // Remove top border from thead by default
46 | > caption + thead,
47 | > colgroup + thead,
48 | > thead:first-child {
49 | > tr:first-child {
50 | > th,
51 | > td {
52 | border-top: 0;
53 | }
54 | }
55 | }
56 | // Account for multiple tbody instances
57 | > tbody + tbody {
58 | border-top: 2px solid $table-border-color;
59 | }
60 |
61 | // Nesting
62 | .table {
63 | background-color: $body-bg;
64 | }
65 | }
66 |
67 |
68 | // Condensed table w/ half padding
69 |
70 | .table-condensed {
71 | > thead,
72 | > tbody,
73 | > tfoot {
74 | > tr {
75 | > th,
76 | > td {
77 | padding: $table-condensed-cell-padding;
78 | }
79 | }
80 | }
81 | }
82 |
83 |
84 | // Bordered version
85 | //
86 | // Add borders all around the table and between all the columns.
87 |
88 | .table-bordered {
89 | border: 1px solid $table-border-color;
90 | > thead,
91 | > tbody,
92 | > tfoot {
93 | > tr {
94 | > th,
95 | > td {
96 | border: 1px solid $table-border-color;
97 | }
98 | }
99 | }
100 | > thead > tr {
101 | > th,
102 | > td {
103 | border-bottom-width: 2px;
104 | }
105 | }
106 | }
107 |
108 |
109 | // Zebra-striping
110 | //
111 | // Default zebra-stripe styles (alternating gray and transparent backgrounds)
112 |
113 | .table-striped {
114 | > tbody > tr:nth-of-type(odd) {
115 | background-color: $table-bg-accent;
116 | }
117 | }
118 |
119 |
120 | // Hover effect
121 | //
122 | // Placed here since it has to come after the potential zebra striping
123 |
124 | .table-hover {
125 | > tbody > tr:hover {
126 | background-color: $table-bg-hover;
127 | }
128 | }
129 |
130 |
131 | // Table cell sizing
132 | //
133 | // Reset default table behavior
134 |
135 | table col[class*="col-"] {
136 | position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623)
137 | float: none;
138 | display: table-column;
139 | }
140 | table {
141 | td,
142 | th {
143 | &[class*="col-"] {
144 | position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623)
145 | float: none;
146 | display: table-cell;
147 | }
148 | }
149 | }
150 |
151 |
152 | // Table backgrounds
153 | //
154 | // Exact selectors below required to override `.table-striped` and prevent
155 | // inheritance to nested tables.
156 |
157 | // Generate the contextual variants
158 | @include table-row-variant('active', $table-bg-active);
159 | @include table-row-variant('success', $state-success-bg);
160 | @include table-row-variant('info', $state-info-bg);
161 | @include table-row-variant('warning', $state-warning-bg);
162 | @include table-row-variant('danger', $state-danger-bg);
163 |
164 |
165 | // Responsive tables
166 | //
167 | // Wrap your tables in `.table-responsive` and we'll make them mobile friendly
168 | // by enabling horizontal scrolling. Only applies <768px. Everything above that
169 | // will display normally.
170 |
171 | .table-responsive {
172 | overflow-x: auto;
173 | min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837)
174 |
175 | @media screen and (max-width: $screen-xs-max) {
176 | width: 100%;
177 | margin-bottom: ($line-height-computed * 0.75);
178 | overflow-y: hidden;
179 | -ms-overflow-style: -ms-autohiding-scrollbar;
180 | border: 1px solid $table-border-color;
181 |
182 | // Tighten up spacing
183 | > .table {
184 | margin-bottom: 0;
185 |
186 | // Ensure the content doesn't wrap
187 | > thead,
188 | > tbody,
189 | > tfoot {
190 | > tr {
191 | > th,
192 | > td {
193 | white-space: nowrap;
194 | }
195 | }
196 | }
197 | }
198 |
199 | // Special overrides for the bordered tables
200 | > .table-bordered {
201 | border: 0;
202 |
203 | // Nuke the appropriate borders so that the parent can handle them
204 | > thead,
205 | > tbody,
206 | > tfoot {
207 | > tr {
208 | > th:first-child,
209 | > td:first-child {
210 | border-left: 0;
211 | }
212 | > th:last-child,
213 | > td:last-child {
214 | border-right: 0;
215 | }
216 | }
217 | }
218 |
219 | // Only nuke the last row's bottom-border in `tbody` and `tfoot` since
220 | // chances are there will be only one `tr` in a `thead` and that would
221 | // remove the border altogether.
222 | > tbody,
223 | > tfoot {
224 | > tr:last-child {
225 | > th,
226 | > td {
227 | border-bottom: 0;
228 | }
229 | }
230 | }
231 |
232 | }
233 | }
234 | }
235 |
--------------------------------------------------------------------------------