Commit 231f4642 authored by Mario Manno's avatar Mario Manno
Browse files

move notifications onto conferences

parent c83e06f8
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -27,29 +27,19 @@ class CallForPapersController < ApplicationController
    @call_for_papers = @conference.call_for_papers
  end

  def edit_notifications
    @call_for_papers = @conference.call_for_papers
  end

  def update
    @call_for_papers = @conference.call_for_papers
    if @call_for_papers.update_attributes(call_for_papers_params)
      redirect_to call_for_papers_path, notice: "Changes saved successfully!"
    else
      flash[:alert] = "Failed to update notifications"
      flash[:alert] = "Failed to update"
      render action: "edit"
    end
  end

  def default_notifications
    locale = params[:code]
    @notification = Notification.new(locale: locale)
    @notification.set_default_text(locale)
  end

  private

  def call_for_papers_params
    params.require(:call_for_papers).permit(:start_date, :end_date, :hard_deadline, :welcome_text, :info_url, :contact_email, notifications_attributes: %i(id locale accept_subject accept_body reject_subject reject_body _destroy))
    params.require(:call_for_papers).permit(:start_date, :end_date, :hard_deadline, :welcome_text, :info_url, :contact_email)
  end
end
+11 −1
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ class ConferencesController < ApplicationController
  def edit
  end

  def edit_notifications
  end

  # POST /conferences
  # POST /conferences.xml
  def create
@@ -71,6 +74,12 @@ class ConferencesController < ApplicationController
    end
  end

  def default_notifications
    locale = params[:code]
    @notification = Notification.new(locale: locale)
    @notification.set_default_text(locale)
  end

  # DELETE /conferences/1
  # DELETE /conferences/1.xml
  def destroy
@@ -118,7 +127,8 @@ class ConferencesController < ApplicationController
      days_attributes: %i(start_date end_date _destroy id),
      tracks_attributes: %i(name color _destroy id),
      languages_attributes: %i(language_id code _destroy id),
      ticket_server_attributes: %i(url user password queue _destroy id)
      ticket_server_attributes: %i(url user password queue _destroy id),
      notifications_attributes: %i(id locale accept_subject accept_body reject_subject reject_body _destroy)
    )
  end

+2 −2
Original line number Diff line number Diff line
@@ -169,8 +169,8 @@ class EventsController < ApplicationController
    if params[:send_mail]

      # If integrated mailing is used, take care that a notification text is present.
      if @event.conference.call_for_papers.notifications.empty?
        return redirect_to edit_call_for_papers_path, alert: 'No notification text present. Please change the default text for your needs, before accepting/ rejecting events.'
      if @event.conference.notifications.empty?
        return redirect_to edit_conference_path, alert: 'No notification text present. Please change the default text for your needs, before accepting/ rejecting events.'
      end

      return redirect_to(@event, alert: "Cannot send mails: Please specify an email address for this conference.") unless @conference.email
+7 −0
Original line number Diff line number Diff line
module ConferencesHelper

  def conference_tab(current, active)
    css_class = 'active' if current == active
    haml_tag :li, class: css_class do
      yield
    end
  end

  def timeslot_durations(conference)
    result = Array.new
    durations = [1,5,10,15,20,30,45,60,90,120]
+2 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ class SelectionNotification < ActionMailer::Base
    @conference = @event.conference
    @token = event_person.confirmation_token
    @locale = @person.locale_for_mailing(@conference)
    @notification = @conference.call_for_papers.notifications.with_locale(@locale).first
    @notification = @conference.notifications.with_locale(@locale).first
    raise "Notification for #{@locale} not found" if @notification.nil?

    mail(
@@ -23,7 +23,7 @@ class SelectionNotification < ActionMailer::Base
    @event = event_person.event
    @conference = @event.conference
    @locale = @person.locale_for_mailing(@conference)
    @notification = @conference.call_for_papers.notifications.with_locale(@locale).first
    @notification = @conference.notifications.with_locale(@locale).first
    raise "Notification for #{@locale} not found" if @notification.nil?

    mail(
Loading