Skip to content

Commit

Permalink
Replace content specific notify and icalendar
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Nov 2, 2023
1 parent bfa5df2 commit 5542552
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 225 deletions.
30 changes: 0 additions & 30 deletions modules/meeting/app/controllers/meeting_contents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,6 @@ def diff
render_404
end

def notify
unless @content.new_record?
service = MeetingNotificationService.new(@meeting)
result = service.call(:invited)

if result.success?
flash[:notice] = I18n.t(:notice_successful_notification)
else
flash[:error] = I18n.t(:error_notification_with_errors,
recipients: result.errors.map(&:name).join('; '))
end
end
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
end

def icalendar
unless @content.new_record?
service = MeetingNotificationService.new(@meeting)
result = service.call(:icalendar_notification, include_author: true)

if result.success?
flash[:notice] = I18n.t(:notice_successful_notification)
else
flash[:error] = I18n.t(:error_notification_with_errors,
recipients: result.errors.map(&:name).join('; '))
end
end
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
end

def default_breadcrumb
MeetingsController.new.send(:default_breadcrumb)
end
Expand Down
27 changes: 0 additions & 27 deletions modules/meeting/app/helpers/meeting_contents_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ def meeting_content_context_menu(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)

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

menu.join(' ')
end

Expand Down Expand Up @@ -129,28 +124,6 @@ def meeting_content_history_link(content_type, meeting)
end
end

def meeting_content_notify_link(content_type, meeting)
content_tag :li, '', class: 'toolbar-item' do
link_to_if_authorized({ controller: '/' + content_type.pluralize,
action: 'notify', meeting_id: meeting },
method: :put,
class: 'button') do
text_with_icon(I18n.t(:label_notify), 'icon-mail1')
end
end
end

def meeting_content_icalendar_link(content_type, meeting)
content_tag :li, '', class: 'toolbar-item' do
link_to_if_authorized({ controller: '/' + content_type.pluralize,
action: 'icalendar', meeting_id: meeting },
method: :put,
class: 'button') do
text_with_icon(I18n.t(:label_icalendar), 'icon-calendar2')
end
end
end

def text_with_icon(text, icon)
op_icon("button--icon #{icon}") +
' ' +
Expand Down
95 changes: 64 additions & 31 deletions modules/meeting/app/views/meetings/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title "#{t(:label_meeting)}: #{@meeting.title}" %>
<%= toolbar title: t(:label_meeting),
link_to: link_to(@meeting),
html: { class: 'meeting--main-toolbar' } do %>
html: { class: 'meeting--main-toolbar -with-dropdown' } do %>
<% unless User.current.anonymous? %>
<li class="toolbar-item hidden-for-tablet">
<div class="button">
Expand All @@ -40,31 +40,56 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<% if authorize_for(:meetings, :edit) %>
<li class="toolbar-item">
<%= link_to({:controller => '/meetings', :action => 'edit', :id => @meeting}, class: 'button',:accesskey => accesskey(:edit)) do%>
<%= link_to({ :controller => '/meetings', :action => 'edit', :id => @meeting }, class: 'button', :accesskey => accesskey(:edit)) do %>
<%= op_icon('button--icon icon-edit') %>
<span class="button--text"><%= t(:button_edit) %></span>
<% end %>
</li>
<% end %>
<% if authorize_for(:meetings, :copy) %>
<li class="toolbar-item hidden-for-tablet">
<%= link_to({:controller => '/meetings', :action => 'copy', :id => @meeting}, class: 'button') do %>
<%= op_icon('button--icon icon-copy') %>
<span class="button--text"><%= t(:button_copy) %></span>

<li class="toolbar-item drop-down">
<a
href="#"
aria-haspopup="true"
title="<%= t(:label_more) %>"
class="button"
data-test-selector="meetings-more-dropdown-menu"
>
<%= op_icon('button--icon icon-show-more') %>
</a>
<ul style="display:none;" class="menu-drop-down-container">
<% if authorize_for(:meetings, :notify) %>
<li>
<%= link_to t('meeting.label_mail_all_participants'),
notify_meeting_path(@meeting),
class: 'icon-context icon-mail1' %>
</li>
<% end %>
</li>
<% end %>
<% if authorize_for(:meetings, :destroy) %>
<li class="toolbar-item">
<%= link_to({controller: '/meetings', action: 'destroy', id: @meeting},
class: 'button',
method: :delete,
data: { confirm: t(:text_are_you_sure) }) do %>
<%= op_icon('button--icon icon-delete') %>
<span class="button--text"><%= t(:button_delete) %></span>
<% if authorize_for(:meetings, :icalendar) %>
<li>
<%= link_to t(:label_icalendar_download),
download_ics_meeting_path(@meeting),
class: 'icon-context icon-calendar2' %>
</li>
<% end %>
</li>
<% end %>
<% if authorize_for(:meetings, :copy) %>
<li>
<%= link_to(t(:button_copy),
copy_meeting_path(@meeting),
class: 'icon-context icon-copy') %>
</li>
<% end %>
<% if authorize_for(:meetings, :destroy) %>
<li>
<%= link_to(t(:button_delete),
meeting_path(@meeting),
class: 'icon-context icon-delete',
method: :delete,
data: { confirm: t(:text_are_you_sure) }) %>
</li>
<% end %>
</ul>
</li>
<% end %>

<div class="meeting details box">
Expand All @@ -74,28 +99,36 @@ See COPYRIGHT and LICENSE files for more details.
<p class="author"><%= authoring @meeting.created_at, @meeting.author %></p>
</div>
<div class="grid-content small-6">
<p><strong><%= Meeting.human_attribute_name(:start_time) %></strong>: <%= format_date @meeting.start_time %> <%= format_time @meeting.start_time, false %> - <%= format_time @meeting.end_time, false %> <%= Time.zone %></p>
<p>
<strong><%= Meeting.human_attribute_name(:start_time) %></strong>: <%= format_date @meeting.start_time %> <%= format_time @meeting.start_time, false %>
- <%= format_time @meeting.end_time, false %> <%= Time.zone %></p>
</div>
<div class="grid-content small-6">
<p><strong><%= Meeting.human_attribute_name(:location) %></strong>: <%= auto_link(h(@meeting.location), link: :all, html: { target: '_blank' }) %></p>
<p>
<strong><%= Meeting.human_attribute_name(:location) %></strong>: <%= auto_link(h(@meeting.location), link: :all, html: { target: '_blank' }) %>
</p>
</div>
<div class="grid-content small-12">
<p><strong><%= Meeting.human_attribute_name(:participants_invited) %></strong>: <%= format_participant_list @meeting.participants.invited %></p>
<p>
<strong><%= Meeting.human_attribute_name(:participants_invited) %></strong>: <%= format_participant_list @meeting.participants.invited %>
</p>
</div>
<div class="grid-content small-12">
<p><strong><%= Meeting.human_attribute_name(:participants_attended) %></strong>: <%= format_participant_list @meeting.participants.attended %></p>
<p>
<strong><%= Meeting.human_attribute_name(:participants_attended) %></strong>: <%= format_participant_list @meeting.participants.attended %>
</p>
</div>
</div>
</div>

<%= render_tabs [{:name => 'agenda', :action => :create_meeting_agendas, :partial => 'meeting_contents/show', :path => meeting_agenda_path(@meeting), :label => :label_meeting_agenda, :content => @meeting.agenda || @meeting.build_agenda, :content_type => "meeting_agenda"},
{:name => 'minutes', :action => :create_meeting_minutes, :partial => 'meeting_contents/show', :path => meeting_minutes_path(@meeting), :label => :label_meeting_minutes, :content => @meeting.minutes || @meeting.build_minutes, :content_type => "meeting_minutes"}] %>
<%= render_tabs [{ :name => 'agenda', :action => :create_meeting_agendas, :partial => 'meeting_contents/show', :path => meeting_agenda_path(@meeting), :label => :label_meeting_agenda, :content => @meeting.agenda || @meeting.build_agenda, :content_type => "meeting_agenda" },
{ :name => 'minutes', :action => :create_meeting_minutes, :partial => 'meeting_contents/show', :path => meeting_minutes_path(@meeting), :label => :label_meeting_minutes, :content => @meeting.minutes || @meeting.build_minutes, :content_type => "meeting_minutes" }] %>

<% if @meeting.journals.changing.present? %>
<div id="history">
<h3><%=t(:label_history)%></h3>
<% @meeting.journals.each do |journal| %>
<%= render_meeting_journal @meeting, journal %>
<% end %>
</div>
<div id="history">
<h3><%= t(:label_history) %></h3>
<% @meeting.journals.each do |journal| %>
<%= render_meeting_journal @meeting, journal %>
<% end %>
</div>
<% end %>
5 changes: 0 additions & 5 deletions modules/meeting/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@
get :diff
put :close
put :open
put :notify
put :icalendar
post :preview
end

Expand All @@ -87,16 +85,13 @@
member do
get :history
get :diff
put :notify
get :icalendar
end
end

resource :minutes, controller: 'meeting_minutes', only: [:update] do
member do
get :history
get :diff
put :notify
post :preview
end

Expand Down
131 changes: 0 additions & 131 deletions modules/meeting/spec/controllers/meeting_contents_controller_spec.rb

This file was deleted.

Loading

0 comments on commit 5542552

Please sign in to comment.