Sha256: 11b4b987fe322fd12122589ee1dd97d96ea755109e55481c38115d7dee738b91

Contents?: true

Size: 878 Bytes

Versions: 6

Compression:

Stored size: 878 Bytes

Contents

class MembershipsController < ArtfullyOseController
  before_filter :load_tags, :only => [:index]

  def index
    @person = current_organization.people.find(params[:person_id])
    @expired_count = @person.memberships.lapsed.count
    @membership_types = current_organization.membership_types
  end

  def bulk_update
    @person = current_organization.people.find(params[:person_id])
    extend_memberships(params)
    redirect_to person_memberships_path(@person)
  end

  private

    def extend_memberships(params)
      
      #I hate how these are tied to the button text
      if params[:commit].eql? "Change Expiration"
        params[:membership_ids].each do |membership_id|
          current_organization.memberships.find(membership_id).adjust_expiration_to(params[:ends_at])
        end
        flash[:notice] = "Memberships have been adjusted."
      end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
artfully_ose-1.2.0 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.beta.1 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.alpha.2 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.alpha.1 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.pre.27 app/controllers/memberships_controller.rb
artfully_ose-1.2.0.pre.26 app/controllers/memberships_controller.rb