Skip to content

Commit

Permalink
Merge branch 'avo-hq:main' into feature/add-visible-option-to-panels
Browse files Browse the repository at this point in the history
  • Loading branch information
icaroryan authored Jul 18, 2024
2 parents 162c058 + 4185532 commit a84b924
Show file tree
Hide file tree
Showing 39 changed files with 632 additions and 367 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/i18n-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: i18n Tests

on:
pull_request:
branches:
- main
- 1.x
- 2.x
push:
branches:
- main
- 1.x
- 2.x

env:
RAILS_ENV: test
PGHOST: localhost
PGUSER: postgres
PGPORT: 5432
POSTGRES_HOST: localhost
POSTGRES_USERNAME: postgres
POSTGRES_PORT: 5432
BUNDLE_PATH_RELATIVE_TO_CWD: true
AVO_LICENSE_KEY: license_123
COVERAGE: true

jobs:
i18n_tests:
strategy:
matrix:
ruby:
- '3.3.0'
rails:
- '8.0'
runs-on: ubuntu-latest

env:
RAILS_VERSION: ${{matrix.rails}}
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}_ruby_${{ matrix.ruby }}.gemfile

services:
postgres:
image: postgres:10.8
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
# bundler-cache: true
bundler: default
ruby-version: ${{ matrix.ruby }}

- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bin/rails db:create
bin/rails db:migrate
- name: Get yarn cache directory path
id: test-yarn-cache-dir-path
run: echo "name=dir::$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: test-yarn-cache
with:
path: ${{ steps.test-yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-test-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-test-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Yarn install the dummy app
run: |
cd spec/dummy
yarn
- name: Yarn install
run: yarn

- name: Build assets
env:
RAILS_ENV: production
NODE_ENV: production
run: |
yarn build:js
yarn build:css
yarn build:custom-js
- name: Run tests
id: run_tests
run: bundle exec rspec spec/system/i18n_spec.rb

- uses: actions/upload-artifact@v3
with:
name: coverage_system_${{ matrix.rails }}_ruby_${{ matrix.ruby }}
path: coverage/.resultset.json

- uses: actions/upload-artifact@v3
if: always() && steps.run_tests.outcome == 'failure'
with:
name: rspec_failed_screenshots_rails_${{ matrix.rails }}_ruby_${{ matrix.ruby }}
path: ./spec/dummy/tmp/screenshots
2 changes: 1 addition & 1 deletion .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Run tests
id: run_tests
run: bundle exec rspec spec/system
run: bundle exec rspec spec/system/ --tag=~i18n

- uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ GIT
PATH
remote: .
specs:
avo (3.10.5)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -484,7 +484,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= index_field_wrapper **field_wrapper_args, dash_if_blank: false, flush: true do %>
<%= index_field_wrapper **field_wrapper_args, flush: true do %>
<%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @field.value %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= field_wrapper **field_wrapper_args, dash_if_blank: false do %>
<%= field_wrapper **field_wrapper_args do %>
<%= render Avo::Fields::Common::BooleanCheckComponent.new checked: @field.value %>
<% end %>
17 changes: 14 additions & 3 deletions app/components/avo/fields/date_time_field/edit_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= field_wrapper **field_wrapper_args do %>
<%= content_tag :div, data: {
<%= content_tag :div, class: "flex relative", data: {
controller: "date-field",
date_field_view_value: @view,
date_field_enable_time_value: true,
Expand All @@ -16,7 +16,7 @@
value: @field.edit_formatted_value,
class: classes("w-full #{"hidden" unless params[:avo_show_hidden_inputs]}"),
data: {
'date-field-target': 'input',
date_field_target: :input,
placeholder: @field.placeholder,
**@field.get_html(:data, view: view, element: :input)
},
Expand All @@ -28,13 +28,24 @@
value: @field.edit_formatted_value,
class: classes("w-full"),
data: {
'date-field-target': 'fakeInput',
date_field_target: :fakeInput,
placeholder: @field.placeholder,
**@field.get_html(:data, view: view, element: :input)
},
disabled: disabled?,
placeholder: @field.placeholder,
style: @field.get_html(:style, view: view, element: :input)
%>
<%= content_tag :button,
class: "absolute right-0 self-center mr-4 uppercase font-semibold text-xs",
id: :reset,
type: :button,
title: t("avo.reset").capitalize,
data: {
action: "click->date-field#clear",
tippy: :tooltip
} do %>
<%= helpers.svg "avo/times", class: "h-4" %>
<% end %>
<% end %>
<% end %>
17 changes: 14 additions & 3 deletions app/components/avo/fields/time_field/edit_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= field_wrapper **field_wrapper_args do %>
<%= content_tag :div, data: {
<%= content_tag :div, class: "flex relative", data: {
controller: "date-field",
date_field_view_value: @view,
date_field_enable_time_value: true,
Expand All @@ -16,7 +16,7 @@
value: @field.edit_formatted_value,
class: classes("w-full #{"hidden" unless params[:avo_show_hidden_inputs]}"),
data: {
'date-field-target': 'input',
date_field_target: :input,
placeholder: @field.placeholder,
**@field.get_html(:data, view: view, element: :input)
},
Expand All @@ -28,13 +28,24 @@
value: @field.edit_formatted_value,
class: classes("w-full"),
data: {
'date-field-target': 'fakeInput',
date_field_target: :fakeInput,
placeholder: @field.placeholder,
**@field.get_html(:data, view: view, element: :input)
},
disabled: disabled?,
placeholder: @field.placeholder,
style: @field.get_html(:style, view: view, element: :input)
%>
<%= content_tag :button,
class: "absolute right-0 self-center mr-4 uppercase font-semibold text-xs",
id: :reset,
type: :button,
title: t("avo.reset").capitalize,
data: {
action: "click->date-field#clear",
tippy: :tooltip
} do %>
<%= helpers.svg "avo/times", class: "h-4" %>
<% end %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/components/avo/index/table_row_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<% end %>
<% end %>
<% if Avo.configuration.resource_controls_on_the_right? %>
<td class="text-right whitespace-nowrap" data-control="resource-controls">
<td class="text-right whitespace-nowrap px-3" data-control="resource-controls">
<div class="flex items-center justify-end flex-grow-0 h-full">
<%= render resource_controls_component %>
</div>
Expand Down
2 changes: 0 additions & 2 deletions app/components/avo/resource_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def can_see_the_destroy_button?
end

def can_see_the_actions_button?
return false if @actions.blank?

return authorize_association_for(:act_on) if @reflection.present?

@resource.authorization.authorize_action(:act_on, raise_exception: false) && !has_reflection_and_is_read_only
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/js/controllers/fields/date_field_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,8 @@ export default class extends Controller {
updateRealInput(value) {
this.inputTarget.value = value
}

clear() {
this.fakeInputTarget._flatpickr.clear();
}
}
4 changes: 2 additions & 2 deletions gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -415,7 +415,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -415,7 +415,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -446,7 +446,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -446,7 +446,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -442,7 +442,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -442,7 +442,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/rails_8.0_ruby_3.1.4.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ PATH
PATH
remote: ..
specs:
avo (3.10.2)
avo (3.10.6)
actionview (>= 6.1)
active_link_to
activerecord (>= 6.1)
Expand Down Expand Up @@ -453,7 +453,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.2)
strscan
ripper-tags (1.0.2)
rspec-core (3.13.0)
Expand Down
Loading

0 comments on commit a84b924

Please sign in to comment.