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

Fix typos & formatting inconsistencies in README/comments. #291

Merged
merged 1 commit into from
Nov 25, 2024
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
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Decimal numbers and Dates are NOT supported; they theoretically could be in the

* Javascript requires you to be using either rails-importmaps or a package.json-based builder like jsbundling-rails or vite-ruby. Legacy "sprockets-only" is not supported, however propshaft or sprockets can be used as your base asset pipeline.

* Blaklight 7.0+. Rails 7.0+
* Blacklight 7.0+. Rails 7.0+


# Installation
Expand All @@ -34,7 +34,7 @@ Run `rails generate blacklight_range_limit:install`

### Manual Javascript setup is not hard

The installer could have trouble figuring out how to add Javascript to your particular setup. In the end, all you need is `blacklight-range-limit` either importmap-pinned (with it's chart.js dependency), or added to your package.json, and then, in a file that has access to the `Blacklight` import:
The installer could have trouble figuring out how to add Javascript to your particular setup. In the end, all you need is `blacklight-range-limit` either importmap-pinned (with its chart.js dependency), or added to your package.json, and then, in a file that has access to the `Blacklight` import:

import BlacklightRangeLimit from "blacklight-range-limit";
BlacklightRangeLimit.init({ onLoadHandler: Blacklight.onLoad });
Expand All @@ -59,7 +59,7 @@ For import map pins, note:

### Unreleased version?

If you'd like to use an unrelased version from git, just add that to your Gemfile in the usual way.
If you'd like to use an unreleased version from git, just add that to your Gemfile in the usual way.

importmap-rails use should then Just Work.

Expand Down Expand Up @@ -102,8 +102,7 @@ config.add_facet_field 'pub_date', label: 'Publication Year', range_config: {
chart_segment_border_color: "rgba(0,0,0, 0.5)",
chart_segment_bg_color: "#ccddcc",
chart_aspect_ratio: "2"
}
)
}
```

* **:num_segments** :
Expand All @@ -112,19 +111,21 @@ config.add_facet_field 'pub_date', label: 'Publication Year', range_config: {
* Default null. For a result set that has not yet been limited, instead of taking boundaries from results and making a second AJAX request to fetch segments, just assume these given boundaries. If you'd like to avoid this second AJAX Solr call, you can set :assumed_boundaries to a two-element array of integers instead, and the assumed boundaries will always be used. Note this is live ruby code, you can put calculations in there like Time.now.year + 2.
* **chart_js**:
* Default true. If false, the Javascript chart is not loaded, you can still get textual facets for bucket with `textual_facets` config.
* **textual_facets**: Default true. Should we show textual facet list too? Universal design
* **textual_facets**:
* Default true. Should we show textual facet list too? Universal design
for accessibility, may have accessibilty concerns to turn off.
* **textual_facets_collapsible**: Put the textual facets in a collapse/expand
* **textual_facets_collapsible**:
* Put the textual facets in a collapse/expand
disclosure. If you set chart_js to false, may make sense to set this to false too, to have
textual facets only instead of chart?
* **chart_segment_border_color** / **chart_segment_bg_color** :
* **chart_segment_border_color** / **chart_segment_bg_color**:
* Set colors for the edge and fill of the segment bars in the histogram.
* chart_aspect_ratio: for chart.js, will fill available width then this determines size of chart. defaults to 2

* **chart_aspect_ratio**:
* Defaults to 2. For chart.js, will fill available width then this determines size of chart.

## Javascript dependencies

We use [chart.js](https://www.chartjs.org/) to draw the chart. It has one dependency of it's own. These need to be either pinned with importmap-rails, or used via the chart.js npm package and an npm-package-based bundler.
We use [chart.js](https://www.chartjs.org/) to draw the chart. It has one dependency of its own. These need to be either pinned with importmap-rails, or used via the chart.js npm package and an npm-package-based bundler.

There is **no CSS** needed.

Expand Down Expand Up @@ -169,4 +170,3 @@ Once you are done iterating on your test you will need to stop the application s
# Publishing Javascript

run `npm publish` to push the javascript package to https://npmjs.org/package/blacklight-range-limit

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- no results profile if missing is selected -->
<% unless @facet_field.missing_selected? %>
<%# this has to be on page if you want calculated facets to show up, JS sniffs it.
it was very hard to get chart.js to be succesfully resonsive, required this wrapper!
it was very hard to get chart.js to be successfully responsive, required this wrapper!
https://github.com/chartjs/Chart.js/issues/11005 -%>
<div class="chart-wrapper mb-3" data-chart-wrapper="true" style="display: none; position: relative; width: 100%; aspect-ratio: <%= range_config[:chart_aspect_ratio] %>;">
</div>
Expand All @@ -30,7 +30,7 @@
(min = @facet_field.min) &&
(max = @facet_field.max) %>
<div class="distribution <%= 'chart_js' unless range_config[:chart_js] == false %>">
<!-- if we already fetched segments from solr, display them
<!-- if we already fetched segments from solr, display them
here. Otherwise, display a link to fetch them, which JS
will AJAX fetch. -->
<% if @facet_field.range_queries.any? %>
Expand Down
Loading