| Age | Commit message (Collapse) | Author |
|
Change "_filters.html.slim" to call `#human_attribute_name` on the model
instead of the collection, because the collection decorator doesn't
delegate that method, and it's better to call it on the class.
Refs #3479
|
|
On the
http://stif-boiv.dev:3000/stop_area_referentials/1/stop_areas/139416
page, move the header links into a decorator to allow us to use them in
the table of stop areas on StopAreaReferentials#index.
Refs #3479
|
|
Refs #3479
|
|
In order to allow us to use these links in tables of networks via the
new table builder, move the link definitions into decorator
`#action_links`.
This changes both of these types of pages:
* http://stif-boiv.dev:3000/referentials/4/networks/118
* http://stif-boiv.dev:3000/line_referentials/1/networks/118
Refs #3479
|
|
Just wrote the `#index` method and saw that the `#show` method's
`context` hash contents are a bit verbose. Shorten them to match the
`#index` method. These mean the same thing but are a bit cleaner.
Refs #3479
|
|
Render table of `RoutingConstraintZones` using the new table builder.
Refs #3479
|
|
I had broken the breadcrumb by overriding `#show` here. Add in the
`build_breadcrumb` call to make it appear again.
Refs #3479
|
|
Leverage our newly created `ReferentialLineDecorator` to render the
header links, allowing us to use them both here and in the table of
lines on the Referentials#show page.
Used the extended decoration syntax to allow us to specify the
`ReferentialLineDecorator`, otherwise Draper will infer `LineDecorator`,
which is not what we want in this case.
Refs #3479
|
|
Needed to add a new decorator to provide links to this table's gear
menu. The links correspond to those in the header on the
"referential_lines/show.html.slim" page.
Call `#human_attribute_name` on the model directly instead of the
collection because the decorated collection doesn't expose that method.
Refs #3479
|
|
|
|
Delete this route and associated template files. Wasn't sure if using
`exclude:` in the routes file was the best way to do this, as I'm not
sure if there are other routes we want to exclude from here also.
I visited the page because I'm migrating templates to the new table
builder helper and this one uses table builder. Upon visiting the page,
it looked pretty wonky, and after consulting with Jean-Paul and Luc, it
turns out this page isn't used any more because the table of
`Chouette::Line`s rendered there is now instead displayed on the
Referentials#show page, obviating the need for this page.
Refs #3479
|
|
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
|
|
TODO: Rename `line_referential` context parameter in `CompanyDecorator`
to `referential` since the name needs to make sense both for
`Referential` and for `LineReferential`.
Refs #3479
|
|
Refs #3479
|
|
|
|
|
|
|
|
controllers
|
|
Additionally convert the `#human_attribute_name` calls to call it on the
class because this is more correct and because that method doesn't exist
on the decorated collection of `@time_tables`.
TODO: There's a bug here where the #show and #edit links don't link
correctly, they go to `/referentials/:id` instead of
`/referentials/:id/time_tables/:id`.
Refs #3479
|
|
Apparently I messed up the breadcrumb in these views because I was
overriding the `#index` and `#show` methods defined in
`BreadcrumbController`, which make these calls to `#build_breadcrumb`.
Add them in to restore the breadcrumb links to these pages.
Refs #3479
|
|
Refs #3479
|
|
Convert the table of `Route`s on this page to use the new table builder
helper. This gives us the links from the `RouteDecorator` in the gear
menu next to each row in the table.
Ended up removing the `route_sp` field from the `RouteDecorator` context
because it seems like we can just grab that collection directly from the
`Route` object. At first I thought about renaming it because after
coming back to this code I thought, 'what does sp mean?'. Then after
some investigation, it appears that we don't need to pass it in
explicitly. Now, no need to bother with that from the ReferentialLines
controller.
The RoutesController does create a separate `@route_sp` variable, but
this only changes the sort order of the stop points, not the contents of
the collection. Thus it seems safe to get them directly from the Route
in the decorator.
Refs #3479
|
|
|
|
Convert the table of Lines to use the new version of the table builder.
Update the view with the new calling format of the helper.
The controller needs to decorate the `@lines` collection in order to
make `#action_links` available to the table builder.
Needed to update the "_filters.html.slim" template to call
`#human_attribute_name` on the class instead of the collection, because
we can't do that on a decorated collection.
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
|
|
- PolicyChecker authorizes(*) all now
- Untied ApplicationPolicy#index? from show?
- mv access_point_policy.rb to access_point_policy.rb fixing an invisible name curruption (local problem?)
* to authorize: to allow (not here), to undergo the process of authorization (here)
|
|
+ ApplicationController provides Pundit's UserContext's referential with `@referential` instead of `current_referential`,
(`@referential` is computed from the URL, while `current_referential` was aliased to different methods, **not always**
pointing to `Referential` instances)
+ ApplicationPolicy uses the record's referential in its `referential method` iff it is an instance of `Referential` else
it uses the abovely provided referential, locally named `@current_referential` (as it should be named in the Ctrl too)
This assures, in combination with the Ctrl Change, that `referential` **always** returns an instance of `Referential`!
- TODO: Review my understanding of _Referential Setup_ inside the Ctrls
|
|
Refs #3954
|
|
Refs #3871
|
|
|
|
refs #3936
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Refs #3826
|
|
refs #3826
|
|
|
|
|
|
The tests failed because we weren't using a decorated `Chouette::Line`
object, but the views now expect decorated lines in order to be able to
call the `#action_links` method.
Here are our failures:
5) /lines/show should render h1 with the line name
Failure/Error: - @line.action_links.each do |link|
ActionView::Template::Error:
undefined method `action_links' for #<Chouette::Line:0x007fc8cdf0bb88>
# ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360'
# ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader'
# ./app/helpers/newapplication_helper.rb:244:in `block in pageheader'
# ./app/helpers/newapplication_helper.rb:243:in `pageheader'
# ./app/views/lines/show.html.slim:2:in `_app_views_lines_show_html_slim___3813514632397395671_70250211127360'
# ./spec/views/lines/show.html.erb_spec.rb:16:in `block (2 levels) in <top (required)>'
# -e:1:in `<main>'
# ------------------
# --- Caused by: ---
# NoMethodError:
# undefined method `action_links' for #<Chouette::Line:0x007fc8cdf0bb88>
# ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360'
6) /lines/show should render a link to remove the line
Failure/Error: - @line.action_links.each do |link|
ActionView::Template::Error:
undefined method `action_links' for #<Chouette::Line:0x007fc8cfdaa710>
# ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360'
# ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader'
# ./app/helpers/newapplication_helper.rb:244:in `block in pageheader'
# ./app/helpers/newapplication_helper.rb:243:in `pageheader'
# ./app/views/lines/show.html.slim:2:in `_app_views_lines_show_html_slim___3813514632397395671_70250211127360'
# ./spec/views/lines/show.html.erb_spec.rb:31:in `block (2 levels) in <top (required)>'
# -e:1:in `<main>'
# ------------------
# --- Caused by: ---
# NoMethodError:
# undefined method `action_links' for #<Chouette::Line:0x007fc8cfdaa710>
# ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360'
Update the test to decorate the lines used in them.
Turn `current_organisation` into a `context` field on `LineDecorator`
because otherwise it's a global variable that comes from wherever that's
required in `LineDecorator`. And we'd have to mock
`current_organisation` on `line` in the test, which I wasn't keen on.
Refs #3479
|
|
Don't really know what this is (assuming it comes from
'inherited_resources'), but putting the decoration inside this block
seemed to work in the other cases I tried recently (like
`LinesController#show`).
Refs #3479
|
|
3479-refactor-table_builder-helper
|
|
This enables us to reuse these links in other parts of the application.
Get the links from `TimeTableDecorator#action_links`.
Refs #3479
|
|
To abstract the links and make them reusable in other contexts, render
the buttons in the header from `CalendarDecorator#action_links`.
Refs #3479
|
|
Get the header links from the decorator so we can reuse them instead of
defining them directly in the template.
Add an option to the `destroy_link_content` Rails helper method to allow
us to specify alternate translation keys, giving us different text in
the button label. Added this because the template in question uses a
different label than the others (usually it's `actions.destroy`).
Refs #3479
|
|
Use the `RoutingConstraintZonesDecorator` to render the header links
instead of constructing them in the view. This allows us to reuse the
links.
To be honest, I haven't actually tested this for real. Don't know how to
set up an Interdiction de Traffic Local.
Refs #3479
|
|
Instead of defining the header links in the view, get them from our
decorator so we can reuse them. Need to wrap `@route` in the decorator
in the controller and pass it the necessary context in order for it to
be able to properly build links.
Move `Chouette::RouteDecorator` to the top level app/decorators/
directory and remove it from the `Chouette` namespace. I had put it
there to make it more similar to our model directory layout, but Draper
isn't intelligent enough to look in subdirectories of `decorators` when
using the `ActiveRecord::Base#decorate` method. Otherwise I suppose I
could do `Chouette::RouteDecorator.decorate(@route)`, but that seemed
not as clean since it doesn't take advantage of the default behaviour of
Draper. Now going to have to do this for the other decorators.
Refs #3479
|
|
missing flash message
|