shopqi-app 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/shop.rb +8 -2
- data/lib/generators/shopqi_app/templates/app/assets/stylesheets/application.css.less.erb +6 -0
- data/lib/generators/shopqi_app/templates/app/controllers/home_controller.rb +1 -1
- data/lib/generators/shopqi_app/templates/app/views/layouts/application.html.haml +13 -5
- data/lib/generators/shopqi_app/templates/config/app_secret_config.yml.erb +5 -2
- data/lib/shopqi_app/version.rb +1 -1
- metadata +4 -4
data/app/models/shop.rb
CHANGED
@@ -2,7 +2,13 @@ class Shop < ActiveRecord::Base
|
|
2
2
|
attr_accessible :shop_id, :name, :shopqi_domain, :access_token
|
3
3
|
|
4
4
|
def self.find_for_shopqi_oauth(data)
|
5
|
-
|
6
|
-
where(shop_id:
|
5
|
+
shop_data = data.extra.raw_info.shop
|
6
|
+
shop = where(shop_id: shop_data.id).first_or_create! name: shop_data.name, shopqi_domain: shop_data.shopqi_domain
|
7
|
+
shop.access_token = data.credentials.token
|
8
|
+
shop.tap(&:save)
|
9
|
+
end
|
10
|
+
|
11
|
+
def use_shopkit
|
12
|
+
Shopkit.setup url: self.shopqi_domain, access_token: self.access_token
|
7
13
|
end
|
8
14
|
end
|
@@ -3,7 +3,7 @@ class HomeController < ApplicationController
|
|
3
3
|
|
4
4
|
def index
|
5
5
|
if signed_in?
|
6
|
-
|
6
|
+
current_shop.use_shopkit
|
7
7
|
@orders = Shopkit.orders per_page: 3
|
8
8
|
@products = Shopkit.products per_page: 5
|
9
9
|
else
|
@@ -1,7 +1,7 @@
|
|
1
1
|
!!!
|
2
2
|
%html
|
3
3
|
%head
|
4
|
-
%title
|
4
|
+
%title=SecretSetting.app_name
|
5
5
|
= stylesheet_link_tag "application"
|
6
6
|
= javascript_include_tag "application"
|
7
7
|
= csrf_meta_tags
|
@@ -9,12 +9,12 @@
|
|
9
9
|
.navbar.navbar-fixed-top
|
10
10
|
.navbar-inner
|
11
11
|
.container
|
12
|
-
%a.brand(href="/")
|
12
|
+
%a.brand(href="/")=SecretSetting.app_name
|
13
13
|
-if current_shop
|
14
14
|
%ul.nav.pull-right
|
15
15
|
%li.dropdown
|
16
16
|
=link_to shop_url, class: 'dropdown-toggle', data: { toggle: :dropdown } do
|
17
|
-
=current_shop['
|
17
|
+
=current_shop['name']
|
18
18
|
%b.caret
|
19
19
|
%ul.dropdown-menu
|
20
20
|
%li
|
@@ -31,5 +31,13 @@
|
|
31
31
|
%i.icon-off
|
32
32
|
退出
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
.container
|
35
|
+
#main
|
36
|
+
= yield
|
37
|
+
#footer.footer
|
38
|
+
%p
|
39
|
+
==Copyright©#{Date.today.year}
|
40
|
+
=link_to SecretSetting.app_name, '/'
|
41
|
+
版权所有
|
42
|
+
|
|
43
|
+
=SecretSetting.domain.record
|
@@ -1,12 +1,14 @@
|
|
1
1
|
defaults: &defaults
|
2
|
+
app_name: ShopQi App Example
|
2
3
|
oauth:
|
3
4
|
client_id: <%= client_id %>
|
4
5
|
secret: <%= client_secret %>
|
5
6
|
scope: 'read_products read_orders'
|
6
7
|
callback_path: '/callback'
|
7
8
|
domain:
|
8
|
-
host: 'lvh.me:3000'
|
9
9
|
record: 粤ICP备11089804号
|
10
|
+
shopqi_domain:
|
11
|
+
protocol: 'http://'
|
10
12
|
|
11
13
|
development:
|
12
14
|
<<: *defaults
|
@@ -22,5 +24,6 @@ production:
|
|
22
24
|
scope: 'read_products read_orders'
|
23
25
|
callback_path: '/callback'
|
24
26
|
domain:
|
25
|
-
host: 'example.shopqiapp.com'
|
26
27
|
record: 粤ICP备11089804号
|
28
|
+
shopqi_domain:
|
29
|
+
protocol: 'https://'
|
data/lib/shopqi_app/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopqi-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -205,7 +205,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
segments:
|
207
207
|
- 0
|
208
|
-
hash: -
|
208
|
+
hash: -277092943
|
209
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
210
|
none: false
|
211
211
|
requirements:
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
segments:
|
216
216
|
- 0
|
217
|
-
hash: -
|
217
|
+
hash: -277092943
|
218
218
|
requirements: []
|
219
219
|
rubyforge_project:
|
220
220
|
rubygems_version: 1.8.24
|