| Age | Commit message (Collapse) | Author |
|
Referentials#show has a button "Purger" that isn't a link. Instead, it's
a `<button>` element that opens a modal.
Previously, we only knew how to put `Link`s in the `#action_links`, and
only these could then be rendered in the header bar as buttons.
This change allows us to accept non-Link objects. Since the button is
rather simple, I decided to create a simple `HTMLElement` class to
represent it and output it in the resulting HTML. The class uses the
`#content_tag` `ActionView` helper to render the final HTML.
Update "referentials/show.html.slim" to output the button correctly in
addition to the normal links.
Update `TableBuilderHelper#build_links` to not add anything that's not a
`Link` to the gear menu. This allows us to display the "Purger" button
on the Referentials#show page but not in the table on Workbenches#show.
Refs #3479
|
|
The only difference between :name and :content was that :name contained
a string and :content contained HTML. But they're really the same thing.
Thus it makes much more sense to combine those into a single property
that means both, and handles content regardless of type.
Refs #3479
|
|
Previously we weren't correctly outputting the proper HTML to get the
:delete link rendering correctly with the icon and text. It should show:
[TRASH CAN ICON] Supprimer
but instead was showing the href.
To get this working, I added a `@content` attribute to `Link`. This
allows us to optionally specify non-text content to display in the link.
We then have delete-link-specific handling when rendering the gear
menu's HTML. In that particular case, the `<li>` needs to have a
'delete-action' class in order for the styling to work properly.
Created a new `destroy_link` helper method to allow us to reuse the
destroy link content in the header bar.
TODO: Collect Link#content and Link#name into the same property.
TODO: Rename `#destroy_link` to `#destroy_link_content`
Refs #3479
|
|
Don't set links as `method: :get` by default. This shows up as:
link_to _, _, method: :get
If we set the method to `nil` instead, we don't get a
`data-method="get"` attribute in our HTML output. Instead, we get no
`data-method` attribute, which is a lot better and cleaner.
I had originally used `:get` as a default because I wanted to generalise
links and certain ones we create need `:delete` or `:put` methods. I
figured, since we're always going to be passing `method:` to `link_to`,
we should have a sane default for that option. However, using `nil` is
even better as a default because then we don't get an extra attribute in
our HTML at all.
Refs #3479
|
|
Add a new `ReferentialDecorator` that we can use to define the links
that appear as buttons in the header of the `/referentials/:id` page.
The idea is that these links will take the place of the existing view
code and in the view, we'll instead loop over the links provided by the
decorator and render them as buttons.
I decided to do it this way because there's a requirement that the links
in the gear menu in tables show the same links that appear in the header
of the page. So the Workbenches#show page would show a table of
referentials, and their gear menu links should ostensibly be the same as
the header links in the Referentials#show page.
My goal was to abstract links, and try to separate them from the
presentation layer. Still having trouble with this though. I created a
new `Link` class to represent a link. We can then use this in the
template to create a `link_to`. It becomes messy, though, when we want
to put other elements inside a certain link, as evidenced by the
`:delete` link. Don't like how that's done, but still working out the
best approach to make it cleaner.
Refs #3479
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'public_name'
|
|
Previously, the `#exceeds_gap?` method would modulo the
`later - earlier` duration against 24 hours such that no duration
exceeded 24 hours, and the resulting duration being compared was
adjusted to fit inside a single day.
When we removed the numbers from `exceeds_gap?`, we also removed the
modulo operation. I had a feeling that would potentially cause problems,
and it turns out it did. Though it still took too much investigation
time to realise that the most obvious answer was in fact the correct
one. Blame the confusing test failures if I will:
Failures:
1) Chouette::VehicleJourney state_update should return errors when validation failed
Failure/Error: expect(state['errors'][:vehicle_journey_at_stops].size).to eq 1
NoMethodError:
undefined method `[]' for nil:NilClass
# ./spec/models/chouette/vehicle_journey_spec.rb:148:in `block (3 levels) in <top (required)>'
2) Chouette::VehicleJourney state_update vehicle_journey_at_stops should return errors when validation failed
Failure/Error: expect(item['errors'][:arrival_time].size).to eq 1
NoMethodError:
undefined method `[]' for nil:NilClass
# ./spec/models/chouette/vehicle_journey_spec.rb:189:in `block (4 levels) in <top (required)>'
3) VehicleJourneyImport.save should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order
Failure/Error: expect(VehicleJourneyImport.new(:route => route, :file => invalid_file_on_vjas_object).save).to be_falsey
expected: falsey value
got: true
# ./spec/models/vehicle_journey_import_spec.rb:90:in `block (3 levels) in <top (required)>'
Finished in 4 minutes 20.7 seconds (files took 14.47 seconds to load)
1089 examples, 3 failures, 23 pending
Failed examples:
rspec ./spec/models/chouette/vehicle_journey_spec.rb:137 # Chouette::VehicleJourney state_update should return errors when validation failed
rspec ./spec/models/chouette/vehicle_journey_spec.rb:183 # Chouette::VehicleJourney state_update vehicle_journey_at_stops should return errors when validation failed
rspec ./spec/models/vehicle_journey_import_spec.rb:89 # VehicleJourneyImport.save should not import vehicle_journeys and not create objects when vehicle journey at stops are not in ascendant order
These three tests failed with my version of `exceeds_gap?`.
To correct the failures, add back in the 24-hour adjustment. Put it in a
named method that is hopefully clear enough to understand.
The second test failure ("vehicle_journey_at_stops should return errors
when validation failed") used two times that were the same. I decided to
add a test for this because it seemed like an interesting edge case. The
test I added didn't fail even for the previous version of
`.exceeds_gap?`, but I figure it seems like a useful test anyway.
Refs #870
|
|
Describe what's going on here to hopefully make it easier to understand.
Refs #870
|
|
Instead of hard-coding the duration to compare against, get it from the
function argument. This allows us to set different durations at the time
the method is called.
Also simplify the comparison, getting rid of the math that makes this
method much more difficult to read.
Refs #870
|
|
Put the `exceeds_gap?` method in a new module called `TimeDuration`.
This will allow us to use it from both the
`Chouette::VehicleJourneyAtStop` class and from the
`IncreasingTimeOrderValidator`. Doing this also allows us to test it
independently.
Haven't yet rewritten the increasing times validator to take advantage
of this new method, but adding it now to ensure we don't get an error
calling a non-existent method in `VehicleJourneyAtStop`.
I changed the signature of the method to take a duration as its first
argument. This allows us to set arbitrary durations to compare against
and surfaces the duration when reading code where the method is called.
Not sure if that's the best approach here, but it seems to make sense
for now.
Refs #870
|
|
|
|
* use a single transaction
* use by default workbench 1
* use a random line found in workbench lines
|
|
|
|
|
|
|
|
|
|
|
|
Range#intersection
|
|
Refs #3077
|
|
|
|
Refs #3089
|
|
|
|
* define default start_date and end_date
* associate VehicleJourneyAtStops to VehicleJourney
* associate VehicleJourney to TimeTables
* add a message to display which Referential is created
* mark created Referential as ready
|
|
lib/af83/stored_procedures.rb for sql stored procedure management; Refs #2864
|
|
|
|
|
|
|
|
|
|
Refs #2789
|
|
Refs #2737
|
|
dates. Refs #2621
|
|
|
|
Refs #2490
|
|
|
|
Refs #2451
|
|
|
|
|
|
|
|
|
|
|
|
Refs #2089
|
|
Refs #2089
|
|
|
|
|