diff --git a/.github/workflows/brakeman-analysis.yml b/.github/workflows/brakeman-analysis.yml index 05f210b..01b1a5b 100644 --- a/.github/workflows/brakeman-analysis.yml +++ b/.github/workflows/brakeman-analysis.yml @@ -19,7 +19,7 @@ jobs: steps: # Checkout the repository to the GitHub Actions runner - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Customize the ruby version depending on your needs - name: Set up Ruby @@ -29,7 +29,7 @@ jobs: - name: Setup Brakeman env: - BRAKEMAN_VERSION: "6.1" # SARIF support is provided in Brakeman version 4.10+ + BRAKEMAN_VERSION: "6.2.1" # SARIF support is provided in Brakeman version 4.10+ run: | gem install brakeman --version $BRAKEMAN_VERSION @@ -41,6 +41,6 @@ jobs: # Upload the SARIF file generated in the previous step - name: Upload SARIF - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: output.sarif.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6c41d6..e394c36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,8 @@ jobs: alchemy_branch: - "7.0-stable" - "7.1-stable" + - "7.2-stable" ruby: - - "3.0" - "3.1" - "3.2" - "3.3" @@ -49,7 +49,7 @@ jobs: MYSQL_ROOT_PASSWORD: password options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -95,11 +95,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: "3.0" + ruby-version: "3.1" bundler-cache: true - name: Lint Ruby files run: bundle exec standardrb diff --git a/.rubocop.yml b/.rubocop.yml index 6faf5db..2db2740 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ require: standard AllCops: - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 inherit_gem: standard: config/base.yml diff --git a/.standard.yml b/.standard.yml index 4bd8331..6ab3913 100644 --- a/.standard.yml +++ b/.standard.yml @@ -1,3 +1,4 @@ parallel: true +ruby_version: 3.1 ignore: - "spec/dummy/**/*" diff --git a/Gemfile b/Gemfile index 1b474e8..bd465c1 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,6 @@ gem "rails", "~> #{rails_version}.0" gem "listen", "~> 3.8" gem "puma", "~> 6.0" -gem "sprockets-rails", "< 3.5.0" - # Specify your gem's dependencies in alchemy-solidus.gemspec gemspec diff --git a/app/models/alchemy/user.rb b/app/models/alchemy/user.rb index 24bab48..e5b7d46 100644 --- a/app/models/alchemy/user.rb +++ b/app/models/alchemy/user.rb @@ -47,6 +47,10 @@ def ransackable_attributes(_auth_object = nil) ] end + def ransortable_attributes(_auth_object = nil) + %w[last_sign_in_at] + end + alias_method :searchable_alchemy_resource_attributes, :ransackable_attributes def ransackable_associations(_auth_object = nil) diff --git a/app/views/alchemy/admin/users/_resource_table.html.erb b/app/views/alchemy/admin/users/_resource_table.html.erb new file mode 100644 index 0000000..3bbbdc5 --- /dev/null +++ b/app/views/alchemy/admin/users/_resource_table.html.erb @@ -0,0 +1,34 @@ +<%= render Alchemy::Admin::Resource::Table.new(@users, query: @query) do |table| %> + <% table.icon_column do |user| %> + <%= render_icon(:user, style: user.logged_in? ? "solid" : "regular") %> + <% end %> + <% table.column :login, sortable: true do |user| %> + <% if can?(:edit, user) %> + <%= link_to_dialog user.login, + alchemy.edit_admin_user_path(user), { + title: Alchemy.t(:edit_user), + overflow: true, + size: "430x560" + }, + title: Alchemy.t(:edit_user) %> + <% else %> + <%= user.login %> + <% end %> + <% end %> + <% table.column :firstname, class_name: "name", sortable: true %> + <% table.column :lastname, sortable: true %> + <% table.column :email, sortable: true %> + <% table.column :language do |user| %> + <%= Alchemy.t(user.language, scope: :translations, default: Alchemy.t(:unknown)) %> + <% end %> + <% table.column :last_sign_in_at, sortable: true do |user| %> + <%= user.last_sign_in_at.present? ? l(user.last_sign_in_at, format: :"alchemy.default") : Alchemy.t(:unknown) %> + <% end %> + <% table.column :role, header: Alchemy::User.human_attribute_name(:alchemy_roles) do |user| %> + <%= user.human_roles_string %> + <% end %> + <% table.delete_button tooltip: Alchemy.t(:delete_user), confirm_message: Alchemy.t(:confirm_to_delete_user) %> + <% table.edit_button tooltip: Alchemy.t(:edit_user), dialog_size: "430x560" %> +<% end %> + +<%= paginate @users, theme: "alchemy" %> diff --git a/app/views/alchemy/admin/users/_table.html.erb b/app/views/alchemy/admin/users/_table.html.erb new file mode 100644 index 0000000..31cad89 --- /dev/null +++ b/app/views/alchemy/admin/users/_table.html.erb @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + <%= render partial: "user", collection: @users %> + +
+ <%= sort_link @query, :firstname, hide_indicator: true %> + + <%= sort_link @query, :lastname, hide_indicator: true %> + <%= Alchemy::User.human_attribute_name('language') %> + <%= sort_link @query, :last_sign_in_at, hide_indicator: true %> + <%= Alchemy::User.human_attribute_name('roles') %>
diff --git a/app/views/alchemy/admin/users/index.html.erb b/app/views/alchemy/admin/users/index.html.erb index 2b550bb..38b16be 100644 --- a/app/views/alchemy/admin/users/index.html.erb +++ b/app/views/alchemy/admin/users/index.html.erb @@ -20,37 +20,14 @@ <% end %>
- <%= render "alchemy/admin/resources/table_header" %> <% if @users.any? %> + <%= render "alchemy/admin/resources/table_header" %> - - - - - - - - - - - - - - - - <%= render partial: 'alchemy/admin/users/user', collection: @users %> - -
- <%= sort_link @query, :firstname, hide_indicator: true %> - - <%= sort_link @query, :lastname, hide_indicator: true %> - <%= Alchemy::User.human_attribute_name('language') %> - <%= sort_link @query, :last_sign_in_at, hide_indicator: true %> - <%= Alchemy::User.human_attribute_name('roles') %>
+ <% if Alchemy::Admin.const_defined?(:Resource) %> + <%= render "resource_table" %> + <% else %> + <%= render "table" %> + <% end %> <%= paginate @users, theme: 'alchemy' %>