# HG changeset patch # User Chris Cannam # Date 1295878680 0 # Node ID 857ac9ccf6136a82be9bfec26ba962dd2534f287 # Parent 0460c75392bce7d585e8233949978b25e26c305b# Parent e47742d68d2d9323d204683ba7e7f3a68949988d Merge from branch "live" diff -r e47742d68d2d -r 857ac9ccf613 app/controllers/my_controller.rb --- a/app/controllers/my_controller.rb Mon Jan 24 14:03:13 2011 +0000 +++ b/app/controllers/my_controller.rb Mon Jan 24 14:18:00 2011 +0000 @@ -52,11 +52,29 @@ def account @user = User.current @pref = @user.pref + @ssamr_user_details = @user.ssamr_user_detail if request.post? @user.attributes = params[:user] @user.mail_notification = params[:notification_option] || 'only_my_events' @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') + + if @user.ssamr_user_detail == nil + @ssamr_user_details = SsamrUserDetail.new() + @user.ssamr_user_detail = @ssamr_user_details + else + @ssamr_user_details = @user.ssamr_user_detail + end + + if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty? + @ssamr_user_details.description = @user.ssamr_user_detail.description + @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id + else + @ssamr_user_details.description = params[:ssamr_user_details][:description] + @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id] + @ssamr_user_details.save! + end + if @user.save @user.pref.save @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) diff -r e47742d68d2d -r 857ac9ccf613 app/controllers/users_controller.rb --- a/app/controllers/users_controller.rb Mon Jan 24 14:03:13 2011 +0000 +++ b/app/controllers/users_controller.rb Mon Jan 24 14:18:00 2011 +0000 @@ -54,6 +54,9 @@ if @user.ssamr_user_detail != nil @description = @user.ssamr_user_detail.description + if @user.ssamr_user_detail.institution_id != nil + @institution_name = Institution.find(@user.ssamr_user_detail.institution_id).name + end end # show projects based on current user visibility @@ -82,6 +85,10 @@ @auth_sources = AuthSource.find(:all) @ssamr_user_details = SsamrUserDetail.new + + # default value + @selected_institution_id = 1 + end @@ -131,6 +138,7 @@ @notification_option = @user.mail_notification @ssamr_user_details = @user.ssamr_user_detail + @selected_institution_id = @user.ssamr_user_detail.institution_id.to_i @auth_sources = AuthSource.find(:all) @membership ||= Member.new @@ -163,12 +171,13 @@ else @ssamr_user_details = @user.ssamr_user_detail end - - + if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty? @ssamr_user_details.description = @user.ssamr_user_detail.description + @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id else @ssamr_user_details.description = params[:ssamr_user_details][:description] + @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id] @ssamr_user_details.save! end diff -r e47742d68d2d -r 857ac9ccf613 app/models/institution.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/models/institution.rb Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,2 @@ +class Institution < ActiveRecord::Base +end diff -r e47742d68d2d -r 857ac9ccf613 app/views/account/register.rhtml --- a/app/views/account/register.rhtml Mon Jan 24 14:03:13 2011 +0000 +++ b/app/views/account/register.rhtml Mon Jan 24 14:18:00 2011 +0000 @@ -35,11 +35,15 @@ <% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>

- <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit' %> - <%= wikitoolbar_for 'ssamr_user_details_description' %> + <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit' %> <%=l(:text_user_ssamr_description_info)%>

+ +

+ + <%= ssamr_user_detail.collection_select(:institution_id, Institution.all, :id, :name, {:prompt => true}) %> +

<% end %> diff -r e47742d68d2d -r 857ac9ccf613 app/views/account/terms.rhtml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/account/terms.rhtml Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,17 @@ +

<%=l(:label_terms_and_conditions)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>

+ +<% form_tag({:action => 'register'}, :class => "tabular") do %> +<%= error_messages_for 'user' %> + + + + +
+ + + <%= label_tag(:label_accept_terms_and_conditions, l(:label_accept_terms_and_conditions)) %> + <%= check_box_tag(:pet_dog) %> + + <% end %> \ No newline at end of file diff -r e47742d68d2d -r 857ac9ccf613 app/views/my/account.rhtml --- a/app/views/my/account.rhtml Mon Jan 24 14:03:13 2011 +0000 +++ b/app/views/my/account.rhtml Mon Jan 24 14:18:00 2011 +0000 @@ -9,6 +9,8 @@ :builder => TabularFormBuilder, :lang => current_language, :html => { :id => 'my_account_form' } do |f| %> + +

<%=l(:label_information_plural)%>

@@ -23,9 +25,24 @@ <% @user.custom_field_values.select(&:editable?).each do |value| %>

<%= custom_field_tag_with_label :user, value %>

<% end %> + <%= call_hook(:view_my_account, :user => @user, :form => f) %>
+

<%=l(:label_ssamr_details)%>

+
+ <% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %> +

+ <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 25, :required => true, :class => 'wiki-edit' %> +

+

+ + <%= ssamr_user_detail.collection_select(:institution_id, Institution.all, :id, :name, {:selected => @user.ssamr_user_detail.institution_id.to_i} ) %> +

+ <% end %> +
+ + <%= submit_tag l(:button_save) %>
@@ -43,6 +60,14 @@ <% end %> + + + + + + + + <% content_for :sidebar do %> <%= render :partial => 'sidebar' %> <% end %> diff -r e47742d68d2d -r 857ac9ccf613 app/views/users/_form.rhtml --- a/app/views/users/_form.rhtml Mon Jan 24 14:03:13 2011 +0000 +++ b/app/views/users/_form.rhtml Mon Jan 24 14:18:00 2011 +0000 @@ -23,10 +23,11 @@

<%=l(:label_ssamr_details)%>

<% fields_for :ssamr_user_details, :builder => TabularFormBuilder, :lang => current_language do |ssamr_user_detail| %>

- <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit' %> - <%= wikitoolbar_for 'ssamr_user_details_description' %> -
- <%=l(:text_user_ssamr_description_info)%> + <%= ssamr_user_detail.text_area :description, :rows => 3, :cols => 40, :required => true, :class => 'wiki-edit' %> +

+

+ + <%= ssamr_user_detail.collection_select(:institution_id, Institution.all, :id, :name, {:selected => @selected_institution_id} ) %>

<% end %> diff -r e47742d68d2d -r 857ac9ccf613 app/views/users/show.rhtml --- a/app/views/users/show.rhtml Mon Jan 24 14:03:13 2011 +0000 +++ b/app/views/users/show.rhtml Mon Jan 24 14:18:00 2011 +0000 @@ -23,6 +23,9 @@

<%=l(:label_ssamr_description)%>

<%= textilizable @description %> +

<%=l(:label_ssamr_institution)%>

+<%= h @institution_name %> + <% unless @memberships.empty? %>

<%=l(:label_project_plural)%>

diff -r e47742d68d2d -r 857ac9ccf613 config/locales/en-GB.yml --- a/config/locales/en-GB.yml Mon Jan 24 14:03:13 2011 +0000 +++ b/config/locales/en-GB.yml Mon Jan 24 14:18:00 2011 +0000 @@ -415,7 +415,7 @@ label_notifications: Important Message label_ssamr_description: Research description label_ssamr_details: Other Details - + label_ssamr_institution: Institution label_user: User label_user_plural: Users label_user_new: New user @@ -423,8 +423,6 @@ label_project: Project label_project_new: New project label_project_plural: Projects - label_my_project_plural: My Projects - label_other_project_plural: "Everyone Else's Projects" label_x_projects: zero: no projects one: 1 project @@ -469,6 +467,7 @@ label_information_plural: Information label_please_login: Please log in label_register: Register + label_terms_and_conditions: Terms & Conditions for use of code.soundsoftware.ac.uk label_login_with_open_id_option: or login with OpenID label_password_lost: Lost password label_home: Home @@ -704,7 +703,7 @@ label_week: Week label_date_from: From label_date_to: To - label_language_based: "Based on user's language" + label_language_based: Based on user's language label_sort_by: "Sort by {{value}}" label_send_test_email: Send a test email label_feeds_access_key: RSS access key @@ -846,7 +845,7 @@ text_project_homepage_info: 'Link to an external project page.' text_project_name_info: "This will be the name of your project throughout this site.
You can change your project's name at any time, in the project's settings." text_project_visibility_info: "If your project is not public, it will only be visible to users that you have added as project members." - text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.
This information is publicly visible in your profile and you can edit it at any time.
It may also be used to establish eligibility for your initial registration.' + text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.
This information is publicly visible in your profile and you can edit it at any time.' text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.' text_caracters_maximum: "{{count}} characters maximum." text_caracters_minimum: "Must be at least {{count}} characters long." diff -r e47742d68d2d -r 857ac9ccf613 config/locales/en.yml --- a/config/locales/en.yml Mon Jan 24 14:03:13 2011 +0000 +++ b/config/locales/en.yml Mon Jan 24 14:18:00 2011 +0000 @@ -427,9 +427,9 @@ project_module_boards: Boards project_module_calendar: Calendar project_module_gantt: Gantt - label_tipoftheday: Tip of the day label_ssamr_details: Other Details + label_ssamr_institution: Institution label_user: User label_user_plural: Users label_user_new: New user @@ -438,7 +438,7 @@ label_project_new: New project label_project_plural: Projects label_my_project_plural: My Projects - label_other_project_plural: "Everyone Else's Projects" + label_other_project_plural: Other Projects label_x_projects: zero: no projects one: 1 project @@ -483,6 +483,8 @@ label_information_plural: Information label_please_login: Please log in label_register: Register + label_terms_and_conditions: Terms & Conditions for use of code.soundsoftware.ac.uk + label_accept_terms_and_conditions: I have read the terms and conditions and fully accept them label_login_with_open_id_option: or login with OpenID label_password_lost: Lost password label_home: Home @@ -872,7 +874,7 @@ text_project_name_info: "This will be the name of your project throughout this site.
You can change your project's name at any time, in the project's settings." text_project_visibility_info: "If your project is not public, it will only be visible to users that you have added as project members." text_project_homepage_info: 'Link to an external project page.' - text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.
This information is publicly visible in your profile and you can edit it at any time.
It may also be used to establish eligibility for your initial registration.' + text_user_ssamr_description_info: 'Please describe your current research or development interests, within the fields of audio and music.
This information is publicly visible in your profile and you can edit it at any time.' text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.' text_caracters_maximum: "{{count}} characters maximum." text_caracters_minimum: "Must be at least {{count}} characters long." diff -r e47742d68d2d -r 857ac9ccf613 console/db/seeds.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/console/db/seeds.rb Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,9 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Major.create(:name => 'Daley', :city => cities.first) + +puts "this is a test" \ No newline at end of file diff -r e47742d68d2d -r 857ac9ccf613 db/migrate/20101216140621_create_institutions.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/migrate/20101216140621_create_institutions.rb Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,13 @@ +class CreateInstitutions < ActiveRecord::Migration + def self.up + create_table :institutions do |t| + t.string :name + + t.timestamps + end + end + + def self.down + drop_table :institutions + end +end diff -r e47742d68d2d -r 857ac9ccf613 db/migrate/20101216145813_fix_university_name_in_ssamr_details_table.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/migrate/20101216145813_fix_university_name_in_ssamr_details_table.rb Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,10 @@ +class FixUniversityNameInSsamrDetailsTable < ActiveRecord::Migration + def self.up + rename_column :ssamr_user_details, :university, :institution_id + end + + def self.down + # there's no need to rollback the name of this column + # because it was not used previously + end +end diff -r e47742d68d2d -r 857ac9ccf613 db/seed_data/institutions.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/seed_data/institutions.txt Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,141 @@ +University of Aberdeen +University of Abertay Dundee +Aberystwyth University +Anglia Ruskin University +University of the Arts London +Aston University +Bangor University +University of Bath +Bath Spa University +University of Bedfordshire +Birkbeck, University of London +University of Birmingham +Birmingham City University +Birmingham Conservatoire +University Centre at Blackburn College +University of Bolton +Bournemouth University +University of Bradford +University of Brighton +University of Bristol +Brunel University +University of Buckingham +Buckinghamshire New University +University of Cambridge +Institute of Cancer Research, University of London +Canterbury Christ Church University +Cardiff University +University of Central Lancashire +Central School of Speech and Drama, University of London +University of Chester +University of Chichester +City University London +Courtauld Institute of Art +Coventry University +Cranfield University +University for the Creative Arts +University of Cumbria +De Montfort University +University of Derby +University of Dundee +Durham University +University of East Anglia +University of East London +Edge Hill University +University of Edinburgh +Edinburgh Napier University +Institute of Education, University of London +University of Essex +University of Exeter +University of Glamorgan +University of Glasgow +Glasgow Caledonian University +University of Gloucestershire +Goldsmiths, University of London +University of Greenwich +Glyndŵr University +Heriot-Watt University +University of Hertfordshire +Heythrop College +University of Huddersfield +University of Hull +Hull York Medical School +Imperial College London +Keele University +University of Kent +King's College London +Kingston University +Lancaster University +University of Leeds +Leeds Metropolitan University +University of Leicester +University of Lincoln +University of Liverpool +Liverpool Hope University +Liverpool John Moores University +London Business School +London College of Music +London Metropolitan University +London School of Economics and Political Science +London School of Hygiene and Tropical Medicine +London South Bank University +Loughborough University +University of Manchester +Manchester Metropolitan University +Middlesex University +Newcastle University +University of Northampton +Northumbria University +University of Nottingham +Nottingham Trent University +The Open University +University of Oxford +Oxford Brookes University +Peninsula College of Medicine and Dentistry +University of Plymouth +University of Portsmouth +Queen's University Belfast +Queen Margaret University +Queen Mary, University of London +University of Reading +The Robert Gordon University, Aberdeen +Roehampton University +Royal Academy of Music +Royal College of Art +Royal Holloway, University of London +Royal Veterinary College +University of St Andrews +St George's, University of London +University of Salford +School of Advanced Study, University of London +School of Oriental and African Studies +School of Pharmacy, University of London +University of Sheffield +Sheffield Hallam University +University of Southampton +Southampton Solent University +Staffordshire University +University of Stirling +University of Strathclyde +University of Sunderland +University of Surrey +University of Sussex +Swansea Metropolitan University +Swansea University +University of Teesside +Thames Valley University +University of Ulster +University College London +University of Wales +University of Wales Institute, Cardiff +University of Wales, Newport +University of Wales, Trinity Saint David +University of Warwick +University of Westminster +University of the West of England +University of the West of Scotland +University of Winchester +University of Wolverhampton +University of Worcester +University of York +York St John University diff -r e47742d68d2d -r 857ac9ccf613 db/seed_data/terms_and_conditions.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/seed_data/terms_and_conditions.txt Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,20 @@ +As a registered user, + + you are expected to be an active researcher in audio and music in the UK, or to be working with active researchers in audio and music in the UK who are registered users of the site + you undertake to ensure that copyright law is respected in, and attributions are properly maintained for, work you store on or publish through this site + you take responsibility for ensuring that your own institution's terms and conditions are followed with regard to rights in the work you store on this site + you undertake not to use this site for any illegal purpose or for the encouragement of illegal activity + you undertake not to harass or cause a nuisance for any other users, or for anyone else through your use of this site + you undertake not to use the site to promote any commercial activity outside of your normal research work + you accept that any account details you enter will be publicly visible, except for your email address if you choose to to hide it + you accept that any activity associated with your account may be publicly visible + you accept that any account details you enter will be visible to SoundSoftware.ac.uk administrators and may be used to determine whether they have a legitimate reason to use the site or not + The SoundSoftware.ac.uk administrators + + claim no rights in material stored here by users (all copyright holders retain their copyright in work stored here) + accept no liability for ensuring that material stored or published here by users is in accordance with copyright law + aim to keep the site available and to ensure that data is secure and backed up, but offer no guarantee to that effect + reserve the right to carry out administrative tasks as necessary, including administrative work that relates to private projects set up by users + declare that we will not permit users' private projects to be seen or used by employees or students of Queen Mary University of London, except in the case of administrative officials for reasons concerned solely with the daily running of the site + undertake that all content will be made available to the users who own it even if for any reason this site can no longer be maintained and run + SoundSoftware.ac.uk and Queen Mary, University of London accept no liability for any loss or damage incurred through the use of this site. \ No newline at end of file diff -r e47742d68d2d -r 857ac9ccf613 db/seeds.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/seeds.rb Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,15 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Major.create(:name => 'Daley', :city => cities.first) + +Institution.delete_all + +open("db/seed_data/institutions.txt") do |institutions| + institutions.read.each_line do |institution| + Institution.create(:name => institution.chomp) + end +end \ No newline at end of file diff -r e47742d68d2d -r 857ac9ccf613 test/fixtures/institutions.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/fixtures/institutions.yml Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,7 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html + +one: + name: MyString + +two: + name: MyString diff -r e47742d68d2d -r 857ac9ccf613 test/unit/institution_test.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/unit/institution_test.rb Mon Jan 24 14:18:00 2011 +0000 @@ -0,0 +1,8 @@ +require 'test_helper' + +class InstitutionTest < ActiveSupport::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end