-
Notifications
You must be signed in to change notification settings - Fork 210
What's New In 3.6.0
Before 3.6.0 :model_class was used in column definitions for columns from joined tables.
In 3.6.0 the API has changed to use associations.
If, say, a Task belongs_to a Priority, a column definition should specify this association using :assoc:
g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
task.priority.name if task.priority
endIf, say, a Task belongs_to a Project, and a Project belongs to a Customer,
assoc: should be a list of these associations:
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
task.project.customer.name if task.project && task.project.customer
endBlockless columns used to only work for the main model. Now they can be used for joined tables, too.
Instead of
g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
task.priority.name if task.priority
endyou can write
g.column name: 'Priority', attribute: 'name', assoc: :priorityInstead of
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
task.project.customer.name if task.project && task.project.customer
endyou can write
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer]Before 3.6.0 to choose a datepicker type we used :helper_style in column definitions and Wice::Defaults:HELPER_STYLE in the configuration_file.
In 3.6.0 :helper_style and Wice::Defaults:HELPER_STYLE are gone.
Now each datepicker is simply a separate filter type, and to pick a datepicker we can use :filter_type, just like other filter types are chosen.
Filter types for dates and datetimes are
:rails_datetime_helper:rails_date_helper:jquery_datepicker:bootstrap_datepicker
Example:
g.column name: 'Updated', attribute: 'updated_at', filter_type: :rails_datetime_helper do |task|
task.updated_at.to_s(:db)
endDefault filter types for date and datetime columns are set by Wice::Defaults:DEFAULT_FILTER_FOR_DATE and Wice::Defaults:DEFAULT_FILTER_FOR_DATETIME.
There are no more icons inside the gem. Instead, Font Awesome is used.
CSS is no longer copied to the application asset directory. Instead the user is supposed to add
@import "wice_grid";
@import "font-awesome-sprockets";
@import "font-awesome";to application.scss.
font-awesome-sass is not a dependency of WiceGrid in case you decide to style WiceGrid icons differently,
so you need to add it explicitly to your Gemfile:
gem 'font-awesome-sass', '~> 4.3'Setting a configuration value in Wice::Defaults::STRING_MATCHING_OPERATORS to CI_LIKE will result in the following SQL generated for string filters:
UPPER(table.field) LIKE UPPER(?)"New USE_DEFAULT_SCOPE configuration value from @nathanvda.
By default ActiveRecord calls are always executed inside Model.unscoped{}.
Setting USE_DEFAULT_SCOPE to true will use the default scope for all queries.
© Yuri Leikind