hippo-fw 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/client/hippo/access/subscription-choice-layer.jsx +170 -0
  3. data/client/hippo/access/subscription-choice-layer/cancel-subscription.jsx +111 -0
  4. data/client/hippo/access/subscription-choice-layer/payment-form.jsx +154 -0
  5. data/client/hippo/access/subscription-choice-layer/subscription-choice.scss +29 -0
  6. data/client/hippo/boot.jsx +1 -1
  7. data/client/hippo/components/asset.jsx +1 -1
  8. data/client/hippo/components/asset.scss +1 -0
  9. data/client/hippo/components/data-table.jsx +36 -38
  10. data/client/hippo/components/date-time.jsx +25 -9
  11. data/client/hippo/components/form/api.js +1 -0
  12. data/client/hippo/components/form/fields.jsx +3 -2
  13. data/client/hippo/components/form/fields/checkbox-wrapper.jsx +1 -1
  14. data/client/hippo/components/form/fields/date-wrapper.jsx +1 -1
  15. data/client/hippo/components/form/fields/email-wrapper.jsx +31 -0
  16. data/client/hippo/components/form/fields/form-field.scss +8 -0
  17. data/client/hippo/components/form/fields/label.jsx +5 -7
  18. data/client/hippo/components/form/fields/select-wrapper.jsx +1 -1
  19. data/client/hippo/components/form/fields/tags-wrapper.jsx +1 -1
  20. data/client/hippo/components/form/fields/text-wrapper.jsx +1 -1
  21. data/client/hippo/components/form/fields/textarea-wrapper.jsx +1 -1
  22. data/client/hippo/components/form/wrapper.jsx +1 -1
  23. data/client/hippo/components/grid.js +1 -0
  24. data/client/hippo/components/master-detail.jsx +1 -1
  25. data/client/hippo/components/network-activity-overlay.jsx +6 -6
  26. data/client/hippo/components/payments/field.jsx +64 -0
  27. data/client/hippo/components/payments/field.scss +18 -0
  28. data/client/hippo/components/popout-window.jsx +1 -1
  29. data/client/hippo/components/query-builder.jsx +1 -1
  30. data/client/hippo/components/query-builder/boolean-picker.jsx +1 -1
  31. data/client/hippo/components/query-builder/clause-filter.jsx +2 -2
  32. data/client/hippo/components/query-builder/clause.jsx +16 -10
  33. data/client/hippo/components/query-builder/date-picker.jsx +1 -1
  34. data/client/hippo/components/query-builder/query-builder.scss +23 -2
  35. data/client/hippo/components/record-finder.jsx +5 -2
  36. data/client/hippo/components/record-finder/query-layer.jsx +1 -1
  37. data/client/hippo/components/save-button.jsx +1 -1
  38. data/client/hippo/components/screen.jsx +1 -1
  39. data/client/hippo/components/text-editor.jsx +82 -40
  40. data/client/hippo/components/text-editor/renderer.jsx +15 -35
  41. data/client/hippo/components/text-editor/renderer.scss +15 -0
  42. data/client/hippo/components/text-editor/text-editor.scss +2 -15
  43. data/client/hippo/components/text-editor/upload-adapter.js +66 -0
  44. data/client/hippo/components/time-zone-select.jsx +1 -1
  45. data/client/hippo/components/tool-tip.jsx +9 -14
  46. data/client/hippo/components/toolbar.jsx +16 -0
  47. data/client/hippo/components/warning-notification.jsx +1 -1
  48. data/client/hippo/extensions/base.js +3 -2
  49. data/client/hippo/extensions/index.js +1 -1
  50. data/client/hippo/lib/action_cable.js +8 -0
  51. data/client/hippo/lib/action_cable/cable.js +47 -0
  52. data/client/hippo/lib/action_cable/connection.js +192 -0
  53. data/client/hippo/lib/action_cable/connection_monitor.js +135 -0
  54. data/client/hippo/lib/action_cable/consumer.js +56 -0
  55. data/client/hippo/lib/action_cable/subscription.js +98 -0
  56. data/client/hippo/lib/action_cable/subscriptions.js +129 -0
  57. data/client/hippo/lib/date-range.js +22 -5
  58. data/client/hippo/lib/lazy-getter.js +31 -0
  59. data/client/hippo/lib/util.js +6 -1
  60. data/client/hippo/models/base.js +8 -3
  61. data/client/hippo/models/config.js +7 -2
  62. data/client/hippo/models/date-type.js +14 -0
  63. data/client/hippo/models/decorators.js +5 -5
  64. data/client/hippo/models/pub_sub.js +1 -1
  65. data/client/hippo/models/query/array-result.js +4 -1
  66. data/client/hippo/models/subscription.js +35 -0
  67. data/client/hippo/models/sync.js +1 -1
  68. data/client/hippo/models/tenant.js +14 -1
  69. data/client/hippo/react/component-not-found.jsx +14 -18
  70. data/client/hippo/screens/async-loading.jsx +46 -0
  71. data/client/hippo/screens/definition.js +2 -1
  72. data/client/hippo/screens/preferences.jsx +57 -0
  73. data/client/hippo/screens/system-settings.jsx +4 -6
  74. data/client/hippo/screens/system-settings/mailer-config.jsx +1 -1
  75. data/client/hippo/screens/system-settings/tenant.jsx +57 -4
  76. data/client/hippo/screens/user-management.jsx +2 -2
  77. data/client/hippo/screens/user-management/edit-form.jsx +1 -1
  78. data/client/hippo/styles/global/fancy-header.scss +2 -1
  79. data/client/hippo/styles/global/mixins.scss +14 -1
  80. data/client/hippo/testing/index.js +7 -0
  81. data/client/hippo/user.js +9 -2
  82. data/client/hippo/workspace/index.jsx +29 -8
  83. data/client/hippo/workspace/menu-group.jsx +1 -1
  84. data/client/hippo/workspace/menu-option.jsx +2 -0
  85. data/client/hippo/workspace/menu.jsx +30 -6
  86. data/client/hippo/workspace/screen.jsx +5 -1
  87. data/client/hippo/workspace/styles.scss +22 -3
  88. data/command-reference-files/initial/Gemfile +1 -1
  89. data/config/routes.rb +6 -0
  90. data/config/screens.rb +9 -17
  91. data/db/migrate/20171129024737_create_subscriptions.rb +12 -0
  92. data/fixtures/vcr_cassettes/Tenant_changes/sends_email_when_tenant_identifier_changes.yml +72 -0
  93. data/fixtures/vcr_cassettes/Tenant_isoloation/disallows_using_a_user_s_token_on_incorrect_domain.yml +141 -0
  94. data/fixtures/vcr_cassettes/Tenant_isoloation/isolates_bar_s_tenant_data_from_foo.yml +141 -0
  95. data/fixtures/vcr_cassettes/Tenant_isoloation/isolates_foo_s_tenant_data_from_bar.yml +141 -0
  96. data/hippo-fw.gemspec +4 -3
  97. data/lib/hippo.rb +1 -0
  98. data/lib/hippo/access/roles/basic_user.rb +1 -0
  99. data/lib/hippo/api/authentication_provider.rb +4 -5
  100. data/lib/hippo/api/handlers/asset.rb +9 -4
  101. data/lib/hippo/api/handlers/subscription.rb +39 -0
  102. data/lib/hippo/api/handlers/user_session.rb +0 -1
  103. data/lib/hippo/api/helper_methods.rb +8 -4
  104. data/lib/hippo/api/request_wrapper.rb +12 -1
  105. data/lib/hippo/command/console.rb +3 -3
  106. data/lib/hippo/concerns/asset_uploader.rb +8 -2
  107. data/lib/hippo/concerns/pub_sub.rb +8 -8
  108. data/lib/hippo/configuration.rb +6 -4
  109. data/lib/hippo/extension.rb +3 -2
  110. data/lib/hippo/model.rb +1 -0
  111. data/lib/hippo/models/subscription.rb +7 -0
  112. data/lib/hippo/payments.rb +129 -0
  113. data/lib/hippo/screen.rb +4 -2
  114. data/lib/hippo/screen/definition.rb +4 -0
  115. data/lib/hippo/spec_helper.rb +4 -4
  116. data/lib/hippo/templates/liquid/precision.rb +9 -0
  117. data/lib/hippo/tenant.rb +4 -5
  118. data/lib/hippo/user.rb +5 -5
  119. data/lib/hippo/version.rb +1 -1
  120. data/lib/hippo/webpack.rb +5 -1
  121. data/package-lock.json +437 -881
  122. data/package.json +19 -5
  123. data/spec/client/components/__snapshots__/query-builder.spec.jsx.snap +34 -1
  124. data/spec/client/components/__snapshots__/record-finder.spec.jsx.snap +1 -0
  125. data/spec/client/models/base.spec.js +7 -0
  126. data/spec/client/models/subscription.spec.js +8 -0
  127. data/spec/client/screens/__snapshots__/preferences.spec.jsx.snap +223 -0
  128. data/spec/client/screens/preferences.spec.jsx +10 -0
  129. data/spec/client/test-models.js +1 -1
  130. data/spec/client/workspace/__snapshots__/menu.spec.jsx.snap +12 -0
  131. data/spec/factories/subscription.rb +6 -0
  132. data/spec/factories/tenant.rb +1 -1
  133. data/spec/factories/user.rb +1 -1
  134. data/spec/server/api/tenant_change_spec.rb +11 -8
  135. data/spec/server/api/tenant_isolation_spec.rb +11 -8
  136. data/spec/server/api/user_sessions_spec.rb +10 -7
  137. data/spec/server/api/user_spec.rb +45 -0
  138. data/spec/server/models/subscription_spec.rb +10 -0
  139. data/spec/server/payment_helpers.rb +13 -0
  140. data/spec/server/print/form_spec.rb +1 -1
  141. data/spec/server/spec_helper.rb +3 -11
  142. data/templates/js/screen-definitions.js +4 -1
  143. data/templates/spec/factories/model.rb +1 -1
  144. data/views/hippo_root_view.erb +5 -5
  145. metadata +84 -25
  146. data/client/hippo/components/grid/config.json +0 -3
  147. data/client/hippo/components/grid/editors.scss +0 -78
  148. data/client/hippo/components/grid/index.js +0 -2
  149. data/client/hippo/components/grid/row-editor.scss +0 -74
  150. data/client/hippo/components/grid/styles.scss +0 -118
  151. data/client/hippo/components/text-editor/display-modes/Button.jsx +0 -20
  152. data/client/hippo/components/text-editor/display-modes/ToggleEdit.jsx +0 -23
  153. data/client/hippo/components/text-editor/display-modes/ToggleInsert.jsx +0 -22
  154. data/client/hippo/components/text-editor/display-modes/ToggleLayout.jsx +0 -22
  155. data/client/hippo/components/text-editor/display-modes/TogglePreview.jsx +0 -22
  156. data/client/hippo/components/text-editor/display-modes/ToggleResize.jsx +0 -22
  157. data/client/hippo/components/text-editor/display-modes/index.css +0 -0
  158. data/client/hippo/components/text-editor/display-modes/index.js +0 -30
  159. data/client/hippo/components/text-editor/image-plugin/Component/Display/index.js +0 -82
  160. data/client/hippo/components/text-editor/image-plugin/Component/Form/index.js +0 -42
  161. data/client/hippo/components/text-editor/image-plugin/Component/index.js +0 -16
  162. data/client/hippo/components/text-editor/image-plugin/Component/index.scss +0 -0
  163. data/client/hippo/components/text-editor/image-plugin/index.js +0 -32
  164. data/client/hippo/components/text-editor/image-plugin/index.scss +0 -25
  165. data/client/hippo/components/toolbar/changes-notification.scss +0 -63
  166. data/client/hippo/components/toolbar/index.js +0 -3
  167. data/client/hippo/components/toolbar/styles.scss +0 -74
@@ -1,82 +0,0 @@
1
- // @flow
2
- import React from 'react';
3
- import { observer, inject } from 'mobx-react';
4
- import { action, computed } from 'mobx';
5
- import { find } from 'lodash';
6
- import Dropzone from 'react-dropzone';
7
- import Button from 'grommet/components/Button';
8
- import ImageIcon from 'grommet/components/icons/base/Image';
9
- import cn from 'classnames';
10
-
11
- const iconStyle = {
12
- width: '100%',
13
- height: 'auto',
14
- padding: '0',
15
- color: '#aaa',
16
- textAlign: 'center',
17
- minWidth: 64,
18
- minHeight: 64,
19
- maxHeight: 256,
20
- };
21
-
22
-
23
- @inject('assets')
24
- @observer
25
- export default class Display extends React.PureComponent {
26
-
27
- @computed get asset() {
28
- return find(this.props.assets, asset =>
29
- asset.metadata && asset.metadata.nodeId === this.props.id);
30
- }
31
-
32
- @action.bound
33
- onFileDrop(files) {
34
- let { asset } = this;
35
- if (!asset) {
36
- this.props.assets.push({ metadata: { nodeId: this.props.id } });
37
- asset = this.props.assets.get(this.props.assets.length - 1);
38
- }
39
-
40
- asset.setFile(files[0]).then(() => {
41
- this.props.onChange({ src: asset.previewUrl });
42
- asset.save().then(() => {
43
- this.props.onChange({
44
- assetId: asset.id, src: asset.urlFor(),
45
- });
46
- });
47
- });
48
- }
49
-
50
- renderImage() {
51
- const { state: { src } } = this.props;
52
- return src ? <img className="content-image" src={src} /> : <ImageIcon style={iconStyle} />;
53
- }
54
-
55
- @action.bound
56
- onAddClick() {
57
- this.dropZone.open();
58
- }
59
-
60
- render() {
61
- const { isEditMode, state, focused } = this.props;
62
- if (isEditMode) {
63
- return (
64
- <div className={cn('content-image-wrapper', { focused })}>
65
- <Button onClick={this.onAddClick}>{state.src ? 'Change' : 'Add'}</Button>
66
- <Dropzone
67
- ref={(dz) => { this.dropZone = dz; }}
68
- style={{}}
69
- disableClick
70
- multiple={false}
71
- onDrop={this.onFileDrop}
72
- className="image-drop-zone"
73
- >
74
- {this.renderImage()}
75
- </Dropzone>
76
- </div>
77
- );
78
- }
79
- return this.renderImage();
80
- }
81
-
82
- }
@@ -1,42 +0,0 @@
1
- // @flow
2
- import React from 'react';
3
- import { inject, observer } from 'mobx-react';
4
- import Dropzone from 'react-dropzone';
5
- import { action } from 'mobx';
6
- import { BottomToolbar } from 'ory-editor-ui';
7
-
8
- import Display from '../Display';
9
-
10
- @inject('model', 'images_attribute')
11
- @observer
12
- export default class Form extends React.PureComponent {
13
-
14
- get assets() {
15
- return this.props.model[this.props.images_attribute];
16
- }
17
-
18
- @action.bound
19
- onFileDrop(files) {
20
- this.assets.push({});
21
- const asset = this.assets.at(this.assets.length - 1);
22
- asset.setFile(files[0]);
23
- }
24
-
25
- render() {
26
- const { props } = this;
27
-
28
- return (
29
- <div>
30
- <Display {...props} />
31
- <BottomToolbar open={props.focused}>
32
- <Dropzone
33
- onDrop={this.onFileDrop}
34
- >
35
- Drop a file here, or click to select one to upload.
36
- </Dropzone>
37
- </BottomToolbar>
38
- </div>
39
- );
40
- }
41
-
42
- }
@@ -1,16 +0,0 @@
1
- // @flow
2
- import React from 'react'; // eslint-disable-line no-unused-vars
3
- import getMuiTheme from 'material-ui/styles/getMuiTheme';
4
- import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
5
- import type { ContentPluginProps } from 'ory-editor-core/lib/service/plugin/classes';
6
- import Display from './Display';
7
-
8
- export type PropTypes = ContentPluginProps<{ src: string, caption: string }>
9
-
10
- const Image = (props: PropTypes) => (
11
- <MuiThemeProvider muiTheme={getMuiTheme()}>
12
- <Display {...props} />
13
- </MuiThemeProvider>
14
- );
15
-
16
- export default Image;
@@ -1,32 +0,0 @@
1
- // @flow
2
- import React from 'react'; // eslint-disable-line no-unused-vars
3
- import Panorama from 'material-ui/svg-icons/image/panorama';
4
- import './index.scss';
5
- import Asset from '../../../models/asset';
6
- import Component from './Component';
7
-
8
- export default {
9
- Component,
10
- name: 'ory/editor/core/content/image',
11
- version: '0.0.1',
12
- IconComponent: <Panorama />,
13
- text: 'Image',
14
- isInlineable: true,
15
- description: 'Loads an image from an url.',
16
-
17
- handleRemoveHotKey(ev, node) {
18
- if (node.content.state.assetId) {
19
- const asset = new Asset({ id: node.content.state.assetId });
20
- return asset.destroy();
21
- }
22
- return Promise.resolve(node);
23
- },
24
-
25
- // We need this because otherwise we lose hotkey focus on elements like spoilers.
26
- // This could probably be solved in an easier way by listening to window.document?
27
-
28
- handleFocus: (props: any, source: any, ref: HTMLElement) => {
29
- if (!ref) { return; }
30
- setTimeout(() => ref.focus());
31
- },
32
- };
@@ -1,25 +0,0 @@
1
- @import 'hippo/styles/global';
2
-
3
- .ory-plugins-content-image {
4
- width: 100%;
5
- }
6
-
7
- .ory-plugins-content-image-placeholder {
8
- position: relative;
9
- width: 100%;
10
- text-align: center;
11
- }
12
-
13
- .content-image-wrapper {
14
- border: 1px solid rgba(0, 0, 0, 0.15);
15
- cursor: pointer;
16
- &.focused {
17
- border-width: 2px;
18
- border-color: $focus-border-color;
19
- }
20
- button {
21
- position: absolute;
22
- top: 1rem;
23
- right: 1rem;
24
- }
25
- }
@@ -1,63 +0,0 @@
1
- .changes-notification {
2
-
3
- .btn.dropdown-toggle {
4
- i {
5
- font-size: 28px;
6
- }
7
- .badge {
8
- top: -11px;
9
- position: relative;
10
- left: -11px;
11
- padding: 3px 7px;
12
- font-size: 75%;
13
- }
14
- }
15
- .title{
16
- margin: 0; // reset heading margin
17
- padding: 8px 14px;
18
- font-size: $font-size-base;
19
- background-color: $popover-title-bg;
20
- border-bottom: 1px solid darken($popover-title-bg, 5%);
21
- border-radius: ($border-radius-large - 1) ($border-radius-large - 1) 0 0;
22
- }
23
-
24
- .dropdown-menu {
25
- width: 300px;
26
- right: 0;
27
- left: -200px;
28
- .update {
29
- border-bottom: 1px solid $table-border-color;
30
- margin-bottom: 5px;
31
- padding: 5px;
32
- &:last-child {
33
- margin-bottom: 0;
34
- border-bottom: 0;
35
- }
36
- .header {
37
- display: flex;
38
- align-items: stretch;
39
- justify-content: space-between;
40
- }
41
- .time {
42
- font-size: 80%;
43
- }
44
- .change > div {
45
- margin-bottom: 2px;
46
- }
47
- .from, .to {
48
- margin-left: 0.5rem;
49
- white-space: nowrap;
50
- text-overflow: ellipsis;
51
- overflow: hidden;
52
- }
53
- }
54
- .scroller {
55
- max-height: 350px;
56
- overflow-y: auto;
57
- }
58
- .ago {
59
- @extend small;
60
- }
61
- }
62
-
63
- }
@@ -1,3 +0,0 @@
1
- //= require ./Toolbar
2
- //= require ./SaveButton
3
- //= require ./RemoteChangeSets
@@ -1,74 +0,0 @@
1
- .hippo-toolbar {
2
-
3
- background-color: $navbar-default-bg;
4
-
5
- border: 1px solid transparent;
6
- border-radius: $border-radius-base;
7
- border-color: $navbar-default-border;
8
- margin-bottom: $navbar-margin-bottom;
9
- padding-right: $navbar-padding-horizontal;
10
- padding-left: $navbar-padding-horizontal;
11
-
12
- display: flex;
13
- flex-direction: row;
14
- justify-content: flex-start;
15
- align-items: center;
16
- flex-wrap: wrap;
17
-
18
-
19
- .navbar-btn {
20
- &.save > a {
21
- width: 100%;
22
- @extend .btn;
23
- @extend .btn-primary;
24
- // the save button needs to be clicable even if disabled
25
- &.disabled {
26
- pointer-events: all;
27
- cursor: pointer;
28
- }
29
- }
30
- }
31
- .spacer {
32
- flex: 1;
33
- }
34
- .control {
35
- width: 120px;
36
- margin-right: 10px;
37
- }
38
- .arrow {
39
- border-style: solid;
40
-
41
- border-left-color: transparent;
42
- border-right-color: transparent;
43
-
44
- border-bottom-color: $popover-title-bg;
45
- border-top-color: $popover-title-bg !important;
46
-
47
- border-width: 0 9px 9px;
48
- height: 0;
49
- left: 7px;
50
- margin-top: 10px;
51
- opacity: 1;
52
- position: absolute;
53
- top: -18px;
54
- transition: all 0.25s ease 0s;
55
- width: 0;
56
- z-index: 10;
57
- }
58
-
59
- label {
60
- margin-bottom: 0;
61
- }
62
- input {
63
- margin: 0 0.25rem 0 0;
64
- }
65
- .toggle {
66
- label {
67
- display: flex;
68
- flex-direction: row;
69
- align-items: center;
70
- justify-content: space-around;
71
- }
72
- }
73
- @import "./changes-notification";
74
- }