Mercurial > hg > soundsoftware-site
changeset 303:93b4cfd3aaaa cannam-pre-20110113-merge
Merge from branch "bug_97"
author | Chris Cannam |
---|---|
date | Mon, 28 Mar 2011 17:30:04 +0100 |
parents | 861eb230b8fe (current diff) 76c548e4e6e4 (diff) |
children | 6c56a595dc1c |
files | app/views/projects/settings/_members.rhtml config/locales/en-GB.yml config/locales/en.yml |
diffstat | 15 files changed, 145 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/members_controller.rb Wed Mar 23 11:31:44 2011 +0000 +++ b/app/controllers/members_controller.rb Mon Mar 28 17:30:04 2011 +0100 @@ -28,12 +28,24 @@ attrs = params[:member].dup if (user_ids = attrs.delete(:user_ids)) user_ids.each do |user_id| - members << Member.new(attrs.merge(:user_id => user_id)) + @new_member = Member.new(attrs.merge(:user_id => user_id)) + members << @new_member + + # send notification to member + Mailer.deliver_added_to_project(@new_member, @project) + end else - members << Member.new(attrs) + @new_member = Member.new(attrs) + members << @new_member + + # send notification to member + Mailer.deliver_added_to_project(@new_member, @project) + end + @project.members << members + end respond_to do |format| if members.present? && members.all? {|m| m.valid? }
--- a/app/controllers/repositories_controller.rb Wed Mar 23 11:31:44 2011 +0000 +++ b/app/controllers/repositories_controller.rb Mon Mar 28 17:30:04 2011 +0100 @@ -36,7 +36,11 @@ def edit @repository = @project.repository + if !@repository + + params[:repository_scm]='Mercurial' + @repository = Repository.factory(params[:repository_scm]) @repository.project = @project if @repository end @@ -44,6 +48,7 @@ @repository.attributes = params[:repository] @repository.save end + render(:update) do |page| page.replace_html "tab-content-repository", :partial => 'projects/settings/repository' if @repository && !@project.repository
--- a/app/helpers/repositories_helper.rb Wed Mar 23 11:31:44 2011 +0000 +++ b/app/helpers/repositories_helper.rb Mon Mar 28 17:30:04 2011 +0100 @@ -145,13 +145,19 @@ send(method, form, repository) if repository.is_a?(Repository) && respond_to?(method) && method != 'repository_field_tags' end + + def ssamr_scm_update(repository) + check_box_tag('repository_scm', value = "1", checked = false, onchange => remote_function(:url => { :controller => 'repositories', :action => 'ssamr_edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)")) + + end + def scm_select_tag(repository) scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']] Redmine::Scm::Base.all.each do |scm| scm_options << ["Repository::#{scm}".constantize.scm_name, scm] if Setting.enabled_scm.include?(scm) || (repository && repository.class.name.demodulize == scm) end - select_tag('repository_scm', + select_tag('repository_scm', options_for_select(scm_options, repository.class.name.demodulize), :disabled => (repository && !repository.new_record?), :onchange => remote_function(:url => { :controller => 'repositories', :action => 'edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)")
--- a/app/models/mailer.rb Wed Mar 23 11:31:44 2011 +0000 +++ b/app/models/mailer.rb Mon Mar 28 17:30:04 2011 +0100 @@ -31,6 +31,27 @@ h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank? { :host => h, :protocol => Setting.protocol } end + + + + # Builds a tmail object used to email the specified user that he was added to a project + # + # Example: + # add_to_project(user) => tmail object + # Mailer.deliver_add_to_project(user) => sends an email to the registered user + def added_to_project(member, project) + + user = User.find(member.user_id) + + set_language_if_valid user.language + recipients user.mail + subject l(:mail_subject_added_to_project, Setting.app_title) + body :project_url => url_for(:controller => 'projects', :action => 'show', :id => project.id), + :project_name => project.name + render_multipart('added_to_project', body) + end + + # Builds a tmail object used to email recipients of the added issue. # @@ -440,3 +461,7 @@ end end end + + + +
--- a/app/models/repository/mercurial.rb Wed Mar 23 11:31:44 2011 +0000 +++ b/app/models/repository/mercurial.rb Mon Mar 28 17:30:04 2011 +0100 @@ -19,7 +19,7 @@ class Repository::Mercurial < Repository attr_protected :root_url - validates_presence_of :url + # validates_presence_of :url FETCH_AT_ONCE = 100 # number of changesets to fetch at once
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/mailer/added_to_project.text.html.rhtml Mon Mar 28 17:30:04 2011 +0100 @@ -0,0 +1,3 @@ +<p><%= l(:notice_added_to_project, :project_name => @project_name) %></p> +<p><%= l(:notice_project_homepage, :project_url => @project_url) %></p> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/views/mailer/added_to_project.text.plain.rhtml Mon Mar 28 17:30:04 2011 +0100 @@ -0,0 +1,2 @@ +<%= l(:notice_added_to_project, :project_name => @project_name) %> +<%= l(:notice_project_homepage, :project_url => @project_url) %>
--- a/app/views/projects/settings/_members.rhtml Wed Mar 23 11:31:44 2011 +0000 +++ b/app/views/projects/settings/_members.rhtml Mon Mar 28 17:30:04 2011 +0100 @@ -75,6 +75,7 @@ </div> <p><%= l(:label_set_role_plural) %>:</p> + <p> <% roles.each do |role| %> <label><%= check_box_tag 'member[role_ids][]', role.id %> <%=h role %> </label><div style="margin-left: 2em; margin-bottom: 0.5em"><i><%=l( 'label_' + role.name.downcase + "_description").to_sym %></i></div> <% end %>
--- a/app/views/projects/settings/_repository.rhtml Wed Mar 23 11:31:44 2011 +0000 +++ b/app/views/projects/settings/_repository.rhtml Mon Mar 28 17:30:04 2011 +0100 @@ -1,3 +1,6 @@ + +<%= javascript_include_tag 'repository' %> + <% remote_form_for :repository, @repository, :url => { :controller => 'repositories', :action => 'edit', :id => @project }, :builder => TabularFormBuilder, @@ -6,22 +9,43 @@ <%= error_messages_for 'repository' %> <div class="box tabular"> -<% if !@repository || !@repository.url %> -<ul><li><%= l(:text_settings_repo_creation) %></li></ul> + + +<% if @repository %> + <% if @repository.is_external %> + <%= l(:text_settings_repo_is_external) %></ br> + <% else %> + <%= l(:text_settings_repo_is_internal) %></ br> <% end %> -<p><%= label_tag('repository_scm', l(:label_scm)) %><%= scm_select_tag(@repository) %></p> -<%= repository_field_tags(f, @repository) if @repository %> + <% else %> + <%= l(:text_settings_repo_creation) %></ br> +<% end %> + + + + + +<p> + <%= label_tag('repository_is_external', l(:label_is_external_repository)) %> + <%= check_box :repository, :is_external, :onclick => "toggle_ext_url()" %> + <%= l(:setting_external_repository) %> +</p> + + +<p> + <%= label_tag('repository_external_url', l(:label_repository_external_url)) %> + <%= text_field :repository, :external_url, :disabled => true %> + <%= l(:setting_external_repository_url) %> +</p> + + </div> <div class="contextual"> <% if @repository && !@repository.new_record? %> <%= link_to(l(:label_user_plural), {:controller => 'repositories', :action => 'committers', :id => @project}, :class => 'icon icon-user') %> -<%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project}, - :confirm => l(:text_are_you_sure), - :method => :post, - :class => 'icon icon-del') %> <% end %> </div> -<%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save), :disabled => @repository.nil?) %> +<%= submit_tag(l(:button_save), :onclick => remote_function(:url => { :controller => 'repositories', :action => 'edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)")) %> <% end %>
--- a/app/views/users/edit.rhtml Wed Mar 23 11:31:44 2011 +0000 +++ b/app/views/users/edit.rhtml Mon Mar 28 17:30:04 2011 +0100 @@ -8,3 +8,4 @@ <%= render_tabs user_settings_tabs %> <% html_title(l(:label_user), @user.login, l(:label_administration)) -%> +
--- a/config/locales/en-GB.yml Wed Mar 23 11:31:44 2011 +0000 +++ b/config/locales/en-GB.yml Mon Mar 28 17:30:04 2011 +0100 @@ -296,6 +296,9 @@ field_group_by: Group results by field_sharing: Sharing + setting_external_repository: "In the case you wish to follow an external repository" + setting_external_repository_url: "The external repository URL" + label_repository_external_url: "External rep URL" setting_app_title: Application title setting_app_subtitle: Application subtitle setting_welcome_text: Welcome text @@ -619,6 +622,7 @@ label_not_contains: doesn't contain label_day_plural: days label_repository: Repository + label_is_external_repository: External? label_repository_plural: Repositories label_browse: Browse label_modification: "{{count}} change" @@ -900,6 +904,9 @@ text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?" text_settings_repo_creation: The repository for a project should be set up automatically within a few minutes of the project being created.<br>You should not have to adjust any settings here; please check again in ten minutes. + text_settings_repo_is_internal: The repository for this project is an internal Mercurial Repository, hosted by SoundSoftware.ac.uk. + text_settings_repo_is_external: You are tracking an external repository, with a mirror Mercurial repository hosted by SoundSoftware.ac.uk. + default_role_manager: Manager default_role_developer: Developer default_role_reporter: Reporter @@ -964,4 +971,8 @@ label_developer_description: Can commit to repository and carry out most project editing tasks label_reporter_description: Can submit bug reports; has read access for private projects - label_set_role_plural: Choose roles for new member \ No newline at end of file + label_set_role_plural: Choose roles for new member + notice_added_to_project: 'You have been added to the project "{{project_name}}".' + notice_project_homepage: "You can visit the project using the following link: {{project_url}}" + mail_subject_added_to_project: "You've been added to a project on {{value}}" + \ No newline at end of file
--- a/config/locales/en.yml Wed Mar 23 11:31:44 2011 +0000 +++ b/config/locales/en.yml Mon Mar 28 17:30:04 2011 +0100 @@ -305,7 +305,10 @@ field_assigned_to_role: "Assignee's role" field_text: Text field field_visible: Visible - + + setting_external_repository: "In the case you wish to follow an external repository" + setting_external_repository_url: "The external repository URL" + label_repository_external_url: "External rep URL" setting_tipoftheday_text: Tip of the Day setting_notifications_text: Notifications field_terms_and_conditions: 'Terms and Conditions:' @@ -631,6 +634,7 @@ label_not_contains: doesn't contain label_day_plural: days label_repository: Repository + label_is_external_repository: External? label_repository_plural: Repositories label_browse: Browse label_modification: "{{count}} change" @@ -924,8 +928,12 @@ text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?" text_zoom_in: Zoom in text_zoom_out: Zoom out + text_files_active_change: <br>Click the star to switch active status for a download on or off.<br>Active files will be shown more prominently in the download page. text_settings_repo_creation: The repository for a project should be set up automatically within a few minutes of the project being created.<br>You should not have to adjust any settings here.<br>Please check again in ten minutes, and <a href="/projects/soundsoftware-site/wiki/Help">contact us</a> if there is any problem. - text_files_active_change: <br>Click the star to switch active status for a download on or off.<br>Active files will be shown more prominently in the download page. + text_settings_repo_is_internal: The repository for this project is an internal Mercurial Repository, hosted by SoundSoftware.ac.uk. + text_settings_repo_is_external: You are tracking an external repository, with a mirror Mercurial repository hosted by SoundSoftware.ac.uk. + + default_role_manager: Manager default_role_developer: Developer @@ -960,3 +968,11 @@ label_set_role_plural: Choose roles for new member + label_manager_description: All powers including adding and removing members and adjusting project settings + label_developer_description: Can commit to repository and carry out most project editing tasks + label_reporter_description: Can submit bug reports; has read access for private projects + + label_set_role_plural: Choose roles for new member + notice_added_to_project: 'You have been added to the project "{{project_name}}".' + notice_project_homepage: "You can visit the project using the following link: {{project_url}}" + mail_subject_added_to_project: "You've been added to a project on {{value}}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/db/migrate/20110207142856_add_ext_rep_to_repositories.rb Mon Mar 28 17:30:04 2011 +0100 @@ -0,0 +1,11 @@ +class AddExtRepToRepositories < ActiveRecord::Migration + def self.up + add_column :repositories, :is_external, :bool + add_column :repositories, :external_url, :string + end + + def self.down + remove_column :repositories, :is_external + remove_column :repositories, :external_url + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/public/javascripts/repository.js Mon Mar 28 17:30:04 2011 +0100 @@ -0,0 +1,7 @@ +function toggle_ext_url(){ + if($('repository_is_external').checked) + $('repository_external_url').enable(); + else + $('repository_external_url').disable(); +} +
--- a/public/javascripts/ssamr_registration.js Wed Mar 23 11:31:44 2011 +0000 +++ b/public/javascripts/ssamr_registration.js Mon Mar 28 17:30:04 2011 +0100 @@ -4,13 +4,12 @@ /* institution related functions */ Event.observe(window, 'load', - function() { - + function() { if(!$('ssamr_user_details_institution_type_true').checked && $('ssamr_user_details_institution_type_true').checked){ - $('ssamr_user_details_other_institution').disable(); - $('ssamr_user_details_institution_id').enable(); - $('ssamr_user_details_institution_type_true').checked = true; - $('ssamr_user_details_institution_type_false').checked = false; + $('ssamr_user_details_other_institution').disable(); + $('ssamr_user_details_institution_id').enable(); + $('ssamr_user_details_institution_type_true').checked = true; + $('ssamr_user_details_institution_type_false').checked = false; } } );