Skip to content

Commit

Permalink
Make thumbnail selection simple to understand.
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
ewlarson committed Nov 5, 2024
1 parent e0e94b2 commit b2e3cf4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/assets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def set_asset

# Only allow a list of trusted parameters through.
def asset_params
params.require(:asset).permit(:parent_id)
params.require(:asset).permit(:parent_id, :thumbnail)
end

def date_check?(val)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/document_assets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def set_document_asset

# Only allow a list of trusted parameters through.
def document_asset_params
params.require(:asset).permit(:title, :label, :dct_references_uri_key)
params.require(:asset).permit(:title, :label, :dct_references_uri_key, :thumbnail)
end
end
end
1 change: 1 addition & 0 deletions app/javascript/controllers/results_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Controller } from "stimulus"
export default class extends Controller {

connect() {
console.log("GBL Admin - ResultsController connected");
}

checkedState(checked, selector='input[type=checkbox]') {
Expand Down
8 changes: 0 additions & 8 deletions app/javascript/entrypoints/engine.js

This file was deleted.

7 changes: 5 additions & 2 deletions app/javascript/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
console.log('Vite ⚡️ Rails - GBL Admin')

// Stimulus
// Import Stimulus and controllers
import { Application } from '@hotwired/stimulus'
import ResultsController from "./controllers/results_controller"

// Initialize Stimulus
window.Stimulus = Application.start()
Stimulus.register("results", ResultsController)

// Register controllers
Stimulus.register("results", ResultsController)
5 changes: 3 additions & 2 deletions app/views/admin/document_assets/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
<% @document_assets.each do |document_asset| %>
<tr>
<td>
<% if document_asset.respond_to?(:thumbnail) %>
<%= document_asset.thumbnail %>
<%= form_with model: document_asset, url: admin_document_document_asset_path(document_asset.parent, document_asset), method: :put, remote: true, class: 'thumbnail-form' do |f| %>
<%= f.check_box :thumbnail, class: 'thumbnail-toggle', onchange: "this.form.submit()" %>
<%= f.submit 'Save', class: 'btn btn-sm btn-primary d-none' %>
<% end %>
</td>
<td>
Expand Down
10 changes: 9 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ standardrb --fix
### Test App
```bash
bundle exec rake ci
```
```

### Build Node Module
Bump the package version in `package.json` and run the following commands to build and publish the node module.

```bash
bundle exec vite build
npm publish
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@geoblacklight/admin",
"type": "module",
"version": "0.4.4",
"version": "0.4.12",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit b2e3cf4

Please sign in to comment.