Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy test app #19

Merged
merged 16 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Gemfile.lock
gemfiles/.bundle
pkg/
.rspec
9 changes: 9 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env ruby

appraise "administrate-0.10" do
gem "administrate", "0.10.0"
end

appraise "administrate-master" do
gem "administrate", git: "https://github.com/thoughtbot/administrate", branch: "master"
end
8 changes: 6 additions & 2 deletions administrate-field-nested_has_many.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ Gem::Specification.new do |gem|
gem.add_dependency "administrate", "> 0.8", "< 1"
gem.add_dependency "cocoon", "~> 1.2", ">= 1.2.11"

gem.add_development_dependency "rake"
gem.add_development_dependency "rspec"
gem.add_development_dependency "appraisal"
gem.add_development_dependency "capybara"
gem.add_development_dependency "factory_bot"
gem.add_development_dependency "i18n-tasks"
gem.add_development_dependency "rake"
gem.add_development_dependency "rspec-rails"
gem.add_development_dependency "sqlite3"
end
48 changes: 6 additions & 42 deletions app/views/fields/nested_has_many/_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,45 +1,9 @@
<%#
# HasMany Show Partial

This partial renders a has_many relationship,
to be displayed on a resource's show page.

By default, the relationship is rendered
as a table of the first few associated resources.
The columns of the table are taken
from the associated resource class's dashboard.

## Local variables:

- `field`:
An instance of [Administrate::Field::HasMany][1].
Contains methods to help display a table of associated resources.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
<%
current = Gem::Version.new(Administrate::VERSION)
v0_10 = Gem::Version.new("0.10")
%>

<% if field.resources.any? %>
<% order = field.order_from_params(params.fetch(field.name, {})) %>
<% page_number = params.fetch(field.name, {}).fetch(:page, nil) %>
<%= render(
"collection",
collection_presenter: field.associated_collection(order),
collection_field_name: field.name,
page: page,
resources: field.resources(page_number, order),
table_title: field.name,
) %>

<% if field.more_than_limit? %>
<span>
<%= t(
'administrate.fields.has_many.more',
count: field.limit,
total_count: field.data.count,
) %>
</span>
<% end %>

<% if current <= v0_10 %>
<%= render "fields/nested_has_many/show_old", **local_assigns %>
<% else %>
<%= t("administrate.fields.has_many.none", default: "–") %>
<%= render "fields/nested_has_many/show_current", **local_assigns %>
<% end %>
44 changes: 44 additions & 0 deletions app/views/fields/nested_has_many/_show_current.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<%#
# HasMany Show Partial

This partial renders a has_many relationship,
to be displayed on a resource's show page.

By default, the relationship is rendered
as a table of the first few associated resources.
The columns of the table are taken
from the associated resource class's dashboard.

## Local variables:

- `field`:
An instance of [Administrate::Field::HasMany][1].
Contains methods to help display a table of associated resources.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
%>

<% if field.resources.any? %>
<% order = field.order_from_params(params.fetch(field.name, {})) %>
<% page_number = params.fetch(field.name, {}).fetch(:page, nil) %>
<%= render(
"collection",
collection_presenter: field.associated_collection(order),
collection_field_name: field.name,
page: page,
resources: field.resources(page_number, order),
table_title: field.name,
) %>

<% if field.more_than_limit? %>
<span>
<%= t(
'administrate.fields.has_many.more',
count: field.limit,
total_count: field.data.count,
) %>
</span>
<% end %>
<% else %>
<%= t("administrate.fields.has_many.none", default: "–") %>
<% end %>
36 changes: 36 additions & 0 deletions app/views/fields/nested_has_many/_show_old.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%#
# HasMany Show Partial
This partial renders a has_many relationship,
to be displayed on a resource's show page.
By default, the relationship is rendered
as a table of the first few associated resources.
The columns of the table are taken
from the associated resource class's dashboard.
## Local variables:
- `field`:
An instance of [Administrate::Field::HasMany][1].
Contains methods to help display a table of associated resources.
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
%>

<% if field.resources.any? %>
<%= render(
"collection",
collection_presenter: field.associated_collection,
resources: field.resources,
table_title: field.name
) %>

<% if field.more_than_limit? %>
<span>
<%= t(
'administrate.fields.has_many.more',
count: field.limit,
total_count: field.data.count,
) %>
</span>
<% end %>

<% else %>
<%= t("administrate.fields.has_many.none", default: "–") %>
<% end %>
13 changes: 13 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'
7 changes: 7 additions & 0 deletions gemfiles/administrate_0.10.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "administrate", "0.10.0"

gemspec path: "../"
206 changes: 206 additions & 0 deletions gemfiles/administrate_0.10.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
PATH
remote: ..
specs:
administrate-field-nested_has_many (1.1.0)
administrate (> 0.8, < 1)
cocoon (~> 1.2, >= 1.2.11)

GEM
remote: https://rubygems.org/
specs:
actionpack (5.2.1)
actionview (= 5.2.1)
activesupport (= 5.2.1)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1)
activesupport (= 5.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activemodel (5.2.1)
activesupport (= 5.2.1)
activerecord (5.2.1)
activemodel (= 5.2.1)
activesupport (= 5.2.1)
arel (>= 9.0)
activesupport (5.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
administrate (0.10.0)
actionpack (>= 4.2, < 6.0)
actionview (>= 4.2, < 6.0)
activerecord (>= 4.2, < 6.0)
autoprefixer-rails (>= 6.0)
datetime_picker_rails (~> 0.0.7)
jquery-rails (>= 4.0)
kaminari (>= 1.0)
momentjs-rails (~> 2.8)
sass-rails (~> 5.0)
selectize-rails (~> 0.6)
appraisal (2.2.0)
bundler
rake
thor (>= 0.14.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.1.4)
execjs
builder (3.2.3)
capybara (3.7.1)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
xpath (~> 3.1)
cocoon (1.2.12)
concurrent-ruby (1.0.5)
crass (1.0.4)
datetime_picker_rails (0.0.7)
momentjs-rails (>= 2.8.1)
deepl-rb (2.1.0)
diff-lcs (1.3)
easy_translate (0.5.1)
thread
thread_safe
erubi (1.7.1)
execjs (2.7.0)
factory_bot (4.10.0)
activesupport (>= 3.0.0)
ffi (1.9.25)
highline (2.0.0)
i18n (1.1.0)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.23)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
deepl-rb (>= 2.1.0)
easy_translate (>= 0.5.1)
erubi
highline (>= 1.7.3)
i18n
parser (>= 2.2.3.0)
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (0.9.0)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
momentjs-rails (2.20.1)
railties (>= 3.1)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
parser (2.5.1.2)
ast (~> 2.4.0)
public_suffix (3.0.3)
rack (2.0.5)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.1)
actionpack (= 5.2.1)
activesupport (= 5.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
sass (3.5.7)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selectize-rails (0.12.5)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (0.20.0)
thread (0.2.2)
thread_safe (0.3.6)
tilt (2.0.8)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.0)
xpath (3.1.0)
nokogiri (~> 1.8)

PLATFORMS
ruby

DEPENDENCIES
administrate (= 0.10.0)
administrate-field-nested_has_many!
appraisal
capybara
factory_bot
i18n-tasks
rake
rspec-rails
sqlite3

BUNDLED WITH
1.17.1
7 changes: 7 additions & 0 deletions gemfiles/administrate_master.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "administrate", git: "https://github.com/thoughtbot/administrate", branch: "master"

gemspec path: "../"
Loading