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.
139 lines
5.3 KiB
139 lines
5.3 KiB
11 years ago
|
#-- copyright
|
||
11 years ago
|
# OpenProject Meeting Plugin
|
||
|
#
|
||
|
# Copyright (C) 2011-2014 the OpenProject Foundation (OPF)
|
||
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 version 3.
|
||
|
#
|
||
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.
|
||
|
#
|
||
11 years ago
|
# 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.
|
||
|
#
|
||
|
# See doc/COPYRIGHT.md for more details.
|
||
11 years ago
|
#++
|
||
|
|
||
14 years ago
|
module MeetingContentsHelper
|
||
14 years ago
|
def can_edit_meeting_content?(content, content_type)
|
||
|
authorize_for(content_type.pluralize, 'update') && content.editable?
|
||
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def saved_meeting_content_text_present?(content)
|
||
|
!content.new_record? && content.text.present? && !content.text.empty?
|
||
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def show_meeting_content_editor?(content, content_type)
|
||
14 years ago
|
can_edit_meeting_content?(content, content_type) && (!saved_meeting_content_text_present?(content) || content.changed?)
|
||
14 years ago
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def meeting_content_context_menu(content, content_type)
|
||
|
menu = []
|
||
|
menu << meeting_agenda_toggle_status_link(content, content_type)
|
||
|
menu << meeting_content_edit_link(content_type) if can_edit_meeting_content?(content, content_type)
|
||
|
menu << meeting_content_history_link(content_type, content.meeting)
|
||
8 years ago
|
|
||
|
if saved_meeting_content_text_present?(content)
|
||
|
menu << meeting_content_notify_link(content_type, content.meeting)
|
||
|
menu << meeting_content_icalendar_link(content_type, content.meeting)
|
||
|
end
|
||
|
|
||
10 years ago
|
menu.join(' ')
|
||
14 years ago
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def meeting_agenda_toggle_status_link(content, content_type)
|
||
12 years ago
|
content.meeting.agenda.present? && content.meeting.agenda.locked? ?
|
||
11 years ago
|
open_meeting_agenda_link(content_type, content.meeting) :
|
||
12 years ago
|
close_meeting_agenda_link(content_type, content.meeting)
|
||
14 years ago
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def close_meeting_agenda_link(content_type, meeting)
|
||
|
case content_type
|
||
10 years ago
|
when 'meeting_agenda'
|
||
9 years ago
|
content_tag :li, '', class: 'toolbar-item' do
|
||
9 years ago
|
link_to_if_authorized l(:label_meeting_close),
|
||
|
{ controller: '/meeting_agendas',
|
||
|
action: 'close',
|
||
|
meeting_id: meeting },
|
||
|
method: :put,
|
||
7 years ago
|
data: { confirm: I18n.t(:text_meeting_closing_are_you_sure) },
|
||
|
class: 'meetings--close-meeting-button button icon-context icon-locked'
|
||
9 years ago
|
end
|
||
10 years ago
|
when 'meeting_minutes'
|
||
9 years ago
|
content_tag :li, '', class: 'toolbar-item' do
|
||
9 years ago
|
link_to_if_authorized l(:label_meeting_agenda_close),
|
||
|
{ controller: '/meeting_agendas',
|
||
|
action: 'close',
|
||
|
meeting_id: meeting },
|
||
|
method: :put,
|
||
|
class: 'button icon-context icon-locked'
|
||
9 years ago
|
end
|
||
14 years ago
|
end
|
||
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def open_meeting_agenda_link(content_type, meeting)
|
||
|
case content_type
|
||
10 years ago
|
when 'meeting_agenda'
|
||
9 years ago
|
content_tag :li, '', class: 'toolbar-item' do
|
||
9 years ago
|
link_to_if_authorized l(:label_meeting_open),
|
||
|
{ controller: '/meeting_agendas',
|
||
|
action: 'open',
|
||
|
meeting_id: meeting },
|
||
|
method: :put,
|
||
|
class: 'button icon-context icon-unlocked',
|
||
|
confirm: l(:text_meeting_agenda_open_are_you_sure)
|
||
9 years ago
|
end
|
||
10 years ago
|
when 'meeting_minutes'
|
||
14 years ago
|
end
|
||
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def meeting_content_edit_link(content_type)
|
||
9 years ago
|
content_tag :li, '', class: 'toolbar-item' do
|
||
7 years ago
|
|
||
9 years ago
|
content_tag :button,
|
||
|
'',
|
||
7 years ago
|
data: { 'content-type': content_type },
|
||
|
class: 'button button--edit-agenda' do
|
||
9 years ago
|
link_to l(:button_edit),
|
||
|
'',
|
||
|
class: 'icon-context icon-edit',
|
||
9 years ago
|
accesskey: accesskey(:edit)
|
||
9 years ago
|
end
|
||
9 years ago
|
end
|
||
14 years ago
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def meeting_content_history_link(content_type, meeting)
|
||
9 years ago
|
content_tag :li, '', class: 'toolbar-item' do
|
||
9 years ago
|
link_to_if_authorized l(:label_history),
|
||
|
{ controller: '/' + content_type.pluralize,
|
||
|
action: 'history',
|
||
|
meeting_id: meeting },
|
||
|
class: 'button icon-context icon-wiki'
|
||
9 years ago
|
end
|
||
14 years ago
|
end
|
||
11 years ago
|
|
||
14 years ago
|
def meeting_content_notify_link(content_type, meeting)
|
||
9 years ago
|
content_tag :li, '', class: 'toolbar-item' do
|
||
9 years ago
|
link_to_if_authorized l(:label_notify),
|
||
|
{ controller: '/' + content_type.pluralize,
|
||
|
action: 'notify', meeting_id: meeting },
|
||
|
method: :put,
|
||
9 years ago
|
class: 'button icon-context icon-mail1'
|
||
9 years ago
|
end
|
||
14 years ago
|
end
|
||
8 years ago
|
|
||
8 years ago
|
def meeting_content_icalendar_link(content_type, meeting)
|
||
|
content_tag :li, '', class: 'toolbar-item' do
|
||
|
link_to_if_authorized l(:label_icalendar),
|
||
|
{ controller: '/' + content_type.pluralize,
|
||
|
action: 'icalendar', meeting_id: meeting },
|
||
|
method: :put,
|
||
|
class: 'button icon-context icon-calendar2'
|
||
|
end
|
||
|
end
|
||
13 years ago
|
end
|