kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
3.2 KiB
82 lines
3.2 KiB
11 years ago
|
#-- copyright
|
||
5 years ago
|
# OpenProject is an open source project management software.
|
||
|
# Copyright (C) 2012-2020 the OpenProject GmbH
|
||
11 years ago
|
#
|
||
5 years ago
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License version 3.
|
||
|
#
|
||
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||
|
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
||
11 years ago
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
5 years ago
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
11 years ago
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
5 years ago
|
#
|
||
|
# See docs/COPYRIGHT.rdoc for more details.
|
||
11 years ago
|
#++
|
||
|
|
||
13 years ago
|
class Widget::Settings < Widget::Base
|
||
|
dont_cache! # Settings may change due to permissions
|
||
|
|
||
13 years ago
|
def render_filter_settings
|
||
|
render_widget Widget::Settings::Fieldset, @subject,
|
||
5 years ago
|
type: 'filters' do
|
||
13 years ago
|
render_widget Widget::Filters, @subject
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def render_group_by_settings
|
||
|
render_widget Widget::Settings::Fieldset, @subject,
|
||
5 years ago
|
type: 'group_by' do
|
||
13 years ago
|
render_widget Widget::GroupBys, @subject
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def render_controls_settings
|
||
6 years ago
|
content_tag :div, class: 'form--buttons -with-button-form hide-when-print' do
|
||
13 years ago
|
widgets = ''.html_safe
|
||
10 years ago
|
render_widget(Widget::Controls::Apply, @subject, to: widgets)
|
||
|
render_widget(Widget::Controls::Save, @subject, to: widgets,
|
||
10 years ago
|
can_save: allowed_to?(:save, @subject, current_user))
|
||
13 years ago
|
if allowed_to?(:create, @subject, current_user)
|
||
10 years ago
|
render_widget(Widget::Controls::SaveAs, @subject, to: widgets,
|
||
10 years ago
|
can_save_as_public: allowed_to?(:save_as_public, @subject, current_user))
|
||
13 years ago
|
end
|
||
10 years ago
|
render_widget(Widget::Controls::Clear, @subject, to: widgets)
|
||
|
render_widget(Widget::Controls::Delete, @subject, to: widgets,
|
||
8 years ago
|
can_delete: allowed_to?(:destroy, @subject, current_user))
|
||
13 years ago
|
end
|
||
13 years ago
|
end
|
||
|
|
||
13 years ago
|
def render
|
||
10 years ago
|
write(form_tag('#', id: 'query_form', method: :post) do
|
||
|
content_tag :div, id: 'query_form_content' do
|
||
13 years ago
|
# will render a setting menu for every setting.
|
||
|
# To add new settings, write a new instance method render_<a name>_setting
|
||
|
# and add <a name> to the @@settings_to_render list.
|
||
|
content = ''.html_safe
|
||
5 years ago
|
settings_to_render.each do |setting_name|
|
||
13 years ago
|
render_method_name = "render_#{setting_name}_settings"
|
||
10 years ago
|
content << send(render_method_name) if respond_to? render_method_name
|
||
13 years ago
|
end
|
||
13 years ago
|
content
|
||
13 years ago
|
end
|
||
|
end)
|
||
|
end
|
||
5 years ago
|
|
||
|
def settings_to_render
|
||
|
@settings_to_render ||= %i[filter group_by controls]
|
||
|
end
|
||
13 years ago
|
end
|