comable_backend 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +10 -10
- data/app/controllers/comable/admin/shipment_methods_controller.rb +67 -0
- data/app/controllers/comable/admin/store_controller.rb +57 -0
- data/app/helpers/comable/admin/shipment_methods_helper.rb +6 -0
- data/app/helpers/comable/admin/stores_helper.rb +6 -0
- data/app/views/comable/admin/shipment_methods/_form.slim +33 -0
- data/app/views/comable/admin/shipment_methods/edit.slim +7 -0
- data/app/views/comable/admin/shipment_methods/index.slim +17 -0
- data/app/views/comable/admin/shipment_methods/new.slim +5 -0
- data/app/views/comable/admin/shipment_methods/show.slim +22 -0
- data/app/views/comable/admin/store/_form.slim +38 -0
- data/app/views/comable/admin/store/edit.slim +5 -0
- data/app/views/comable/admin/store/new.slim +3 -0
- data/app/views/comable/admin/store/show.slim +24 -0
- data/config/routes.rb +5 -2
- metadata +17 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ca8267bcc1518556a807dafb17a9958b8f8744e
|
|
4
|
+
data.tar.gz: 323662d9d997ec5cdb10350c6d87b5d6b3b2e50b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 554f1985fec57b836b89f89095502d8a4b4cddcd2a9b7863c7f4da7dc2e42df81f1b70d62837d9a46183b24281bacd718f76327883472b15ea1b506f3378198c
|
|
7
|
+
data.tar.gz: 14aa052091837b0d69c49fd1698319f760ec7bfce98a7ec434681098bcedccef65fa5e23c16157a2a2576461547e3a8b01b0b90d909763389903f69aeb98b5db
|
data/Rakefile
CHANGED
|
@@ -6,9 +6,6 @@ end
|
|
|
6
6
|
|
|
7
7
|
require 'rdoc/task'
|
|
8
8
|
|
|
9
|
-
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
|
10
|
-
require 'tasks/release'
|
|
11
|
-
|
|
12
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
|
13
10
|
rdoc.rdoc_dir = 'rdoc'
|
|
14
11
|
rdoc.title = 'Comable'
|
|
@@ -16,11 +13,12 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
|
16
13
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
17
14
|
end
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
|
17
|
+
load 'rails/tasks/engine.rake'
|
|
18
|
+
|
|
19
|
+
if File.exist?('comable.gemspec')
|
|
20
|
+
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
|
21
|
+
require 'tasks/release'
|
|
24
22
|
|
|
25
23
|
namespace :app do
|
|
26
24
|
namespace :spec do
|
|
@@ -47,7 +45,7 @@ else
|
|
|
47
45
|
namespace :migrate do
|
|
48
46
|
task :all do
|
|
49
47
|
FRAMEWORKS.each do |framework|
|
|
50
|
-
command = "cd #{framework} && test -d db && bundle exec rake db:migrate RAILS_ENV=#{Rails.env}
|
|
48
|
+
command = "cd #{framework} && test -d db && bundle exec rake db:migrate RAILS_ENV=#{Rails.env}"
|
|
51
49
|
puts command
|
|
52
50
|
system command
|
|
53
51
|
end
|
|
@@ -62,7 +60,7 @@ else
|
|
|
62
60
|
namespace :reset do
|
|
63
61
|
task :all do
|
|
64
62
|
FRAMEWORKS.each do |framework|
|
|
65
|
-
command = "cd #{framework} && test -d db && bundle exec rake db:migrate:reset RAILS_ENV=#{Rails.env}
|
|
63
|
+
command = "cd #{framework} && test -d db && bundle exec rake db:migrate:reset RAILS_ENV=#{Rails.env}"
|
|
66
64
|
puts command
|
|
67
65
|
system command
|
|
68
66
|
end
|
|
@@ -74,6 +72,8 @@ else
|
|
|
74
72
|
task default: ['app:spec:all', 'rubocop']
|
|
75
73
|
end
|
|
76
74
|
|
|
75
|
+
task default: ['app:spec', 'rubocop']
|
|
76
|
+
|
|
77
77
|
Bundler::GemHelper.install_tasks
|
|
78
78
|
|
|
79
79
|
# from https://github.com/rspec/rspec-rails/issues/936
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require_dependency 'comable/admin/application_controller'
|
|
2
|
+
|
|
3
|
+
module Comable
|
|
4
|
+
module Admin
|
|
5
|
+
class ShipmentMethodsController < ApplicationController
|
|
6
|
+
# GET /admin/shipment_methods
|
|
7
|
+
def index
|
|
8
|
+
@shipment_methods = Comable::ShipmentMethod.all
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# GET /admin/shipment_methods/1
|
|
12
|
+
def show
|
|
13
|
+
@shipment_method = Comable::ShipmentMethod.find(params[:id])
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /admin/shipment_methods/new
|
|
17
|
+
def new
|
|
18
|
+
@shipment_method = Comable::ShipmentMethod.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /admin/shipment_methods/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
@shipment_method = Comable::ShipmentMethod.find(params[:id])
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# POST /admin/shipment_methods
|
|
27
|
+
def create
|
|
28
|
+
@shipment_method = Comable::ShipmentMethod.new(shipment_method_params)
|
|
29
|
+
|
|
30
|
+
if @shipment_method.save
|
|
31
|
+
redirect_to comable.admin_shipment_method_url(@shipment_method), notice: 'Shipment method was successfully created.'
|
|
32
|
+
else
|
|
33
|
+
render :new
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# PATCH/PUT /admin/shipment_methods/1
|
|
38
|
+
def update
|
|
39
|
+
@shipment_method = Comable::ShipmentMethod.find(params[:id])
|
|
40
|
+
if @shipment_method.update(shipment_method_params)
|
|
41
|
+
redirect_to comable.admin_shipment_method_url(@shipment_method), notice: 'Shipment method was successfully updated.'
|
|
42
|
+
else
|
|
43
|
+
render :edit
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# DELETE /admin/shipment_methods/1
|
|
48
|
+
def destroy
|
|
49
|
+
@shipment_method = Comable::ShipmentMethod.find(params[:id])
|
|
50
|
+
@shipment_method.destroy
|
|
51
|
+
redirect_to comable.admin_shipment_methods_url, notice: 'Shipment method was successfully destroyed.'
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
# Only allow a trusted parameter "white list" through.
|
|
57
|
+
def shipment_method_params
|
|
58
|
+
params.require(:shipment_method).permit(
|
|
59
|
+
:activate_flag,
|
|
60
|
+
:name,
|
|
61
|
+
:fee,
|
|
62
|
+
:traking_url
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require_dependency 'comable/admin/application_controller'
|
|
2
|
+
|
|
3
|
+
module Comable
|
|
4
|
+
module Admin
|
|
5
|
+
class StoreController < ApplicationController
|
|
6
|
+
# GET /admin/store
|
|
7
|
+
def show
|
|
8
|
+
@store = Comable::Store.first
|
|
9
|
+
return redirect_to action: :new unless @store
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /admin/store/new
|
|
13
|
+
def new
|
|
14
|
+
@store = Comable::Store.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# GET /admin/store/edit
|
|
18
|
+
def edit
|
|
19
|
+
@store = Comable::Store.first
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# POST /admin/store
|
|
23
|
+
def create
|
|
24
|
+
@store = Comable::Store.new(store_params)
|
|
25
|
+
|
|
26
|
+
if @store.save
|
|
27
|
+
redirect_to comable.admin_store_url(@store), notice: 'Store was successfully created.'
|
|
28
|
+
else
|
|
29
|
+
render :new
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# PATCH/PUT /admin/store
|
|
34
|
+
def update
|
|
35
|
+
@store = Comable::Store.first
|
|
36
|
+
if @store.update(store_params)
|
|
37
|
+
redirect_to comable.admin_store_url(@store), notice: 'Store was successfully updated.'
|
|
38
|
+
else
|
|
39
|
+
render :edit
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
# Only allow a trusted parameter "white list" through.
|
|
46
|
+
def store_params
|
|
47
|
+
params.require(:store).permit(
|
|
48
|
+
:name,
|
|
49
|
+
:meta_keyword,
|
|
50
|
+
:meta_description,
|
|
51
|
+
:email_sender,
|
|
52
|
+
:email_activate_flag
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
= form_for([comable, :admin, @shipment_method]) do |f|
|
|
2
|
+
- if @shipment_method.errors.any?
|
|
3
|
+
#error_explanation
|
|
4
|
+
h2
|
|
5
|
+
= pluralize(@shipment_method.errors.count, 'error')
|
|
6
|
+
| prohibited this shipment_method from being saved:
|
|
7
|
+
|
|
8
|
+
ul
|
|
9
|
+
- @shipment_method.errors.full_messages.each do |message|
|
|
10
|
+
li = message
|
|
11
|
+
|
|
12
|
+
.activate_flag
|
|
13
|
+
= f.label :activate_flag do
|
|
14
|
+
span = f.check_box :activate_flag
|
|
15
|
+
span = @shipment_method.class.human_attribute_name(:activate_flag)
|
|
16
|
+
|
|
17
|
+
.name
|
|
18
|
+
= f.label :name do
|
|
19
|
+
span = @shipment_method.class.human_attribute_name(:name)
|
|
20
|
+
span = f.text_field :name
|
|
21
|
+
|
|
22
|
+
.fee
|
|
23
|
+
= f.label :fee do
|
|
24
|
+
span = @shipment_method.class.human_attribute_name(:fee)
|
|
25
|
+
span = f.text_field :fee
|
|
26
|
+
|
|
27
|
+
.traking_url
|
|
28
|
+
= f.label :traking_url do
|
|
29
|
+
span = @shipment_method.class.human_attribute_name(:traking_url)
|
|
30
|
+
span = f.text_field :traking_url
|
|
31
|
+
|
|
32
|
+
.actions
|
|
33
|
+
= f.submit
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
h1 Listing shipment_methods
|
|
2
|
+
|
|
3
|
+
table
|
|
4
|
+
thead
|
|
5
|
+
tr
|
|
6
|
+
th colspan="3"
|
|
7
|
+
|
|
8
|
+
tbody
|
|
9
|
+
- @shipment_methods.each do |shipment_method|
|
|
10
|
+
tr
|
|
11
|
+
td = link_to 'Show', comable.admin_shipment_method_path(shipment_method)
|
|
12
|
+
td = link_to 'Edit', comable.edit_admin_shipment_method_path(shipment_method)
|
|
13
|
+
td = link_to 'Destroy', comable.admin_shipment_method_path(shipment_method), method: :delete, data: { confirm: 'Are you sure?' }
|
|
14
|
+
|
|
15
|
+
br
|
|
16
|
+
|
|
17
|
+
= link_to 'New Shipment method', comable.new_admin_shipment_method_path
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
p#notice = notice
|
|
2
|
+
|
|
3
|
+
.attributes
|
|
4
|
+
.activate_flag
|
|
5
|
+
span = @shipment_method.class.human_attribute_name(:activate_flag)
|
|
6
|
+
span = @shipment_method.activate_flag
|
|
7
|
+
|
|
8
|
+
.name
|
|
9
|
+
span = @shipment_method.class.human_attribute_name(:name)
|
|
10
|
+
span = @shipment_method.name
|
|
11
|
+
|
|
12
|
+
.fee
|
|
13
|
+
span = @shipment_method.class.human_attribute_name(:fee)
|
|
14
|
+
span = @shipment_method.fee
|
|
15
|
+
|
|
16
|
+
.tracking_url
|
|
17
|
+
span = @shipment_method.class.human_attribute_name(:traking_url)
|
|
18
|
+
span = @shipment_method.traking_url
|
|
19
|
+
|
|
20
|
+
= link_to 'Edit', comable.edit_admin_shipment_method_path(@shipment_method)
|
|
21
|
+
| |
|
|
22
|
+
= link_to 'Back', comable.admin_shipment_methods_path
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
= form_for(@store, url: comable.admin_store_path(@store)) do |f|
|
|
2
|
+
- if @store.errors.any?
|
|
3
|
+
#error_explanation
|
|
4
|
+
h2
|
|
5
|
+
= pluralize(@store.errors.count, "error")
|
|
6
|
+
| prohibited this store from being saved:
|
|
7
|
+
|
|
8
|
+
ul
|
|
9
|
+
- @store.errors.full_messages.each do |message|
|
|
10
|
+
li = message
|
|
11
|
+
|
|
12
|
+
.name
|
|
13
|
+
= f.label :name do
|
|
14
|
+
span = @store.class.human_attribute_name(:name)
|
|
15
|
+
span = f.text_field :name
|
|
16
|
+
|
|
17
|
+
.meta_keyword
|
|
18
|
+
= f.label :meta_keyword do
|
|
19
|
+
span = @store.class.human_attribute_name(:meta_keyword)
|
|
20
|
+
span = f.text_field :meta_keyword
|
|
21
|
+
|
|
22
|
+
.meta_description
|
|
23
|
+
= f.label :meta_description do
|
|
24
|
+
span = @store.class.human_attribute_name(:meta_description)
|
|
25
|
+
span = f.text_field :meta_description
|
|
26
|
+
|
|
27
|
+
.email_sender
|
|
28
|
+
= f.label :email_sender do
|
|
29
|
+
span = @store.class.human_attribute_name(:email_sender)
|
|
30
|
+
span = f.email_field :email_sender
|
|
31
|
+
|
|
32
|
+
.email_activate_flag
|
|
33
|
+
= f.label :email_activate_flag do
|
|
34
|
+
span = f.check_box :email_activate_flag
|
|
35
|
+
span = @store.class.human_attribute_name(:email_activate_flag)
|
|
36
|
+
|
|
37
|
+
.actions
|
|
38
|
+
= f.submit
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
p#notice = notice
|
|
2
|
+
|
|
3
|
+
.attributes
|
|
4
|
+
.name
|
|
5
|
+
span = @store.class.human_attribute_name(:name)
|
|
6
|
+
span = @store.name
|
|
7
|
+
|
|
8
|
+
.meta_keyword
|
|
9
|
+
span = @store.class.human_attribute_name(:meta_keyword)
|
|
10
|
+
span = @store.meta_keyword
|
|
11
|
+
|
|
12
|
+
.meta_description
|
|
13
|
+
span = @store.class.human_attribute_name(:meta_description)
|
|
14
|
+
span = @store.meta_description
|
|
15
|
+
|
|
16
|
+
.email_sender
|
|
17
|
+
span = @store.class.human_attribute_name(:email_sender)
|
|
18
|
+
span = @store.email_sender
|
|
19
|
+
|
|
20
|
+
.email_activate_flag
|
|
21
|
+
span = @store.class.human_attribute_name(:email_activate_flag)
|
|
22
|
+
span = @store.email_activate_flag
|
|
23
|
+
|
|
24
|
+
= link_to 'Edit', comable.edit_admin_store_path(@store)
|
data/config/routes.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: comable_backend
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- YOSHIDA Hiroki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-09-
|
|
11
|
+
date: 2014-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: comable_core
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.2.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.2.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rails
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -67,9 +67,22 @@ files:
|
|
|
67
67
|
- app/assets/stylesheets/comable/admin/products.css
|
|
68
68
|
- app/controllers/comable/admin/application_controller.rb
|
|
69
69
|
- app/controllers/comable/admin/products_controller.rb
|
|
70
|
+
- app/controllers/comable/admin/shipment_methods_controller.rb
|
|
71
|
+
- app/controllers/comable/admin/store_controller.rb
|
|
70
72
|
- app/helpers/comable/admin/application_helper.rb
|
|
71
73
|
- app/helpers/comable/admin/products_helper.rb
|
|
74
|
+
- app/helpers/comable/admin/shipment_methods_helper.rb
|
|
75
|
+
- app/helpers/comable/admin/stores_helper.rb
|
|
72
76
|
- app/views/comable/admin/products/index.slim
|
|
77
|
+
- app/views/comable/admin/shipment_methods/_form.slim
|
|
78
|
+
- app/views/comable/admin/shipment_methods/edit.slim
|
|
79
|
+
- app/views/comable/admin/shipment_methods/index.slim
|
|
80
|
+
- app/views/comable/admin/shipment_methods/new.slim
|
|
81
|
+
- app/views/comable/admin/shipment_methods/show.slim
|
|
82
|
+
- app/views/comable/admin/store/_form.slim
|
|
83
|
+
- app/views/comable/admin/store/edit.slim
|
|
84
|
+
- app/views/comable/admin/store/new.slim
|
|
85
|
+
- app/views/comable/admin/store/show.slim
|
|
73
86
|
- app/views/layouts/comable/admin/application.slim
|
|
74
87
|
- config/routes.rb
|
|
75
88
|
- lib/comable/backend/engine.rb
|