Revision 1035:4ac34b54f946
| app/controllers/projects_controller.rb | ||
|---|---|---|
| 111 | 111 |
end |
| 112 | 112 |
# end of code to be removed |
| 113 | 113 |
|
| 114 |
|
|
| 115 |
if validate_parent_id && @project.save |
|
| 114 |
if validate_is_public_key && validate_parent_id && @project.save |
|
| 116 | 115 |
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
| 117 | 116 |
# Add current user as a project member if he is not admin |
| 118 | 117 |
unless User.current.admin? |
| ... | ... | |
| 300 | 299 |
render_404 |
| 301 | 300 |
end |
| 302 | 301 |
|
| 302 |
def validate_is_public_key |
|
| 303 |
# Although is_public isn't mandatory in the project model (it gets |
|
| 304 |
# defaulted), it must be present in params -- it can be true or |
|
| 305 |
# false, but it must be there. This permits us to make forms in |
|
| 306 |
# which the user _has_ to select public or private (rather than |
|
| 307 |
# defaulting it) if we want to |
|
| 308 |
if params.nil? || params[:project].nil? || !params[:project].has_key?(:is_public) |
|
| 309 |
@project.errors.add :is_public, :public_or_private |
|
| 310 |
return false |
|
| 311 |
end |
|
| 312 |
true |
|
| 313 |
end |
|
| 314 |
|
|
| 303 | 315 |
# Validates parent_id param according to user's permissions |
| 304 | 316 |
# TODO: move it to Project model in a validation that depends on User.current |
| 305 | 317 |
def validate_parent_id |
| app/views/projects/_form.html.erb | ||
|---|---|---|
| 21 | 21 |
<br /> |
| 22 | 22 |
<em> <%= l(:text_project_homepage_info) %></em> |
| 23 | 23 |
</p> |
| 24 |
<p><%= f.check_box :is_public %> |
|
| 24 |
<p> |
|
| 25 |
<%= label(:project, :is_public_1, l(:field_public_or_private) + content_tag("span", " *", :class => "required")) %>
|
|
| 26 |
<% |
|
| 27 |
# if the project hasn't been created fully yet, then we don't |
|
| 28 |
# want to set either public or private (make the user decide) |
|
| 29 |
initialised = !@project.id.nil? |
|
| 30 |
%> |
|
| 31 |
<%= f.radio_button :is_public, 1, :checked => (initialised && @project.is_public?) %> |
|
| 32 |
<%= l(:text_project_public_info) %> |
|
| 25 | 33 |
<br /> |
| 26 |
<em> <%= l(:text_project_visibility_info) %></em> |
|
| 34 |
<%= f.radio_button :is_public, 0, :checked => (initialised && !@project.is_public?) %> |
|
| 35 |
<%= l(:text_project_private_info) %> |
|
| 36 |
<br> |
|
| 37 |
<em><%= l(:text_project_visibility_info) %></em> |
|
| 27 | 38 |
</p> |
| 28 | 39 |
<%= wikitoolbar_for 'project_description' %> |
| 29 | 40 |
|
| config/locales/en.yml | ||
|---|---|---|
| 130 | 130 |
circular_dependency: "This relation would create a circular dependency" |
| 131 | 131 |
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks" |
| 132 | 132 |
must_accept_terms_and_conditions: "You must accept the Terms and Conditions" |
| 133 |
public_or_private: "You must select either public or private" |
|
| 133 | 134 |
|
| 134 | 135 |
actionview_instancetag_blank_option: Please select |
| 135 | 136 |
|
| ... | ... | |
| 328 | 329 |
field_root_directory: Root directory |
| 329 | 330 |
field_cvsroot: CVSROOT |
| 330 | 331 |
field_cvs_module: Module |
| 332 |
field_public_or_private: "Public or Private?" |
|
| 331 | 333 |
|
| 332 | 334 |
setting_external_repository: "Select this if the project's main repository is hosted somewhere else" |
| 333 | 335 |
setting_external_repository_url: "The URL of the existing external repository. Must be publicly accessible without a password" |
| ... | ... | |
| 966 | 968 |
text_caracters_minimum: "Must be at least %{count} characters long."
|
| 967 | 969 |
text_length_between: "Length between %{min} and %{max} characters."
|
| 968 | 970 |
text_project_name_info: "This will be the name of your project as it appears throughout this site.<br /> You can change it at any time, in the project's settings." |
| 969 |
text_project_visibility_info: "If your project is not public, it will be visible only to you and to users that you have added as project members.<br/>You can change this later if you wish." |
|
| 971 |
text_project_public_info: "Public: visible to anybody browsing the site." |
|
| 972 |
text_project_private_info: "Private: visible only to you, and to users you have added as project members." |
|
| 973 |
text_project_visibility_info: "You can change whether your project is public or private later if you wish." |
|
| 970 | 974 |
text_user_ssamr_description_info: 'Please describe your current research or development interests.<br/>This information will be used at registration to determine that you are a real person – so please be descriptive, or your application may be delayed or rejected.<br/>After registration, the description is publicly visible in your profile and you can edit it at any time.' |
| 971 | 975 |
text_issue_parent_issue_info: 'If this is a subtask, please insert its parent task number or write the main task name.' |
| 972 | 976 |
|
Also available in: Unified diff