| Age | Commit message (Collapse) | Author | 
|---|
|  |  | 
|  |  | 
|  | 5877 Add a condition on TableBuilderHelper::Column | 
|  | Infer it when possible, and use a nested otherwise | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | af83/5281-workbench-import-structural-bug-reading-zip
5281 workbench import structural bug reading zip | 
|  | Update TableBuilderHelper to allow the `selectable` param to be a
lambda, thus allowing us to have row-based granularity. | 
|  | Add specs for the view.
Refactor to come | 
|  | - CR change from #5006, severity of zip file messages :warning -> :error
  - View specs for showing import_messages | 
|  |  | 
|  |  | 
|  |  | 
|  | remove the Chouette namespace
off of the construction of link in the app and in other places.
Added a small change in the reflex sync to set the stop_area_referential in the initialization of the object to be in sync with the work on the objectids (need a objectid_formatter) | 
|  | 4755 page for validate referential | 
|  |  | 
|  | Step 2: Added validation of reference->workbench->organisation consistency
            Made all specs pass
            Chased bug #4826 | 
|  |  | 
|  | The `TableBuilderHelper` now requires you to specify a `link_to`
attribute in a column you want to make a link out of instead of doing it
automagically as before.
Update the tests to do this and continue to output the right `<a>`s for
links. | 
|  | This reverts commit 28db706443a912e8355e4c48488dc40c403e7f76.
Turns out we didn't need to be able to pass an arbitrary number of
arguments to the lambda after all. The URL helper objects necessary in
addition to the first argument to the lambda can be retrieved from the
view context directly instead of passing them into the block as
parameters (which would actually make things more difficult, because the
block is called in the `TableBuilderHelper`, thus outside the scope of
the view). | 
|  | This enables us to pass multiple objects into the lambda, so that we can
for example build a URL using a Rails helper using multiple objects.
Example:
    column.link_to(referential, item)
    lambda do |referential, item|
      some_path(referential, item)
    end | 
|  | This tells the markup assembler whether or not this column should be
wrapped in a link (`<a>`). It intends to serve the same purpose as
`TableBuilderHelper#column_is_linkable`, but at the column level. The
idea is to remove that method when these links only operate by column
and not by pre-defined values like before/now. | 
|  | This parameter will be used as the `href` to link the column value
somewhere.
We give it a lambda because this makes it easier to call any method on
the row object.
This means the accessor needs to take the object as an argument, like in
the `#value` method, because we don't have a better way to handle that
(it can't be done at initialisation time because at that point we don't
have row objects, we have a collection). | 
|  | Rename this to `referential` to be more generic. This is because we
could be passing both `Referential`s and `LineReferential`s into this
parameter.
In `CompaniesController`, we use a `LineReferential` while in
`ReferentialCompaniesController` we use `Referential`.
Refs #3479 | 
|  | Instead of getting the referential to use when building the polymorphic
URL from the `UserContext`, pass in a referential directly.
The old code that used `user_context.context[:referential]` relied on
the fact that `ApplicationController#pundit_user` was defined as
follows:
     def pundit_user
       UserContext.new(current_user, referential: self.try(:current_referential))
     end
(We pass `pundit_user` into `CustomLinks` from
`TableBuilderHelper#build_links`.)
However, Robert's change 747d333ffbcc8ee0c9f1daf93ccca32799434e04
removes the `current_referential` call from `#pundit_user`. In
`CustomLinks`, we actually always want to be using
`current_referential`.
For example, on `Companies#index` (/line_referentials/:id/companies),
`CustomLinks` fails to build a correct #show link because
`user_context.context[:referential]` is `nil`, when it should instead be
a `LineReferential` object, that gets returned by the
`#current_referential` helper method. Sure, `#current_referential` is
hard to understand, so maybe we'll change that around in the future, but
this at least allows us to use the current referential in `CustomLinks`.
Refs #3479 | 
|  | The name of this method changed, but wasn't updated in the `describe`
label. | 
|  |  | 
|  | These two specs were failing because of the line:
    current_referential ||= nil
which would set `current_referential` to `nil` even after updating the
object being stubbed to `helper`.
Change the specs to stub the method on the correct object now that
`TableBuilderHelper::URL` doesn't depend on `current_referential`.
Update the faulty line in question to not clobber `current_referential`,
but still give us the `nil` value we were looking for when the helper
method isn't defined.
Refs #3479 | 
|  | Policy Refactoring and Policy Test Completion
   - All policies (and all permissions) under test.
   - Common patterns and potential problems identified...
   - ... and documented in DEVNOTES.md
   - some simply refactorings | 
|  | -  All permissions tied to `!archived?`
   -  Tests adapted
   -  Policies refactored
   ?  Is `create?` permission bound to `organisation_match?` | 
|  | models and actions
 - ApplicationPolicy nondestructive permission depend on model existance
 - ApplicationPolicy destructive permission default to `false`
 - Tied Policy permissions at ApplicationPolicy Level: edit? → update?, new? → create?, index? → show?
 - ApplicationPolicy convenience methods `delete?` & `authorizes_action?(action)`
 - Refactoring of `spec/helpers/table_builder_helper_spec.rb` accordingly
 - Stubbing scope in specs (cannot switch to referential with a `build_stubbed` instance) | 
|  |  | 
|  | to moving authoriation BL into policies | 
|  |  | 
|  |  | 
|  |  | 
|  | We're how have a separate module for the box containing links to perform
actions on selections of multiple objects in the table. I had put this
in `MultipleSelectionToolboxHelper`.
Refs #3479 | 
|  | Remove the hard-coded IDs and replace them with the test referential's
ID. I guess I had copied the output from the spec output, because the
test then passed when I ran it individually, causing me to not catch the
error. Only saw it when I ran the full test suite.
Refs #3479 | 
|  | These are all finished.
Refs #3479 | 
|  | Instead of building our context with an `OpenStruct`, use the
`UserContext` class that actually exists and represents the thing that
we want to represent.
I had copied the `OpenStruct` way of doing from
"spec/support/pundit/policies.rb" this before I found out that
`UserContext` existed.
Refs #3479 | 
|  | The delete button confirmation text has changed now that we're getting
the delete link from `ReferentialDecorator`. Update the spec to reflect
the new state of the code.
Refs #3479 | 
|  | We need the ability to say that an entire table is not sortable. By
default, all tables are sortable, and individual columns can have
sorting deactivated. This blanket deactivates sorting for all columns.
Take our `sortable` argument and pass it to `#thead`. Then
`#build_column_header` takes that value into account when creating a
header column value.
The actual label used in the column header is determined by the old
`#column_header_label` method. We've now moved it into the
`TableBuilderHelper::Column` class because it makes more sense there.
The method will now return the column's `:name` property if it was
defined, and otherwise gets the translation for `:key` as before.
Add a test on `TableBuilderHelper` that verifies that a table with
`sortable: false` returns the correct HTML without sorting links.
Refs #3479 | 
|  | In order to enable access to `CompanyDecorator#action_links`, wrap the
companies collection passed to the table builder in the test in the
decorator.
Specify the class that `CompanyDecorator` decorates explicitly. Since
`Chouette::Company` is namespaced, Draper can't infer the model from the
decorator class name.
Refs #3479 | 
|  | We're now using the `current_referential` method in
`TableBuilderHelper::URL` instead of in `TableBuilderHelper`. Thus it
couldn't get `current_referential` and caused an error. Move the mock to
`TableBuilderHelper::URL` to give it access to the method.
Refs #3479 | 
|  | A couple more links should appear in the gear menu thanks to the
inclusion of the `ReferentialDecorator#action_links`'s links in the
menu.
The test still fails, though, because the destroy link that comes out of
the decorator isn't formatted correctly (it looks like all the other
links instead of having a special icon).
Refs #3479 | 
|  | The `ReferentialDecorator` duplicates the [:archive, :unarchive,
:delete] actions, so we should remove these from our test like we did
previously in the "workbenches/show.html.slim" template.
Refs #3479 |