<feed xmlns='http://www.w3.org/2005/Atom'>
<title>chouette-core/spec/helpers/table_builder_helper, branch docker</title>
<subtitle>Chouette manage transport static data</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/'/>
<entry>
<title>Revert "TableBuilderHelper::Column#link_to: Allow arbitrary number of arguments"</title>
<updated>2017-09-01T15:22:47+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-01T14:51:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=df64a6dcbc38cefe41c74bcb1d2d166d13711b23'/>
<id>df64a6dcbc38cefe41c74bcb1d2d166d13711b23</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
<entry>
<title>TableBuilderHelper::Column#link_to: Allow arbitrary number of arguments</title>
<updated>2017-09-01T14:04:59+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-01T14:04:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=28db706443a912e8355e4c48488dc40c403e7f76'/>
<id>28db706443a912e8355e4c48488dc40c403e7f76</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>TableBuilderHelper::Column: Add `#linkable?` method</title>
<updated>2017-09-01T12:52:53+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-01T12:51:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=7f85e8bbb15ec4063dad8b080e61d690b77dead7'/>
<id>7f85e8bbb15ec4063dad8b080e61d690b77dead7</id>
<content type='text'>
This tells the markup assembler whether or not this column should be
wrapped in a link (`&lt;a&gt;`). 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This tells the markup assembler whether or not this column should be
wrapped in a link (`&lt;a&gt;`). 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.
</pre>
</div>
</content>
</entry>
<entry>
<title>TableBuilderHelper::Column: Add `link_to` argument</title>
<updated>2017-09-01T12:47:29+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-09-01T12:47:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=9574d8b8351fd59eeada05a1ba71893a82b86989'/>
<id>9574d8b8351fd59eeada05a1ba71893a82b86989</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
<entry>
<title>CustomLinks: Pass referential directly when initialising</title>
<updated>2017-07-12T09:06:03+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-07-07T14:42:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=9ab672a31cd3a1aeea59e6ae3dab96e4057ee997'/>
<id>9ab672a31cd3a1aeea59e6ae3dab96e4057ee997</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>CustomLinks spec: Update method name in spec describe</title>
<updated>2017-07-12T09:06:03+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-07-07T14:22:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=cdf5854f9a7b52f7b9f2607796d0dff90d04f6e4'/>
<id>cdf5854f9a7b52f7b9f2607796d0dff90d04f6e4</id>
<content type='text'>
The name of this method changed, but wasn't updated in the `describe`
label.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The name of this method changed, but wasn't updated in the `describe`
label.
</pre>
</div>
</content>
</entry>
<entry>
<title>Refs: #3478@1h;</title>
<updated>2017-07-05T09:59:06+00:00</updated>
<author>
<name>Robert</name>
</author>
<published>2017-07-05T09:54:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=e53aa88c442bd0057c4e0ae66e2684d62d3193ed'/>
<id>e53aa88c442bd0057c4e0ae66e2684d62d3193ed</id>
<content type='text'>
   -  All permissions tied to `!archived?`
   -  Tests adapted
   -  Policies refactored

   ?  Is `create?` permission bound to `organisation_match?`
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
   -  All permissions tied to `!archived?`
   -  Tests adapted
   -  Policies refactored

   ?  Is `create?` permission bound to `organisation_match?`
</pre>
</div>
</content>
</entry>
<entry>
<title>Refs: #3478@1h removed boiv-read-offer and BoivPolicy</title>
<updated>2017-07-04T19:54:04+00:00</updated>
<author>
<name>Robert</name>
</author>
<published>2017-07-04T15:28:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=16423b19122eefed728fc71e52d5c1660ff5575a'/>
<id>16423b19122eefed728fc71e52d5c1660ff5575a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Refs: #3478@0.5h; refactored table_builder_helper/custom_links.rb, according to moving authoriation BL into policies</title>
<updated>2017-07-04T19:54:04+00:00</updated>
<author>
<name>Robert</name>
</author>
<published>2017-07-04T13:21:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=cf546740389e782b17278259369e0d288dbf2653'/>
<id>cf546740389e782b17278259369e0d288dbf2653</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>TableBuilder: Make table-level `sortable` work</title>
<updated>2017-06-15T11:52:31+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-06-15T10:33:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/fork/chouette-core/commit/?id=d79a0db0301d14e0ab4e5ecb2d8b60560f4490a9'/>
<id>d79a0db0301d14e0ab4e5ecb2d8b60560f4490a9</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
