diff --git a/app/models/campaign.rb b/app/models/campaign.rb index aa88b0a5..dfce67e7 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -180,6 +180,14 @@ class Campaign < ActiveRecord::Base end def child_campaign? - true if parent_campaign.present? + if parent_campaign.present? + true + else + false + end + end + + def parent_campaign? + !child_campaign? end end diff --git a/app/views/campaigns/_admin_top_nav.html.erb b/app/views/campaigns/_admin_top_nav.html.erb index 6f1499e3..0ee237a4 100644 --- a/app/views/campaigns/_admin_top_nav.html.erb +++ b/app/views/campaigns/_admin_top_nav.html.erb @@ -5,39 +5,42 @@
Manage Campaign
- - - - Settings - - - - Dashboard - - - - - Offsite Donation - - - - Gift Options + + Settings - - - Custom Receipt - + <% if @campaign.parent_campaign? %> + + Dashboard + + + + + Offsite Donation + + + + + Gift Options + + + + + Custom Receipt + + <% end %> Preview Mode - - - Copy Campaign - + <% if @campaign.parent_campaign? %> + + + Copy Campaign + + <% end %> <%= render 'components/messages/deleted_campaign_or_event', type: 'campaign' %> diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb index 56c5bc55..36e6477f 100644 --- a/app/views/campaigns/show.html.erb +++ b/app/views/campaigns/show.html.erb @@ -16,14 +16,14 @@ app.days_remaining = '<%= @campaign.days_left %>' app.recurring_fund = <%= @campaign.recurring_fund? %> app.vimeo_id = "<%= @campaign.vimeo_video_id ? @campaign.vimeo_video_id : '' %>" - app.current_campaign_editor = <%= current_campaign_editor? %> + app.current_campaign_editor = <%= current_campaign_editor? %> + app.is_parent_campaign = <%= @campaign.parent_campaign? %> appl.def('has_video', <%= @campaign.video_url.present? %>) appl.def('campaign_is_deleted', <%= @campaign.deleted || false %>) - appl.def('has_main_image', <%= @campaign.main_image.file.present? %>) - - <%= render 'schema', campaign: @campaign, url: @url %> - <%= render 'common/froala' if current_campaign_editor? %> + appl.def('has_main_image', <%= @campaign.main_image.file.present? %>) + + <%= render 'schema', campaign: @campaign, url: @url %> <%= IncludeAsset.js '/client/js/campaigns/show/page.js' %> <% end %> diff --git a/client/js/campaigns/show/admin.js b/client/js/campaigns/show/admin.js index 3d8cd877..d69f4ed1 100644 --- a/client/js/campaigns/show/admin.js +++ b/client/js/campaigns/show/admin.js @@ -17,10 +17,12 @@ require('../../components/ajax/toggle_soft_delete')(url, 'campaign') // Initialize the froala wysiwyg var editable = require('../../common/editable') -editable($('#js-campaignBody'), { - sticky: true, - placeholder: "Add your campaign's story here. We strongly recommend that this section is filled out with at least 250 words. It will be saved automatically as you type. You can add images, videos and custom HTML too." -}) +if (app.is_parent_campaign) { + editable($('#js-campaignBody'), { + sticky: true, + placeholder: "Add your campaign's story here. We strongly recommend that this section is filled out with at least 250 words. It will be saved automatically as you type. You can add images, videos and custom HTML too." + }) +} editable($('#js-customReceipt'), { button: ["bold", "italic", "formatBlock", "align", "createLink", diff --git a/client/js/campaigns/show/gift-option-list.js b/client/js/campaigns/show/gift-option-list.js index 8b49069d..a2ef43bb 100644 --- a/client/js/campaigns/show/gift-option-list.js +++ b/client/js/campaigns/show/gift-option-list.js @@ -30,7 +30,7 @@ function init(giftsNeedRefresh$, parentState) { state.giftOptions$ = flyd.mergeAll([ pageloadGifts$ , refreshedGifts$ - , flyd.stream([]) // default before ajax loads + , flyd.stream([]) // default before ajax loads ]) return state } @@ -59,7 +59,7 @@ const giftBox = state => gift => { , h('p.u-marginBottom--15', gift.description) , h('div', [ giftButton(state, gift) ]) ]) - , app.current_campaign_editor // Show edit button only if the current user is a campaign editor + , (app.current_campaign_editor && app.is_parent_campaign) // Show edit button only if the current user is a parent campaign editor ? h('button.button--tiny.absolute.edit.hasShadow', { on: {click: ev => state.openEditGiftModal$(gift)} }, [ @@ -79,4 +79,3 @@ const totalContributions = gift => { } module.exports = {view, init} -