Limit editing of child campaigns
This commit is contained in:
parent
e5419408ce
commit
341d7511d2
5 changed files with 50 additions and 38 deletions
|
@ -180,6 +180,14 @@ class Campaign < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def child_campaign?
|
def child_campaign?
|
||||||
true if parent_campaign.present?
|
if parent_campaign.present?
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def parent_campaign?
|
||||||
|
!child_campaign?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,39 +5,42 @@
|
||||||
|
|
||||||
<p><strong>Manage Campaign</strong></p>
|
<p><strong>Manage Campaign</strong></p>
|
||||||
|
|
||||||
|
|
||||||
<a class='button--tiny edit'>
|
|
||||||
<!--= on 'click' (open_modal 'campaignSettings') -->
|
|
||||||
<i class='fa fa-gear'></i> Settings
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a class='button--tiny edit' target='_blank' href="<%= @campaign.url + '/supporters' %>">
|
|
||||||
<i class='fa fa-th-list'></i> Dashboard
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a class='button--tiny edit'>
|
|
||||||
<!--= on 'click' (open_modal 'offlineCampaignDonation') -->
|
|
||||||
<i class='fa fa-plus'></i> Offsite Donation
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a class='button--tiny edit'>
|
<a class='button--tiny edit'>
|
||||||
<!--= on 'click' (open_modal 'manageGiftOptionsModal') -->
|
<!--= on 'click' (open_modal 'campaignSettings') -->
|
||||||
<i class='fa fa-gift'></i> Gift Options
|
<i class='fa fa-gear'></i> Settings
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class='button--tiny edit'>
|
<% if @campaign.parent_campaign? %>
|
||||||
<!--= on 'click' (open_modal 'customReceiptModal') -->
|
<a class='button--tiny edit' target='_blank' href="<%= @campaign.url + '/supporters' %>">
|
||||||
<i class='fa fa-pencil'></i> Custom Receipt
|
<i class='fa fa-th-list'></i> Dashboard
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a class='button--tiny edit'>
|
||||||
|
<!--= on 'click' (open_modal 'offlineCampaignDonation') -->
|
||||||
|
<i class='fa fa-plus'></i> Offsite Donation
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class='button--tiny edit'>
|
||||||
|
<!--= on 'click' (open_modal 'manageGiftOptionsModal') -->
|
||||||
|
<i class='fa fa-gift'></i> Gift Options
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class='button--tiny edit'>
|
||||||
|
<!--= on 'click' (open_modal 'customReceiptModal') -->
|
||||||
|
<i class='fa fa-pencil'></i> Custom Receipt
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<a class='button--tiny edit' href='?preview=t'>
|
<a class='button--tiny edit' href='?preview=t'>
|
||||||
<i class='fa fa-eye'></i> Preview Mode
|
<i class='fa fa-eye'></i> Preview Mode
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class='button--tiny edit'>
|
<% if @campaign.parent_campaign? %>
|
||||||
<!--= on 'click' (open_modal 'duplicateFundraiserModal') -->
|
<a class='button--tiny edit'>
|
||||||
<i class='fa fa-copy'></i> Copy Campaign
|
<!--= on 'click' (open_modal 'duplicateFundraiserModal') -->
|
||||||
</a>
|
<i class='fa fa-copy'></i> Copy Campaign
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render 'components/messages/deleted_campaign_or_event', type: 'campaign' %>
|
<%= render 'components/messages/deleted_campaign_or_event', type: 'campaign' %>
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
app.days_remaining = '<%= @campaign.days_left %>'
|
app.days_remaining = '<%= @campaign.days_left %>'
|
||||||
app.recurring_fund = <%= @campaign.recurring_fund? %>
|
app.recurring_fund = <%= @campaign.recurring_fund? %>
|
||||||
app.vimeo_id = "<%= @campaign.vimeo_video_id ? @campaign.vimeo_video_id : '' %>"
|
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('has_video', <%= @campaign.video_url.present? %>)
|
||||||
appl.def('campaign_is_deleted', <%= @campaign.deleted || false %>)
|
appl.def('campaign_is_deleted', <%= @campaign.deleted || false %>)
|
||||||
appl.def('has_main_image', <%= @campaign.main_image.file.present? %>)
|
appl.def('has_main_image', <%= @campaign.main_image.file.present? %>)
|
||||||
</script>
|
</script>
|
||||||
<%= render 'schema', campaign: @campaign, url: @url %>
|
|
||||||
<%= render 'common/froala' if current_campaign_editor? %>
|
|
||||||
|
|
||||||
|
<%= render 'schema', campaign: @campaign, url: @url %>
|
||||||
<%= IncludeAsset.js '/client/js/campaigns/show/page.js' %>
|
<%= IncludeAsset.js '/client/js/campaigns/show/page.js' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,12 @@ require('../../components/ajax/toggle_soft_delete')(url, 'campaign')
|
||||||
|
|
||||||
// Initialize the froala wysiwyg
|
// Initialize the froala wysiwyg
|
||||||
var editable = require('../../common/editable')
|
var editable = require('../../common/editable')
|
||||||
editable($('#js-campaignBody'), {
|
if (app.is_parent_campaign) {
|
||||||
sticky: true,
|
editable($('#js-campaignBody'), {
|
||||||
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."
|
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'), {
|
editable($('#js-customReceipt'), {
|
||||||
button: ["bold", "italic", "formatBlock", "align", "createLink",
|
button: ["bold", "italic", "formatBlock", "align", "createLink",
|
||||||
|
|
|
@ -59,7 +59,7 @@ const giftBox = state => gift => {
|
||||||
, h('p.u-marginBottom--15', gift.description)
|
, h('p.u-marginBottom--15', gift.description)
|
||||||
, h('div', [ giftButton(state, gift) ])
|
, 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', {
|
? h('button.button--tiny.absolute.edit.hasShadow', {
|
||||||
on: {click: ev => state.openEditGiftModal$(gift)}
|
on: {click: ev => state.openEditGiftModal$(gift)}
|
||||||
}, [
|
}, [
|
||||||
|
@ -79,4 +79,3 @@ const totalContributions = gift => {
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {view, init}
|
module.exports = {view, init}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue