aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/public_body_controller.rb
Commit message (Collapse)AuthorAgeLines
* Limit the number of pages of requests shown for public bodies.Louise Crow2015-04-07-1/+9
| | | | Needs to be restored as part of https://github.com/mysociety/alaveteli/issues/2137.
* WIP commit of public body page redesignMartin Wright2015-03-02-0/+3
|
* Add a “Back to search results” linkGareth Rees2015-01-13-0/+3
| | | | | | | | | | | | | | | | | | | Store the search parameters in the flash when a search is made via the select_authority_path page. Stores the parameters for both POST and AJAX typeahead searches. The presence of stored search params renders the link on the PublicBodyController#show template. “keep”s the search params in PublicBodyController#show so that if the user clicks the browser’s back button the “Back to search results” link can still be rendered on the next search result they click. “keep”s all flash keys in ServicesController#other_country_message as it’s called through AJAX and ends up sweeping the flash. [1] [1] More details about this: http://mikenaberezny.com/2007/09/08/keep-the-flash-and-test-it-too/
* Remove old PublicBodyCategories calls.Louise Crow2014-10-09-2/+2
| | | | | Add deprecation notice to draw attention to any place where PublicBodyCategories is called from themes.
* Merge branch 'issues/1415-bulk-update-public-bodies' into rails-3-developGareth Rees2014-06-25-12/+22
|\
| * Move PublicBody domain logic from controllerGareth Rees2014-06-06-2/+2
| | | | | | | | | | | | Moves the magic 'site_administration' tag logic to the PublicBody model. Easier to make the string passed to `PublicBody#has_tag?` configurable if we want to allow this to be set per install.
| * Extract public body CSV export to its own classGareth Rees2014-06-06-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - SRP: Do one thing. PublicBodyCSV converts a collection of bodies in to a CSV formatted String - Adds some parenthesis around parameters in PublicBodyController#list_all_csv - Let the controller handle what records to pull out for the CSV export Arguably this doesn't really need to be anything to do with PublicBody, but it allows us to set nice defaults.
| * Remove FasterCSV dependencyGareth Rees2014-06-04-1/+0
| | | | | | | | The last remaining usage was removed in c1ee22fe
* | Rename XXX comments with TODO:Gareth Rees2014-06-10-3/+3
|/ | | | Picks these up in `rake notes` and adds semantic meaning
* Support simple searching of bodies by short_nameGareth Rees2014-05-28-4/+6
|
* Minor tidying of PublicBodyController#listGareth Rees2014-05-28-19/+19
| | | Spacing, parenthesis, etc
* Move make_query_from_params to XapianQueriesLouise Crow2013-12-19-1/+1
| | | | | | | | | | This is involved with the construction of meaningful xapian queries with respect to InfoRequestEvents. This commit also removes the get_tags_from_params method, which presumably was targeted at PublicBodies, but doesn't seem to actually be used anywhere. XapianQueries is used to extend InfoRequestEvent in order to prevent InfoRequestEvent becoming too unwieldy and to preserve the association between these methods.
* Reduce the memory used to serve /body/all-authorities.csvMark Longair2013-11-14-2/+26
| | | | | | | | | | | | | | | | | | | | | | On WDTK, /body/all-authorities was using lots of memory - this commit reduces that by (a) fetching the public bodies in batches, rather than keeping them all in memory at one time and (b) writing the CSV to a file and then returning it with X-Sendfile (or equivalent), rather than returning the whole file from memory with send_data. There's a FIXME to do with the layout of download directories; if that's changed, the example nginx config, etc. will need to be updated too. This commit also adds a basic test for reasonable CSV being returned and switches from FasterCSV to CSV in order to fix this NotImplementedError under Ruby 1.9: Please switch to Ruby 1.9's standard CSV library. It's FasterCSV plus support for Ruby 1.9's m17n encoding engine. (The CSV version seems to still work fine under 1.8.7.)
* Factor out code for generating graphable data and add testsMark Longair2013-11-05-23/+48
| | | | | | This simplifies the statistics action of the PublicBodyController and makes it easier to test the functionality now in the simplify_stats_for_graphs method.
* Add "(n)" to the tooltips on the stats graphsMark Longair2013-11-05-1/+2
|
* Fix a small error in stats-graphs-improvementsMark Longair2013-11-03-2/+2
|
* Avoid an error when the statistics column hasn't been populatedMark Longair2013-10-31-14/+14
| | | | | | | | The 'if data' needs to be earlier to avoid an error if one of the statistics columns hasn't been filled in by the stats:update_public_bodies_stats rake task yet. Thanks to Louise Crow for pointing this out in code review.
* Refactor to avoid repeating .each_with_index.mapMark Longair2013-10-15-4/+9
|
* Increase the number of public bodies per graph to 10Mark Longair2013-10-15-1/+1
| | | | | | Now that there are rotated names on the x axis we shouldn't need to worry about them overlapping, which was the reason for limiting the number to 8 in the first place.
* Only include minimal information about public bodies in JSONMark Longair2013-10-15-1/+6
| | | | | | | Previously, the JSON included all the columns from the public body table, which was unnecessary and included the public body's email address. Instead, just include the name and URL of the public body.
* Allow public body listing based on first letter outside US-ASCIIMark Longair2013-10-04-2/+2
| | | | | | | | | | | | | Under Ruby 1.8, it was previously impossible to use one of the "first letter" alphabet links on the public body listing page if the first letter was outside [A-Za-z] since the test for the parameter only being a single letter wasn't aware of the possibly of multi-byte characters. In addition, upcasing of letters outside [A-Za-z] didn't work because String#upcase in Ruby 1.8 isn't Unicode-aware. This commit fixes these two problems, so that non-US-ASCII first letter links will work under Ruby 1.8. (Fixes #1112.)
* Make graph title and axis labels translatableMark Longair2013-09-12-11/+11
| | | | | The labels on the public body statistics graphs weren't marked as being translatable. Fixes #1079.
* Merge branch 'public-body-locale-fallback' into rails-3-developLouise Crow2013-09-12-21/+81
|\ | | | | | | | | | | | | Conflicts: app/controllers/public_body_controller.rb config/general.yml-example lib/configuration.rb
| * Don't display duplicate public bodies with the fallbackMark Longair2013-09-12-30/+78
| | | | | | | | | | | | | | | | | | | | | | This introduces some raw SQL statement for the fallback case, but we can't see an easy way to avoid that in this case. This commit also adds some tests that assert the sorting and non-duplication properties of the listing. Thanks to Louise Crow for working out the SQL expression for falling back to the default locale.
| * Make falling back to default locale in public body listings optionalMark Longair2013-09-10-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the code stood, the list method in PublicBodyController would only return results that had translations of the public body in the default locale. This has a variety of problems if you're viewing pages in the non-default locale - for example, the "first letter" links wouldn't bring up the public bodies that began with that letter in the current locale, only those that began with it in the default locale. Ideally, every public body would be translated into every available locale for the site, but there are cases where deployers wish to have public body listings also include those from the default locale, in case there are untralsated public bodies: https://groups.google.com/d/msg/alaveteli-dev/zUY_USaAMAM/M7KTQ9RC5YUJ This commit makes the default behaviour to look for public body listings only in the current locale, but if the new configuration option PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE is set, then public body listings will be looked for in both the current locale and the default locale. Fixes #1000
| * Tidy up SQL query stringsMark Longair2013-08-29-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the list method of PublicBodyController, capitalize the SQL keywords consistenly and don't include extraneous whitespace in the strings. (On the former point, previously only some were - the convention is a matter of some debate, but in this case the you editor's not doing to do syntax highlighting of SQL so having the keywords capitalized helps its readibility, I think.) I wouldn't normally do this kind of cosmetic tidying up, since it affects the tidiness of diffs and merges, but in this case I'm going to change all these lines in the next commit anyway, so that reasoning doesn't apply.
* | Reduce the number of public bodies per graphMark Longair2013-08-20-1/+1
| | | | | | | | | | | | | | | | It seems to be difficult to customize the display of the tick labels (see the body-statistics-rotated-label branch for an as-yet-not-working alternative) so for the moment just reduce the number of public bodies shown per graph from 10 to 8.
* | Add a config option to enable the public body statistics pageMark Longair2013-08-20-0/+4
| |
* | Refactor calculation of statisticsMark Longair2013-08-20-77/+48
| | | | | | | | | | | | Move the calculation of statistics on public bodies into the PublicBody model, so that there's less logic in the controller.
* | Make the minimum requests for statistics configurableMark Longair2013-08-20-1/+3
| | | | | | | | This adds the MINIMUM_REQUESTS_FOR_STATISTICS config option.
* | Add a page with experimental statistics on public bodiesMark Longair2013-08-20-1/+102
|/ | | | | | | | | | | | | | | | | The statistics on the status of the requests to a particular public body are too slow to calculate on-the-fly, so this commit adds: * Extra columns on public_bodies to store counts of the successful, not held, and overdue request counts for each public body. * A rake task which should be run periodically to update the overdue request count column. If Javascript is not available, the summary statistics are shown as tables. If Javascript is available, graphs are drawn with Flot.
* Respond to a (currently unsupported) json request for a public body list ↵Louise Crow2013-06-20-1/+3
| | | | with a 406, not a 500 caused by a missing template.
* Change email address in header of source code to hello@mysociety.orgMatthew Landauer2013-03-26-1/+1
|
* Merge remote-tracking branch 'mysociety/develop' into rails-3-developHenare Degan2013-03-14-5/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile Gemfile.lock app/controllers/admin_request_controller.rb app/controllers/admin_track_controller.rb app/controllers/request_controller.rb app/controllers/services_controller.rb app/helpers/link_to_helper.rb app/mailers/request_mailer.rb app/models/application_mailer.rb app/models/info_request.rb app/views/admin_censor_rule/edit.html.erb app/views/admin_censor_rule/new.html.erb app/views/admin_public_body/_form.html.erb app/views/admin_public_body/_locale_selector.html.erb app/views/admin_public_body/_one_list.html.erb app/views/admin_public_body/edit.html.erb app/views/admin_public_body/list.html.erb app/views/admin_public_body/new.html.erb app/views/admin_request/_incoming_message_actions.html.erb app/views/admin_request/edit.html.erb app/views/admin_request/edit_comment.html.erb app/views/admin_request/edit_outgoing.html.erb app/views/admin_request/list.html.erb app/views/admin_request/list_old_unclassified.html.erb app/views/admin_request/show.html.erb app/views/admin_track/_some_tracks.html.erb app/views/admin_track/list.html.erb app/views/admin_user/edit.html.erb app/views/admin_user/list.html.erb app/views/admin_user/show.html.erb app/views/general/_footer.html.erb app/views/general/exception_caught.html.erb app/views/help/contact.html.erb app/views/layouts/default.html.erb app/views/public_body/_alphabet.html.erb app/views/request/_request_listing_single.html.erb app/views/request/_sidebar.html.erb app/views/request/new.html.erb app/views/request/show.html.erb app/views/request_mailer/external_response.rhtml app/views/request_mailer/fake_response.rhtml config/environment.rb config/environments/production.rb config/routes.rb spec/controllers/admin_censor_rule_controller_spec.rb spec/controllers/request_controller_spec.rb spec/controllers/track_controller_spec.rb spec/helpers/link_to_helper_spec.rb spec/mailers/request_mailer_spec.rb spec/models/info_request_spec.rb spec/spec_helper.rb spec/views/public_body/show.html.erb_spec.rb spec/views/request/show.html.erb_spec.rb vendor/plugins/rails_xss/lib/rails_xss/erubis.rb
| * Merge remote-tracking branch 'openaustralia_github/make-links-relative' into ↵Louise Crow2013-03-06-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | develop Conflicts: app/controllers/admin_request_controller.rb app/models/request_mailer.rb app/views/admin_general/index.rhtml app/views/admin_general/stats.rhtml app/views/admin_public_body/_one_list.rhtml app/views/admin_public_body/_tags.rhtml app/views/admin_public_body/show.rhtml app/views/admin_request/show.rhtml app/views/admin_user/show.rhtml app/views/layouts/admin.rhtml app/views/public_body/show.rhtml app/views/request/new.rhtml
| | * Stop using main_url to generate absolute urls for the main siteMatthew Landauer2013-02-15-1/+1
| | |
| * | Don't pass latest_status param to locale switching links. Fixes #789Matthew Landauer2013-02-12-3/+1
| | |
| * | Retain filter settings when redirecting a public body to its canonical urlMatthew Landauer2013-02-12-1/+1
| | |
| * | Pass parameters to method rather explicitlyMatthew Landauer2013-02-12-1/+1
| |/
* | Convert query to more activerecord 3 formMatthew Landauer2013-01-31-2/+2
| |
* | Convert query to more activerecord 3 formMatthew Landauer2013-01-31-4/+2
| |
* | The with_locale has been removed in Globalize3Henare Degan2012-12-11-3/+3
| | | | | | | | | | | | I think Globalize is supposed to pick up the locale from I18n anyway so I don't know if these are needed. I think I still haven't done the right thing but it's time to move on.
* | Switch to new method nameHenare Degan2012-12-11-3/+3
|/
* Extract methodMatthew Landauer2012-10-24-32/+1
|
* Remove svn tags that are out of date as we are now using gitMatthew Landauer2012-10-09-2/+0
|
* Use faster csv for public body cvs generation, eagerly load tags and ↵Louise Crow2012-09-12-8/+7
| | | | translations.
* Remove trailing whitespace (to make a cleaner forthcoming merge with ↵Seb Bacon2012-05-15-17/+17
| | | | wombleton:feature/440_sparkly_admin_css)
* Make better wording at the top of the page listing subsets of public bodies. ↵Seb Bacon2012-01-30-4/+8
| | | | At the same time, cause the tests not to rely on WDTK data. Fixes #396
* Fix problem with typeahead searches containing " - " characters and similar. ↵Seb Bacon2012-01-11-7/+1
| | | | Closes #328
* Make sure paging authority list works even when using typeahead searchSeb Bacon2012-01-09-1/+1
|