Show only templates belonging to current nonprofit
This commit is contained in:
parent
aedb12ee03
commit
a5bc158628
4 changed files with 5 additions and 3 deletions
|
@ -6,8 +6,8 @@ module Nonprofits
|
|||
before_filter :authenticate_nonprofit_user!, only: [:index, :show]
|
||||
|
||||
def index
|
||||
@templates = CampaignTemplate.all
|
||||
@nonprofit = current_nonprofit
|
||||
@templates = @nonprofit.campaign_templates
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -17,7 +17,8 @@ class CampaignTemplate < ActiveRecord::Base
|
|||
:summary,
|
||||
:body,
|
||||
:end_datetime,
|
||||
:goal_customizable
|
||||
:goal_customizable,
|
||||
:nonprofit_id
|
||||
|
||||
attr_accessor :goal_amount_dollars
|
||||
attr_accessor :goal_customizable
|
||||
|
|
|
@ -62,6 +62,7 @@ class Nonprofit < ActiveRecord::Base
|
|||
has_many :supporter_notes, through: :supporters
|
||||
has_many :profiles, through: :donations
|
||||
has_many :campaigns, dependent: :destroy
|
||||
has_many :campaign_templates, dependent: :destroy
|
||||
has_many :events, dependent: :destroy
|
||||
has_many :tickets, through: :events
|
||||
has_many :users, through: :roles
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<form parsley-validate>
|
||||
<!--= on 'submit' (def 'new_campaign_template' form_object) (wizard.advance 'new_campaign_template_wiz') -->
|
||||
<input type='hidden' name='campaign_template[profile_id]' value='<%= current_user.profile.id %>'>
|
||||
<input type='hidden' name='campaign_template[nonprofit_id]' value='<%= @nonprofit.id %>'>
|
||||
|
||||
<fieldset>
|
||||
<label>Template Name</label>
|
||||
|
|
Loading…
Reference in a new issue