diff options
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | app/models/info_request.rb | 13 | ||||
-rw-r--r-- | app/models/public_body.rb | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/_form.rhtml | 3 | ||||
-rw-r--r-- | app/views/admin_public_body/import_csv.rhtml | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/show.rhtml | 4 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml | 3 | ||||
-rw-r--r-- | app/views/request/_request_listing_via_event.rhtml | 10 | ||||
-rw-r--r-- | config/.gitignore | 1 | ||||
-rw-r--r-- | config/newrelic.yml-example | 54 | ||||
-rw-r--r-- | db/migrate/20121022031914_add_disclosure_log.rb | 13 | ||||
-rw-r--r-- | doc/INSTALL.md | 6 | ||||
-rw-r--r-- | spec/fixtures/public_body_translations.yml | 7 | ||||
-rw-r--r-- | spec/views/public_body/show.rhtml_spec.rb | 1 |
14 files changed, 77 insertions, 44 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 58c5bcbe0..86329ab86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,7 +20,7 @@ GEM activesupport (2.3.14) annotate (2.4.0) archive-tar-minitar (0.5.2) - capistrano (2.13.3) + capistrano (2.13.4) highline net-scp (>= 1.0.0) net-sftp (>= 2.0.0) diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 74a67b9d9..47424e573 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -584,12 +584,11 @@ public # waiting_classification # waiting_response_overdue # waiting_response_very_overdue - def calculate_status - if @@custom_states_loaded - return self.theme_calculate_status - else - self.base_calculate_status + def calculate_status(cached_value_ok=false) + if cached_value_ok && @cached_calculated_status + return @cached_calculated_status end + @cached_calculated_status = @@custom_states_loaded ? self.theme_calculate_status : self.base_calculate_status end def base_calculate_status @@ -871,8 +870,8 @@ public end end - def display_status - InfoRequest.get_status_description(self.calculate_status) + def display_status(cached_value_ok=false) + InfoRequest.get_status_description(self.calculate_status(cached_value_ok)) end # Completely delete this request and all objects depending on it diff --git a/app/models/public_body.rb b/app/models/public_body.rb index c3cc76345..933dc8fb1 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -413,7 +413,7 @@ class PublicBody < ActiveRecord::Base next end - field_list = ['name', 'short_name', 'request_email', 'notes', 'publication_scheme', 'home_page', 'tag_string'] + field_list = ['name', 'short_name', 'request_email', 'notes', 'publication_scheme', 'disclosure_log', 'home_page', 'tag_string'] if public_body = bodies_by_name[name] # Existing public body available_locales.each do |locale| diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml index d854b53f5..0d6ae51e2 100644 --- a/app/views/admin_public_body/_form.rhtml +++ b/app/views/admin_public_body/_form.rhtml @@ -38,6 +38,9 @@ <p><label for="<%= form_tag_id(t.object_name, :publication_scheme, locale) %>">Publication scheme URL</label><br/> <%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme, locale) %></p> + <p><label for="<%= form_tag_id(t.object_name, :disclosure_log, locale) %>">Disclosure log URL</label><br/> + <%= t.text_field :disclosure_log, :size => 60, :id => form_tag_id(t.object_name, :disclosure_log, locale) %></p> + <p><label for="<%= form_tag_id(t.object_name, :notes, locale) %>">Public notes</label> <small>(HTML, for users to consider when making FOI requests to the authority)</small><br/> <%= t.text_area :notes, :rows => 3, :cols => 60, :id => form_tag_id(t.object_name, :notes, locale) %></p> </div> diff --git a/app/views/admin_public_body/import_csv.rhtml b/app/views/admin_public_body/import_csv.rhtml index 4a03d0665..62908ba52 100644 --- a/app/views/admin_public_body/import_csv.rhtml +++ b/app/views/admin_public_body/import_csv.rhtml @@ -51,7 +51,7 @@ </blockquote> <p>Supported fields: name (i18n), short_name (i18n), request_email (i18n), notes (i18n), - publication_scheme (i18n), home_page, tag_string (tags separated by spaces).</p> + publication_scheme (i18n), disclosure_log (i18n), home_page, tag_string (tags separated by spaces).</p> <p><strong>Note:</strong> Choose <strong>dry run</strong> to test, without actually altering the database. Choose <strong>upload</strong> to actually diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml index fa17d4027..094007c02 100644 --- a/app/views/admin_public_body/show.rhtml +++ b/app/views/admin_public_body/show.rhtml @@ -9,9 +9,9 @@ for column in columns %> <b><%= column.human_name %>:</b> - <% if column.name == 'home_page' and !column.name.empty? %> + <% if ['home_page', 'publication_scheme', 'disclosure_log'].include? column.name %> <%= link_to(h(@public_body.send(column.name)), @public_body.send(column.name)) %> - <% elsif column.name == 'request_email' and !column.name.empty? %> + <% elsif column.name == 'request_email' %> <%= link_to(h(@public_body.send(column.name)), "mailto:#{@public_body.send(column.name)}") %> <% if !@public_body.is_requestable? %> (not requestable due to: <%=h @public_body.not_requestable_reason %><% if @public_body.is_followupable? %>; but followupable<% end %>) diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index b56556d5d..e13f9d1c0 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -14,6 +14,9 @@ <% if !@public_body.publication_scheme.empty? %> <%= link_to _('Publication scheme'), @public_body.publication_scheme %><br> <% end %> + <% unless @public_body.disclosure_log.empty? %> + <%= link_to _('Disclosure log'), @public_body.disclosure_log %><br> + <% end %> <% if @public_body.has_tag?("charity") %> <% for tag_value in @public_body.get_tag_values("charity") %> <% if tag_value.match(/^SC/) %> diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml index e3abfe393..ee1cc079a 100644 --- a/app/views/request/_request_listing_via_event.rhtml +++ b/app/views/request/_request_listing_via_event.rhtml @@ -17,13 +17,13 @@ end %> </span> <div class="requester"> <% if event.event_type == 'sent' %> - <%= _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> + <%= _('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> <% elsif event.event_type == 'followup_sent' %> <%=event.display_status %> - <%= _('sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> + <%= _('sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> <% elsif event.event_type == 'response' %> <%=event.display_status %> - <%= _('by {{public_body_name}} to {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> + <%= _('by {{public_body_name}} to {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at )) %> <% elsif event.event_type == 'comment' %> <%= _('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>user_link_absolute(info_request.user),:event_comment_user=>user_link_absolute(event.comment.user),:date=>simple_date(event.created_at)) %> <% else %> @@ -35,12 +35,12 @@ end %> </div> <span class="bottomline icon_<%= info_request.calculate_status %>"> <strong> - <%= info_request.display_status %> + <%= info_request.display_status(cached_value_ok=true) %> </strong><br> </span> </div> <div class="request_right"> - <span class="desc"> + <span class="desc"> <%= highlight_and_excerpt(event.search_text_main(true), @highlight_words, 150) %> </span> </div> diff --git a/config/.gitignore b/config/.gitignore index 78d586ea8..5ad2de008 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -7,3 +7,4 @@ logrotate memcached.yml *.deployed deploy.yml +newrelic.yml diff --git a/config/newrelic.yml-example b/config/newrelic.yml-example index 8da7e26bd..ce19cca54 100644 --- a/config/newrelic.yml-example +++ b/config/newrelic.yml-example @@ -15,7 +15,7 @@ common: &default_settings # account. This key binds your Agent's data to your account in the # New Relic service. #license_key: '' - + # Agent Enabled (Ruby/Rails Only) # Use this setting to force the agent to run or not run. # Default is 'auto' which means the agent will install and run only @@ -23,21 +23,21 @@ common: &default_settings # it from running with Rake or the console. Set to false to # completely turn the agent off regardless of the other settings. # Valid values are true, false and auto. - # agent_enabled: auto - + agent_enabled: false + # Application Name # Set this to be the name of your application as you'd like it show # up in New Relic. New Relic will then auto-map instances of your application # into a New Relic "application" on your home dashboard page. If you want # to map this instance into multiple apps, like "AJAX Requests" and # "All UI" then specify a semicolon-separated list of up to three - # distinct names. If you comment this out, it defaults to the + # distinct names. If you comment this out, it defaults to the # capitalized RAILS_ENV (i.e., Production, Staging, etc) app_name: My Application - # When "true", the agent collects performance data about your + # When "true", the agent collects performance data about your # application and reports this data to the New Relic service at - # newrelic.com. This global switch is normally overridden for each + # newrelic.com. This global switch is normally overridden for each # environment below. (formerly called 'enabled') monitor_mode: true @@ -49,7 +49,7 @@ common: &default_settings # information separate from that of your application. Specify its # log level here. log_level: info - + # The newrelic agent communicates with the New Relic service via http by # default. If you want to communicate via https to increase # security, then turn on SSL by setting this value to true. Note, @@ -86,7 +86,7 @@ common: &default_settings # Rails: the RoR filter_parameter_logging excludes parameters # Java: create a config setting called "ignored_params" and set it to # a comma separated list of HTTP parameter names. - # ex: ignored_params: credit_card, ssn, password + # ex: ignored_params: credit_card, ssn, password capture_params: false # Transaction tracer captures deep information about slow @@ -94,12 +94,12 @@ common: &default_settings # minute. Included in the transaction is the exact call sequence of # the transactions including any SQL statements issued. transaction_tracer: - + # Transaction tracer is enabled by default. Set this to false to # turn it off. This feature is only available at the Professional # product level. enabled: true - + # Threshold in seconds for when to collect a transaction # trace. When the response time of a controller action exceeds # this threshold, a transaction trace will be recorded and sent to @@ -107,13 +107,13 @@ common: &default_settings # which will use the threshold for an dissatisfying Apdex # controller action - four times the Apdex T value. transaction_threshold: apdex_f - + # When transaction tracer is on, SQL statements can optionally be # recorded. The recorder has three modes, "off" which sends no # SQL, "raw" which sends the SQL statement in its original form, # and "obfuscated", which strips out numeric and string literals. record_sql: obfuscated - + # Threshold in seconds for when to collect stack trace for a SQL # call. In other words, when SQL statements exceed this threshold, # then capture and send to New Relic the current stack trace. This is @@ -125,24 +125,24 @@ common: &default_settings # set to false when using other adapters. # explain_enabled: true - # Threshold for query execution time below which query plans will not + # Threshold for query execution time below which query plans will not # not be captured. Relevant only when `explain_enabled` is true. # explain_threshold: 0.5 - + # Error collector captures information about uncaught exceptions and # sends them to New Relic for viewing error_collector: - + # Error collector is enabled by default. Set this to false to turn # it off. This feature is only available at the Professional # product level. enabled: true - - # Rails Only - tells error collector whether or not to capture a - # source snippet around the place of the error when errors are View + + # Rails Only - tells error collector whether or not to capture a + # source snippet around the place of the error when errors are View # related. - capture_source: true - + capture_source: true + # To stop specific errors from reporting to New Relic, set this property # to comma-separated values. Default is to ignore routing errors, # which are how 404's get triggered. @@ -152,7 +152,7 @@ common: &default_settings # won't run. Useful when you are using the agent to monitor an # external resource # disable_samplers: true - + # If you aren't interested in visibility in these areas, you can # disable the instrumentation to reduce overhead. # @@ -160,8 +160,8 @@ common: &default_settings # disable_activerecord_instrumentation: true # disable_memcache_instrumentation: true # disable_dj: true - - # Certain types of instrumentation such as GC stats will not work if + + # Certain types of instrumentation such as GC stats will not work if # you are running multi-threaded. Please let us know. # multi_threaded = false @@ -179,17 +179,17 @@ development: <<: *default_settings # Turn off communication to New Relic service in development mode (also # 'enabled'). - # NOTE: for initial evaluation purposes, you may want to temporarily + # NOTE: for initial evaluation purposes, you may want to temporarily # turn agent communication on in development mode. monitor_mode: false - # Rails Only - when running in Developer Mode, the New Relic Agent will + # Rails Only - when running in Developer Mode, the New Relic Agent will # present performance information on the last 100 transactions you have # executed since starting the app server. # NOTE: There is substantial overhead when running in developer mode. - # Do not use for production or load testing. + # Do not use for production or load testing. developer_mode: true - + # Enable textmate links # textmate: true diff --git a/db/migrate/20121022031914_add_disclosure_log.rb b/db/migrate/20121022031914_add_disclosure_log.rb new file mode 100644 index 000000000..82ea7dbcd --- /dev/null +++ b/db/migrate/20121022031914_add_disclosure_log.rb @@ -0,0 +1,13 @@ +class AddDisclosureLog < ActiveRecord::Migration + def self.up + add_column :public_bodies, :disclosure_log, :text, :null => false, :default => "" + add_column :public_body_versions, :disclosure_log, :text, :null => false, :default => "" + add_column :public_body_translations, :disclosure_log, :text + end + + def self.down + remove_column :public_bodies, :disclosure_log + remove_column :public_body_versions, :disclosure_log + remove_column :public_body_translations, :disclosure_log + end +end diff --git a/doc/INSTALL.md b/doc/INSTALL.md index b805ee0c5..e36d10e2b 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -222,6 +222,12 @@ Interlock Rails plugin, to cache content using memcached. You probably don't want this in your development profile; the example `memcached.yml` file disables this behaviour. +Finally, copy `config/newrelic.yml-example` to `config/newrelic.yml`. +This file contains configuration information for the New Relic +performance management system. By default, monitoring is switched off +by the `agent_enabled: false` setting. See https://github.com/newrelic/rpm +for instructions on switching on local and remote performance analysis. + # Deployment In the 'alaveteli' directory, run: diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml index f3453e853..24b14c470 100644 --- a/spec/fixtures/public_body_translations.yml +++ b/spec/fixtures/public_body_translations.yml @@ -9,6 +9,7 @@ geraldine_es_public_body_translation: locale: es notes: "" publication_scheme: "" + disclosure_log: "" geraldine_en_public_body_translation: name: Geraldine Quango @@ -21,6 +22,7 @@ geraldine_en_public_body_translation: locale: en notes: "" publication_scheme: "" + disclosure_log: "" humpadink_es_public_body_translation: name: "El Department for Humpadinking" @@ -33,6 +35,7 @@ humpadink_es_public_body_translation: locale: es notes: Baguette publication_scheme: "" + disclosure_log: "" humpadink_en_public_body_translation: name: "Department for Humpadinking" @@ -45,6 +48,7 @@ humpadink_en_public_body_translation: locale: en notes: An albatross told me!!! publication_scheme: "" + disclosure_log: "" forlorn_en_public_body_translation: name: "Department of Loneliness" @@ -57,6 +61,7 @@ forlorn_en_public_body_translation: locale: en notes: A very lonely public body that no one has corresponded with publication_scheme: "" + disclosure_log: "" silly_walks_en_public_body_translation: id: 6 @@ -69,6 +74,7 @@ silly_walks_en_public_body_translation: url_name: msw notes: You know the one. publication_scheme: "" + disclosure_log: "" sensible_walks_en_public_body_translation: id: 7 @@ -81,3 +87,4 @@ sensible_walks_en_public_body_translation: url_name: sensible_walks notes: I bet you’ve never heard of it. publication_scheme: "" + disclosure_log: "" diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb index a42516d72..b68b3f43b 100644 --- a/spec/views/public_body/show.rhtml_spec.rb +++ b/spec/views/public_body/show.rhtml_spec.rb @@ -11,6 +11,7 @@ describe "when viewing a body" do :eir_only? => nil, :info_requests => [1, 2, 3, 4], # out of sync with Xapian :publication_scheme => '', + :disclosure_log => '', :calculated_home_page => '') @pb.stub!(:override_request_email).and_return(nil) @pb.stub!(:is_requestable?).and_return(true) |