aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/images/next-step-facebook.pngbin0 -> 626 bytes
-rw-r--r--app/assets/images/next-step-twitter.pngbin0 -> 959 bytes
-rw-r--r--app/assets/stylesheets/admin.scss8
-rw-r--r--app/assets/stylesheets/main.scss213
-rw-r--r--app/assets/stylesheets/responsive/_global_style.scss20
-rw-r--r--app/assets/stylesheets/responsive/_lists_layout.scss6
-rw-r--r--app/assets/stylesheets/responsive/_new_request_layout.scss140
-rw-r--r--app/assets/stylesheets/responsive/_new_request_style.scss88
-rw-r--r--app/assets/stylesheets/responsive/_public_body_layout.scss63
-rw-r--r--app/assets/stylesheets/responsive/_public_body_style.scss92
-rw-r--r--app/assets/stylesheets/responsive/_request_style.scss21
-rw-r--r--app/assets/stylesheets/responsive/_signin_layout.scss18
-rw-r--r--app/assets/stylesheets/responsive/_signin_style.scss11
-rw-r--r--app/controllers/admin_public_body_categories_controller.rb44
-rw-r--r--app/controllers/admin_public_body_controller.rb6
-rw-r--r--app/controllers/admin_public_body_headings_controller.rb63
-rw-r--r--app/controllers/general_controller.rb17
-rw-r--r--app/controllers/public_body_controller.rb3
-rw-r--r--app/controllers/request_controller.rb8
-rw-r--r--app/controllers/user_controller.rb12
-rw-r--r--app/helpers/public_body_helper.rb61
-rw-r--r--app/models/info_request.rb9
-rw-r--r--app/models/public_body.rb287
-rw-r--r--app/models/public_body_category.rb65
-rw-r--r--app/models/public_body_heading.rb43
-rw-r--r--app/models/track_thing.rb3
-rw-r--r--app/models/user.rb12
-rw-r--r--app/views/admin_public_body/_form.html.erb98
-rw-r--r--app/views/admin_public_body/_locale_fields.html.erb49
-rw-r--r--app/views/admin_public_body/import_csv.html.erb23
-rw-r--r--app/views/admin_public_body_categories/_form.html.erb75
-rw-r--r--app/views/admin_public_body_categories/_locale_fields.html.erb27
-rw-r--r--app/views/admin_public_body_headings/_form.html.erb69
-rw-r--r--app/views/admin_public_body_headings/_locale_fields.html.erb9
-rw-r--r--app/views/general/search.html.erb12
-rw-r--r--app/views/info_request_batch/_batch_sent.html.erb69
-rw-r--r--app/views/public_body/_body_listing_single.html.erb35
-rw-r--r--app/views/public_body/_search_ahead.html.erb20
-rw-r--r--app/views/public_body/show.html.erb158
-rw-r--r--app/views/public_body/view_email.html.erb2
-rw-r--r--app/views/request/_request_filter_form.html.erb8
-rw-r--r--app/views/request/_request_sent.html.erb75
-rw-r--r--app/views/request/_search_ahead.html.erb10
-rw-r--r--app/views/request/followup_bad.html.erb17
-rw-r--r--app/views/request/new.html.erb322
-rw-r--r--app/views/request/preview.html.erb112
-rw-r--r--app/views/request/select_authorities.html.erb4
-rw-r--r--app/views/request/select_authority.html.erb13
-rw-r--r--app/views/user/_signin.html.erb17
-rw-r--r--app/views/user/_signup.html.erb31
-rw-r--r--app/views/user/set_draft_profile_photo.html.erb4
-rw-r--r--app/views/user/set_profile_about_me.html.erb8
-rw-r--r--app/views/user/show.html.erb2
-rw-r--r--app/views/user/sign.html.erb19
54 files changed, 1687 insertions, 914 deletions
diff --git a/app/assets/images/next-step-facebook.png b/app/assets/images/next-step-facebook.png
new file mode 100644
index 000000000..c01fa6ced
--- /dev/null
+++ b/app/assets/images/next-step-facebook.png
Binary files differ
diff --git a/app/assets/images/next-step-twitter.png b/app/assets/images/next-step-twitter.png
new file mode 100644
index 000000000..e79255bd6
--- /dev/null
+++ b/app/assets/images/next-step-twitter.png
Binary files differ
diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss
index 31fe7e95a..9b792dee3 100644
--- a/app/assets/stylesheets/admin.scss
+++ b/app/assets/stylesheets/admin.scss
@@ -123,6 +123,14 @@ body.admin {
padding: 3px 0;
}
+ .fieldWithErrors {
+ display:block;
+ padding:0.2em;
+ textarea, input {
+ border:solid 1px Red !important;
+ }
+ }
+
/* Holidays */
.day_select {
width: 75px;
diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss
index b063b0d77..91e509083 100644
--- a/app/assets/stylesheets/main.scss
+++ b/app/assets/stylesheets/main.scss
@@ -185,11 +185,9 @@ margin:18px 0 36px;
}
#stepwise_make_request {
-color:#222;
font-size:1.1em;
text-align:left;
-width:412px;
-margin:0 14em 40px 0;
+margin-bottom: 1em;
}
#stepwise_make_request_view_email {
@@ -586,12 +584,25 @@ width:40%;
width:26em;
}
+#request_form {
+width: 63.6666%;
+margin-right: 3%;
+float: left;
+}
+
#request_advice {
float:right;
-width:250px;
+width:30.3333%;
margin-top:1em;
}
+.advice-panel {
+ ul {
+ list-style: none outside none;
+ padding-left: 0 !important;
+ }
+}
+
#select_authority_help {
background-color: #FEF1F6;
float: right;
@@ -616,20 +627,18 @@ padding-top:0.5em;
padding-bottom:1em;
}
+#request_header_subject {
+ .form_item_note {
+ margin-top: 0.5em;
+ }
+}
+
#request_form label,label.form_label {
-display:block;
-float:left;
-clear:none;
-width:100px;
-text-align:left;
-margin:2px 0 0;
-padding:0 10px 0 0;
+ display: block;
}
.form_item_note,.form_note {
-width:34em;
-margin-left:110px;
-font-size:1em;
+
}
.form_item_note {
@@ -637,7 +646,7 @@ margin-top:-1em;
}
.form_button {
-margin:0 0 0 9em;
+margin:0;
}
p#sign_in_reason, p#superuser_message {
@@ -653,7 +662,6 @@ p#superuser_message {
clear:none;
margin-bottom:1em;
float:none;
-margin-top:20px;
width:auto;
}
@@ -675,8 +683,16 @@ margin-left:25%;
#signup .form_item_note,#signin .form_note {
font-size:0.9em;
-margin-left:11.5em;
-width:inherit;
+margin-top: 0.5em;
+}
+
+.sign-in-wrapper {
+ overflow: hidden;
+ padding: 1em 1.5em 1.5em;
+ background-color: #f4f4f4;
+ h2 {
+ margin-top: 0.2em;
+ }
}
div.controller_help dt a,div.controller_help h1 a,div#help_unhappy h1 a.hover_a {
@@ -898,7 +914,6 @@ margin:0 1.2em 0 0.9em;
#request_header_text,#request_search_ahead_results {
font-size:0.9em;
-margin-left:11em;
}
div.feed_link img,div.act_link img {
@@ -907,34 +922,6 @@ vertical-align:middle;
text-decoration:none;
}
-#follow_box {
-
- padding: 4px;
-}
-
-#follow_box .feed_link {
- text-align: center;
-}
-
-#follow_count {
- color: #93278F;
- font-family: 'DeliciousBold', Arial, sans-serif;
- font-weight: 700;
- font-size: 60px;
- line-height: 60px;
- text-align: right;
- float: left;
- margin-top: -15px;
- margin-right: 5px;
-}
-.follow_count {
- clear:both;
-}
-
-#follow_box h2 {
- margin: 0;
-}
-
h2,dt {
font-size:1.8em;
}
@@ -995,21 +982,20 @@ width:245px;
float:left;
}
+.authority__body__foi-results .request_right {
+width:545px;
+}
+
#request_header_text {
-margin-left:110px;
-width: 30em;
border-radius:3px;
-moz-border-radius:3px;
-margin-top: 10px;
+margin: 10px 10px 0;
background-color:#D5FFD8;
border-color:#1EFF38;
border-style:solid;
border-width:1px;
padding:0.5em;
-
font-style: italic;
-
-
}
#request_header_text h3 {
@@ -1272,13 +1258,19 @@ font-style:italic;
color:#444;
}
-#sign_together h1 {
-width:320px;
-text-align:center;
+
+#sign_together {
+ #left_half {
+ width: 63.666%;
+ margin-right: 3%;
+ }
+ #right_half {
+ width: 33.333%;
+ }
}
-#sign_together .form_button {
-margin-left:10.5em;
+.pretitle {
+ margin-bottom: 0;
}
form input[type=text],form input[type=password] {
@@ -1817,3 +1809,108 @@ text-decoration:none;
color: #0000EE;
font-size: 0.9em;
}
+
+.back-to-results {
+ margin-top: 0.5em;
+}
+
+.authority__header {
+ border-bottom: 1px solid #e9e9e9;
+ margin-bottom: 1em;
+}
+
+
+.authority__header__subtitle {
+ font-size: 1.2em;
+ color: #666;
+}
+
+.authority__header__notes {
+ margin: 1em;
+}
+
+.authority__body {
+ overflow: hidden;
+}
+
+.authority__body__foi-results {
+ width: 63.666%;
+ float: left;
+ margin-right: 3%;
+}
+
+.authority__body__sidebar {
+ width: 33.333%;
+ float: left;
+}
+
+.authority__header__action-bar {
+ font-size: 0;
+ padding: 16px 0;
+ margin-top: 8px;
+ border-top: 1px solid #e9e9e9;
+}
+
+.action-bar__make-request,
+.action-bar__follow,
+.action-bar__follow-button,
+.action-bar__follower-count {
+ font-size: 16px;
+ display: inline-block;
+ margin:0 1em 0 0;
+ .feed_link {
+ padding: 0;
+ }
+}
+
+.list-filter-item {
+ .title {
+ display: inline;
+ font-size: 1em;
+ font-weight: normal;
+ }
+}
+
+.list-filter-item {
+ ul {
+ list-style: none outside none;
+ margin: 0;
+ padding: 0;
+ }
+ li {
+ display: inline-block;
+ &:after {
+ content:' | ';
+ display: inline-block;
+ color: #ccc; //Unsupported browsers will ignore the rgba declaration below
+ color: rgba(0,0,0,0.1);
+ }
+ &:last-child {
+ &:after {
+ content: '';
+ }
+ }
+
+ }
+}
+
+.authority__body__sidebar__links {
+ a {
+ display: inline-block;
+ margin-bottom: 0.5em;
+ }
+}
+
+#list-filter {
+ margin-bottom: 3em;
+}
+
+#filter_requests_form label.title {
+ display: block;
+ width: auto;
+ margin-bottom: 0.3em;
+}
+
+#notice.request-sent-message {
+ font-size: 1em;
+}
diff --git a/app/assets/stylesheets/responsive/_global_style.scss b/app/assets/stylesheets/responsive/_global_style.scss
index af25fb0b0..24cddc0d9 100644
--- a/app/assets/stylesheets/responsive/_global_style.scss
+++ b/app/assets/stylesheets/responsive/_global_style.scss
@@ -92,7 +92,7 @@ dt + dd {
/* Links in sidebars usually only underlined on hover */
.feed_link,.act_link {
- margin-bottom:10px;
+
a{
text-decoration:none;
}
@@ -116,7 +116,7 @@ dt + dd {
}
/* Notices to the user (usually on action completion) */
-#notice, #error {
+#notice, #error, .warning {
font-size:1em;
border-radius:3px;
margin:1em 0;
@@ -136,7 +136,7 @@ dt + dd {
background-color: lighten(#62b356, 23%);
}
-#error {
+#error, .warning {
background-color: lighten(#b05460, 23%);
}
@@ -191,15 +191,6 @@ form input[type=text],form input[type=password] {
padding:0.5em;
}
-#preview_form ul {
- margin:0;
- padding:1px 32px 10px;
-}
-
-#preview_form ul li {
- margin:10px 0;
-}
-
label small{
text-transform: none;
}
@@ -225,6 +216,11 @@ div.pagination {
}
+.pretitle {
+ margin-bottom: -0.5em;
+ color: #666;
+}
+
/* Search result highlighting */
.highlight {
background:#FF0;
diff --git a/app/assets/stylesheets/responsive/_lists_layout.scss b/app/assets/stylesheets/responsive/_lists_layout.scss
index 69237ae91..6a874e8fe 100644
--- a/app/assets/stylesheets/responsive/_lists_layout.scss
+++ b/app/assets/stylesheets/responsive/_lists_layout.scss
@@ -81,4 +81,8 @@
}
}
-
+/* .make-request-quick-button displays in the typeahead search results in the 'make request' process */
+.make-request-quick-button {
+ margin-bottom: 1em;
+ margin-top: -0.5em;
+}
diff --git a/app/assets/stylesheets/responsive/_new_request_layout.scss b/app/assets/stylesheets/responsive/_new_request_layout.scss
index a8b24e1b1..2ebba0813 100644
--- a/app/assets/stylesheets/responsive/_new_request_layout.scss
+++ b/app/assets/stylesheets/responsive/_new_request_layout.scss
@@ -3,8 +3,9 @@
/* /select_authority page */
#authority_selection {
@include grid-column($columns: 12, $collapse: true);
+
@include respond-min( $main_menu-mobile_menu_cutoff ){
- @include grid-column($columns: 6, $collapse: true);
+ @include grid-column(8, $collapse: true);
@include ie8{
padding-right: 0.9375em;
}
@@ -15,16 +16,27 @@
width: 80%;
}
}
+ .authority_search_ahead_results_container {
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-row($behavior: nest);
+ }
+ }
+ #authority_search_ahead_results,
+ .cant_find_results {
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column(12);
+ }
+ }
}
.new_info_request{
- @include grid-row($behavior: nest);
+ @include grid-row();
}
#select_authority_help {
- @include grid-column(12);
+ @include grid-column(12, $collapse: true);
@include respond-min( $main_menu-mobile_menu_cutoff ) {
- @include grid-column(6);
+ @include grid-column(4);
@include ie8 {
padding-right: 0.9375em;
}
@@ -32,14 +44,41 @@
width: 26.188em;
}
}
+
+ /* Hide some elements of the public body that aren't appropriate in this
+ context */
+ #list-filter, h2.foi_results, .public-body-name-prefix {
+ display: none;
+ }
+
+ /* Compact request list for viewing in authority preview column */
+ .request_left, #header_left {
+ @include grid-column(12, $collapse: true);
+ }
+
+ .request_right {
+ @include grid-column(12, $collapse: true);
+ }
+
+ span.desc {
+ background:none;
+ line-height:18px;
+ padding: 0;
+ }
+
+ .typeahead_response {
+ @include grid-row($behavior: nest);
+ }
+
+
}
/* /new/[body_name] page */
#request_header {
- @include grid-row;
+ @include grid-row($behavior: nest);
/* Restrict width of form elements on wide screens */
- #request_header_body, #request_header_subject, #typeahead_response {
+ #request_header_body, #request_header_subject, #typeahead_response {
@include grid-column(12);
@include respond-min( $main_menu-mobile_menu_cutoff ){
@include grid-column($columns:8, $last-column:true);
@@ -62,12 +101,19 @@
float: right;
}
-/* Advice sits on right hand side */
-#request_advice {
+.request_body {
+ @include grid-row($behavior: nest);
+}
+#request_body_header {
+ @include grid-column(12);
+}
+
+/* Advice sits on right hand side */
+#request_advice, .preview-advice {
@include grid-column(12);
@include respond-min( $main_menu-mobile_menu_cutoff ){
- @include grid-column($columns:4, $push: 8);
+ @include grid-column($columns:4, $push:8, $last-column:true);
@include ie8{
padding-left: 0.9375em;
}
@@ -78,10 +124,9 @@
}
#request_form {
-
@include grid-column(12);
@include respond-min( $main_menu-mobile_menu_cutoff ){
- @include grid-column($columns:8, $pull: 4);
+ @include grid-column($columns:8, $pull:4);
@include ie8{
padding-right: 0.9375em;
}
@@ -92,10 +137,28 @@
}
-#preview_form {
- @include grid-column(12);
+#outgoing_message_body {
+ width: 100%;
+}
+
+/* Message preview */
+.message-preview {
+ @include grid-row($behavior: nest);
}
+.preview-pane {
+ @include grid-column(12);
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column($columns:8, $pull:4);
+ @include ie8{
+ padding-right: 0.9375em;
+ }
+ @include lte-ie7 {
+ width: 36.813em;
+ }
+ }
+ }
+
/* Batch request page*/
@@ -164,6 +227,57 @@ div.batch_public_body_toggle {
margin-left: 110px;
}
+/* Request sent page */
+.request-sent-message {
+ margin-top: 1em;
+ h1 {
+ font-size: 1.3em;
+ margin-top: 0;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ font-size: 2em;
+ margin-bottom: 1em;
+ }
+ }
+ .share-link img {
+ display:block;
+ margin: 1em auto;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ display: inline-block;
+ margin: inherit;
+ }
+ }
+
+}
+.request-sent-message__row {
+ @include grid-row($behavior: nest);
+}
+
+.request-sent-message__column-1 {
+ @include grid-column(12);
+ margin-bottom: 1em;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column($columns:8);
+ margin-bottom: 0;
+ @include ie8{
+ padding-right: 0.9375em;
+ }
+ @include lte-ie7 {
+ width: 36.813em;
+ }
+ }
+}
+.request-sent-message__column-2 {
+ @include grid-column(12);
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column($columns:4);
+ @include ie8{
+ padding-left: 0.9375em;
+ }
+ @include lte-ie7 {
+ width: 17.438em;
+ }
+ }
+}
diff --git a/app/assets/stylesheets/responsive/_new_request_style.scss b/app/assets/stylesheets/responsive/_new_request_style.scss
index 86e17cbfe..55abdca31 100644
--- a/app/assets/stylesheets/responsive/_new_request_style.scss
+++ b/app/assets/stylesheets/responsive/_new_request_style.scss
@@ -29,15 +29,23 @@
#to_public_body {
font-weight: bold;
font-size: 1.3em;
+ margin-bottom: 0.5em;
+}
+
+.to_public_body_label {
+ color: #777;
+ font-weight: normal;
+}
+
+#request_header {
+ border-bottom: 1px solid #ccc; //Unsupported browsers will ignore the rgba declaration below
+ border-color: rgba(0,0,0,0.1);
+ margin-bottom: 2em;
}
#request_header_text {
- border-radius:3px;
- background-color: lighten(#62b356, 23%);
- padding:0 1em;
- margin-bottom: 1.5em;
- margin-top: 1.5em;
overflow: hidden;
+ font-size: 0.875em;
h3 {
font-size: 1em;
}
@@ -45,15 +53,54 @@
}
#request_advice {
+ margin-bottom: 1.5em;
+ font-size: 0.875em;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ font-size: 1em;
+ }
+ .advice-panel {
+ margin-top: 1.5em;
+ }
+}
+
+.advice-panel {
+ margin-bottom: 1.5em;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ margin-bottom: 0;
+ }
ul {
margin:0 auto;
-
+ list-style: none outside none;
+ padding: 0;
li {
margin:0 0 1em;
}
}
}
+#request_search_ahead_results {
+ background-color: #f4f4f4;
+ padding: 1.5em;
+ margin-bottom: 1.5em;
+ h2 {
+ font-size: 1em;
+ font-weight: normal;
+ }
+}
+
+
+input#reedit_button {
+ background-color: transparent;
+ color: #2688dc;
+ text-decoration: underline;
+ &:hover,
+ &:active,
+ &:focus {
+ color: #333333;
+ }
+ border: none;
+}
+
/* Batch request page */
@@ -61,3 +108,32 @@
color: #0000EE;
font-size: 0.9em;
}
+
+/* Request sent page */
+.request-sent-message {
+ border-bottom: 1px solid #e9e9e9;
+ font-size: 1em;
+ h1 {
+ }
+}
+
+.request-sent-message__column-1 {
+ h2 {
+ font-size: 1em;
+ }
+}
+
+.what-next {
+ background-color: #e6e8d6;
+ background-color: rgba(255,255,255, 0.4);
+ padding: 0.5em 1.5em 1.5em;
+ margin-bottom: 1.5em;
+}
+
+.what-next__list {
+ list-style: none outside none;
+ padding-left: 0;
+ li {
+ margin-bottom: 0.5em;
+ }
+}
diff --git a/app/assets/stylesheets/responsive/_public_body_layout.scss b/app/assets/stylesheets/responsive/_public_body_layout.scss
index 39d42e213..7a9637bc9 100644
--- a/app/assets/stylesheets/responsive/_public_body_layout.scss
+++ b/app/assets/stylesheets/responsive/_public_body_layout.scss
@@ -8,3 +8,66 @@
@include grid-column(12);
margin-top: 0.5em;
}
+
+.authority__header {
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ margin-bottom: 1em;
+ }
+ @include grid-column(12);
+}
+
+.authority__body {
+ .request_left,
+ .request_right {
+ float: none;
+ width: auto;
+ }
+ .desc {
+ padding-left: 0;
+ }
+ .request_listing .bottomline {
+ padding-bottom: 0.5em;
+ }
+}
+
+.authority__body__foi-results {
+ @include grid-column(12);
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column(8);
+ }
+}
+
+.authority__body__sidebar {
+ @include grid-column(12);
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ @include grid-column(4);
+ }
+}
+
+.authority__header__action-bar {
+ font-size: 0;
+ padding: 16px 0;
+ margin-top: 8px;
+}
+
+.action-bar__make-request,
+.action-bar__follow,
+.action-bar__follow-button,
+.action-bar__follower-count {
+ vertical-align: top;
+ font-size: 16px;
+ margin: 1em 0;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ display: inline-block;
+ margin:0 1em 0 0;
+ }
+}
+
+
+.list-filter-item {
+ .title {
+ display: inline;
+ font-size: 1em;
+ font-weight: normal;
+ }
+}
diff --git a/app/assets/stylesheets/responsive/_public_body_style.scss b/app/assets/stylesheets/responsive/_public_body_style.scss
index 4040198b3..748f6218b 100644
--- a/app/assets/stylesheets/responsive/_public_body_style.scss
+++ b/app/assets/stylesheets/responsive/_public_body_style.scss
@@ -1,24 +1,76 @@
/* Style for public body pages */
.back-to-results {
- .message {
- margin-top: 0.5em;
- padding: 0.5em 0.8em;
- background-color: #fff;
- background-color: rgba(0,0,0,0.1);
- }
-}
-
-.public-body-name-prefix {
- color:#888;
- font-size: 1.3em;
- position: relative;
- top: 1em;
-}
-
-#follow_count {
- font-weight: bold;
- font-size: 3em;
- position: relative;
- top: 0.25em;
+ .message {
+ margin-top: 0.5em;
+ padding: 0.5em 0.8em;
+ background-color: #fff;
+ background-color: rgba(0,0,0,0.1);
+ a {
+ text-decoration: none;
+ }
+ }
+}
+
+.authority__header {
+ border-bottom: 1px solid #e9e9e9;
+}
+
+.authority__header__subtitle {
+ font-size: 1.2em;
+ color: #666;
+}
+
+.authority__header__action-bar {
+ border-top: 1px solid #e9e9e9;
+}
+
+.authority__body__sidebar {
+ h2 {
+ font-size: 1.2em;
+ }
+ h3 {
+ font-size: 1em;
+ }
+}
+
+
+.list-filter-item {
+ ul {
+ list-style: none outside none;
+ margin: 0;
+ padding: 0;
+ }
+ li {
+ display: inline-block;
+ &:after {
+ content:' | ';
+ display: inline-block;
+ color: #ccc; //Unsupported browsers will ignore the rgba declaration below
+ color: rgba(0,0,0,0.1);
+ }
+ &:last-child {
+ &:after {
+ content: '';
+ }
+ }
+
+ }
+}
+
+.authority__body__sidebar__links {
+ a {
+ display: inline-block;
+ margin-bottom: 0.5em;
+ }
+}
+
+#list-filter {
+ margin-bottom: 3em;
+}
+
+#filter_requests_form label.title {
+ display: block;
+ width: auto;
+ margin-bottom: 0.3em;
}
diff --git a/app/assets/stylesheets/responsive/_request_style.scss b/app/assets/stylesheets/responsive/_request_style.scss
index c33688793..e6f36674a 100644
--- a/app/assets/stylesheets/responsive/_request_style.scss
+++ b/app/assets/stylesheets/responsive/_request_style.scss
@@ -3,7 +3,10 @@
div.correspondence {
border: 1px solid #ccc;
margin: 0 0 1em;
- padding: 0.5em 1em 0 0.5em;
+ padding: 1em;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ padding: 1.5em;
+ }
h2 {
text-align:right;
@@ -11,6 +14,20 @@ div.correspondence {
}
}
+.preview_subject,
+.preview_to {
+ font-weight: bold;
+ strong {
+ font-weight: normal;
+ display: block;
+ color: #777;
+ }
+}
+
+.preview_subject {
+ margin-bottom: 1.5em;
+}
+
div.comment_in_request {
border: 1px dotted #ccc;
margin:0 0 1em 3em;
@@ -30,7 +47,7 @@ div.comment_in_request {
margin-bottom: 1em;
}
-.correspondence_text,.comment_in_request_text {
+.comment_in_request_text {
margin:0 1.2em 0 0.9em;
}
diff --git a/app/assets/stylesheets/responsive/_signin_layout.scss b/app/assets/stylesheets/responsive/_signin_layout.scss
index 44999d31b..5a0e0057f 100644
--- a/app/assets/stylesheets/responsive/_signin_layout.scss
+++ b/app/assets/stylesheets/responsive/_signin_layout.scss
@@ -6,7 +6,7 @@
#left_half {
@include grid-column(12);
@include respond-min( $main_menu-mobile_menu_cutoff ){
- @include grid-column($columns:5,$float:left);
+ @include grid-column($columns:7,$float:left);
@include ie8{
padding-right: 0.9375em;
}
@@ -19,7 +19,7 @@
#right_half {
@include grid-column(12);
@include respond-min( $main_menu-mobile_menu_cutoff ){
- @include grid-column($columns:5,$float:right);
+ @include grid-column($columns:4,$float:right);
@include ie8{
padding-left: 0.9375em;
}
@@ -29,20 +29,6 @@
}
}
-#middle_strip {
- @include grid-column(12);
- @include respond-min( $main_menu-mobile_menu_cutoff ){
- @include grid-column($columns:2,$float:left);
- @include ie8{
- padding-left: 0.9375em;
- padding-right: 0.9375em;
- }
- @include lte-ie7 {
- width: 7.438em;
- }
- }
-}
-
#sign_together{
@include grid-row($behavior: nest);
}
diff --git a/app/assets/stylesheets/responsive/_signin_style.scss b/app/assets/stylesheets/responsive/_signin_style.scss
index 2bd2802b4..918392365 100644
--- a/app/assets/stylesheets/responsive/_signin_style.scss
+++ b/app/assets/stylesheets/responsive/_signin_style.scss
@@ -15,14 +15,19 @@
font-size:1.2em;
}
-p#sign_in_reason, p#superuser_message {
+#sign_in_reason, #superuser_message {
font-size:2em;
font-weight:bold;
line-height:1em;
}
-p#superuser_message {
+#superuser_message {
font-size:1.2em;
}
-
+.sign-in-wrapper {
+ margin-top: 1.5em;
+ @include respond-min( $main_menu-mobile_menu_cutoff ){
+ margin-top: 0;
+ }
+}
diff --git a/app/controllers/admin_public_body_categories_controller.rb b/app/controllers/admin_public_body_categories_controller.rb
index 5e305dde3..a86171c76 100644
--- a/app/controllers/admin_public_body_categories_controller.rb
+++ b/app/controllers/admin_public_body_categories_controller.rb
@@ -7,17 +7,39 @@ class AdminPublicBodyCategoriesController < AdminController
def new
@category = PublicBodyCategory.new
- render :formats => [:html]
+ @category.build_all_translations
+ end
+
+ def create
+ I18n.with_locale(I18n.default_locale) do
+ @category = PublicBodyCategory.new(params[:public_body_category])
+ if @category.save
+ # FIXME: This can't handle failure (e.g. if a PublicBodyHeading
+ # doesn't exist)
+ if params[:headings]
+ params[:headings].values.each do |heading_id|
+ PublicBodyHeading.find(heading_id).add_category(@category)
+ end
+ end
+ flash[:notice] = 'Category was successfully created.'
+ redirect_to admin_categories_path
+ else
+ @category.build_all_translations
+ render :action => 'new'
+ end
+ end
end
def edit
@category = PublicBodyCategory.find(params[:id])
+ @category.build_all_translations
@tagged_public_bodies = PublicBody.find_by_tag(@category.category_tag)
end
def update
@category = PublicBodyCategory.find(params[:id])
@tagged_public_bodies = PublicBody.find_by_tag(@category.category_tag)
+
heading_ids = []
I18n.with_locale(I18n.default_locale) do
@@ -43,6 +65,8 @@ class AdminPublicBodyCategoriesController < AdminController
end
added_headings.each do |heading_id|
+ # FIXME: This can't handle failure (e.g. if a
+ # PublicBodyHeading doesn't exist)
PublicBodyHeading.find(heading_id).add_category(@category)
end
end
@@ -51,29 +75,13 @@ class AdminPublicBodyCategoriesController < AdminController
flash[:notice] = 'Category was successfully updated.'
redirect_to edit_admin_category_path(@category)
else
+ @category.build_all_translations
render :action => 'edit'
end
end
end
end
- def create
- I18n.with_locale(I18n.default_locale) do
- @category = PublicBodyCategory.new(params[:public_body_category])
- if @category.save
- if params[:headings]
- params[:headings].values.each do |heading_id|
- PublicBodyHeading.find(heading_id).add_category(@category)
- end
- end
- flash[:notice] = 'Category was successfully created.'
- redirect_to admin_categories_path
- else
- render :action => 'new'
- end
- end
- end
-
def destroy
@locale = self.locale_from_params
I18n.with_locale(@locale) do
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index cfb6f240d..7de27121a 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -23,6 +23,8 @@ class AdminPublicBodyController < AdminController
def new
@public_body = PublicBody.new
+ @public_body.build_all_translations
+
if params[:change_request_id]
@change_request = PublicBodyChangeRequest.find(params[:change_request_id])
end
@@ -53,6 +55,7 @@ class AdminPublicBodyController < AdminController
flash[:notice] = 'PublicBody was successfully created.'
redirect_to admin_body_url(@public_body)
else
+ @public_body.build_all_translations
render :action => 'new'
end
end
@@ -60,6 +63,8 @@ class AdminPublicBodyController < AdminController
def edit
@public_body = PublicBody.find(params[:id])
+ @public_body.build_all_translations
+
if params[:change_request_id]
@change_request = PublicBodyChangeRequest.find(params[:change_request_id])
end
@@ -89,6 +94,7 @@ class AdminPublicBodyController < AdminController
flash[:notice] = 'PublicBody was successfully updated.'
redirect_to admin_body_url(@public_body)
else
+ @public_body.build_all_translations
render :action => 'edit'
end
end
diff --git a/app/controllers/admin_public_body_headings_controller.rb b/app/controllers/admin_public_body_headings_controller.rb
index e893e760d..a7fe27390 100644
--- a/app/controllers/admin_public_body_headings_controller.rb
+++ b/app/controllers/admin_public_body_headings_controller.rb
@@ -1,22 +1,52 @@
class AdminPublicBodyHeadingsController < AdminController
+ def new
+ @heading = PublicBodyHeading.new
+ @heading.build_all_translations
+ end
+
+ def create
+ I18n.with_locale(I18n.default_locale) do
+ @heading = PublicBodyHeading.new(params[:public_body_heading])
+ if @heading.save
+ flash[:notice] = 'Heading was successfully created.'
+ redirect_to admin_categories_url
+ else
+ @heading.build_all_translations
+ render :action => 'new'
+ end
+ end
+ end
+
def edit
@heading = PublicBodyHeading.find(params[:id])
- render :formats => [:html]
+ @heading.build_all_translations
end
def update
+ @heading = PublicBodyHeading.find(params[:id])
+
I18n.with_locale(I18n.default_locale) do
- @heading = PublicBodyHeading.find(params[:id])
if @heading.update_attributes(params[:public_body_heading])
- flash[:notice] = 'Category heading was successfully updated.'
+ flash[:notice] = 'Heading was successfully updated.'
redirect_to edit_admin_heading_path(@heading)
else
+ @heading.build_all_translations
render :action => 'edit'
end
end
end
+ def destroy
+ @locale = self.locale_from_params
+ I18n.with_locale(@locale) do
+ heading = PublicBodyHeading.find(params[:id])
+ heading.destroy
+ flash[:notice] = "Heading was successfully destroyed."
+ redirect_to admin_categories_url
+ end
+ end
+
def reorder
transaction = reorder_headings(params[:headings])
if transaction[:success]
@@ -35,33 +65,6 @@ class AdminPublicBodyHeadingsController < AdminController
end
end
- def new
- @heading = PublicBodyHeading.new
- render :formats => [:html]
- end
-
- def create
- I18n.with_locale(I18n.default_locale) do
- @heading = PublicBodyHeading.new(params[:public_body_heading])
- if @heading.save
- flash[:notice] = 'Category heading was successfully created.'
- redirect_to admin_categories_url
- else
- render :action => 'new'
- end
- end
- end
-
- def destroy
- @locale = self.locale_from_params()
- I18n.with_locale(@locale) do
- heading = PublicBodyHeading.find(params[:id])
- heading.destroy
- flash[:notice] = "Category heading was successfully destroyed."
- redirect_to admin_categories_url
- end
- end
-
protected
def reorder_headings(headings)
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 2c8abbaf4..438bbfd3f 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -9,6 +9,8 @@ require 'open-uri'
class GeneralController < ApplicationController
+ MAX_RESULTS = 500
+
# New, improved front page!
def frontpage
medium_cache
@@ -124,38 +126,45 @@ class GeneralController < ApplicationController
end
end
+ @page = get_search_page_from_params
+
# Query each type separately for separate display (TODO: we are calling
# perform_search multiple times and it clobbers per_page for each one,
# so set as separate var)
requests_per_page = params[:requests_per_page] ? params[:requests_per_page].to_i : 25
- @this_page_hits = @total_hits = @xapian_requests_hits = @xapian_bodies_hits = @xapian_users_hits = 0
+ # Later pages are very expensive to load
+ if @page > MAX_RESULTS / requests_per_page
+ raise ActiveRecord::RecordNotFound.new("Sorry. No pages after #{MAX_RESULTS / requests_per_page}.")
+ end
+
+ @total_hits = @xapian_requests_hits = @xapian_bodies_hits = @xapian_users_hits = 0
if @requests
@xapian_requests = perform_search([InfoRequestEvent], @query, @sortby, 'request_collapse', requests_per_page)
@requests_per_page = @per_page
- @this_page_hits += @xapian_requests.results.size
@xapian_requests_hits = @xapian_requests.results.size
@xapian_requests_total_hits = @xapian_requests.matches_estimated
@total_hits += @xapian_requests.matches_estimated
@request_for_spelling = @xapian_requests
+ @max_requests = (@xapian_requests.matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @xapian_requests.matches_estimated
end
if @bodies
@xapian_bodies = perform_search([PublicBody], @query, @sortby, nil, 5)
@bodies_per_page = @per_page
- @this_page_hits += @xapian_bodies.results.size
@xapian_bodies_hits = @xapian_bodies.results.size
@xapian_bodies_total_hits = @xapian_bodies.matches_estimated
@total_hits += @xapian_bodies.matches_estimated
@request_for_spelling = @xapian_bodies
+ @max_bodies = (@xapian_bodies.matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @xapian_bodies.matches_estimated
end
if @users
@xapian_users = perform_search([User], @query, @sortby, nil, 5)
@users_per_page = @per_page
- @this_page_hits += @xapian_users.results.size
@xapian_users_hits = @xapian_users.results.size
@xapian_users_total_hits = @xapian_users.matches_estimated
@total_hits += @xapian_users.matches_estimated
@request_for_spelling = @xapian_users
+ @max_users = (@xapian_users.matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @xapian_users.matches_estimated
end
# Spelling and highight words are same for all three queries
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 2e540d198..cc3d0b64a 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -58,6 +58,9 @@ class PublicBodyController < ApplicationController
flash.keep(:search_params)
@track_thing = TrackThing.create_track_for_public_body(@public_body)
+ if @user
+ @existing_track = TrackThing.find_existing(@user, @track_thing)
+ end
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
respond_to do |format|
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 081c14d7f..e847cae1e 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -16,11 +16,9 @@ class RequestController < ApplicationController
@@custom_states_loaded = false
begin
- if !Rails.env.test?
- require 'customstates'
- include RequestControllerCustomStates
- @@custom_states_loaded = true
- end
+ require 'customstates'
+ include RequestControllerCustomStates
+ @@custom_states_loaded = true
rescue MissingSourceFile, NameError
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 56f42891d..d66b4aa8e 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -460,6 +460,12 @@ class UserController < ApplicationController
return
end
if !params[:submitted_draft_profile_photo].nil?
+ if @user.banned?
+ flash[:error]= _('Banned users cannot edit their profile')
+ redirect_to set_profile_photo_path
+ return
+ end
+
# check for uploaded image
file_name = nil
file_content = nil
@@ -569,6 +575,12 @@ class UserController < ApplicationController
return
end
+ if @user.banned?
+ flash[:error] = _('Banned users cannot edit their profile')
+ redirect_to set_profile_about_me_path
+ return
+ end
+
@about_me = AboutMeValidator.new(params[:about_me])
if !@about_me.valid?
render :action => 'set_profile_about_me'
diff --git a/app/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb
new file mode 100644
index 000000000..332e93284
--- /dev/null
+++ b/app/helpers/public_body_helper.rb
@@ -0,0 +1,61 @@
+module PublicBodyHelper
+
+ # Public: The reasons a request can't be made to a PublicBody
+ # The returned reasons are ordered by priority. For example, if the body no
+ # longer exists there is no reason to ask for its contact details if we don't
+ # have an email for it.
+ #
+ # public_body - Instance of a PublicBody
+ #
+ # Returns an Array
+ def public_body_not_requestable_reasons(public_body)
+ reasons = []
+
+ if public_body.defunct?
+ reasons.push _('This authority no longer exists, so you cannot make a request to it.')
+ end
+
+ if public_body.not_apply?
+ reasons.push _('Freedom of Information law does not apply to this authority, so you cannot make a request to it.')
+ end
+
+ unless public_body.has_request_email?
+ # Make the authority appear requestable to encourage users to help find
+ # the authority's email address
+ msg = link_to _("Make a request to this authority"),
+ new_request_to_body_path(:url_name => public_body.url_name),
+ :class => "link_button_green"
+
+ reasons.push(msg)
+ end
+
+ reasons.compact
+ end
+
+ # Use tags to describe what type of authority a PublicBody is.
+ #
+ # public_body - Instance of a PublicBody
+ #
+ # Returns a string
+ def type_of_authority(public_body)
+ types = public_body.tags.each_with_index.map do |tag, index|
+ if PublicBodyCategory.get().by_tag().include?(tag.name)
+ desc = PublicBodyCategory.get().singular_by_tag()[tag.name]
+
+ if index.zero?
+ desc = desc.sub(/\S/) { |m| Unicode.upcase(m) }
+ end
+ link_to(desc, list_public_bodies_path(tag.name))
+ end
+ end
+
+ types.compact!
+
+ if types.any?
+ types.to_sentence(:last_word_connector => ' and ').html_safe
+ else
+ _("A public authority")
+ end
+ end
+
+end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 8d455e488..fd42ccd9c 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -187,11 +187,9 @@ class InfoRequest < ActiveRecord::Base
@@custom_states_loaded = false
begin
- if !Rails.env.test?
- require 'customstates'
- include InfoRequestCustomStates
- @@custom_states_loaded = true
- end
+ require 'customstates'
+ include InfoRequestCustomStates
+ @@custom_states_loaded = true
rescue MissingSourceFile, NameError
end
@@ -748,7 +746,6 @@ public
# This is a long stop - even with UK public interest test extensions, 40
# days is a very long time.
def date_very_overdue_after
- last_sent = last_event_forming_initial_request
if self.public_body.is_school?
# schools have 60 working days maximum (even over a long holiday)
Holiday.due_date_from(self.date_initial_request_last_sent_at, AlaveteliConfiguration::special_reply_very_late_after_days, AlaveteliConfiguration::working_or_calendar_days)
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index a9cdfeab2..232c0ffa1 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -64,6 +64,7 @@ class PublicBody < ActiveRecord::Base
}
translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme
+ accepts_nested_attributes_for :translations, :reject_if => :empty_translation_in_params?
# Default fields available for importing from CSV, in the format
# [field_name, 'short description of field (basic html allowed)']
@@ -151,30 +152,24 @@ class PublicBody < ActiveRecord::Base
translations
end
- def translated_versions=(translation_attrs)
- def empty_translation?(attrs)
- attrs_with_values = attrs.select{ |key, value| value != '' and key != 'locale' }
- attrs_with_values.empty?
- end
+ def ordered_translations
+ translations.
+ select { |t| I18n.available_locales.include?(t.locale) }.
+ sort_by { |t| I18n.available_locales.index(t.locale) }
+ end
- if translation_attrs.respond_to? :each_value # Hash => updating
- translation_attrs.each_value do |attrs|
- next if empty_translation?(attrs)
- t = translation_for(attrs[:locale]) || PublicBody::Translation.new
- t.attributes = attrs
- calculate_cached_fields(t)
- t.save!
- end
- else # Array => creating
- translation_attrs.each do |attrs|
- next if empty_translation?(attrs)
- new_translation = PublicBody::Translation.new(attrs)
- calculate_cached_fields(new_translation)
- translations << new_translation
- end
+ def build_all_translations
+ I18n.available_locales.each do |locale|
+ translations.build(:locale => locale) unless translations.detect{ |t| t.locale == locale }
end
end
+ def translated_versions=(translation_attrs)
+ warn "[DEPRECATION] PublicBody#translated_versions= will be replaced " \
+ "by PublicBody#translations_attributes= as of release 0.22"
+ self.translations_attributes = translation_attrs
+ end
+
def set_default_publication_scheme
# Make sure publication_scheme gets the correct default value.
# (This would work automatically, were publication_scheme not a translated attribute)
@@ -222,39 +217,38 @@ class PublicBody < ActiveRecord::Base
return self.has_tag?('defunct')
end
- # Can an FOI (etc.) request be made to this body, and if not why not?
+ # Can an FOI (etc.) request be made to this body?
def is_requestable?
- if self.defunct?
- return false
- end
- if self.not_apply?
- return false
- end
- if self.request_email.nil?
- return false
- end
- return !self.request_email.empty? && self.request_email != 'blank'
+ has_request_email? && !defunct? && !not_apply?
end
+
# Strict superset of is_requestable?
def is_followupable?
- if self.request_email.nil?
- return false
- end
- return !self.request_email.empty? && self.request_email != 'blank'
+ has_request_email?
end
+
+ def has_request_email?
+ !request_email.blank? && request_email != 'blank'
+ end
+
# Also used as not_followable_reason
def not_requestable_reason
if self.defunct?
return 'defunct'
elsif self.not_apply?
return 'not_apply'
- elsif self.request_email.nil? or self.request_email.empty? or self.request_email == 'blank'
+ elsif !has_request_email?
return 'bad_contact'
else
- raise "requestable_failure_reason called with type that has no reason"
+ raise "not_requestable_reason called with type that has no reason"
end
end
+ def special_not_requestable_reason?
+ self.defunct? || self.not_apply?
+ end
+
+
class Version
def last_edit_comment_for_html_display
@@ -333,39 +327,6 @@ class PublicBody < ActiveRecord::Base
end
end
-
- # Use tags to describe what type of thing this is
- def type_of_authority(html = false)
- types = []
- first = true
- for tag in self.tags
- if PublicBodyCategory.get().by_tag().include?(tag.name)
- desc = PublicBodyCategory.get().singular_by_tag()[tag.name]
- if first
- # terrible that Ruby/Rails doesn't have an equivalent of ucfirst
- # (capitalize shockingly converts later characters to lowercase)
- desc = desc[0,1].capitalize + desc[1,desc.size]
- first = false
- end
- if html
- # TODO: this should call proper route helpers, but is in model sigh
- desc = '<a href="/body/list/' + tag.name + '">' + desc + '</a>'
- end
- types.push(desc)
- end
- end
- if types.size > 0
- ret = types[0, types.size - 1].join(", ")
- if types.size > 1
- ret = ret + " and "
- end
- ret = ret + types[-1]
- return ret.html_safe
- else
- return _("A public authority")
- end
- end
-
# Guess home page from the request email, or use explicit override, or nil
# if not known.
def calculated_home_page
@@ -445,8 +406,6 @@ class PublicBody < ActiveRecord::Base
def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor, available_locales = [])
errors = []
notes = []
- available_locales = [I18n.default_locale] if available_locales.empty?
-
begin
ActiveRecord::Base.transaction do
# Use the default locale when retrieving existing bodies; otherwise
@@ -467,9 +426,18 @@ class PublicBody < ActiveRecord::Base
end
set_of_importing = Set.new()
- field_names = { 'name'=>1, 'request_email'=>2 } # Default values in case no field list is given
+ # Default values in case no field list is given
+ field_names = { 'name' => 1, 'request_email' => 2 }
line = 0
+ import_options = {:field_names => field_names,
+ :available_locales => available_locales,
+ :tag => tag,
+ :tag_behaviour => tag_behaviour,
+ :editor => editor,
+ :notes => notes,
+ :errors => errors }
+
CSV.foreach(csv_filename) do |row|
line = line + 1
@@ -481,7 +449,7 @@ class PublicBody < ActiveRecord::Base
end
fields = {}
- field_names.each{|name, i| fields[name] = row[i]}
+ field_names.each{ |name, i| fields[name] = row[i] }
yield line, fields if block_given?
@@ -497,83 +465,11 @@ class PublicBody < ActiveRecord::Base
next
end
- field_list = []
- self.csv_import_fields.each do |field_name, field_notes|
- field_list.push field_name
- end
-
- if public_body = bodies_by_name[name] # Existing public body
- available_locales.each do |locale|
- I18n.with_locale(locale) do
- changed = ActiveSupport::OrderedHash.new
- field_list.each do |field_name|
- localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
- localized_value = field_names[localized_field_name] && row[field_names[localized_field_name]]
-
- # Tags are a special case, as we support adding to the field, not just setting a new value
- if localized_field_name == 'tag_string'
- if localized_value.nil?
- localized_value = tag unless tag.empty?
- else
- if tag_behaviour == 'add'
- localized_value = "#{localized_value} #{tag}" unless tag.empty?
- localized_value = "#{localized_value} #{public_body.tag_string}"
- end
- end
- end
-
- if !localized_value.nil? and public_body.send(field_name) != localized_value
- changed[field_name] = "#{public_body.send(field_name)}: #{localized_value}"
- public_body.send("#{field_name}=", localized_value)
- end
- end
-
- unless changed.empty?
- notes.push "line #{line.to_s}: updating authority '#{name}' (locale: #{locale}):\n\t#{changed.to_json}"
- public_body.last_edit_editor = editor
- public_body.last_edit_comment = 'Updated from spreadsheet'
- public_body.save!
- end
- end
- end
- else # New public body
- public_body = PublicBody.new(:name=>"", :short_name=>"", :request_email=>"")
- available_locales.each do |locale|
- I18n.with_locale(locale) do
- changed = ActiveSupport::OrderedHash.new
- field_list.each do |field_name|
- localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
- localized_value = field_names[localized_field_name] && row[field_names[localized_field_name]]
-
- if localized_field_name == 'tag_string' and tag_behaviour == 'add'
- localized_value = "#{localized_value} #{tag}" unless tag.empty?
- end
-
- if !localized_value.nil? and public_body.send(field_name) != localized_value
- changed[field_name] = localized_value
- public_body.send("#{field_name}=", localized_value)
- end
- end
-
- unless changed.empty?
- notes.push "line #{line.to_s}: creating new authority '#{name}' (locale: #{locale}):\n\t#{changed.to_json}"
- public_body.publication_scheme = public_body.publication_scheme || ""
- public_body.last_edit_editor = editor
- public_body.last_edit_comment = 'Created from spreadsheet'
-
- begin
- public_body.save!
- rescue ActiveRecord::RecordInvalid
- public_body.errors.full_messages.each do |msg|
- errors.push "error: line #{ line }: #{ msg } for authority '#{ name }'"
- end
- next
- end
- end
- end
- end
- end
+ public_body = bodies_by_name[name] || PublicBody.new(:name => "",
+ :short_name => "",
+ :request_email => "")
+ public_body.import_values_from_csv_row(row, line, name, import_options)
set_of_importing.add(name)
end
@@ -595,6 +491,77 @@ class PublicBody < ActiveRecord::Base
return [errors, notes]
end
+ def self.localized_csv_field_name(locale, field_name)
+ (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
+ end
+
+
+ # import values from a csv row (that may include localized columns)
+ def import_values_from_csv_row(row, line, name, options)
+ is_new = new_record?
+ edit_info = if is_new
+ { :action => "creating new authority",
+ :comment => 'Created from spreadsheet' }
+ else
+ { :action => "updating authority",
+ :comment => 'Updated from spreadsheet' }
+ end
+ locales = options[:available_locales]
+ locales = [I18n.default_locale] if locales.empty?
+ locales.each do |locale|
+ I18n.with_locale(locale) do
+ changed = set_locale_fields_from_csv_row(is_new, locale, row, options)
+ unless changed.empty?
+ options[:notes].push "line #{ line }: #{ edit_info[:action] } '#{ name }' (locale: #{ locale }):\n\t#{ changed.to_json }"
+ self.last_edit_comment = edit_info[:comment]
+ self.publication_scheme = publication_scheme || ""
+ self.last_edit_editor = options[:editor]
+
+ begin
+ save!
+ rescue ActiveRecord::RecordInvalid
+ errors.full_messages.each do |msg|
+ options[:errors].push "error: line #{ line }: #{ msg } for authority '#{ name }'"
+ end
+ next
+ end
+ end
+ end
+ end
+ end
+
+ # Sets attribute values for a locale from a csv row
+ def set_locale_fields_from_csv_row(is_new, locale, row, options)
+ changed = ActiveSupport::OrderedHash.new
+ csv_field_names = options[:field_names]
+ csv_import_fields.each do |field_name, field_notes|
+ localized_field_name = self.class.localized_csv_field_name(locale, field_name)
+ column = csv_field_names[localized_field_name]
+ value = column && row[column]
+ # Tags are a special case, as we support adding to the field, not just setting a new value
+ if field_name == 'tag_string'
+ new_tags = [value, options[:tag]].select{ |new_tag| !new_tag.blank? }
+ if new_tags.empty?
+ value = nil
+ else
+ value = new_tags.join(" ")
+ value = "#{value} #{tag_string}"if options[:tag_behaviour] == 'add'
+ end
+
+ end
+
+ if value and read_attribute_value(field_name, locale) != value
+ if is_new
+ changed[field_name] = value
+ else
+ changed[field_name] = "#{read_attribute_value(field_name, locale)}: #{value}"
+ end
+ assign_attributes({ field_name => value })
+ end
+ end
+ changed
+ end
+
# Does this user have the power of FOI officer for this body?
def is_foi_officer?(user)
user_domain = user.email_domain
@@ -793,6 +760,26 @@ class PublicBody < ActiveRecord::Base
private
+ # Read an attribute value (without using locale fallbacks if the attribute is translated)
+ def read_attribute_value(name, locale)
+ if self.class.translates.include?(name.to_sym)
+ if globalize.stash.contains?(locale, name)
+ globalize.stash.read(locale, name)
+ else
+ translation_for(locale).send(name)
+ end
+ else
+ send(name)
+ end
+ end
+
+ def empty_translation_in_params?(attributes)
+ attrs_with_values = attributes.select do |key, value|
+ value != '' and key.to_s != 'locale'
+ end
+ attrs_with_values.empty?
+ end
+
def request_email_if_requestable
# Request_email can be blank, meaning we don't have details
if self.is_requestable?
diff --git a/app/models/public_body_category.rb b/app/models/public_body_category.rb
index c313e5734..eeb2511fa 100644
--- a/app/models/public_body_category.rb
+++ b/app/models/public_body_category.rb
@@ -10,12 +10,15 @@ require 'forwardable'
class PublicBodyCategory < ActiveRecord::Base
attr_accessible :locale, :category_tag, :title, :description,
- :translated_versions, :display_order
+ :translated_versions, :translations_attributes,
+ :display_order
has_many :public_body_category_links, :dependent => :destroy
has_many :public_body_headings, :through => :public_body_category_links
translates :title, :description
+ accepts_nested_attributes_for :translations, :reject_if => :empty_translation_in_params?
+
validates_uniqueness_of :category_tag, :message => 'Tag is already taken'
validates_presence_of :title, :message => "Title can't be blank"
validates_presence_of :category_tag, :message => "Tag can't be blank"
@@ -49,11 +52,6 @@ class PublicBodyCategory < ActiveRecord::Base
PublicBodyCategory.find_by_sql(sql)
end
- # Called from the old-style public_body_categories_[locale].rb data files
- def self.add(locale, data_list)
- CategoryAndHeadingMigrator.add_categories_and_headings_from_list(locale, data_list)
- end
-
# Convenience methods for creating/editing translations via forms
def find_translation_by_locale(locale)
translations.find_by_locale(locale)
@@ -64,25 +62,48 @@ class PublicBodyCategory < ActiveRecord::Base
end
def translated_versions=(translation_attrs)
- def empty_translation?(attrs)
- attrs_with_values = attrs.select{ |key, value| value != '' and key != 'locale' }
- attrs_with_values.empty?
+ warn "[DEPRECATION] PublicBodyCategory#translated_versions= will be replaced " \
+ "by PublicBodyCategory#translations_attributes= as of release 0.22"
+ self.translations_attributes = translation_attrs
+ end
+
+ def ordered_translations
+ translations.
+ select { |t| I18n.available_locales.include?(t.locale) }.
+ sort_by { |t| I18n.available_locales.index(t.locale) }
+ end
+
+ def build_all_translations
+ I18n.available_locales.each do |locale|
+ translations.build(:locale => locale) unless translations.detect{ |t| t.locale == locale }
end
- if translation_attrs.respond_to? :each_value # Hash => updating
- translation_attrs.each_value do |attrs|
- next if empty_translation?(attrs)
- t = translation_for(attrs[:locale]) || PublicBodyCategory::Translation.new
- t.attributes = attrs
- t.save!
- end
- else # Array => creating
- translation_attrs.each do |attrs|
- next if empty_translation?(attrs)
- new_translation = PublicBodyCategory::Translation.new(attrs)
- translations << new_translation
- end
+ end
+
+ private
+
+ def empty_translation_in_params?(attributes)
+ attrs_with_values = attributes.select do |key, value|
+ value != '' and key.to_s != 'locale'
end
+ attrs_with_values.empty?
end
+
end
+PublicBodyCategory::Translation.class_eval do
+ with_options :if => lambda { |t| !t.default_locale? && t.required_attribute_submitted? } do |required|
+ required.validates :title, :presence => { :message => _("Title can't be blank") }
+ required.validates :description, :presence => { :message => _("Description can't be blank") }
+ end
+ def default_locale?
+ locale == I18n.default_locale
+ end
+
+ def required_attribute_submitted?
+ PublicBodyCategory.required_translated_attributes.compact.any? do |attribute|
+ !read_attribute(attribute).blank?
+ end
+ end
+
+end
diff --git a/app/models/public_body_heading.rb b/app/models/public_body_heading.rb
index f394c37c6..8c160ba8b 100644
--- a/app/models/public_body_heading.rb
+++ b/app/models/public_body_heading.rb
@@ -7,13 +7,15 @@
#
class PublicBodyHeading < ActiveRecord::Base
- attr_accessible :name, :display_order, :translated_versions
+ attr_accessible :locale, :name, :display_order, :translated_versions,
+ :translations_attributes
has_many :public_body_category_links, :dependent => :destroy
has_many :public_body_categories, :order => :category_display_order, :through => :public_body_category_links
default_scope order('display_order ASC')
translates :name
+ accepts_nested_attributes_for :translations, :reject_if => :empty_translation_in_params?
validates_uniqueness_of :name, :message => 'Name is already taken'
validates_presence_of :name, :message => 'Name can\'t be blank'
@@ -36,24 +38,20 @@ class PublicBodyHeading < ActiveRecord::Base
end
def translated_versions=(translation_attrs)
- def empty_translation?(attrs)
- attrs_with_values = attrs.select{ |key, value| value != '' and key != 'locale' }
- attrs_with_values.empty?
- end
+ warn "[DEPRECATION] PublicBodyHeading#translated_versions= will be replaced " \
+ "by PublicBodyHeading#translations_attributes= as of release 0.22"
+ self.translations_attributes = translation_attrs
+ end
+
+ def ordered_translations
+ translations.
+ select { |t| I18n.available_locales.include?(t.locale) }.
+ sort_by { |t| I18n.available_locales.index(t.locale) }
+ end
- if translation_attrs.respond_to? :each_value # Hash => updating
- translation_attrs.each_value do |attrs|
- next if empty_translation?(attrs)
- t = translation_for(attrs[:locale]) || PublicBodyHeading::Translation.new
- t.attributes = attrs
- t.save!
- end
- else # Array => creating
- translation_attrs.each do |attrs|
- next if empty_translation?(attrs)
- new_translation = PublicBodyHeading::Translation.new(attrs)
- translations << new_translation
- end
+ def build_all_translations
+ I18n.available_locales.each do |locale|
+ translations.build(:locale => locale) unless translations.detect{ |t| t.locale == locale }
end
end
@@ -71,4 +69,13 @@ class PublicBodyHeading < ActiveRecord::Base
end
end
+ private
+
+ def empty_translation_in_params?(attributes)
+ attrs_with_values = attributes.select do |key, value|
+ value != '' and key.to_s != 'locale'
+ end
+ attrs_with_values.empty?
+ end
+
end
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 5819876ff..cd90c4a9e 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -231,8 +231,7 @@ class TrackThing < ActiveRecord::Base
{ # Website
:verb_on_page => _("Follow requests to {{public_body_name}}",
:public_body_name => public_body.name),
- :verb_on_page_already => _("You are already following requests to {{public_body_name}}",
- :public_body_name => public_body.name),
+ :verb_on_page_already => _("Following"),
# Email
:title_in_email => _("{{foi_law}} requests to '{{public_body_name}}'",
:foi_law => public_body.law_only_short,
diff --git a/app/models/user.rb b/app/models/user.rb
index c953e52f2..920c0da46 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -207,7 +207,7 @@ class User < ActiveRecord::Base
if not name.nil?
name.strip!
end
- if public_banned?
+ if banned?
# Use interpolation to return a string rather than a SafeBuffer so that
# gsub can be called on it until we upgrade to Rails 3.2. The name returned
# is not marked as HTML safe so will be escaped automatically in views. We
@@ -294,10 +294,18 @@ class User < ActiveRecord::Base
def admin_page_links?
super?
end
+
# Is it public that they are banned?
+ def banned?
+ !ban_text.empty?
+ end
+
def public_banned?
- !ban_text.empty?
+ warn %q([DEPRECATION] User#public_banned? will be replaced with
+ User#banned? as of 0.22).squish
+ banned?
end
+
# Various ways the user can be banned, and text to describe it if failed
def can_file_requests?
ban_text.empty? && !exceeded_limit?
diff --git a/app/views/admin_public_body/_form.html.erb b/app/views/admin_public_body/_form.html.erb
index 2da13ab01..cf0c0e3de 100644
--- a/app/views/admin_public_body/_form.html.erb
+++ b/app/views/admin_public_body/_form.html.erb
@@ -1,69 +1,49 @@
-<%= error_messages_for 'public_body' %>
+<% if @public_body.errors.any? %>
+ <ul>
+ <% @public_body.errors.each do |attr, message| %>
+ <% unless attr.to_s.starts_with?('translation') %>
+ <li><%= message %></li>
+ <% end %>
+ <% end %>
+ </ul>
+<% end %>
+
+<% @public_body.ordered_translations.each do |translation| %>
+ <% if translation.errors.any? %>
+ <%= locale_name(translation.locale.to_s) || translation.locale.to_s %>
+ <ul>
+ <% translation.errors.each do |attr, message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ <% end %>
+<% end %>
<!--[form:public_body]-->
<div id="div-locales">
<ul class="locales nav nav-tabs">
- <% I18n.available_locales.each_with_index do |locale, i| %>
- <li><a href="#div-locale-<%=locale.to_s%>" data-toggle="tab" ><%=locale_name(locale.to_s) || _("Default locale")%></a></li>
- <% end %>
+ <% @public_body.ordered_translations.each do |translation| %>
+ <li>
+ <a href="#div-locale-<%= translation.locale.to_s %>" data-toggle="tab">
+ <%= locale_name(translation.locale.to_s) || translation.locale.to_s %>
+ </a>
+ </li>
+ <% end %>
</ul>
+
<div class="tab-content">
-<%
- for locale in I18n.available_locales do
- if locale==I18n.default_locale # The default locale is submitted as part of the bigger object...
- prefix = 'public_body'
- object = @public_body
- else # ...but additional locales go "on the side"
- prefix = "public_body[translated_versions][]"
- object = @public_body.new_record? ?
- PublicBody::Translation.new :
- @public_body.find_translation_by_locale(locale.to_s) || PublicBody::Translation.new
- end
-%>
- <%= fields_for prefix, object do |t| %>
- <div class="tab-pane" id="div-locale-<%=locale.to_s%>">
- <div class="control-group">
- <%= t.hidden_field :locale, :value => locale.to_s %>
- <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">Name</label>
- <div class="controls">
- <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %>
- </div>
- </div>
- <div class="control-group">
- <label for="<%= form_tag_id(t.object_name, :short_name, locale) %>", class="control-label"><%=_("Short name")%></label>
- <div class="controls">
- <%= t.text_field :short_name, :id => form_tag_id(t.object_name, :short_name, locale), :class => "span2" %>
- <p class="help-block"><%=_("Only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL – don't worry about breaking URLs through renaming, as the history is used to redirect")%></p>
- </div>
- </div>
- <div class="control-group">
- <label for="<%= form_tag_id(t.object_name, :request_email, locale) %>" class="control-label"><%=_("Request email")%></label>
- <div class="controls">
- <%= t.text_field :request_email, :id => form_tag_id(t.object_name, :request_email, locale), :class => "span3" %>
- <p class="help-block"><%=_("set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA")%></p>
- </div>
- </div>
- <div class="control-group">
- <label for="<%= form_tag_id(t.object_name, :publication_scheme, locale) %>" class="control-label"><%=_("Publication scheme URL")%></label>
- <div class="controls">
- <%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme, locale), :class => "span3" %>
- </div>
- </div>
- <div class="control-group">
- <label for="<%= form_tag_id(t.object_name, :notes, locale) %>" class="control-label"><%=_("Public notes")%></label>
- <div class="controls">
- <%= t.text_area :notes, :rows => 3, :id => form_tag_id(t.object_name, :notes, locale), :class => "span6" %>
- <p class="help-block">
- HTML, for users to consider when making FOI requests to the authority
- </p>
- </div>
- </div>
- </div>
-<%
- end
- end
-%>
+ <% @public_body.ordered_translations.each do |translation| %>
+ <% if translation.locale.to_s == I18n.default_locale.to_s %>
+ <%= fields_for('public_body', @public_body) do |t| %>
+ <%= render :partial => 'locale_fields', :locals => { :t => t, :locale => translation.locale } %>
+ <% end %>
+ <% else %>
+ <%= f.fields_for(:translations, translation, :child_index => translation.locale) do |t| %>
+ <%= render :partial => 'locale_fields' , :locals => { :t => t, :locale => translation.locale } %>
+ <% end %>
+ <% end %>
+ <% end %>
</div>
</div>
diff --git a/app/views/admin_public_body/_locale_fields.html.erb b/app/views/admin_public_body/_locale_fields.html.erb
new file mode 100644
index 000000000..cbe008fe2
--- /dev/null
+++ b/app/views/admin_public_body/_locale_fields.html.erb
@@ -0,0 +1,49 @@
+
+<div class="tab-pane" id="div-locale-<%=locale.to_s%>">
+ <div class="control-group">
+ <%= t.hidden_field :locale, :value => locale.to_s %>
+ <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">Name</label>
+ <div class="controls">
+ <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label for="<%= form_tag_id(t.object_name, :short_name, locale) %>" class="control-label"><%=_("Short name")%></label>
+ <div class="controls">
+ <%= t.text_field :short_name, :id => form_tag_id(t.object_name, :short_name, locale), :class => "span2" %>
+ <p class="help-block">
+ <%=_("Only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL – don't worry about breaking URLs through renaming, as the history is used to redirect")%>
+ </p>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label for="<%= form_tag_id(t.object_name, :request_email, locale) %>" class="control-label"><%=_("Request email")%></label>
+ <div class="controls">
+ <%= t.text_field :request_email, :id => form_tag_id(t.object_name, :request_email, locale), :class => "span3" %>
+ <p class="help-block">
+ <%=_("set to <strong>blank</strong> (empty string) if can't find an address; these emails are <strong>public</strong> as anyone can view with a CAPTCHA")%>
+ </p>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label for="<%= form_tag_id(t.object_name, :publication_scheme, locale) %>" class="control-label"><%=_("Publication scheme URL")%></label>
+ <div class="controls">
+ <%= t.text_field :publication_scheme, :size => 60, :id => form_tag_id(t.object_name, :publication_scheme, locale), :class => "span3" %>
+ </div>
+ </div>
+
+ <div class="control-group">
+ <label for="<%= form_tag_id(t.object_name, :notes, locale) %>" class="control-label"><%=_("Public notes")%></label>
+ <div class="controls">
+ <%= t.text_area :notes, :rows => 3, :id => form_tag_id(t.object_name, :notes, locale), :class => "span6" %>
+ <p class="help-block">
+ HTML, for users to consider when making FOI requests to the authority
+ </p>
+ </div>
+ </div>
+
+</div>
+
diff --git a/app/views/admin_public_body/import_csv.html.erb b/app/views/admin_public_body/import_csv.html.erb
index 4b14226d1..4b481e895 100644
--- a/app/views/admin_public_body/import_csv.html.erb
+++ b/app/views/admin_public_body/import_csv.html.erb
@@ -70,16 +70,25 @@ Another One,another@example.com,Otro organismo,a_tag
"Add new tags to existing ones".
</p>
- <p><%= submit_tag 'Dry run' %> <%= submit_tag 'Upload' %></p>
+ <div class="form-actions">
+ <p>
+ <%= submit_tag 'Dry run', :class => 'btn btn-success' %>
+ <%= submit_tag 'Upload', :class => 'btn btn-warning' %>
+ </p>
+ </div>
<% end %>
<hr>
-<p>Standard tags:
- <% for category, description in PublicBodyCategory.get().by_tag() %>
- <% if category != "other" %>
- <strong><%= category %></strong>=<%= description %>;
- <% end %>
+<div id="standard-tags">
+ <h2>Standard tags:</h2>
+
+ <ul>
+ <% PublicBodyCategory.get().by_tag().each do |category, description| %>
+ <% if category != "other" %>
+ <li><strong><%= category %></strong>=<%= description %></li>
+ <% end %>
<% end %>
- </p>
+ </ul>
+</div>
diff --git a/app/views/admin_public_body_categories/_form.html.erb b/app/views/admin_public_body_categories/_form.html.erb
index 1f033ac9b..00137b9ed 100644
--- a/app/views/admin_public_body_categories/_form.html.erb
+++ b/app/views/admin_public_body_categories/_form.html.erb
@@ -1,46 +1,49 @@
-<%= error_messages_for 'category' %>
+<% if @category.errors.any? %>
+ <ul>
+ <% @category.errors.each do |attr, message| %>
+ <% unless attr.to_s.starts_with?('translation') %>
+ <li><%= message %></li>
+ <% end %>
+ <% end %>
+ </ul>
+<% end %>
+
+<% @category.ordered_translations.each do |translation| %>
+ <% if translation.errors.any? %>
+ <%= locale_name(translation.locale.to_s) || translation.locale.to_s %>
+ <ul>
+ <% translation.errors.each do |attr, message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ <% end %>
+<% end %>
<!--[form:public_body_category]-->
<div id="div-locales">
<ul class="locales nav nav-tabs">
- <% I18n.available_locales.each_with_index do |locale, i| %>
- <li><a href="#div-locale-<%=locale.to_s%>" data-toggle="tab" ><%=locale_name(locale.to_s) || "Default locale"%></a></li>
- <% end %>
+ <% @category.ordered_translations.each do |translation| %>
+ <li>
+ <a href="#div-locale-<%= translation.locale.to_s %>" data-toggle="tab" >
+ <%= locale_name(translation.locale.to_s) || translation.locale.to_s %>
+ </a>
+ </li>
+ <% end %>
</ul>
+
<div class="tab-content">
-<%
- I18n.available_locales.each do |locale|
- if locale==I18n.default_locale # The default locale is submitted as part of the bigger object...
- prefix = 'public_body_category'
- object = @category
- else # ...but additional locales go "on the side"
- prefix = "public_body_category[translated_versions][]"
- object = @category.new_record? ?
- PublicBodyCategory::Translation.new :
- @category.find_translation_by_locale(locale.to_s) || PublicBodyCategory::Translation.new
- end
-%>
- <%= fields_for prefix, object do |t| %>
- <div class="tab-pane" id="div-locale-<%=locale.to_s%>">
- <div class="control-group">
- <%= t.hidden_field :locale, :value => locale.to_s %>
- <label for="<%= form_tag_id(t.object_name, :title, locale) %>" class="control-label">Title</label>
- <div class="controls">
- <%= t.text_field :title, :id => form_tag_id(t.object_name, :title, locale), :class => "span4" %>
- </div>
- </div>
- <div class="control-group">
- <label for="<%= form_tag_id(t.object_name, :description, locale) %>" class="control-label">Description</label>
- <div class="controls">
- <%= t.text_field :description, :id => form_tag_id(t.object_name, :description, locale), :class => "span4" %>
- </div>
- </div>
- </div>
- <%
- end
-end
-%>
+ <% @category.ordered_translations.each do |translation| %>
+ <% if translation.locale.to_s == I18n.default_locale.to_s %>
+ <%= fields_for('public_body_category', @category) do |t| %>
+ <%= render :partial => 'locale_fields', :locals => { :t => t, :locale => translation.locale } %>
+ <% end %>
+ <% else %>
+ <%= f.fields_for(:translations, translation, :child_index => translation.locale) do |t| %>
+ <%= render :partial => 'locale_fields', :locals => { :t => t, :locale => translation.locale } %>
+ <% end %>
+ <% end %>
+ <% end %>
</div>
</div>
diff --git a/app/views/admin_public_body_categories/_locale_fields.html.erb b/app/views/admin_public_body_categories/_locale_fields.html.erb
new file mode 100644
index 000000000..aff001098
--- /dev/null
+++ b/app/views/admin_public_body_categories/_locale_fields.html.erb
@@ -0,0 +1,27 @@
+<div class="tab-pane" id="div-locale-<%=locale.to_s%>">
+ <div class="control-group">
+ <%= t.hidden_field :locale, :value => locale.to_s %>
+ <label for="<%= form_tag_id(t.object_name, :title, locale) %>" class="control-label">Title</label>
+ <div class="controls">
+ <% if locale == I18n.default_locale && t.object.errors[:title].any? %>
+ <span class="fieldWithErrors">
+ <% end %>
+ <%= t.text_field :title, :id => form_tag_id(t.object_name, :title, locale), :class => "span4" %>
+ <% if locale == I18n.default_locale && t.object.errors[:title].any? %>
+ </span>
+ <%end %>
+ </div>
+ </div>
+ <div class="control-group">
+ <label for="<%= form_tag_id(t.object_name, :description, locale) %>" class="control-label">Description</label>
+ <div class="controls">
+ <% if locale == I18n.default_locale && t.object.errors[:description].any? %>
+ <span class="fieldWithErrors">
+ <% end %>
+ <%= t.text_field :description, :id => form_tag_id(t.object_name, :description, locale), :class => "span4" %>
+ <% if locale == I18n.default_locale && t.object.errors[:description].any? %>
+ </span>
+ <%end %>
+ </div>
+ </div>
+</div>
diff --git a/app/views/admin_public_body_headings/_form.html.erb b/app/views/admin_public_body_headings/_form.html.erb
index d4e914ca1..7eaa4bff7 100644
--- a/app/views/admin_public_body_headings/_form.html.erb
+++ b/app/views/admin_public_body_headings/_form.html.erb
@@ -1,40 +1,49 @@
-<%= error_messages_for 'heading' %>
+<% if @heading.errors.any? %>
+ <ul>
+ <% @heading.errors.each do |attr, message| %>
+ <% unless attr.to_s.starts_with?('translation') %>
+ <li><%= message %></li>
+ <% end %>
+ <% end %>
+ </ul>
+<% end %>
+
+<% @heading.ordered_translations.each do |translation| %>
+ <% if translation.errors.any? %>
+ <%= locale_name(translation.locale.to_s) || translation.locale.to_s %>
+ <ul>
+ <% translation.errors.each do |attr, message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ <% end %>
+<% end %>
+
<!--[form:public_body_heading]-->
<div id="div-locales">
<ul class="locales nav nav-tabs">
- <% I18n.available_locales.each_with_index do |locale, i| %>
- <li><a href="#div-locale-<%=locale.to_s%>" data-toggle="tab" ><%=locale_name(locale.to_s) || "Default locale"%></a></li>
- <% end %>
+ <% @heading.ordered_translations.each do |translation| %>
+ <li>
+ <a href="#div-locale-<%= translation.locale.to_s %>" data-toggle="tab" >
+ <%= locale_name(translation.locale.to_s) || translation.locale.to_s %>
+ </a>
+ </li>
+ <% end %>
</ul>
<div class="tab-content">
-<%
- for locale in I18n.available_locales do
- if locale==I18n.default_locale # The default locale is submitted as part of the bigger object...
- prefix = 'public_body_heading'
- object = @heading
- else # ...but additional locales go "on the side"
- prefix = "public_body_heading[translated_versions][]"
- object = @heading.new_record? ?
- PublicBodyHeading::Translation.new :
- @heading.find_translation_by_locale(locale.to_s) || PublicBodyHeading::Translation.new
- end
-%>
- <%= fields_for prefix, object do |t| %>
- <div class="tab-pane" id="div-locale-<%=locale.to_s%>">
- <div class="control-group">
- <%= t.hidden_field :locale, :value => locale.to_s %>
- <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">Name</label>
- <div class="controls">
- <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %>
- </div>
- </div>
- </div>
- <%
- end
-end
-%>
+ <% @heading.ordered_translations.each do |translation| %>
+ <% if translation.locale.to_s == I18n.default_locale.to_s %>
+ <%= fields_for('public_body_heading', @heading) do |t| %>
+ <%= render :partial => 'locale_fields', :locals => { :t => t, :locale => translation.locale } %>
+ <% end %>
+ <% else %>
+ <%= f.fields_for(:translations, translation, :child_index => translation.locale) do |t| %>
+ <%= render :partial => 'locale_fields', :locals => { :t => t, :locale => translation.locale } %>
+ <% end %>
+ <% end %>
+ <% end %>
</div>
</div>
diff --git a/app/views/admin_public_body_headings/_locale_fields.html.erb b/app/views/admin_public_body_headings/_locale_fields.html.erb
new file mode 100644
index 000000000..3846bfafa
--- /dev/null
+++ b/app/views/admin_public_body_headings/_locale_fields.html.erb
@@ -0,0 +1,9 @@
+<div class="tab-pane" id="div-locale-<%=locale.to_s%>">
+ <div class="control-group">
+ <%= t.hidden_field :locale, :value => locale.to_s %>
+ <label for="<%= form_tag_id(t.object_name, :name, locale) %>" class="control-label">name</label>
+ <div class="controls">
+ <%= t.text_field :name, :id => form_tag_id(t.object_name, :name, locale), :class => "span4" %>
+ </div>
+ </div>
+</div>
diff --git a/app/views/general/search.html.erb b/app/views/general/search.html.erb
index 96c91b791..c5ff8e9fd 100644
--- a/app/views/general/search.html.erb
+++ b/app/views/general/search.html.erb
@@ -1,7 +1,5 @@
<% @show_tips = @xapian_requests.nil? || (@total_hits == 0) %>
-<% @include_request_link_in_authority_listing = true %>
-
<%= render :partial => 'localised_datepicker' %>
<% if @query.nil? %>
@@ -157,11 +155,13 @@
<div class="results_block">
<% for result in @xapian_bodies.results %>
- <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
+ <%= render :partial => 'public_body/body_listing_single',
+ :locals => { :public_body => result[:model],
+ :request_link => true } %>
<% end %>
</div>
- <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %>
+ <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @max_bodies) %>
</div>
<% elsif @variety_postfix == 'bodies' %>
<p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p>
@@ -180,7 +180,7 @@
<%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %>
<% end %>
</div>
- <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %>
+ <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @max_users) %>
</div>
<% end %>
@@ -200,7 +200,7 @@
<% end %>
</div>
- <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @xapian_requests.matches_estimated) %>
+ <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @max_requests) %>
</div>
<% end %>
<% end %>
diff --git a/app/views/info_request_batch/_batch_sent.html.erb b/app/views/info_request_batch/_batch_sent.html.erb
index 1bf51962f..b7d54d75c 100644
--- a/app/views/info_request_batch/_batch_sent.html.erb
+++ b/app/views/info_request_batch/_batch_sent.html.erb
@@ -1,18 +1,57 @@
-<div id="notice">
- <p>
- <%= _("Your requests will be <strong>sent</strong> shortly!") %>
- </p>
+<div id="content">
+ <div class="request-sent-message" id="notice">
+ <h1>
+ <%= _("Your requests will be <strong>sent</strong> shortly!") %>
+ </h1>
+ <div class="request-sent-message__row">
+ <div class="request-sent-message__column-1">
+ <p class="subtitle">
+ <%= _("<strong>We will email you</strong> when they have been sent. " \
+ "We will also email you when there is a response to any of them, or " \
+ "after {{late_number_of_days}} working days if the authorities still " \
+ "haven't replied by then.",
+ :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) %>
+ </p>
- <p>
- <%= _("<strong>We will email you</strong> when they have been sent. " \
- "We will also email you when there is a response to any of them, or " \
- "after {{late_number_of_days}} working days if the authorities still" \
- "haven't replied by then.",
- :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) %>
- </p>
+ <h2><%= _("Share your batch request") %></h2>
- <p>
- <%= _("If you write about these requests (for example in a forum or a blog) " \
- "please link to this page.") %>
- </p>
+ <%= link_to image_tag("next-step-twitter.png",
+ :alt => _("Tweet it"),
+ :width => "120",
+ :height => "37"),
+ "https://twitter.com/intent/tweet?" << {
+ :url => request.url,
+ :via => AlaveteliConfiguration.twitter_username,
+ :text => "'#{ @info_request_batch.title }'",
+ :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name)
+ }.to_query, :class => 'share-link' %>
+
+ <%= link_to image_tag("next-step-facebook.png",
+ :alt => _("Share on Facebook"),
+ :width => "120",
+ :height => "37"),
+ "https://www.facebook.com/sharer/sharer.php?" << {
+ :u => request.url
+ }.to_query, :class => 'share-link' %>
+
+ <h2><%= _("Keep your requests up to date") %></h2>
+ <p>
+ <%= _('If you write about these requests ' \
+ '(for example in a forum or a blog) ' \
+ 'please link to this page.') %>
+ </p>
+ </div>
+ <div class="request-sent-message__column-2">
+ <div class="what-next">
+ <h2><%= _("What next?") %></h2>
+ <ul class="what-next__list">
+ <li>
+ <%= link_to _("Help us classify requests that haven't " \
+ "been updated"), categorise_play_path %>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
diff --git a/app/views/public_body/_body_listing_single.html.erb b/app/views/public_body/_body_listing_single.html.erb
index 91a07d09c..b343c20e1 100644
--- a/app/views/public_body/_body_listing_single.html.erb
+++ b/app/views/public_body/_body_listing_single.html.erb
@@ -1,6 +1,10 @@
-<% if @highlight_words.nil?
- @highlight_words = []
- end %>
+<%
+ if @highlight_words.nil?
+ @highlight_words = []
+ end
+
+ request_link = false unless defined?(request_link)
+%>
<div class="body_listing">
<span class="head">
@@ -16,23 +20,28 @@
<% end %>
<br>
<% end %>
- </span>
+ </span>
<span class="bottomline">
<%= n_('{{count}} request made.', '{{count}} requests made.', public_body.info_requests.size,
:count => public_body.info_requests.size) %>
- <% if !public_body.is_requestable? && public_body.not_requestable_reason != 'bad_contact' %>
- <% if public_body.not_requestable_reason == 'defunct' %>
- <%= _('Defunct.') %>
- <% end %>
- <% else %>
- <% if !@include_request_link_in_authority_listing.nil? %>
- <%= link_to _("Make your own request"), public_body_path(public_body) %>.
- <% end %>
- <% end %>
<br>
<span class="date_added">
<%= _("Added on {{date}}", :date => simple_date(public_body.created_at)) %>.
</span>
+ <br>
+ <% if public_body.special_not_requestable_reason? %>
+ <% if public_body.not_requestable_reason == 'not_apply' %>
+ <%= _('FOI law does not apply to this authority.')%>
+ <% elsif public_body.not_requestable_reason == 'defunct' %>
+ <%= _('Defunct.')%>
+ <% end %>
+ <% end %>
</span>
+
+ <% if request_link && !public_body.special_not_requestable_reason? %>
+ <div class="make-request-quick-button">
+ <%= link_to _("Make a request"), new_request_to_body_path(:url_name => public_body.url_name), :class => "link_button_green" %>
+ </div>
+ <% end %>
</div>
diff --git a/app/views/public_body/_search_ahead.html.erb b/app/views/public_body/_search_ahead.html.erb
index b5632bccd..e1465bb15 100644
--- a/app/views/public_body/_search_ahead.html.erb
+++ b/app/views/public_body/_search_ahead.html.erb
@@ -1,14 +1,18 @@
<% if !@xapian_requests.nil? %>
<% if @xapian_requests.results.size > 0 %>
- <h3><%= _('Top search results:') %></h3>
+ <p><%= _('Matching authorities') %></p>
<% else %>
- <h3><%= _('No results found.') %></h3>
+ <p><%= _('No results found.') %></p>
<% end %>
- <div id="authority_search_ahead_results">
- <% for result in @xapian_requests.results %>
- <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
- <% end %>
- </div>
- <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %>
+ <div class="authority_search_ahead_results_container">
+ <div id="authority_search_ahead_results">
+ <% for result in @xapian_requests.results %>
+ <%= render :partial => 'public_body/body_listing_single',
+ :locals => { :public_body => result[:model],
+ :request_link => true } %>
+ <% end %>
+ </div>
+ <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %>
+ </div>
<% end %>
diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb
index 403216c6c..016c2460d 100644
--- a/app/views/public_body/show.html.erb
+++ b/app/views/public_body/show.html.erb
@@ -1,79 +1,87 @@
<% @title = h(@public_body.name) + _(" - view and make Freedom of Information requests") %>
-<div id="main_content">
-
- <% if flash[:search_params] %>
- <div class="back-to-results">
- <div class="message">
- <%= link_to select_authority_path(flash[:search_params]) do %>
- <%= _('« Back to search results') %>
- <% end %>
- </div>
- </div>
- <% end %>
-
- <div id="header_right">
- <h2><%= _('Follow this authority')%></h2>
- <% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %>
- <p>
- <%= n_("{{count}} person is following this authority",
- "{{count}} people are following this authority",
- follower_count,
- :count => content_tag(:span, follower_count, :id => "follow_count")) %>
- </p>
-
- <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>
- <%= render :partial => 'track/rss_feed', :locals => { :track_thing => @track_thing, :location => 'sidebar' } %>
- <%= render :partial => 'more_info', :locals => { :public_body => @public_body } %>
+<% if flash[:search_params] %>
+ <div class="back-to-results">
+ <div class="message">
+ <%= link_to select_authority_path(flash[:search_params]) do %>
+ <%= _('« Back to search results') %>
+ <% end %>
</div>
+ </div>
+<% end %>
- <div id="header_left">
- <p class="public-body-name-prefix"><%= _("Freedom of information requests to") %></p>
- <h1><%=h(@public_body.name)%></h1>
-
- <p class="subtitle">
- <%=@public_body.type_of_authority(true)%><% if not @public_body.short_name.empty? %>,
+<div class="authority__header">
+ <h1><%=h(@public_body.name)%></h1>
+ <p class="authority__header__subtitle">
+ <%= type_of_authority(@public_body) %><% if not @public_body.short_name.empty? %>,
<%= _('also called {{public_body_short_name}}', :public_body_short_name => h(@public_body.short_name))%><% end %>
<% if !@user.nil? && @user.admin_page_links? %>
(<%= link_to _("admin"), admin_body_path(@public_body) %>)
<% end %>
+ </p>
+
+ <% if @public_body.has_notes? || @public_body.eir_only? || @public_body.special_not_requestable_reason? %>
+ <div id="stepwise_make_request">
+ <% if @public_body.has_notes? %>
+ <p class="authority__header__notes">
+ <%= @public_body.notes_as_html.html_safe %>
</p>
+ <% end %>
- <% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
- <% if @public_body.has_notes? %>
- <p><%= @public_body.notes_as_html.html_safe %></p>
- <% end %>
- <% if @public_body.eir_only? %>
- <p><%= _('You can only request information about the environment from this authority.')%></p>
- <% end %>
- <% else %>
- <% if @public_body.not_requestable_reason == 'not_apply' %>
- <p><%= _('Freedom of Information law does not apply to this authority, so you cannot make
- a request to it.')%></p>
- <% elsif @public_body.not_requestable_reason == 'defunct' %>
- <p><%= _('This authority no longer exists, so you cannot make a request to it.')%></p>
- <% else %>
- <p><%= _('For an unknown reason, it is not possible to make a request to this authority.')%></p>
- <% end %>
+ <% if @public_body.is_requestable? %>
+ <% if @public_body.eir_only? %>
+ <p class="authority__header__notes">
+ <%= _('You can only request information about the environment from this authority.')%>
+ </p>
<% end %>
+ <% elsif @public_body.special_not_requestable_reason? %>
+ <p class="authority__header__notes">
+ <%= public_body_not_requestable_reasons(@public_body).first %>
+ </p>
+ <% end %>
+ </div>
+ <% end %>
- <div id="stepwise_make_request">
+ <% if @public_body.info_requests.size > 0 %>
+ <div class="authority__header__stats">
+ <%= n_('{{count}} request',
+ '{{count}} requests',
+ @public_body.info_requests.size,
+ :count => @public_body.info_requests.size) %>
+ </div>
+ <% end %>
+
+ <div class="authority__header__action-bar">
+ <div class="action-bar__make-request">
<% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
<%= link_to _("Make a request to this authority"), new_request_to_body_path(:url_name => @public_body.url_name), :class => "link_button_green" %>
- <% elsif @public_body.has_notes? %>
- <%= @public_body.notes_as_html.html_safe %>
- <% end %>
-
- <% if @public_body.override_request_email %>
- <p>
- <%= _("<strong>Note:</strong> Because we're testing, requests are being sent to {{email}} rather than to the actual authority.", :email => @public_body.override_request_email) %>
- </p>
- <% end %>
+ <% end %>
+ </div>
+ <div class="action-bar__follow">
+ <% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %>
+ <div class="action-bar__follow-button">
+ <% if @existing_track %>
+ <%= (link_to _("Unsubscribe"), {:controller => 'track', :action => 'update', :track_id => @existing_track.id, :track_medium => "delete", :r => request.fullpath}, :class => "link_button_green") %>
+ <% else %>
+ <div class="feed_link">
+ <%= link_to _("Follow"), do_track_path(@track_thing), :class => "link_button_green" %>
+ </div>
+ <% end %>
+ </div>
+
+ <div class="action-bar__follower-count">
+ <%= n_("{{count}} follower",
+ "{{count}} followers",
+ follower_count,
+ :count => content_tag(:span, follower_count, :id => "follow_count")) %>
+ </div>
</div>
</div>
+</div>
- <div id="foi_results_section">
- <% if @public_body.info_requests.size == 0 %>
+<div class="authority__body">
+ <div class="authority__body__foi-results">
+ <% if @public_body.info_requests.size == 0 %>
<% if @public_body.is_requestable? or @public_body.not_requestable_reason != 'defunct' %>
<% if @public_body.eir_only? %>
<h2><%= _('Environmental Information Regulations requests made using this site') %></h2>
@@ -84,31 +92,18 @@
<% end %>
<% end %>
<% else %>
- <h2 class="foi_results">
- <% if @public_body.eir_only? %>
- <%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %>
- <% else %>
- <% if @public_body.info_requests.size > 4 %>
- <%= n_('Search within the {{count}} Freedom of Information requests to {{public_body_name}}', 'Search within the {{count}} Freedom of Information requests made to {{public_body_name}}', @public_body.info_requests.size, :count => @public_body.info_requests.size, :public_body_name => @public_body.name) %>
- <% else %>
- <%= n_('{{count}} Freedom of Information request to {{public_body_name}}',
- '{{count}} Freedom of Information requests to {{public_body_name}}',
- @public_body.info_requests.size,
- :count => @public_body.info_requests.size,
- :public_body_name => @public_body.name) %>
- <% end %>
- <% end %>
+ <% unless @page_desc.blank? %>
+ <h2 class="foi_results">
<%= @page_desc %>
- </h2>
+ </h2>
+ <% end %>
<a name="results"></a>
<% if @public_body.info_requests.size > 4 %>
- <%= render :partial => 'request/request_search_form',
- :locals => { :after_form_fields => render(:partial => 'request/request_filter_form') } %>
+ <%= render :partial => 'request/request_filter_form' %>
<% end %>
<% end %>
- <div style="clear:both">&nbsp;</div>
<% if !@xapian_requests.nil? %>
<% for result in @xapian_requests.results %>
@@ -135,4 +130,13 @@
<p> <%= _('The search index is currently offline, so we can\'t show the Freedom of Information requests that have been made to this authority.')%></p>
<% end %>
</div>
+
+ <div class="authority__body__sidebar">
+ <% if @public_body.info_requests.size > 4 %>
+ <%= render :partial => 'request/request_search_form' %>
+ <% end %>
+ <%= render :partial => 'more_info', :locals => { :public_body => @public_body } %>
+ <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>
+ </div>
+
</div>
diff --git a/app/views/public_body/view_email.html.erb b/app/views/public_body/view_email.html.erb
index 5f4bc95f4..399caaa61 100644
--- a/app/views/public_body/view_email.html.erb
+++ b/app/views/public_body/view_email.html.erb
@@ -24,7 +24,7 @@
</p>
<p>
- <% if @public_body.is_requestable? || @public_body.not_requestable_reason != 'bad_contact' %>
+ <% if @public_body.has_request_email? %>
<%= raw(_('If the address is wrong, or you know a better address, please <a href="{{url}}">contact us</a>.', :url => help_contact_path.html_safe)) %>
<% else %>
<%= raw(_(' If you know the address to use, then please <a href="{{url}}">send it to us</a>.
diff --git a/app/views/request/_request_filter_form.html.erb b/app/views/request/_request_filter_form.html.erb
index 0983c8c57..19961ddfc 100644
--- a/app/views/request/_request_filter_form.html.erb
+++ b/app/views/request/_request_filter_form.html.erb
@@ -1,21 +1,23 @@
<div class="list-filter-item">
- <h3 class="title"><%= _("Showing") %></h3>
<div class="filter-request-types">
+ <ul>
<% statuses = [["all", _("all requests")],
["successful", _("successful requests")],
["unsuccessful", _("unsuccessful requests")],
["awaiting", _("unresolved requests")]] %>
<% statuses.each do |status, label| %>
+ <li>
<% if params[:view] != status %>
<% if params[:controller] == "public_body" %>
<%= link_to label, url_for(:controller => "public_body", :action => "show", :view => status, :url_name => @public_body.url_name) + "?" + request.query_string + '#results' %>
<% else %>
- <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string + '#results' %>
+ <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string + '#results' %>
<% end %>
<% else %>
<%= label %>
<% end %>
- <%= "|" unless statuses.last[0] == status %>
+ </li>
<% end %>
+ </ul>
</div>
</div>
diff --git a/app/views/request/_request_sent.html.erb b/app/views/request/_request_sent.html.erb
index 5ce6f5317..3bbf49446 100644
--- a/app/views/request/_request_sent.html.erb
+++ b/app/views/request/_request_sent.html.erb
@@ -1,19 +1,62 @@
-<div id="notice">
- <p>
- <%= _("Your {{law_used_full}} request has been <strong>sent on its way</strong>!",
- :law_used_full => @info_request.law_used_full) %>
- </p>
+<div id="content">
+ <div class="request-sent-message" id="notice">
+ <h1>
+ <%= _("Your {{law_used_full}} request has been sent",
+ :law_used_full => @info_request.law_used_full) %>
+ </h1>
+ <div class="request-sent-message__row">
+ <div class="request-sent-message__column-1">
+ <p class="subtitle">
+ <%= _("<strong>We will email you</strong> when there is a response, or after " \
+ "{{late_number_of_days}} working days if the authority still hasn't " \
+ "replied by then.",
+ :late_number_of_days => AlaveteliConfiguration.reply_late_after_days) %>
+ </p>
- <p>
- <%= _("<strong>We will email you</strong> when there is a response, or after " \
- "{{late_number_of_days}} working days if the authority still hasn't " \
- "replied by then.",
- :late_number_of_days => AlaveteliConfiguration.reply_late_after_days) %>
- </p>
+ <h2><%= _("Share your request") %></h2>
- <p>
- <%= _("If you write about this request (for example in a forum or a blog) " \
- "please link to this page, and add an annotation below telling people " \
- "about your writing.") %>
- </p>
+ <%= link_to image_tag("next-step-twitter.png",
+ :alt => _("Tweet it"),
+ :width => "120",
+ :height => "37"),
+ "https://twitter.com/intent/tweet?" << {
+ :url => request.url,
+ :via => AlaveteliConfiguration.twitter_username,
+ :text => "'#{ @info_request.title }'",
+ :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name)
+ }.to_query, :class => 'share-link' %>
+
+ <%= link_to image_tag("next-step-facebook.png",
+ :alt => _("Share on Facebook"),
+ :width => "120",
+ :height => "37"),
+ "https://www.facebook.com/sharer/sharer.php?" << {
+ :u => request.url
+ }.to_query, :class => 'share-link' %>
+
+ <h2><%= _("Keep your request up to date") %></h2>
+ <p>
+ <%= _('If you write about this request ' \
+ '(for example in a forum or a blog) ' \
+ 'please link to this page, and <a href="{{url}}">add an ' \
+ 'annotation</a> below telling people ' \
+ 'about your writing.', :url => new_comment_url(:url_title => @info_request.url_title).html_safe) %>
+ </p>
+ </div>
+ <div class="request-sent-message__column-2">
+ <div class="what-next">
+ <h2><%= _("What next?") %></h2>
+ <ul class="what-next__list">
+ <li>
+ <%= link_to _("View other requests to {{public_body}}", :public_body => @info_request.public_body.name), public_body_path(@info_request.public_body) %>
+ </li>
+ <li>
+ <%= link_to _("Help us classify requests that haven't " \
+ "been updated"), categorise_play_path %>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
diff --git a/app/views/request/_search_ahead.html.erb b/app/views/request/_search_ahead.html.erb
index 4fbe06ebc..397973d49 100644
--- a/app/views/request/_search_ahead.html.erb
+++ b/app/views/request/_search_ahead.html.erb
@@ -1,9 +1,8 @@
<% unless @xapian_requests.nil? %>
+<% if @xapian_requests.results.any? %>
<div id="request_search_ahead_results">
- <% if @xapian_requests.results.any? %>
<span class="close-button">X</span>
- <h3><%= _("Possibly related requests:") %></h3>
-
+ <h2><%= _("Possible related requests") %></h2>
<% @xapian_requests.results.each do |result| %>
<%= render :partial => 'request/request_listing_short_via_event',
:locals => { :event => result[:model],
@@ -15,6 +14,7 @@
<%= _("Search in their website for this information &rarr;") %>
</a>
</p>
- <% end %>
- </div>
+
+ </div>
+ <% end %>
<% end %>
diff --git a/app/views/request/followup_bad.html.erb b/app/views/request/followup_bad.html.erb
index ea2400c5d..38a7549b2 100644
--- a/app/views/request/followup_bad.html.erb
+++ b/app/views/request/followup_bad.html.erb
@@ -1,32 +1,31 @@
<% if @incoming_message.nil? || !@incoming_message.valid_to_reply_to? %>
- <% @title = _("Unable to send follow up message to {{username}}",:username=>OutgoingMailer.name_for_followup(@info_request, nil)) %>
+ <% @title = _("Unable to send follow up message to {{username}}", :username => OutgoingMailer.name_for_followup(@info_request, nil)) %>
<% else %>
- <% @title = _("Unable to send a reply to {{username}}",:username=>OutgoingMailer.name_for_followup(@info_request, @incoming_message)) %>
+ <% @title = _("Unable to send a reply to {{username}}", :username => OutgoingMailer.name_for_followup(@info_request, @incoming_message)) %>
<% end %>
-<h1><%=@title%></h1>
+<h1><%= @title %></h1>
<% if @reason == 'not_apply' %>
<!-- we should never get here, but just in case give a sensible message -->
- <p><%= _('Freedom of Information law no longer applies to') %> <%=h @info_request.public_body.name %>.
+ <p><%= _('Freedom of Information law no longer applies to {{public_body_name}}.', :public_body_name => @info_request.public_body.name) %>
<%= _('From the request page, try replying to a particular message, rather than sending
a general followup. If you need to make a general followup, and know
an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %>
</p>
<% elsif @reason == 'defunct' %>
<!-- we should never get here, but just in case give a sensible message -->
- <p><%=h @info_request.public_body.name %> <%= _('no longer exists. If you are trying to make
- From the request page, try replying to a particular message, rather than sending
+ <p><%= _('{{public_body_name}} no longer exists. From the request page, try replying to a particular message, rather than sending
a general followup. If you need to make a general followup, and know
- an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %>
+ an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe, :public_body_name => @info_request.public_body.name) %>
</p>
<% elsif @reason == 'bad_contact' %>
- <p><%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= _('You may be able to find
+ <p><%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.', :law_used_full => @info_request.law_used_full, :public_body_name => @info_request.public_body.name) %> <%= _('You may be able to find
one on their website, or by phoning them up and asking. If you manage
to find one, then please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %>
</p>
<% elsif @reason == 'external' %>
- <p><%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => h(@info_request.public_body.name)) %>
+ <p><%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => @info_request.public_body.name) %>
</p>
<% else %>
<% raise _("unknown reason ") + @reason %>
diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb
index 51224129e..486a89d45 100644
--- a/app/views/request/new.html.erb
+++ b/app/views/request/new.html.erb
@@ -19,11 +19,11 @@
// When following links in typeahead results, open new
// tab/window
$("#typeahead_response a").attr("target","_blank");
-
+
// Update the public body site search link
$("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+
"+site:<%= @info_request.public_body.calculated_home_page %>");
-
+
$('.close-button').click(function() { $(this).parent().hide() });
}
});
@@ -31,178 +31,206 @@
});
</script>
<% end %>
+
+
+
<% if @batch %>
<% @title = _("Make an {{law_used_short}} request", :law_used_short=>h(@info_request.law_used_short)) %>
<% else %>
<% @title = _("Make an {{law_used_short}} request to '{{public_body_name}}'",:law_used_short=>h(@info_request.law_used_short),:public_body_name=>h(@info_request.public_body.name)) %>
<% end %>
- <h1><%= _('2. Ask for Information') %></h1>
-
- <% if @existing_request %>
- <div class="errorExplanation" id="errorExplanation"><ul>
- <li>
- <%= _('{{existing_request_user}} already
- created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>,
- or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_path(@existing_request)) %>
- </li>
- </ul></div>
- <% end %>
- <% if @existing_batch %>
- <div class="errorExplanation" id="errorExplanation"><ul>
- <li>
- <%= _('You already created the same batch of requests on {{date}}. You can either view the <a href="{{existing_batch}}">existing batch</a>, or edit the details below to make a new but similar batch of requests.', :date=>simple_date(@existing_batch.created_at), :existing_batch=>info_request_batch_path(@existing_batch)) %>
- </li>
- </ul></div>
- <% end %>
- <%= foi_error_messages_for :info_request, :outgoing_message %>
- <%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'write_form' } ) do |f| %>
-
- <div id="request_header">
- <div id="request_header_body">
- <label class="form_label"><%= _('To:') %></label>
-
- <% if @batch %>
- <span id="to_public_body">
- <%= _("Your selected authorities") %>
- <span class="batch_public_body_toggle" data-hidetext="<%= _("(hide)") %>" data-showtext="<%= _("(show)") %>"><a class="toggle-message"></a></span>
- </span>
-
- <div class="batch_public_body_list">
- <ul>
- <% @public_bodies.each do |public_body| %>
- <li><%= public_body.name %></li>
- <% end %>
- </ul>
- </div>
+<%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'write_form' } ) do |f| %>
+ <div id="request_header">
+ <div id="request_header_body">
+ <h1><%= _('Make a request') %></h1>
+
+ <% if @existing_request %>
+ <div class="errorExplanation" id="errorExplanation">
+ <ul>
+ <li>
+ <%= _('{{existing_request_user}} already
+ created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>,
+ or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_path(@existing_request)) %>
+ </li>
+ </ul>
+ </div>
+ <% end %>
+
+ <% if @existing_batch %>
+ <div class="errorExplanation" id="errorExplanation">
+ <ul>
+ <li>
+ <%= _('You already created the same batch of requests on {{date}}. You can either view the <a href="{{existing_batch}}">existing batch</a>, or edit the details below to make a new but similar batch of requests.', :date=>simple_date(@existing_batch.created_at), :existing_batch=>info_request_batch_path(@existing_batch)) %>
+ </li>
+ </ul>
+ </div>
+ <% end %>
- <% else %>
- <span id="to_public_body">
- <%=h(@info_request.public_body.name)%>
- </span>
- <% end %>
+ <%= foi_error_messages_for :info_request, :outgoing_message %>
- <% unless @batch %>
- <div class="form_item_note">
- <% if @info_request.public_body.info_requests.size > 0 %>
- <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %>
- <% else %>
- <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %>
- <% end %>
- </div>
-
- <% if @info_request.public_body.has_notes? %>
- <div id="request_header_text">
- <h3><%= _('Special note for this authority!') %></h3>
- <p><%= @info_request.public_body.notes_as_html.html_safe %></p>
- </div>
- <% end %>
-
- <% if @info_request.public_body.eir_only? %>
- <h3><%= _('Please ask for environmental information only') %></h3>
-
- <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>.
- <%= _('However, you have the right to request environmental
- information under a different law') %> (<a href="/help/requesting#eir">explanation</a>).
- <%= _('This covers a very wide spectrum of information about the state of
- the <strong>natural and built environment</strong>, such as:') %>
-
- <ul>
- <li><%= _('Air, water, soil, land, flora and fauna (including how these effect
- human beings)') %></li>
- <li><%= _('Information on emissions and discharges (e.g. noise, energy,
- radiation, waste materials)') %></li>
- <li><%= _('Human health and safety') %></li>
- <li><%= _('Cultural sites and built structures (as they may be affected by the
- environmental factors listed above)') %></li>
- <li><%= _('Plans and administrative measures that affect these matters') %></li>
- </ul>
-
- <p><%= _('Please only request information that comes under those categories, <strong>do not waste your
- time</strong> or the time of the public authority by requesting unrelated information.') %></p>
- <% end %>
- <% end %>
+ <% if !AlaveteliConfiguration::override_all_public_body_request_emails.blank? %>
+ <div class="warning">
+ <%= _("<strong>Note:</strong> Because we're testing, requests are being sent to {{email}} rather than to the actual authority.", :email => AlaveteliConfiguration::override_all_public_body_request_emails) %>
</div>
+ <% end %>
+
+ <% if @batch %>
+ <label class="form_label"><%= _('To:') %></label>
+ <span id="to_public_body">
+ <%= _("Your selected authorities") %>
+ <span class="batch_public_body_toggle" data-hidetext="<%= _("(hide)") %>" data-showtext="<%= _("(show)") %>"><a class="toggle-message"></a></span>
+ </span>
+
+ <div class="batch_public_body_list">
+ <ul>
+ <% @public_bodies.each do |public_body| %>
+ <li><%= public_body.name %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% else %>
+ <p id="to_public_body"><span class="to_public_body_label">To:</span>
+ <%=h(@info_request.public_body.name)%>
+ </p>
+ <% end %>
- <div id="request_header_subject">
- <p>
- <label class="form_label" for="typeahead_search"><%= _('Summary:') %></label>
- <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %>
- </p>
- <div class="form_item_note">
- (<%= _("a one line summary of the information you are requesting, \n\t\t\te.g.") %>
- <%= render :partial => "summary_suggestion" %>)
- </div>
- </div>
+ <% unless @batch %>
+ <% if @info_request.public_body.has_notes? %>
+ <div id="request_header_text">
+ <p><%= @info_request.public_body.notes_as_html.html_safe %></p>
+ </div>
+ <% end %>
+ <% end %>
- <div id="typeahead_response">
- </div>
</div>
+ </div>
+
+ <% unless @batch %>
+ <% if @info_request.public_body.eir_only? %>
+ <div class="request_body">
+ <div id="request_body_header">
+ <h3><%= _('Please ask for environmental information only') %></h3>
+
+ <p><%= _('The Freedom of Information Act <strong>does not apply</strong> to') %> <%=h(@info_request.public_body.name)%>.
+ <%= _('However, you have the right to request environmental
+ information under a different law') %> (<a href="/help/requesting#eir">explanation</a>).
+ <%= _('This covers a very wide spectrum of information about the state of
+ the <strong>natural and built environment</strong>, such as:') %>
+ </p>
+ <ul>
+ <li><%= _('Air, water, soil, land, flora and fauna (including how these effect
+ human beings)') %></li>
+ <li><%= _('Information on emissions and discharges (e.g. noise, energy,
+ radiation, waste materials)') %></li>
+ <li><%= _('Human health and safety') %></li>
+ <li><%= _('Cultural sites and built structures (as they may be affected by the
+ environmental factors listed above)') %></li>
+ <li><%= _('Plans and administrative measures that affect these matters') %></li>
+ </ul>
+
+ <p><%= _('Please only request information that comes under those categories, <strong>do not waste your
+ time</strong> or the time of the public authority by requesting unrelated information.') %></p>
+ </div>
+ </div>
+ <% end %>
+ <% end %>
+ <div class="request_body">
<div id="request_advice">
+ <% unless @batch %>
+ <p>
+ <% if @info_request.public_body.info_requests.size > 0 %>
+ <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %>
+ <% else %>
+ <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %>
+ <% end %>
+ </p>
+ <% end %>
+
+ <% if !@user %>
+ <p>
+ <%= raw(_('Everything that you enter on this page, including <strong>your name</strong>,
+ will be <strong>displayed publicly</strong> on
+ this website <a href="{{url}}">forever</a>', :url => (help_privacy_path+"#public_request").html_safe)) %>.
+ </p>
+ <p>
+ <%= raw(_('<a href="{{url}}">Thinking of using a pseudonym?</a>.', :url => (help_privacy_path+"#real_name").html_safe)) %>
+ </p>
+ <% else %>
+ <p>
+ <%= raw(_('Everything that you enter on this page
+ will be <strong>displayed publicly</strong> on
+ this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
+ </p>
+ <% end %>
+
+ <p>
+ <%= raw(_("<strong> Can I request information about myself?</strong>\n" +
+ "\t\t\t<a href=\"{{url}}\">No!</a>", :url => (help_requesting_path+"#data_protection").html_safe)) %>
+ </p>
+ <div class="advice-panel">
<ul>
- <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li>
- <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li>
- <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="{{url}}">why?</a>).', :url => (help_requesting_path + '#focused').html_safe) %></li>
+
+ <li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li>
+ <li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li>
+ <li><%= _('<a href="{{url}}">Keep it <strong>focused</strong></a>, you\'ll be more likely to get what you want.', :url => (help_requesting_path + '#focused').html_safe) %></li>
</ul>
+ </div>
+
</div>
<div id="request_form">
- <%= fields_for :outgoing_message do |o| %>
- <p>
- <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label>
- <%= o.text_area :body, :rows => 20, :cols => 60 %>
- </p>
- <% end %>
-
- <% if !@user %>
- <p class="form_note">
-
- <%= raw(_('Everything that you enter on this page, including <strong>your name</strong>,
- will be <strong>displayed publicly</strong> on
- this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
- <%= raw(_('If you are thinking of using a pseudonym,
- please <a href="{{url}}">read this first</a>.', :url => (help_privacy_path+"#real_name").html_safe)) %>
- </p>
- <% else %>
- <p class="form_note">
- <%= raw(_('Everything that you enter on this page
- will be <strong>displayed publicly</strong> on
- this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
- </p>
- <% end %>
- <p class="form_note">
- <%= raw(_("<strong> Can I request information about myself?</strong>\n" +
- "\t\t\t<a href=\"{{url}}\">No! (Click here for details)</a>", :url => (help_requesting_path+"#data_protection").html_safe)) %>
+ <div id="request_header_subject">
+ <p>
+ <label class="form_label" for="typeahead_search"><%= _('Summary:') %></label>
+ <%= f.text_field :title, :size => 50, :id =>"typeahead_search" %>
</p>
-
- <div class="form_button">
- <% if @batch %>
- <% params[:public_body_ids].each do |public_body_id| %>
- <%= hidden_field_tag("public_body_ids[]", public_body_id)%>
- <% end %>
- <% else %>
- <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %>
- <% end %>
- <%= hidden_field_tag(:submitted_new_request, 1 ) %>
- <%= hidden_field_tag(:preview, 1 ) %>
- <%= submit_tag _("Preview your public request") %>
+ <div class="form_item_note">
+ <%= _("A one line summary of the information you are requesting, \n\t\t\te.g.") %>
+ <%= render :partial => "summary_suggestion" %>
</div>
+ </div>
+
+ <div id="typeahead_response">
+ </div>
+
+ <%= fields_for :outgoing_message do |o| %>
+ <p>
+ <label class="form_label" for="outgoing_message_body"><%= _('Your request:') %></label>
+ <%= o.text_area :body, :rows => 20, :cols => 60 %>
+ </p>
+ <% end %>
+
+ <div class="form_button">
+ <% if @batch %>
+ <% params[:public_body_ids].each do |public_body_id| %>
+ <%= hidden_field_tag("public_body_ids[]", public_body_id)%>
+ <% end %>
+ <% else %>
+ <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %>
+ <% end %>
+ <%= hidden_field_tag(:submitted_new_request, 1 ) %>
+ <%= hidden_field_tag(:preview, 1 ) %>
+ <%= submit_tag _("Preview your public request") %>
+ </div>
- <% if !@info_request.tag_string.empty? %>
- <p class="form_note">
- <!-- <label class="form_label" for="info_request_tag_string"><%= _("Tags (separated by a space):") %></label>
- <%= f.text_field :tag_string, :size => 50 %> -->
+ <% if !@info_request.tag_string.empty? %>
+ <p class="form_note">
+ <!-- <label class="form_label" for="info_request_tag_string"><%= _("Tags (separated by a space):") %></label>
+ <%= f.text_field :tag_string, :size => 50 %> -->
- <%= f.hidden_field(:tag_string) %>
- <strong>Tags:</strong> <%=h @info_request.tag_string %>
- </p>
- <% end %>
+ <%= f.hidden_field(:tag_string) %>
+ <strong>Tags:</strong> <%=h @info_request.tag_string %>
+ </p>
+ <% end %>
- </div>
+ </div>
+ </div>
<% end %>
+
<% if @batch %>
<%= javascript_include_tag 'new-request.js' %>
<% end %>
diff --git a/app/views/request/preview.html.erb b/app/views/request/preview.html.erb
index ddd5ab30c..3a5b8ae87 100644
--- a/app/views/request/preview.html.erb
+++ b/app/views/request/preview.html.erb
@@ -5,58 +5,68 @@
<% end %>
<%= form_for(@info_request, :url => (@batch ? new_batch_path : new_request_path), :html => { :id => 'preview_form' } ) do |f| %>
- <h1><%= _('3. Now check your request') %></h1>
- <ul>
- <li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li>
- <li><%= raw(_('Your name, request and any responses will appear in <strong>search engines</strong>
- (<a href="{{url}}">details</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
- </li>
- </ul>
-
- <%= fields_for :outgoing_message do |o| %>
-
- <div class="correspondence" id="outgoing-0">
- <p class="preview_subject">
- <strong><%= _('To:') %></strong>
- <% if @batch %>
- <%= _("Your selected authorities")%>
- <% else %>
- <%=h(@info_request.public_body.name)%>
- <% end %>
- <br><strong><%= _('Subject:') %></strong> <%= @info_request.email_subject_request %>
- </p>
-
- <div class="correspondence_text">
- <p><%= @outgoing_message.get_body_for_html_display %></p>
- <%= o.hidden_field(:body) %>
- </div>
+ <h1><%= _('Preview your request') %></h1>
+ <div class="message-preview">
+ <div class="preview-advice">
+ <div class="advice-panel">
+ <ul>
+ <li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li>
+ <li><%= raw(_('Your name, request and any responses will appear in <strong>search engines</strong>
+ (<a href="{{url}}">details</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
+ </li>
+ <li><%= _('<a href="{{url}}">Do you want to request private information about yourself?</a>', :url => (help_requesting_path+"#data_protection").html_safe) %></li>
+ </ul>
- <p class="event_actions">
- </p>
+ </div>
</div>
- <% end %>
-
- <p><%= _('<strong>Privacy note:</strong> If you want to request private information about
- yourself then <a href="{{url}}">click here</a>.', :url => (help_requesting_path+"#data_protection").html_safe) %>
-
- <p>
- <%= f.hidden_field(:title) %>
- <% if @batch %>
- <% params[:public_body_ids].each do |public_body_id| %>
- <%= hidden_field_tag("public_body_ids[]", public_body_id)%>
- <% end %>
- <% else %>
- <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %>
- <% end %>
- <%= f.hidden_field(:tag_string) %>
- <%= hidden_field_tag(:submitted_new_request, 1) %>
- <%= hidden_field_tag(:preview, 0 ) %>
- <%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %>
- <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %>
- </p>
-
- <% if !@info_request.tag_string.empty? %>
- <p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p>
- <% end %>
+ <div class="preview-pane">
+ <%= fields_for :outgoing_message do |o| %>
+
+ <div class="correspondence" id="outgoing-0">
+ <p class="preview_to">
+ <strong><%= _('To') %></strong>
+ <% if @batch %>
+ <%= _("Your selected authorities")%>
+ <% else %>
+ <%=h(@info_request.public_body.name)%>
+ <% end %>
+ </p>
+ <p class="preview_subject">
+ <strong><%= _('Subject') %></strong> <%= @info_request.email_subject_request %>
+ </p>
+
+ <div class="correspondence_text">
+ <p><%= @outgoing_message.get_body_for_html_display %></p>
+ <%= o.hidden_field(:body) %>
+ </div>
+
+ <p class="event_actions">
+ </p>
+ </div>
+ <% end %>
+
+
+
+ <p>
+ <%= f.hidden_field(:title) %>
+ <% if @batch %>
+ <% params[:public_body_ids].each do |public_body_id| %>
+ <%= hidden_field_tag("public_body_ids[]", public_body_id)%>
+ <% end %>
+ <% else %>
+ <%= f.hidden_field(:public_body_id, { :value => @info_request.public_body_id } ) %>
+ <% end %>
+ <%= f.hidden_field(:tag_string) %>
+ <%= hidden_field_tag(:submitted_new_request, 1) %>
+ <%= hidden_field_tag(:preview, 0 ) %>
+ <%= submit_tag _("Edit your request"), :name => 'reedit', :id => 'reedit_button' %>
+ <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %>
+ </p>
+
+ <% if !@info_request.tag_string.empty? %>
+ <p><strong><%= _('Tags:') %></strong> <%=h @info_request.tag_string %></p>
+ <% end %>
+ </div>
+ </div>
<% end %>
diff --git a/app/views/request/select_authorities.html.erb b/app/views/request/select_authorities.html.erb
index e16bcc191..cfbc21a28 100644
--- a/app/views/request/select_authorities.html.erb
+++ b/app/views/request/select_authorities.html.erb
@@ -1,5 +1,5 @@
-<% @title = _("Select the authorities to write to") %>
-<h1><%= _('1. Select authorities') %></h1>
+<% @title = _("Find the authorities to write to") %>
+<h1><%= _('Find the authorities') %></h1>
<p>
<%= _("Search for the authorities you'd like information from:") %>
diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb
index 134648264..7e27d97a8 100644
--- a/app/views/request/select_authority.html.erb
+++ b/app/views/request/select_authority.html.erb
@@ -10,17 +10,20 @@
});
</script>
-<% @title = _("Select the authority to write to") %>
+<% @title = _("Find an authority") %>
-<h1 style="clear: left"><%= _('1. Select an authority') %></h1>
+<h1><%= _('Find an authority') %></h1>
<div id="authority_selection">
<%= form_tag select_authority_path, { :id => 'search_form', :method => 'get' } do %>
<div>
<p>
- <%= _(%Q(First, type in the <strong>name of the UK public authority</strong> you'd
- like information from. <strong>By law, they have to respond</strong>
- (<a href="{{url}}">why?</a>).), :url => (help_about_path(:anchor => 'whybother_them')).html_safe) %>
+ <%= _(%Q(First, type in the <strong>name of the public authority</strong> you'd
+ like information from.)) %>
+ <% if AlaveteliConfiguration.authority_must_respond %>
+ <%= _(%Q(<strong>By law, they have to respond</strong> (<a href="{{url}}">why?</a>).),
+ :url => (help_about_path(:anchor => 'whybother_them')).html_safe) %>
+ <% end %>
</p>
<%= text_field_tag :query,
diff --git a/app/views/user/_signin.html.erb b/app/views/user/_signin.html.erb
index e86791aaf..f63c289df 100644
--- a/app/views/user/_signin.html.erb
+++ b/app/views/user/_signin.html.erb
@@ -9,27 +9,30 @@
<p>
<label class="form_label" for="user_signin_email"><%= _('Your e-mail:')%></label>
- <%= text_field 'user_signin', 'email', { :size => 20, :tabindex => 10 } %>
+ <%= text_field 'user_signin', 'email', { :size => 20, :tabindex => 60 } %>
</p>
<p>
<label class="form_label" for="user_signin_password"><%= _('Password:')%></label>
- <%= password_field 'user_signin', 'password', { :size => 15, :tabindex => 20, :autocomplete => 'off' } %>
+ <%= password_field 'user_signin', 'password', { :size => 15, :tabindex => 70, :autocomplete => 'off' } %>
</p>
<p class="form_note">
- <%= link_to _('Forgotten your password?'), signchangepassword_path(:pretoken => h(params[:token])), :tabindex => 30 %>
+ <%= link_to _('Forgotten your password?'), signchangepassword_path(:pretoken => h(params[:token])), :tabindex => 80 %>
</p>
<p class="form_checkbox">
- <%= check_box_tag 'remember_me', "1", false, :tabindex => 40 %>
- <label for="remember_me"><%= _('Remember me</label> (keeps you signed in longer;
- do not use on a public computer) ')%></p>
+ <%= check_box_tag 'remember_me', "1", false, :tabindex => 90 %>
+
+ <label for="remember_me">
+ <%= _('Remember me (keeps you signed in longer; do not use on a public computer)') %>
+ </label>
+ </p>
<div class="form_button">
<%= hidden_field_tag 'token', params[:token], {:id => 'signin_token' } %>
<%= hidden_field_tag :modal, params[:modal], {:id => 'signin_modal' } %>
- <%= submit_tag _('Sign in'), :tabindex => 50 %>
+ <%= submit_tag _('Sign in'), :tabindex => 100 %>
</div>
<% end %>
diff --git a/app/views/user/_signup.html.erb b/app/views/user/_signup.html.erb
index ec6541881..801d2abe0 100644
--- a/app/views/user/_signup.html.erb
+++ b/app/views/user/_signup.html.erb
@@ -5,35 +5,36 @@
<!--<h2><%= _('If you\'re new to {{site_name}}', :site_name=>site_name)%></h2>-->
+
+
<p>
- <label class="form_label" for="user_signup_email"><%= _('Your e-mail:')%></label>
- <%= text_field 'user_signup', 'email', { :size => 20, :tabindex => 60 } %>
+ <label class="form_label" for="user_signup_name"> <%= _('Your name:')%></label>
+ <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 10, :autocomplete => "off" } %>
</p>
<div class="form_item_note">
- <%= _('We will not reveal your email address to anybody unless you or
- the law tell us to (<a href="{{url}}">details</a>). ', :url => help_privacy_path) %>
+ <%= _('Your <strong>name will appear publicly</strong>
+ (<a href="{{why_url}}">why?</a>)
+ on this website and in search engines.
+ <a href="{{help_url}}">Thinking of using a pseudonym?</a>', :why_url => (help_privacy_path+"#public_request").html_safe, :help_url => (help_privacy_path+"#real_name").html_safe) %>
</div>
<p>
- <label class="form_label" for="user_signup_name"> <%= _('Your name:')%></label>
- <%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70, :autocomplete => "off" } %>
+ <label class="form_label" for="user_signup_email"><%= _('Your e-mail:')%></label>
+ <%= text_field 'user_signup', 'email', { :size => 20, :tabindex => 20 } %>
</p>
<div class="form_item_note">
- <%= _('Your <strong>name will appear publicly</strong>
- (<a href="{{why_url}}">why?</a>)
- on this website and in search engines. If you
- are thinking of using a pseudonym, please
- <a href="{{help_url}}">read this first</a>.', :why_url => (help_privacy_path+"#public_request").html_safe, :help_url => (help_privacy_path+"#real_name").html_safe) %>
+ <%= _('We will not reveal your email address to anybody unless <a href="{{url}}">you or
+ the law tell us to</a>. ', :url => help_privacy_path) %>
</div>
<p>
<label class="form_label" for="user_signup_password"> <%= _('Password:')%></label>
- <%= password_field 'user_signup', 'password', { :size => 15, :tabindex => 80, :autocomplete => "off" } %>
+ <%= password_field 'user_signup', 'password', { :size => 15, :tabindex => 30, :autocomplete => "off" } %>
</p>
<p>
- <label class="form_label" for="user_signup_password_confirmation"> <%= _('Password: (again)')%></label>
- <%= password_field 'user_signup', 'password_confirmation', { :size => 15, :tabindex => 90, :autocomplete => "off" } %>
+ <label class="form_label" for="user_signup_password_confirmation"> <%= _('Confirm password:')%></label>
+ <%= password_field 'user_signup', 'password_confirmation', { :size => 15, :tabindex => 40, :autocomplete => "off" } %>
</p>
<% if @request_from_foreign_country %>
@@ -43,7 +44,7 @@
<div class="form_button">
<%= hidden_field_tag 'token', params[:token], {:id => 'signup_token' } %>
<%= hidden_field_tag :modal, params[:modal], {:id => 'signup_modal' } %>
- <%= submit_tag _('Sign up'), :tabindex => 100 %>
+ <%= submit_tag _('Sign up'), :tabindex => 50 %>
</div>
<% end %>
diff --git a/app/views/user/set_draft_profile_photo.html.erb b/app/views/user/set_draft_profile_photo.html.erb
index b4bdd80f3..ba44f54f4 100644
--- a/app/views/user/set_draft_profile_photo.html.erb
+++ b/app/views/user/set_draft_profile_photo.html.erb
@@ -11,7 +11,9 @@
<%= form_tag 'set_photo', :id => 'set_draft_profile_photo_form', :multipart => true do %>
<p>
<label class="form_label" for="file_1"><%= _('Photo of you:')%></label>
- <%= file_field_tag :file, :size => 35, :id => 'file_1' %>
+ <% file_opts = { :size => 35, :id => 'file_1' } %>
+ <% file_opts.merge!({ :disabled => true }) if @user.banned? %>
+ <%= file_field_tag :file, file_opts %>
</p>
<ul>
diff --git a/app/views/user/set_profile_about_me.html.erb b/app/views/user/set_profile_about_me.html.erb
index fb7de7e97..42607ddf8 100644
--- a/app/views/user/set_profile_about_me.html.erb
+++ b/app/views/user/set_profile_about_me.html.erb
@@ -17,8 +17,12 @@
</div>
<p>
- <label class="form_label" for="set_profile_about_me"><%= _('About you:')%></label>
- <%= f.text_area :about_me, :rows => 5, :cols => 55 %>
+ <label class="form_label" for="set_profile_about_me">
+ <%= _('About you:')%>
+ </label>
+ <% about_me_opts = { :rows => 5, :cols => 55 } %>
+ <% about_me_opts.merge!({ :disabled => 'disabled' }) if @user.banned? %>
+ <%= f.text_area :about_me, about_me_opts %>
</p>
<div class="form_note">
diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb
index 7c8d52568..78b513d6a 100644
--- a/app/views/user/show.html.erb
+++ b/app/views/user/show.html.erb
@@ -78,7 +78,7 @@
<% end %>
</p>
- <% if @display_user.public_banned? %>
+ <% if @display_user.banned? %>
<div id="user_public_banned">
<p>
<strong>
diff --git a/app/views/user/sign.html.erb b/app/views/user/sign.html.erb
index 5536e6c73..394c42a47 100644
--- a/app/views/user/sign.html.erb
+++ b/app/views/user/sign.html.erb
@@ -24,26 +24,25 @@
<div id="sign_together">
<% if !@post_redirect.nil? %>
- <p id="sign_in_reason">
+ <h1 id="sign_in_reason">
<% if @post_redirect.reason_params[:web].empty? %>
- <%= _('Please sign in or make a new account.') %>
+ <%= _('Please create an account or sign in') %>
<% else %>
- <%= _('{{reason}}, please sign in or make a new account.', :reason => @post_redirect.reason_params[:web]) %>
+ <%= _('{{reason}}, create an account or sign in', :reason => @post_redirect.reason_params[:web]) %>
<% end %>
- </p>
+ </h1>
<% end %>
<div id="left_half">
- <h1><%= _('Sign up') %></h1>
+ <h2><%= _('Create a new account') %></h2>
<%= render :partial => 'signup' %>
</div>
- <div id="middle_strip">
- <%= _('- or -') %>
- </div>
-
<div id="right_half">
- <h1><%= _('Sign in') %></h1>
+ <div class="sign-in-wrapper">
+ <p class="pretitle"><%= _('Got an account?') %></p>
+ <h2><%= _('Sign in') %></h2>
<%= render :partial => 'signin', :locals => { :sign_in_as_existing_user => false } %>
+ </div>
</div>
<div style="clear:both"></div>