0.11.9
- Fix
standaloneoverrides clobbering inheritedlayout/skip_authentication/skip_forgery_protection. A secondstandalonecall (e.g. a subclass overriding a pre-built component) re-ranStandaloneDslwhoseto_confalways emitted the hard defaults (layout: true,skip_*: false);deep_merge!then overwrote the value inherited from the parent. These now default toniland the real defaults are only injected whenprovide_defaultsis true (first call), socompactstrips them on overrides anddeep_merge!preserves the inherited value — mirroringVerbDsl#to_conf. Subclasses no longer need to repeatlayout :backendjust to keep it. - Enhance documentation for better LLM support (and humans as well of course):
- Documentation: add agent-oriented docs —
CLAUDE.mdprimer,doc/llms.txtindex,doc/guide/dsl_reference.md,doc/guide/glossary.md,doc/guide/gotchas.md,doc/guide/example_advanced.md,doc/guide/patterns.md,doc/guide/cookbook.md(task-indexed recipes). Thicken the thin pre-built component docs (Index, Show, List, WithForm). Fix stale docs: README guide index links (Virtual models, Edit),pre_built_components.md(wrongly claimed no Show/Index component; Edit link), and anEdithook name inedit.md(on_update_failed). - Inline YARD: documented previously-bare DSL hooks (New/Edit/Destroy
on_*) and added@param/@return/@yield/@apiplus@!group DSLto the WithForm, Form, Resourceful, verb and standalone DSL methods. Comments only — no behavior change. .yardoptsnow lists the guide pages as extra files so the whole guide (including the new agent docs) renders in the YARD/rubydoc reference, not justlib/.- Add
doc/integrations.md(companion-gem map mirroring the gemspec) anddoc/guide/maintaining.md(release / docs / dependency / anonymization policy); cross-link non-obvious DSL methods (e.g.path) to matching patterns. - Fix broken relative links:
generators.md→inheritance.md#best-practice(was a doubled./doc/guide/path) and two wrong-depth links inpre_built_components.md(../→./). Full guide link/anchor set now verified (0 broken). - (Run
yard docto regenerate the HTML underdoc/after doc changes.)
- Documentation: add agent-oriented docs —
0.11.8
- Fix
Compony::VirtualModel#attributesto include virtual attributes (declared viaattribute :foo, :type). Theinclude ActiveModel::Attributeswas shadowingActiveType::VirtualAttributes#attributes, so virtual attribute values were stored in@virtual_attributesbut invisible to#attributes, breaking callers that usemodel.attributes.slice(...)ormodel.attributes.select { ... }.
0.11.7
- Relax anchormodel dependency, since anchormodel 0.4 is compatible
0.11.6
- Enhance output of component's
inspect - Add request context view helper
standalone_name
0.11.5
- Replace deprecated
:unprocessable_entityby:unprocessable_content - In pre-built
:listcomponent, expose more details suitable for showing pagination information
0.11.4
- Internal refactoring of submit button
- Switch to anchormodel 0.3.0
0.11.3
- Enhance error message when attachment reflection is missing
0.11.2
- Harmonize authentication interface for the
:newcomponent- When called via GET, and pointing to it from
:index, check for permission on the data class - When called via POST, check for permission on the model instance
- When called via GET, and pointing to it from
0.11.1
- Fix wrong naming in changelog
- In pre-built
:newcomponent, switch authorization to the previously created data class and check fornewin GET. This allows to:- Build intents with prepared data, e.g.
Compony.intent(:new, Post.new(user_id: @data.id), path: { post: { user_id: @data.id } }) - Make the
cancancanability watch for this, e.g.can :manage, Post, user_id: user.id
- Build intents with prepared data, e.g.
0.11.0
- Remove
resourceful_sub_compas the intent API has made it obsolete. - Allow handling UUID style IDs in pre-built Show component
- Fix a bug in intents preventing overriding the feasibility target
Steps to take
- Search for
resourceful_sub_compand replace those calls byrender_sub_compwhile passing@dataas the second intent argument.
0.10.2
- Produce debug output when skipping an intent due to a NameError
- When intents are given both a model (through data) and a family name (through the second argument), prefer the family name to find out the component class
0.10.1
- Implement intent to always return the path it was initialized with in case the argument was given
0.10.0
- Fix a bug in error message for
comp_class_for! - Replace
colorandiconbybutton. This new component DSL call provides defaults forbuttonoptions when intents render, similar tolabel. - Allow blank intents (intents that have no component), useful for creating custom buttons within exposed intents.
- Accept argument
turbo_frameinrender_sub_comp - Fix a problem with translations when fastgettext is not installed
- Update
Compony::Components::List:- Fix a problem where disabling only filtering caused a crash
- Distinguish between boolean setters and
skip_prefixes - Replace
row_actionbyrow_intent
- Rename
ExposedIntentsDsltoManageIntentsDsl, allow passing options and ignoreaddcall if the target component is not defined
Steps to take
- In your components, replace code like
icon :eyeby:button(:icon){ :eye }orbutton(:icon){|_| :eye }(the latter in the resourceful case) - In your components, replace code like
color :dangerby:button(:color){ :danger }orbutton(:color){|_| :danger }(the latter in the resourceful case) - Check all your
Listcomponents, as the interface has changed:skip_DSL calls have been replaced by boolean writers.row_actionhas been replaced byrow_intentswhich renders intents usingaddandremove.
0.9.0
- Enhance Intent API:
- Make
stylea property of the Intent rather than a button option. - No longer allow arbitrary options for building intents. Instead, options for buttons must be wrapped in
button: { class: '...' }.
- Make
Steps to take
- Replace code like
button: { style: :link }by simplystyle: :link - Make sure that code like
button: { label: ... }becomes simply:label: ... - Make sure that all kwargs in intents meant for buttons are wrapped in
button: { ... }.
0.8.1
- Fix a problem in List resulting in
data_classbeing read too early
0.8.0
Be advised that this version brings major interface changes that will break existing applications. When upgrading, carefully follow sthe steps unter "Steps to take" and test your application thoroughly.
- Add
render_sub_comphelper - Major API change: implement
Compony::Intentas discussed in Issue #14:- Rewire many pure helpers to use intents instead, greatly cleaning up their interface
- Remove pure helpers
rails_action_name,path_helper_name,comp_cstandfamily_cst - Remove
button_defaultsand associated logic, as it was rarely used - Remove
Compony::Components::Buttonand replace it byCompony::Components::Buttons::LinkandCompony::Components::Buttons::CssButton - Remove
Compony.button,compony_buttonandcompony_link - Use intents in
sub_compand thus also inresourceful_sub_comp, allowing tho write something likesub_comp :list, user.quotes
- Update documentation
Steps to take
- Make sure you no longer use the following methods that have been removed:
Compony.rails_action_nameCompony.path_helper_nameCompony.button_defaultsCompony.with_button_defaultsCompony.button_component_class=(replace by button styles, see documentation)Component.comp_cst(replace bycomp_name)Component.family_cst(replace byfamily_name)
- If using custom buttons, inherit from
Compony::Components::Buttons::Linkand adjust code as needed. Register your button withCompony.register_button_styleand consider settingCompony.default_button_style=. - Search for each following keywords in your application and replace it as follows:
- Replace root actions (
action ... doandskip_action) by exposed intents (see documentation). - Replace
render_actionsorcompony_actionsby a custom loop of the kindCompony.root_comp&.exposed_intents&.map { |i| i.render(controller) } - Replace buttons and change any
params:topath:; as well aslabel_formatorlabel_opts: { format: ... }by something like:render_intent(:show, @data, button: { label: { format: :short } }):Compony.buttonwas typically used in a component's root actions and should thus already have been replaced in the previous step.- Replace
compony_buttonbyrender_intent - Replace
compony_linkbyrender_intentand passbutton: { style: :link }as an argument
- Replace root actions (
- Enhancement: Consider replacing patterns like
sub_comp(Components::Quotes::List, data: user.quotes).render(controller)byrender_sub_comp(:list, user.quotes).
0.7.1
- Implement
Compony::VirtualModeland document it in the Readme file - Break up documentation into separate files
0.7.0
- Rename Component's internal
pathtoid_pathto distinguish it from Rails paths, as well aspath_hashtoid_path_hash - (internal change): switch
WithForm's defaultsubmit_pathblock toCompony.pathlogic - Implement new component DSL method
path, closes #13- The method allows components to define the path pointing towards them (the default behavior corresponds to that of
Compony.pathof previous versions) - Adjust
Compony.pathto instanciate the target component and use thepathblock rather than come up with the path on its own
- The method allows components to define the path pointing towards them (the default behavior corresponds to that of
Steps to take
- If using the methods formerly called
pathorpath_hash, rename them toid_pathrespectivelyid_path_hash.
0.6.4
- Replace Feasibility's error message generation in case of dependent errors by a logic that fits fastgettext's modern pluralization
0.6.3
- Restrict multi-attachments to upload only when the form's object is a new record
0.6.2
- Change download link label of attachments from "Download" to the actual filename
- Support multiple attachments by providing a simple UI for adding and removing attachments
0.6.1
- Implement
default_sortinginCompony::Components::List
0.6.0
- Implement
Compony::Components::Show - Implement
Compony::Components::IndexandCompony::Components::List
0.5.9
- Fix a bug in generator that was introduced with the previous commit
0.5.8
- Apply most recent rubocop recommendations
- Update rubocop
- #10: Implement feasibility framework for links
- Support
BaseComponents
0.5.7
- Fix a minor bug causing unnecessary param
idto be added to the path after creating or updating when redirecting back to the index component
0.5.6
- Allow overriding the label in the view helper
compony_link
0.5.5
- Support
has_oneassociations for feasibility
0.5.4
- Fix a failure description in Form
- Support
multilang: trueinModelMixin's andForm'sfieldcall, as well as inForm'sschema_field - Allow customizing parameters for form builder
- Implement
skip_forgery_protection!
0.5.3
- Support
standalone_nameinCompony.buttonandcompony_link - Support passing component classes directly to
compony_link - Support
button_paramsin regular buttons - Support
valuein submit buttons - Support
disable!anddisabled: truein Form, disabling all inputs
0.5.2
- Add
constraintstostandalone - Add
scopeandscope_argstostandalone - Set default
label_methodtolabelwhen generating asimple_forminput for:association
0.5.1
- Correctly handle
ActiveType::Objectvirtual fields in Rails 7.2
0.5.0
- Require Ruby 3.3.5 and Rails 7.2.1
- Update Gems Compony depends on (this is to ensure all Compony users have versions Compony is frequently tested against)
Steps to take
- Update your application to Ruby 3.3.5 and Rails 7.2.1. For instance, if you are running an rbenv setup, these would be typical steps involved:
- set
rbenv local 3.3.5and perhaps restart your editor (in particular with VS code) - In your Gemfile:
- switch ruby version to
3.3.5 - switch Rails version to
7.2.1 - Run bundler:
- Update bundler itself:
bundle update --bundler - Run
bundle updateorbundle update --conservativedepending on your preference.
- set
- Check for warnings and react accordingly
0.4.1
- Allow the argument
standalone_namein button and path helper - Provide family and comp name accessors in the static context as well for convenience
- Make
Compony.pathaccept a component class as well - Make Compony.button accept a component as well. Works in combination with passing a model.
- Fix a bug that caused an override of input option arguments if the
acceptparameter is present
0.4.0
- Support Cancancan's
accessible_attributes- Cancancan has fixed https://github.com/CanCanCommunity/cancancan/issues/838
- Automatically declare all fields as ActiveModel attributes
- When using this feature together with ActiveType, be sure to add
include ActiveModel::Attributesat the top of your virtual models. - Due to Rails' implementation of
authenticate_by,:passwordand:password_confirmationcan not be attributes and thus should no longer be declared as fields in your applications.- To handle password fields in forms,
pw_fieldandschema_pw_fieldwere added
- To handle password fields in forms,
- Require
cancancan_actionfor every Form, respectivelyform_cancancan_actionfor every WithForm - Filter form fields by Cancancan action, effectively providing per-field authorization
- Attention, this feature is only used when using
fieldandschema_field, it will not affect custom inputs or schema lines. - Require Ruby 3.2.2
Steps to perform
- If using ActiveType, add
include ActiveModel::Attributesat the top of your virtual models. - In your User model, remove
field :passwordandfield :password_confirmation- If on login, you get the ArgumentError "One or more password arguments are required", you have forgotten to do this.
- In your User Form:
- replace
concat field :passwordbyconcat pw_field :password - replace
concat field :password_confirmationbyconcat pw_field :password_confirmation - replace
schema_field :passwordbyschema_pw_field :password - replace
schema_field :password_confirmationbyschema_pw_field :password_confirmation
- replace
- Make sure your forms work as expected, as cancancan action is now required (see above).
- Either supply the appropriate action (e.g.
:editor:new), or passnilto disable per-field authorization for a form.
- Either supply the appropriate action (e.g.
0.3.3
- In
RequestContext, distinguish betweencontentandcontent!, where the first allows for missing content blocks.
0.3.2
- Add label content block to edit component
- Introduce
remove_content!and make its non-bang pendant tolerate missing blocks
0.3.1
- In
NaturalOrdering, tolerate omitting payload only if it's an override - In
content, tolerate omitting block if it's an override - Instanciate a fresh ActionView
output_bufferwhen rendering nested content to prevent double render errors - Reshape
DestroyandFormcomponents to provide more fine-grained content blocks that can be selectively overridden - Implement
remove_contentwhich allows removing a previously defined content block (useful for usage in subclasses)
0.3.0
- Internals:
- Change internal parameter handling in edit and update (now use validated params only)
- Create
NaturalOrderingwhich provides an interface for theactioncall behavior - Switch actions to
NaturalOrdering - Remove redundant code
- Remove
Component's dynamiccomp_class_forandcomp_class_for! - Switch
contenttoNaturalOrdering, enablingbefore:- Remove
add_content
- Remove
- Switch
before_rendertoNaturalOrdering, allowing having multiplebefore_renderblocks and overwriting them selectively- This change is backwards-compatible as the default behavior of
before_renderis to overwrite:main.
- This change is backwards-compatible as the default behavior of
- Implement nesting of content blocks, as described in README.md -> "Nesting content blocks, calling a content block from another"
Steps to take
- Search for
comp_class_forandcomp_class_for!and replace them byCompony.comp_class_forandCompony.comp_class_for! - Search for
add_contentand replace it bycontentalong with a name. If you used an index inadd_content, replace it bybefore:(see documentation)
0.2.3
- Support collection of Anchormodels in hidden input
0.2.2
- Adjust gemspec
- Generate documentation
- Add VERSION file
- Replace custom anchormodel field implementation by Anchormodel's new implementation of SimpleForm Input
0.2.1
- Fix a bug where the app crashed on HEAD verb
- Show more details about failing authorization block
- Implement
submit_pathDSL call for WithForm - Add French translation
- Implement
skip_autofocusin Form - Allow partial override of standalone verb configs. Example:
ruby verb :get do authorize { true } end verb :post do authorize { true } # Parent class implements more logic here, which will no longer be overwritten by calling `verb :post`. end
0.2.0
- Cleanup old code
- Remove
check_config!that was barely used
- Remove
0.1.1
- Support and force Rails 7.1.2
Steps to perform
- in
config/application.rb, replaceconfig.load_defaults 7.0byconfig.load_defaults 7.1and add:ruby # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. config.autoload_lib(ignore: %w(assets tasks))
0.1.0
- Remove (hopefully) obsolete database safeguard in
resolve_association!as we should no longer be accessing the DB. - BREAKING: Remove
primary_key_typeand tolerate int and str as primary and foreign key in all params.- This fixes a bug introduced in 0.0.10 breaking polymorphic relations.
- Support Rails 7.1
- No longer rely on
controller.response.body.blank?but usecontroller.response_body.nil?instead
- No longer rely on
Steps to perform
- Remove any calls to
primary_key_type
0.0.9
Do not use.
- Support forms with references to tables with uuid type primary key
- Support for
owned_byin model:- Smart redirect
- Auto-generate a back / cancel button
- Add
clear_standalone!to components - Allow passing an array to
preventto prevent multiple actions at once - Add features
Compony.content_before_root_compandCompony.content_after_root_comp - Add new field kind percentage
KNOWN BUGS
- This version breaks polymorphic relations.
0.0.8
- Support selecting anchormodel inputs via radio buttons
- Fix
value_forfor associations to elements that have no show component - Fix spacing problem with invisible action buttons
- Pass the controller as argument to action buttons
- Support option
:labelinvalue_forof date and datetime, support superfluous options in association - Support argument list in form generator
- Create new model field type :color
0.0.7
- Fix
standalone_access_permitted_for?check for buttons pointing to non-get verbs
0.0.6
- Fix a bug that breaks hidden fields of type reference
- Add dynamic method "field" to model mixin
- Tolerate and skip actions that do not define buttons, allows for dynamic action skipping
- Fix
value_forfor boolean fields when they are nil - BREAKING: Rename
on_createdtoon_created_respond,on_updatedtoon_updated_respond, andon_destroyedtoon_destroyed_respond- New hooks
on_created,on_updated, andon_destroyedare called before their_respondcounterpart
- New hooks
- Fix a bug in Attachment Field
- Support overriding simpleform name by providing
name:as an argument to field.simpleform_input - In ModelField Anchormodel, tolerate "value" as input_html key and infer correct constant, allow form.object to be missing
0.0.5
- Fix row bug for Email field type
- Auto-focus first non-hidden element in forms
- Add field type :url
- Automatically set the correct class when generating known components
- Add generator
componentsthat is able to mass-produce the most used components - Make fields point to the correct
model_classin case of STI - Support hidden Anchormodel fields
KNOWN BUGS
- Breaks hidden fields of type reference
0.0.4
- Unscope the namespace of resourceful components
- Add field type :email
Steps to take
- When inheriting from components, replace
Components::Resourceful::...byComponents::...
0.0.3
- Tolerate nil anchormodels
- Fix a nil pointer bug in namespace management
0.0.2
- Add new model field
Attachment - Slightly extend documentation
- Update
Gemfile.lock
0.0.1
First version