Project

General

Profile

Defect #31010 ยป 31010.patch

Go MAEDA, 2024-02-05 08:26

View differences:

app/views/queries/_form.html.erb
<% if User.current.admin? ||
User.current.allowed_to?(:manage_public_queries, @query.project) %>
<p><label><%=l(:field_visible)%></label>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= l(:label_visibility_private) %></label>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= controller.action_name == 'new' ? l(:label_visibility_me) : l(:label_visibility_private) %></label>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label>
<% unless @query.type == 'ProjectQuery' %>
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label>
config/locales/en.yml
label_cross_project_hierarchy: With project hierarchy
label_cross_project_system: With all projects
label_gantt_progress_line: Progress line
label_visibility_private: to me only
label_visibility_private: to the author only
label_visibility_me: to me only
label_visibility_roles: to these roles only
label_visibility_public: to any users
label_link: Link
test/functional/queries_controller_test.rb
assert_select 'option[value=tracker]'
assert_select 'option[value=subject]'
end
# Label for VISIBILITY_PRIVATE should be "to me only" for 'new' action,
# but it should be "to the author only" for 'edit' action
assert_select 'label', text: /to me only/
end
def test_new_global_query
......
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked]'
assert_select 'label', text: /to the author only/
end
def test_edit_global_private_query
    (1-1/1)