shopify_app 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/CHANGELOG +1 -0
  2. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -0
  3. data/lib/generators/shopify_app/templates/app/assets/images/favicon.png +0 -0
  4. data/lib/generators/shopify_app/templates/app/assets/images/grid-18px.png +0 -0
  5. data/lib/generators/shopify_app/templates/app/assets/images/shopify-114.png +0 -0
  6. data/lib/generators/shopify_app/templates/app/assets/images/shopify-57.png +0 -0
  7. data/lib/generators/shopify_app/templates/app/assets/images/shopify-72.png +0 -0
  8. data/lib/generators/shopify_app/templates/app/assets/images/shopify.png +0 -0
  9. data/lib/generators/shopify_app/templates/app/assets/javascripts/application.js +15 -0
  10. data/lib/generators/shopify_app/templates/app/assets/stylesheets/application.css +10 -0
  11. data/lib/generators/shopify_app/templates/app/assets/stylesheets/imports.css.less +5 -0
  12. data/lib/generators/shopify_app/templates/app/assets/stylesheets/shopify_app.scss +150 -0
  13. data/lib/generators/shopify_app/templates/app/assets/stylesheets/shopify_app_buttons.css.less +77 -0
  14. data/lib/generators/shopify_app/templates/app/controllers/home_controller.rb +4 -4
  15. data/lib/generators/shopify_app/templates/app/helpers/tabs_helper.rb +8 -7
  16. data/lib/generators/shopify_app/templates/app/views/home/design.html.erb +3542 -164
  17. data/lib/generators/shopify_app/templates/app/views/home/index.html.erb +161 -96
  18. data/lib/generators/shopify_app/templates/app/views/layouts/application.html.erb +62 -25
  19. data/lib/generators/shopify_app/templates/app/views/login/index.html.erb +18 -12
  20. data/lib/generators/shopify_app/templates/public/404.html +43 -0
  21. data/lib/generators/shopify_app/templates/public/422.html +43 -0
  22. data/lib/generators/shopify_app/templates/public/500.html +43 -0
  23. data/lib/generators/shopify_app/templates/public/favicon.png +0 -0
  24. data/lib/generators/shopify_app/templates/public/shopify-114.png +0 -0
  25. data/lib/generators/shopify_app/templates/public/shopify-57.png +0 -0
  26. data/lib/generators/shopify_app/templates/public/shopify-72.png +0 -0
  27. data/lib/shopify_app/version.rb +1 -1
  28. data/shopify_app.gemspec +1 -1
  29. metadata +21 -32
  30. data/lib/generators/shopify_app/templates/app/assets/stylesheets/shopify_app.css +0 -285
  31. data/lib/generators/shopify_app/templates/public/images/box-bg2.gif +0 -0
  32. data/lib/generators/shopify_app/templates/public/images/info-bg.gif +0 -0
  33. data/lib/generators/shopify_app/templates/public/images/info.gif +0 -0
  34. data/lib/generators/shopify_app/templates/public/images/logo.png +0 -0
@@ -1,103 +1,168 @@
1
- <div id="sidebar">
2
- <h3>Where to start</h3>
3
- <h4>Check out the <code style="font-size: 140%">home_controller</code></h4>
4
-
5
- <p class="description">
6
- The controller in this demo application fetches the latest 3 orders and products and makes them available as instance variables <code style="color: #218BCE">@orders</code> and <code style="color: #218BCE">@products</code>.
7
- </p>
8
-
9
- <h4>Check out the <code>index</code> template</h4>
10
-
11
- <p class="description">
12
- This is the Ruby template you are currently looking at. It is located at:<br />
13
- </p>
14
-
15
- <p style="background: #fff; margin-left: 4px"><code>views/home/index.html.erb</code></p>
16
-
17
- <p class="description">
18
- Have a look at the markup and Ruby code to see how the Shopify API is being used.
19
- </p>
20
-
21
- <h3>Additional documentation</h3>
22
-
23
- <p class="description">
24
- Become an expert:
25
- </p>
26
-
27
- <ul>
28
- <li>
29
- <%= link_to 'API documentation', 'http://www.shopify.com/developers/api/' %>
30
- <span class="note">The reference: what you can do with the Shopify API.</span>
31
- </li>
32
- <li>
33
- <%= link_to 'Wiki', 'http://wiki.shopify.com/' %>
34
- <span class="note">Get more information and share your knowledge.</span>
35
- </li>
36
- <li>
37
- <%= link_to 'Forum', 'http://forums.shopify.com/community' %>
38
- <span class="note">Ask questions and see what others already wanted to know.</span>
39
- </li>
40
- </ul>
41
-
42
- <h3>Once you're ready</h3>
43
-
44
- <p class="description">
45
- We'd love to see what you create using the Shopify API.
46
- Find out how to share your application with the world and read the latest information on the <%= link_to 'API Publishing Page', 'http://www.shopify.com/developers/publishing/' %>.
47
- </p>
48
- </div>
49
-
50
-
51
- <div id="orders">
52
- <h2>Your recent orders</h2>
53
-
54
- <% if @orders.blank? %>
55
-
56
- <em class="note">There are no orders in your store.</em>
57
-
58
- <% else %>
59
-
1
+ <header class="jumbotron">
2
+ <div class="inner">
3
+ <div class="container">
4
+ <h1 style="letter-spacing:-3px; margin-bottom:20px;">Where do I start?</h1>
5
+ <p class="lead">An <strong>intro</strong> to using the Shopify App Template<br/>
6
+ including information on the <strong>Shopify API</strong> and <strong>Bootstrap,</strong><br/>
7
+ just to get the ball rolling.</p>
8
+ </div><!-- /container -->
9
+ </div>
10
+ </header>
11
+
12
+ <div class="row">
13
+ <div class="span3">
14
+ <div class="well">
15
+ <h3>Check out the <code>home_controller</code></h3>
16
+ <hr style="margin:2px 0 7px"/>
17
+ <p>The controller in this demo application fetches the newest 5 orders and products and makes them available as instance variables <code>@orders</code> and <code>@products</code></p>
18
+
19
+ <br/>
20
+
21
+ <h3>Take a look at <code>index.html.erb</code></h3>
22
+ <hr style="margin:2px 0 7px"/>
23
+ <p>Index is the Ruby template you are currently viewing. Have a look at the markup and Ruby code to see how the Shopify API is being used. It's located at <code>views/home/index.html.erb</code></p>
24
+ </div>
25
+
26
+ <h3>Additional Docs</h3>
27
+ <p>You can become an expert pretty quickly by reading up on these docs:</p>
28
+
60
29
  <ul>
61
- <% @orders.each do |order| %>
62
30
  <li>
63
- <div class="order box">
64
- <div class="wrapper">
65
- <strong><%= link_to order.name, "https://#{current_shop.url}/admin/orders/#{order.id}" %></strong>
66
- <span class="price"><%= order.total_price %> <%= order.currency %></span>
67
- <span class="highlight"><%= order.financial_status %></span>
68
- by <span class="note"><%= order.billing_address.name %></span>
69
- </div>
70
- </div>
31
+ <%= link_to 'API documentation', 'http://www.shopify.com/developers/api/' %>
32
+ <span class="note">Learn what you can do with the Shopify API</span>
33
+ </li><br/>
34
+ <li>
35
+ <%= link_to 'Bootstrap documentation', 'http://twitter.github.com/bootstrap/' %>
36
+ <span class="note">Find out what you can do with Twitter Bootstrap</span>
37
+ </li><br/>
38
+ <li>
39
+ <%= link_to 'Wiki', 'http://wiki.shopify.com/' %>
40
+ <span class="note">Get more information and share your knowledge</span>
41
+ </li><br/>
42
+ <li>
43
+ <%= link_to 'Forum', 'http://forums.shopify.com/community' %>
44
+ <span class="note">Ask questions and see what others already wanted to know</span>
71
45
  </li>
72
- <% end %>
73
46
  </ul>
47
+
48
+ <hr/>
49
+
50
+ <h3>Once you're ready</h3>
51
+
52
+ <p>We'd love to see what you create using the Shopify API. You can keep up to date on the latest and greatest via the <%= link_to 'Shopify API Twitter Account', 'http://www.twitter.com/shopifyapi' %>. You can also read the latest information on the <%= link_to 'API Publishing Page', 'http://www.shopify.com/developers/publishing/' %>.</p>
53
+
54
+ <br/>
55
+
56
+ <a href="https://twitter.com/shopifyapi" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @shopifyapi</a>
57
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
58
+ </div> <!-- span3 / left-column -->
74
59
 
75
- <% end %>
76
- </div>
77
-
78
-
79
- <h2>Some of your products</h2>
80
-
81
- <% if @products.blank? %>
82
-
83
- <em class="note">There are no products in your store.</em>
84
-
85
- <% else %>
86
-
87
- <% @products.each do |product| %>
88
- <div class="product box">
89
- <div class="wrapper">
90
- <%= image_tag product.images.first.small rescue '' %>
91
-
92
- <h4><%= link_to product.title, "https://#{current_shop.url}/admin/products/#{product.id}" %></h4>
93
60
 
94
- <p class="price"><%= product.price_range %> <%= current_shop.shop.currency %></p>
95
- <p style="margin-bottom: 0"><%= product.product_type %> <span class="note">type</span></p>
96
- <p style="margin: 0"><%= product.vendor %> <span class="note">vendor</span></p>
61
+ <div class="span8 offset1">
62
+ <h2>Recent orders</h2>
63
+
64
+ <% if @orders.blank? %>
65
+ <table class="table table-striped">
66
+ <tr>
67
+ <td><em>There are no orders in your store.</em></td>
68
+ </tr>
69
+ </table>
70
+
71
+ <% else %>
72
+
73
+ <table class="table table-striped">
74
+ <thead>
75
+ <tr>
76
+ <th>Order</th>
77
+ <th>Placed by</th>
78
+ <th>Paid</th>
79
+ <th>Fulfillment</th>
80
+ <th>Total</th>
81
+ </tr>
82
+ </thead>
83
+ <% @orders.each do |order| %>
84
+ <tr>
85
+ <td><%= link_to order.name, "https://#{current_shop.url}/admin/orders/#{order.id}", :target => 'blank' %></td>
86
+ <td><%= order.billing_address.name %></td>
87
+ <td>
88
+ <span class="label <% if order.financial_status == 'paid' %>label-success<% end %> <% if order.financial_status == 'pending' %>label-warning<% end %> <% if order.financial_status == 'refunded' %>label-important<% end %>"><%= order.financial_status %>
89
+ </span>
90
+ </td>
91
+ <td>
92
+ <% if !order.fulfillment_status %>
93
+ <span class="label">Not Fulfilled</span>
94
+ <% else %>
95
+ <span class="label label-success">Fulfilled</span>
96
+ <% end %>
97
+ </td>
98
+ <td><%= order.total_price %> <%= order.currency %></td>
99
+ </tr>
100
+ <% end %>
101
+ </table>
97
102
 
98
- <div style="clear:left"></div>
99
- </div>
100
- </div>
101
- <% end %>
102
-
103
- <% end %>
103
+ <% end %>
104
+
105
+ <br/>
106
+
107
+ <h2>New Products</h2>
108
+
109
+ <div class="accordion" id="accordion">
110
+
111
+ <% if @products.blank? %>
112
+
113
+ <div class="accordion-group">
114
+ <div class="accordion-heading">
115
+ <em>There are no products in your store.</em>
116
+ </div>
117
+ </div>
118
+
119
+ <% else %>
120
+
121
+ <% @products.each_with_index do |product, index| %>
122
+ <div class="accordion-group">
123
+ <div class="accordion-heading">
124
+
125
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#<%= product.id %>">
126
+ <%= product.title %> <span class="pull-right muted"><%= product.price_range %> <%= current_shop.shop.currency %></span>
127
+ </a>
128
+ </div>
129
+
130
+ <div id="<%= product.id %>" class="accordion-body collapse <% if index == 1 %>in<% end %>">
131
+ <div class="accordion-inner">
132
+
133
+ <% if !product.images.empty? %>
134
+ <div class="polaroid">
135
+ <%= link_to image_tag(product.images.first.medium), '#modal-'+product.id.to_s, :'data-toggle' => 'modal' %>
136
+ </div>
137
+ <% end %>
138
+
139
+ <p><strong>Type:</strong> <%= product.product_type %></p>
140
+ <p><strong>Vendor:</strong> <%= product.vendor %></p>
141
+ <p><%= raw(product.body_html) %></p><br/>
142
+ <% if product.published_at != nil %>
143
+ <p class="muted">Published at <%= Time.parse(product.published_at).strftime("%H:%M on %m/%d/%Y") %></p>
144
+ <% end %>
145
+ <p><%= link_to raw('View in your Shopify Admin <i class="icon-chevron-right" style="opacity:.25"></i>'), "https://#{current_shop.url}/admin/products/#{product.id}", :target => 'blank', :class => 'btn btn-primary' %></p>
146
+ </div>
147
+
148
+ </div>
149
+ </div>
150
+
151
+ <div class="modal hide fade" id="modal-<%= product.id %>" style="display:none;">
152
+ <div class="modal-header">
153
+ <a class="close" data-dismiss="modal">×</a>
154
+ <h3><%= product.title %></h3>
155
+ </div>
156
+ <div class="modal-body" >
157
+ <% if !product.images.empty? %>
158
+ <%= image_tag product.images.first.large %>
159
+ <% end %>
160
+ </div>
161
+ </div>
162
+ <% end %>
163
+
164
+ <% end %>
165
+
166
+ </div> <!-- accordion -->
167
+ </div> <!-- span8 / right-column -->
168
+ </div>
@@ -1,39 +1,76 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
- <title>Shopify Application</title>
4
+ <title>Shopify Demo App</title>
5
5
  <%= stylesheet_link_tag 'application' %>
6
6
  <%= javascript_include_tag 'application' %>
7
7
  <%= csrf_meta_tags %>
8
+
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
11
+
12
+ <!-- icons -->
13
+ <link rel="shortcut icon" href="../assets/favicon.png">
14
+ <link rel="apple-touch-icon" href="../assets/shopify-57.png">
15
+ <link rel="apple-touch-icon" sizes="72x72" href="../assets/shopify-72.png">
16
+ <link rel="apple-touch-icon" sizes="114x114" href="../assets/shopify-114.png">
17
+
18
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
19
+ <!--[if lt IE 9]>
20
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
21
+ <![endif]-->
8
22
  </head>
9
23
 
10
24
  <body>
11
- <div id="header">
12
- <h1><%= link_to 'Shopify Demo Application', '/' %></h1>
13
-
14
- <p id="login-link">
15
- <% if current_shop %>
16
- <span class="note">current shop</span> <%= link_to current_shop.url, "https://#{current_shop.url}", :class => 'shop_name' %> <span class="note">|</span>
17
- <%= link_to 'logout', logout_path %>
18
- <% end %>
19
- </p>
25
+
26
+ <div class="navbar navbar-fixed-top">
27
+ <div class="navbar-inner">
28
+ <div class="container">
29
+
30
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
31
+ <span class="icon-bar"></span>
32
+ <span class="icon-bar"></span>
33
+ <span class="icon-bar"></span>
34
+ </a>
35
+
36
+ <%= link_to 'Shopify Demo App', '/', :class => 'brand' %>
37
+
38
+ <% if current_shop %>
39
+ <div class="nav-collapse">
40
+ <ul class="nav">
41
+ <li class='<%= active_nav_class('home', 'index') %>'><%= link_to 'Where to Start', '/' %></li>
42
+ <li class='<%= active_nav_class('home', 'design') %>'><%= link_to 'Bootstrap Info', '/design' %></li>
43
+ </ul>
44
+ </div>
45
+
46
+ <ul class="nav pull-right">
47
+ <li class="dropdown">
48
+ <%= link_to raw(current_shop.url+' <b class="caret"></b>'), "https://#{current_shop.url}", :class => 'shop_name dropdown-toggle', :'data-toggle' => 'dropdown' %>
49
+ <ul class="dropdown-menu">
50
+ <li><%= link_to raw('<i class="icon-home"></i> Storefront'), "http://"+current_shop.url, :target => 'blank' %></li>
51
+ <li><%= link_to raw('<i class="icon-cog"></i> Shopify Admin'), "http://"+current_shop.url+"/admin", :target => 'blank' %></li>
52
+ <li class="divider"></li>
53
+ <li><%= link_to raw('<i class="icon-off"></i> logout'), logout_path %></li>
54
+ </ul>
55
+ </li>
56
+ </ul>
57
+ <% end %>
58
+
59
+ </div>
60
+ </div>
20
61
  </div>
21
-
22
- <div id="container" class="clearfix">
23
- <ul id="tabs">
24
- <%= tab :index, {:controller => '/home'}, :label => 'Home' %>
25
- <%= tab :design, {:controller => '/home', :action => 'design'}, :label => 'Design Help' %>
26
- </ul>
27
-
28
- <!-- Flash error & notice-->
29
- <% if flash[:error] %> <div id="flasherrors"><%= flash[:error] %></div><% end %>
30
- <% if flash[:notice] %><div id="flashnotices"><%= flash[:notice] %></div><% end %>
31
62
 
32
- <!-- begin div.main-->
33
- <div id="main">
63
+
64
+ <div class="container">
65
+
66
+ <div class="content">
34
67
  <%= yield %>
35
68
  </div>
36
- <!-- end div.main -->
37
- </div>
69
+
70
+ <footer>
71
+ <p>A Shopify app by (company name here)</p>
72
+ </footer>
73
+
74
+ </div> <!-- /container -->
38
75
  </body>
39
76
  </html>
@@ -1,15 +1,21 @@
1
- <h1>Install</h1>
1
+ <div class="page-header" id="login-header">
2
+ <h1>Install This App</h1>
3
+ <h1><small>This app requires you to login to start using it.</small></h1>
4
+ </div>
2
5
 
3
- <p>Install this app in a shop to get access to its private admin data.</p>
6
+ <div style="width:340px; margin:0 auto;">
7
+ <%= form_tag '/login/authenticate', :class => 'form-search' do %>
8
+ <%= text_field_tag 'shop', nil, :placeholder => 'Shop URL', :class => 'btn-large' %>
9
+ <%= submit_tag 'Install', :class => 'btn btn-primary btn-large' %>
10
+ <% end %>
11
+ </div>
4
12
 
5
- <p style="padding-bottom: 1em"><span class="hint">Don&rsquo;t have a shop to install your app in handy? <a href="https://app.shopify.com/services/partners/api_clients/test_shops">Create a test shop.</a></span></p>
13
+ <p align="center" style="margin-top:30px">
14
+ <%= image_tag '../assets/shopify.png' %>
15
+ </p>
6
16
 
7
- <%= form_tag '/login/authenticate' do %>
8
- <label for='shop'><strong>The URL of the Shop</strong>
9
- <span class="hint">(or just the subdomain if it&rsquo;s at myshopify.com)</span>
10
- </label>
11
- <p>
12
- <%= text_field_tag 'shop', nil, {:size => 45} %>
13
- <%= submit_tag 'Install' %>
14
- </p>
15
- <% end %>
17
+ <br/>
18
+
19
+ <p align="center" class="muted">
20
+ Don't have a shop? <a href="https://app.shopify.com/services/partners/api_clients/test_shops">Create a Test Shop</a>
21
+ </p>
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>404 Error: This page doesn't exist!</title>
5
+ <link rel="stylesheet" type="text/css" href="../assets/bootstrap.css" />
6
+ <link rel="stylesheet" type="text/css" href="../assets/responsive-bootstrap.css" />
7
+ <link rel="stylesheet" type="text/css" href="../assets/shopify_app.scss" />
8
+
9
+ <style>
10
+ .container { text-align:center;}
11
+ .navbar .brand { float:none;}
12
+ </style>
13
+ </head>
14
+
15
+ <body>
16
+ <div class="navbar navbar-fixed-top">
17
+ <div class="navbar-inner">
18
+ <div class="container">
19
+ <a href="/" class="brand">Shopify Demo App</a>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="container">
25
+ <div class="content">
26
+ <div class="page-header">
27
+ <h1>AH! 404!</h1>
28
+ </div>
29
+
30
+ <h3><i class="icon-warning-sign" style="margin-top:6px; opacity:.5;"></i> Well dang, looks like this page doesn't exist.</h3>
31
+ <p class="muted">Well, not this one, but the one you were looking for... at least there's a kitten!</p>
32
+ <br/>
33
+ <p><img src="http://gifs.gifbin.com/122009/1259928856_surprised_kitten.gif" style="border-radius:10px;"/></p>
34
+ <br/>
35
+ <p><button type="button" value ="back" onClick="window.history.back();" class='btn btn-primary'><i class="icon-chevron-left" style="opacity:.25"></i> Back to the app</button></p>
36
+ </div>
37
+
38
+ <footer>
39
+ <p>A Shopify app by (company name here)</p>
40
+ </footer>
41
+ </div> <!-- /container -->
42
+ </body>
43
+ </html>
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>422 Error: Your change was rejected</title>
5
+ <link rel="stylesheet" type="text/css" href="../assets/bootstrap.css" />
6
+ <link rel="stylesheet" type="text/css" href="../assets/responsive-bootstrap.css" />
7
+ <link rel="stylesheet" type="text/css" href="../assets/shopify_app.scss" />
8
+
9
+ <style>
10
+ .container { text-align:center;}
11
+ .navbar .brand { float:none;}
12
+ </style>
13
+ </head>
14
+
15
+ <body>
16
+ <div class="navbar navbar-fixed-top">
17
+ <div class="navbar-inner">
18
+ <div class="container">
19
+ <a href="/" class="brand">Shopify Demo App</a>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="container">
25
+ <div class="content">
26
+
27
+ <div class="page-header">
28
+ <h1>422 Error</h1>
29
+ </div>
30
+
31
+ <h3><i class="icon-warning-sign" style="margin-top:6px; opacity:.5;"></i> Sorry, the change you requested was rejected.</h3>
32
+ <p class="muted">Did you try to change something you don't have access to?</p>
33
+
34
+ <p><button type="button" value ="back" onClick="window.history.back();" class='btn btn-primary'><i class="icon-chevron-left" style="opacity:.25"></i> Back to the app</button></p>
35
+
36
+ </div>
37
+
38
+ <footer>
39
+ <p>A Shopify app by (company name here)</p>
40
+ </footer>
41
+ </div> <!-- /container -->
42
+ </body>
43
+ </html>