disco_app 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6bcc38c1a00ea30bb3a0fe0a319b7fbedb26c3e022247a8e2cd5bac114459a4
4
- data.tar.gz: f5b6885baebbeea7b2d5173803822a175bad1be09b2e65db1d8e0376e1fbf306
3
+ metadata.gz: ed90cb5423a1bc8af9fee9c49539fb826270afa2cf76f0865f936c9c95cc15e3
4
+ data.tar.gz: d976b5cf1f1237b2c4d4020107ae0c7ee715b797666ba8af0c4346b4135370ca
5
5
  SHA512:
6
- metadata.gz: d9bb6a2e5e899768eb3954830140a73adf764275eb9e8f7e1635b6a32e7596b1bfbe0f77591c62e7845f2f640904651d81fe5f6606a358ecfe64ee55149c47dd
7
- data.tar.gz: ae895af6f73f42668c2d6b9b2458a81481194becd38d4f9c44e30560a7905d7e8e3d12fff6a5806e18beb3b4082e020a28c95361f356c0ab7df6e54487da0b82
6
+ metadata.gz: 27abe4c9313cc7576ede08b42b5207312a627bc70c189b6adeca4aba4565289e6877a3fa6a8b4e3f45551d3818fbb4e3c3dcf8de837852483d977f47b0ed297c
7
+ data.tar.gz: '059fb5c0f3dde3dcb64607695c60c1c80ea08e357cf446460f5b0c716128f740fd86570226083b1f8259343f2d710126befa76c480e048db9f4517cbabf8df93'
@@ -0,0 +1,29 @@
1
+ /**
2
+ * ShopifyAdminLink
3
+ *
4
+ * Renders a link pointing to an object (such as an order or customer) inside
5
+ * the given shop's Shopify admin. This helper makes it easy to create links
6
+ * to objects within the admin that support both right-clicking and opening in
7
+ * a new tab as well as capturing a left click and redirecting to the relevant
8
+ * object using `ShopifyApp.redirect()`.
9
+ *
10
+ * This component is the React equivalent to the link_to_shopify_admin helper
11
+ * found in app/helpers/disco_app/application_helper.rb.
12
+ */
13
+ var ShopifyAdminLink = React.createClass({
14
+
15
+ handleClick: function(e) {
16
+ e.preventDefault();
17
+ ShopifyApp.redirect(this.props.href);
18
+ },
19
+
20
+ render: function() {
21
+ var href = '/admin' + this.props.href;
22
+ return (
23
+ <a className={this.props.className} href={href} onClick={this.handleClick}>
24
+ {this.props.label}
25
+ </a>
26
+ )
27
+ }
28
+
29
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * disco_app/components.js
3
+ * React components common to Disco applications.
4
+ */
5
+ //= require_tree ./components
@@ -16,7 +16,7 @@
16
16
  @import "bootstrap/type";
17
17
  //@import "bootstrap/code";
18
18
  @import "bootstrap/grid";
19
- @import "bootstrap/tables";
19
+ //@import "bootstrap/tables";
20
20
  @import "bootstrap/forms";
21
21
  @import "bootstrap/buttons";
22
22
 
@@ -0,0 +1,46 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin grid.
3
+ // --------------------------------------------------
4
+
5
+ .next-grid {
6
+ display: flex;
7
+ width: calc(100% - 20px);
8
+ margin: 0 auto;
9
+ box-sizing: border-box;
10
+ padding-top: 10px;
11
+
12
+ &:last-of-type {
13
+ padding-bottom: 10px;
14
+ }
15
+ }
16
+
17
+ .next-grid--no-padding {
18
+ width: 100%;
19
+
20
+ &:first-of-type, &:last-of-type {
21
+ padding: 0;
22
+ }
23
+
24
+ > .next-grid__cell {
25
+ padding: 0;
26
+ }
27
+ }
28
+
29
+ .next-grid--center-aligned, .next-grid--center-both {
30
+ -webkit-box-pack: center;
31
+ -webkit-justify-content: center;
32
+ -ms-flex-pack: center;
33
+ justify-content: center;
34
+ }
35
+
36
+ .next-grid__cell {
37
+ @include flex(1, 1, 0%);
38
+ padding: 10px;
39
+ box-sizing: border-box;
40
+ max-width: 100%;
41
+ min-width: 0;
42
+ }
43
+
44
+ .next-grid__cell--no-flex {
45
+ @include flex(0 0 auto);
46
+ }
@@ -0,0 +1,51 @@
1
+ //
2
+ // Replicate the styles for Shopify Admin tables.
3
+ // --------------------------------------------------
4
+
5
+ table {
6
+ width: 100%;
7
+ border-collapse: separate;
8
+ border-spacing: 0;
9
+
10
+ &.expanded td {
11
+ padding-top: 8px;
12
+ padding-bottom: 8px;
13
+ }
14
+ }
15
+
16
+ th {
17
+ font-weight: 400;
18
+ text-align: left;
19
+ color: #31373d;
20
+ padding: 8px 10px;
21
+ border-bottom: 1px solid #ebeef0;
22
+
23
+ &.right-aligned {
24
+ text-align: right;
25
+ }
26
+
27
+ &.is-sortable {
28
+ cursor: pointer;
29
+
30
+ &:hover {
31
+ background: #eff9fd;
32
+ color: #479ccf;
33
+ }
34
+ }
35
+ }
36
+
37
+ td {
38
+ border-bottom: 1px solid #ebeef0;
39
+ padding: 6px 10px;
40
+ background: transparent;
41
+ }
42
+
43
+ tr:last-child > td {
44
+ border-bottom: none;
45
+ }
46
+
47
+ .table-hover {
48
+ tr:hover td {
49
+ background: #eff9fd;
50
+ }
51
+ }
@@ -43,6 +43,14 @@
43
43
  align-items: center;
44
44
  justify-content: center;
45
45
 
46
+ &:focus,
47
+ &:hover {
48
+ outline: none;
49
+ background-color: #fafbfc;
50
+ color: #479ccf;
51
+ text-decoration: none;
52
+ }
53
+
46
54
  &.next-tab--is-active {
47
55
  background-color: #ffffff;
48
56
  color: #31373d;
@@ -6,9 +6,11 @@
6
6
  @import 'bootstrap/variables';
7
7
  @import 'bootstrap/custom';
8
8
  @import 'disco/mixins/flexbox';
9
+ @import 'disco/grid';
9
10
  @import 'disco/type';
10
11
  @import 'disco/sections';
11
12
  @import 'disco/cards';
12
13
  @import 'disco/buttons';
13
14
  @import 'disco/forms';
15
+ @import 'disco/tables';
14
16
  @import 'disco/tabs';
@@ -1,5 +1,10 @@
1
1
  module DiscoApp::ApplicationHelper
2
2
 
3
+ # Generates a link pointing to an object (such as an order or customer) inside
4
+ # the given shop's Shopify admin. This helper makes it easy to create links
5
+ # to objects within the admin that support both right-clicking and opening in
6
+ # a new tab as well as capturing a left click and redirecting to the relevant
7
+ # object using `ShopifyApp.redirect()`.
3
8
  def link_to_shopify_admin(shop, name, admin_path, options = {})
4
9
  options[:onclick] = "ShopifyApp.redirect('#{admin_path}'); return false;"
5
10
  options[:'data-no-turbolink'] = true
@@ -1,3 +1,3 @@
1
1
  module DiscoApp
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -4,7 +4,6 @@ module DiscoApp
4
4
 
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
 
7
- # Install the react-rails gem and run its setup.
8
7
  def install_gem
9
8
  # Add premailer gem to Gemfile.
10
9
  gem 'premailer-rails', '~> 1.8.2'
@@ -7,7 +7,7 @@ module DiscoApp
7
7
  # Install the react-rails gem and run its setup.
8
8
  def install_gem
9
9
  # Add gem to Gemfile
10
- gem 'react-rails', '~> 1.1.0'
10
+ gem 'react-rails', '~> 1.4.0'
11
11
 
12
12
  # Install gem.
13
13
  Bundler.with_clean_env do
@@ -26,6 +26,20 @@ module DiscoApp
26
26
  application "# Use production variant of React in production.", env: :production
27
27
  end
28
28
 
29
+ # Include the DiscoApp component library in the application.js manifest.
30
+ def add_to_manifest
31
+ inject_into_file manifest, "//= require disco_app/components\n", { before: "//= require components\n" }
32
+ end
33
+
34
+ private
35
+
36
+ # This method of finding the application.js manifest taken from the
37
+ # install generator in react-rails.
38
+ # See https://github.com/reactjs/react-rails/blob/3f0af13fa755d6e95969c17728d0354c234f3a37/lib/generators/react/install_generator.rb#L53-L55
39
+ def manifest
40
+ Pathname.new(destination_root).join('app/assets/javascripts', 'application.js')
41
+ end
42
+
29
43
  end
30
44
  end
31
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disco_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ballard
@@ -243,6 +243,8 @@ extra_rdoc_files: []
243
243
  files:
244
244
  - Rakefile
245
245
  - app/assets/images/disco_app/icon.svg
246
+ - app/assets/javascripts/disco_app/components.js
247
+ - app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
246
248
  - app/assets/javascripts/disco_app/disco_app.js
247
249
  - app/assets/javascripts/disco_app/frame.js
248
250
  - app/assets/javascripts/disco_app/shopify-turbolinks.js
@@ -251,7 +253,9 @@ files:
251
253
  - app/assets/stylesheets/disco_app/disco/_buttons.scss
252
254
  - app/assets/stylesheets/disco_app/disco/_cards.scss
253
255
  - app/assets/stylesheets/disco_app/disco/_forms.scss
256
+ - app/assets/stylesheets/disco_app/disco/_grid.scss
254
257
  - app/assets/stylesheets/disco_app/disco/_sections.scss
258
+ - app/assets/stylesheets/disco_app/disco/_tables.scss
255
259
  - app/assets/stylesheets/disco_app/disco/_tabs.scss
256
260
  - app/assets/stylesheets/disco_app/disco/_type.scss
257
261
  - app/assets/stylesheets/disco_app/disco/mixins/_flexbox.scss