Skip to content

Commit

Permalink
chore: upgrade to use latest wallaby-* gems and remove Cell (#162)
Browse files Browse the repository at this point in the history
* chore: upgrade the gemspec to use latest wallaby-* gems

* chore: use partial instead of cell for index folder

* chore: use partial for resources folder

* chore: remove renderers specs

* chore: remove active_record adaptor specs

* chore: add specs for index partials

* chore: a bit of spec cleanup and remove deprecated methods

* chore: update docs to take out everything about Cell

* chore: update specs

* chore: fix rubocop issue

* chore: update specs for rails 4.2

* chore: update docs again

* chore: update travis
  • Loading branch information
tian-im committed Feb 19, 2020
1 parent e071c45 commit 7be2f0a
Show file tree
Hide file tree
Showing 235 changed files with 1,066 additions and 4,528 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ matrix:
env:
global:
- DB=postgresql
- CC_TEST_REPORTER_ID=a726345933825a3e95f72dcfd646929ecb76eb02c7f7dcd5c28b8c7246167e26
- CC_TEST_REPORTER_ID=0170b911947a17e2b978075a6f33ba73e107446a9a38e08cfeadc8d5dd1df941
services:
- mysql
- postgresql
Expand All @@ -37,9 +37,10 @@ script:
before_script:
- mysql -e 'CREATE DATABASE dummy_test;' -uroot
- psql -c 'CREATE DATABASE dummy_test;' -U postgres
# setup code climate test coverage
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
# setup code climate test coverage only for `master` branch
- if [ "$TRAVIS_BRANCH" = "master" ]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
- if [ "$TRAVIS_BRANCH" = "master" ]; then chmod +x ./cc-test-reporter; fi
- if [ "$TRAVIS_BRANCH" = "master" ]; then ./cc-test-reporter before-build; fi
after_script:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
# send code climate the test coverage
- if [ "$TRAVIS_BRANCH" = "master" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
364 changes: 184 additions & 180 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ gemspec
# gem 'rails', git: 'https://github.com/rails/rails', branch: 'master'
gem 'wallaby-cop', path: '/wallaby-cop'
gem 'wallaby-core', path: '/wallaby-core'
gem 'wallaby-view', path: '/wallaby-view'

# gem 'wallaby-active_record', path: '/wallaby-active_record'
gem 'wallaby-active_record', '0.1.1'
gem 'wallaby-active_record', path: '/wallaby-active_record'
# gem 'wallaby-her', path: '/wallaby-her'

gem 'activestorage'
# gem 'activestorage'
gem 'cancancan'
gem 'her'
gem 'kaminari'
gem 'pundit'
gem 'rails', '~> 6.0.0'
gem 'simple_blog_theme', git: 'https://github.com/tian-im/simple_blog_theme.git', branch: 'master'
# gem 'simple_blog_theme', path: '/simple_blog_theme'
gem 'will_paginate'

# gem 'font-awesome-sass', '< 5.0'

Expand All @@ -38,10 +40,12 @@ group :development, :test do
gem 'devise'
gem 'ffaker'
gem 'mysql2'
gem 'pg', '~> 0.15'
# gem 'pg', '~> 0.15'
gem 'pg'
gem 'pry-rails'
gem 'rspec-rails', '4.0.0.beta3'
gem 'sqlite3'
# gem 'sqlite3', '< 1.4.0'
gem 'yard'
end

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Wallaby
# [Wallaby](https://github.com/wallaby-rails/wallaby)

[![Gem Version](https://badge.fury.io/rb/wallaby.svg)](https://badge.fury.io/rb/wallaby)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Travis CI](https://travis-ci.org/wallaby-rails/wallaby.svg?branch=master)](https://travis-ci.org/wallaby-rails/wallaby)
[![Maintainability](https://api.codeclimate.com/v1/badges/2abd1165bdae523dd2e1/maintainability)](https://codeclimate.com/github/wallaby-rails/wallaby/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/2abd1165bdae523dd2e1/test_coverage)](https://codeclimate.com/github/wallaby-rails/wallaby/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/5b94a30d79f3b6d8c4ce/maintainability)](https://codeclimate.com/github/wallaby-rails/wallaby/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/5b94a30d79f3b6d8c4ce/test_coverage)](https://codeclimate.com/github/wallaby-rails/wallaby/test_coverage)
[![Inch CI](https://inch-ci.org/github/wallaby-rails/wallaby.svg?branch=master)](https://inch-ci.org/github/wallaby-rails/wallaby)

Wallaby is a Rails engine that autocompletes the resourceful controller and view for a given ORM model (ActiveRecord, HER) for admin interface and other purposes.

It can be extended to support any ORM model and can be easily and deeply customized at MVC's different aspects by using [decorators](docs/decorator.md), [controllers](docs/controllers.md), [type partials/cells](docs/view.md), [servicers](docs/servicer.md), [authorizers](docs/authorizer.md), [paginators](docs/paginator.md) and [themes](docs/theme.md).
It can be extended to support any ORM model and can be easily and deeply customized at MVC's different aspects by using [decorators](https://github.com/wallaby-rails/wallaby/blob/master/docs/decorator.md), [controllers](https://github.com/wallaby-rails/wallaby/blob/master/docs/controllers.md), [type partials](https://github.com/wallaby-rails/wallaby/blob/master/docs/view.md), [servicers](https://github.com/wallaby-rails/wallaby/blob/master/docs/servicer.md), [authorizers](https://github.com/wallaby-rails/wallaby/blob/master/docs/authorizer.md), [paginators](https://github.com/wallaby-rails/wallaby/blob/master/docs/paginator.md) and [themes](https://github.com/wallaby-rails/wallaby/blob/master/docs/theme.md).

[Try the demo here](https://wallaby-demo.herokuapp.com/admin/).

Expand Down Expand Up @@ -88,15 +88,15 @@ Restart rails server, and visit http://localhost:3000/blogs to give it a taste!

## Documentation

- [Features and Requirements](docs/features.md)
- [Documentation](docs/README.md) for more usages and customization guides
- [Features and Requirements](https://github.com/wallaby-rails/wallaby/blob/master/docs/features.md)
- [Documentation](https://github.com/wallaby-rails/wallaby/blob/master/docs/README.md) for more usages and customization guides
- [API Reference](https://www.rubydoc.info/gems/wallaby)
- [Change Logs](CHANGELOG.md)
- [Change Logs](https://github.com/wallaby-rails/wallaby/blob/master/CHANGELOG.md)

## Want to contribute?

Raise an issue, discuss and resolve!

## License

This project uses [MIT License](LICENSE).
This project uses [MIT License](https://github.com/wallaby-rails/wallaby/blob/master/LICENSE).
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/_active_storage.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value.try(:attachment) ? link_to(value.attachment.blob.filename, rails_blob_path(value)) : null %>
3 changes: 3 additions & 0 deletions app/views/wallaby/resources/_resource_actions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= show_link(local_assigns[:decorated]) {} %>
<%= edit_link(local_assigns[:decorated]) {} %>
<%= delete_link(local_assigns[:decorated]) {} %>
13 changes: 0 additions & 13 deletions app/views/wallaby/resources/active_storage_html.rb

This file was deleted.

5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_belongs_to.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value.present? ? show_link(value, options: { readonly: true }) : null %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_bigint.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value || null %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_bigserial.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value || null %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_binary.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value ? muted('binary') : null %>
9 changes: 9 additions & 0 deletions app/views/wallaby/resources/index/_bit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
content_tag :code, value
end %>
9 changes: 9 additions & 0 deletions app/views/wallaby/resources/index/_bit_varying.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
content_tag :code, value
end %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_blob.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value ? muted('blob') : null %>
9 changes: 9 additions & 0 deletions app/views/wallaby/resources/index/_boolean.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
value ? fa_icon('check-square') : fa_icon('square')
end %>
16 changes: 16 additions & 0 deletions app/views/wallaby/resources/index/_box.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
max = metadata[:max] || default_metadata.max
value = value.to_s
if value.length > max
concat content_tag(:code, value.truncate(max))
itooltip value
else
content_tag :code, value
end
end %>
13 changes: 13 additions & 0 deletions app/views/wallaby/resources/index/_cidr.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
concat content_tag(:code, value)
link_to(
fa_icon('link'), "http://ip-api.com/##{value}",
target: :_blank, class: 'text-info'
)
end %>
16 changes: 16 additions & 0 deletions app/views/wallaby/resources/index/_circle.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
max = metadata[:max] || default_metadata.max
value = value.to_s
if value.length > max
concat content_tag(:code, value.truncate(max))
itooltip value
else
content_tag :code, value
end
end %>
16 changes: 16 additions & 0 deletions app/views/wallaby/resources/index/_citext.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
max = metadata[:max] || default_metadata.max
value = value.to_s
if value.length > max
concat content_tag(:span, value.truncate(max))
imodal metadata[:label], value
else
value
end
end %>
10 changes: 10 additions & 0 deletions app/views/wallaby/resources/index/_color.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
concat content_tag(:span, nil, style: "background-color: #{value};", class: 'color-square')
content_tag(:span, value, class: 'text-uppercase')
end %>
11 changes: 11 additions & 0 deletions app/views/wallaby/resources/index/_date.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
value = Time.zone.parse value if value.is_a? String
value = value.to_date if value.is_a? Time
I18n.l value
end %>
12 changes: 12 additions & 0 deletions app/views/wallaby/resources/index/_daterange.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
concat content_tag(:span, I18n.l(value.first, format: :short), class: 'from')
concat '...'
concat content_tag(:span, I18n.l(value.last, format: :short), class: 'to')
itooltip "#{I18n.l value.first} ... #{I18n.l value.last}", 'time'
end %>
11 changes: 11 additions & 0 deletions app/views/wallaby/resources/index/_datetime.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
value = Time.zone.parse value if value.is_a? String
concat content_tag(:span, I18n.l(value, format: :short))
itooltip I18n.l(value), 'time'
end %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_decimal.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value || null %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_email.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value.nil? ? null : mail_to(value) %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_float.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value.try(:to_f) || null %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<% unique_collection = value.uniq %>
<%= raw unique_collection.first(2).map { |item| show_link item, options: { readonly: true } }.join(', ') %>
<%= if unique_collection.length > 2
title = metadata[:label]
body = unique_collection.map { |item| show_link item, options: { readonly: true } }.to_sentence.html_safe
label = "#{unique_collection.length - 2} more"
concat ' and '
imodal title, body, label: label
elsif unique_collection.blank?
null
end %>
15 changes: 15 additions & 0 deletions app/views/wallaby/resources/index/_has_many.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<% unique_collection = value.uniq %>
<%= raw unique_collection.first(2).map { |item| show_link item, options: { readonly: true } }.join(', ') %>
<%= if unique_collection.length > 2
title = metadata[:label]
body = unique_collection.map { |item| show_link item, options: { readonly: true } }.to_sentence.html_safe
label = "#{unique_collection.length - 2} more"
concat ' and '
imodal title, body, label: label
elsif unique_collection.blank?
null
end %>
5 changes: 5 additions & 0 deletions app/views/wallaby/resources/index/_has_one.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= value.present? ? show_link(value, options: { readonly: true }) : null %>
16 changes: 16 additions & 0 deletions app/views/wallaby/resources/index/_hstore.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
max = metadata[:max] || default_metadata.max
value = value.to_s
if value.length > max
concat content_tag(:code, value.truncate(max))
imodal metadata[:label], "<pre>#{h value}</pre>".html_safe
else
content_tag :code, value
end
end %>
13 changes: 13 additions & 0 deletions app/views/wallaby/resources/index/_inet.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
concat content_tag(:code, value)
link_to(
fa_icon('link'), "http://ip-api.com/##{value}",
target: :_blank, class: 'text-info'
)
end %>
11 changes: 11 additions & 0 deletions app/views/wallaby/resources/index/_int4range.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%# @param object [model] model instance %>
<%# @param field_name [String] name of the field %>
<%# @param value [Object] value of the field %>
<%# @param metadata [Hash] metadata of the field %>
<%= if value.nil?
null
else
concat content_tag(:span, value.first, class: 'from')
concat '...'
content_tag(:span, value.last, class: 'to')
end %>

0 comments on commit 7be2f0a

Please sign in to comment.