Skip to content

Commit 24a6ed0

Browse files
author
Flavio Auciello
authored
Merge pull request #25 from nebulab/elia/dev-support-updates
Update to the latest solidus-dev-support templates + UI improvements
2 parents ff78003 + b734edf commit 24a6ed0

File tree

19 files changed

+91
-121
lines changed

19 files changed

+91
-121
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ pkg
1515
spec/dummy
1616
spec/examples.txt
1717
/sandbox
18+
.rvmrc
19+
.ruby-version
20+
.ruby-gemset

.rspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
--color
2-
--format documentation
32
--require spec_helper

.rubocop.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,2 @@
11
require:
22
- solidus_dev_support/rubocop
3-
4-
Metrics/LineLength:
5-
Enabled: true
6-
Max: 120
7-
8-
Rails/ApplicationJob:
9-
Enabled: false
10-
11-
Rails/SkipsModelValidations:
12-
Exclude:
13-
- db/migrate/**/*
14-
- spec/**/*
15-
- sandbox/**/*
16-
17-
RSpec/LetSetup:
18-
Enabled: false
19-
20-
RSpec/MultipleExpectations:
21-
# Default is 1
22-
Max: 5
23-
24-
RSpec/NestedGroups:
25-
# Default is 3
26-
Max: 6

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020 Nebulab SRL and other contributors
1+
Copyright (c) 2020 Nebulab SRLs and other contributors
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification,

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ end
9191

9292
Each list of processors can be configured to add, remove, or replace any of the default processors.
9393

94-
## Configuration
94+
### Advanced Configuration
9595

9696
To define your own processors (in this example for products), add to the spree
9797
initializer:
@@ -114,15 +114,23 @@ source file. The `processors` classes are responsible of the import of a single
114114
row of the source file; every processor has a `call` method (with an input
115115
`context`) which makes a specific action and updates the context if needed.
116116

117-
## Testing
117+
## Development
118118

119-
First bundle your dependencies, then run `rake`. `rake` will default to building
120-
the dummy app if it does not exist, then it will run specs, and [Rubocop](https://github.com/bbatsov/rubocop) static code analysis. The dummy app can be regenerated by using
121-
`rake test_app`.
119+
### Testing the extension
120+
121+
First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
122+
app if it does not exist, then it will run specs. The dummy app can be regenerated by using
123+
`bin/rake extension:test_app`.
122124

123125
```shell
124-
bundle
125-
bundle exec rake
126+
bin/setup
127+
bin/rake
128+
```
129+
130+
To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
131+
132+
```shell
133+
bundle exec rubocop
126134
```
127135

128136
When testing your application's integration with this extension you may use its factories.
@@ -132,14 +140,14 @@ Simply add this require statement to your spec_helper:
132140
require 'solidus_importer/factories'
133141

134142
```
135-
Sandbox app
136-
-----------
137143

138-
To run this extension in a sandboxed Solidus application you can run `bin/sandbox`
139-
The path for the sandbox app is `./sandbox` and `bin/rails` will forward any Rails command
140-
to `sandbox/bin/rails`.
144+
### Running the sandbox
141145

142-
Example:
146+
To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
147+
the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
148+
`sandbox/bin/rails`.
149+
150+
Here's an example:
143151

144152
```shell
145153
$ bin/rails server
@@ -149,15 +157,14 @@ $ bin/rails server
149157
Use Ctrl-C to stop
150158
```
151159

152-
Releasing
153-
---------
160+
### Releasing new versions
154161

155162
Your new extension version can be released using `gem-release` like this:
156163

157164
```shell
158165
bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release
159166
```
160167

161-
## About
168+
## License
162169

163-
Copyright (c) 2020 Nebulab SRL, released under the New BSD License
170+
Copyright (c) 2020 Nebulab SRLs, released under the New BSD License

app/overrides/spree/admin/shared/_menu/add_importer_admin_menu_links.html.erb.deface

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div class="row">
2+
<div class="col-4">
3+
<div class="field">
4+
<%= f.label :import_type %><br>
5+
<%= f.select :import_type, [nil] + @import_types %>
6+
</div>
7+
</div>
8+
<div class="col-3">
9+
<div class="field">
10+
<%= f.label :file %><br>
11+
<%= f.file_field :file %>
12+
</div>
13+
</div>
14+
</div>

app/views/spree/admin/solidus_importer/imports/index.html.erb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
<%
2-
admin_layout('full-width')
3-
admin_breadcrumb(
4-
t('spree.solidus_importer.title'),
5-
t('spree.solidus_importer.imports')
6-
)
7-
%>
1+
<% admin_layout('full-width') %>
2+
<% admin_breadcrumb(t('spree.solidus_importer.title'), t('spree.solidus_importer.imports')) %>
83

94
<% content_for :page_actions do %>
105
<li>
@@ -75,7 +70,9 @@ admin_breadcrumb(
7570
</table>
7671
<% else %>
7772
<div class="no-objects-found">
78-
<%= render 'spree/admin/shared/no_objects_found', resource: SolidusImporter::Import %>
73+
<%= render 'spree/admin/shared/no_objects_found',
74+
resource: SolidusImporter::Import,
75+
new_resource_url: new_object_url %>
7976
</div>
8077
<% end %>
8178

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
1-
<%
2-
admin_layout('full-width')
3-
admin_breadcrumb(
4-
t('spree.solidus_importer.title'),
5-
link_to(t('spree.solidus_importer.imports'), admin_solidus_importer_imports_path)
6-
)
7-
%>
1+
<% admin_breadcrumb t('spree.solidus_importer.title'), link_to(t('spree.solidus_importer.imports'), admin_solidus_importer_imports_path) %>
82

93
<%= form_for [:admin, @import], method: :post, html: { multipart: true } do |f| %>
10-
<div data-hook="admin_solidus_importer_import_form_fields">
11-
<div class="row">
12-
<div class="col-6">
13-
<%= f.label :file %><br>
14-
<%= f.file_field :file %>
15-
<fieldset>
16-
<% @import_types.each do |type| %>
17-
<label>
18-
<%= f.radio_button :import_type, type %>
19-
<%= t(type, scope: 'spree.solidus_importer.import_types') %>
20-
</label>
21-
<% end %>
22-
<%= f.button t('spree.admin.solidus_importer.create'), class: 'btn btn-primary' %>
23-
</fieldset>
24-
</div>
4+
<fieldset class="no-border-top">
5+
<%= render partial: 'spree/shared/error_messages', locals: { target: @import } %>
6+
<%= render partial: 'form', locals: { f: f } %>
7+
8+
<div class="form-buttons filter-actions actions" data-hook="buttons">
9+
<%= f.submit t('spree.actions.create'), class: 'btn btn-primary' %>
2510
</div>
26-
</div>
11+
</fieldset>
2712
<% end %>
2813

bin/rails

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
#!/usr/bin/env ruby
22

3-
# frozen_string_literal: true
4-
5-
app_root = 'spec/dummy'
6-
7-
unless File.exist? "#{app_root}/bin/rails"
8-
system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
9-
warn "Automatic creation of the dummy app failed"
10-
exit 1
11-
end
3+
if %w[g generate].include? ARGV.first
4+
exec "#{__dir__}/rails-engine", *ARGV
5+
else
6+
exec "#{__dir__}/rails-sandbox", *ARGV
127
end
13-
14-
Dir.chdir app_root
15-
exec 'bin/rails', *ARGV

0 commit comments

Comments
 (0)