Fixes after merge

This commit is contained in:
Kasia Jarmołkowicz 2018-05-16 21:39:27 +02:00 committed by Eric Schultz
parent 399f6ff0c6
commit a7f0c809b4
4 changed files with 4 additions and 184 deletions

View file

@ -90,9 +90,6 @@
</button>
<% end %>
<<<<<<< HEAD
=======
<<<<<<< HEAD
<% if !@campaign.parent_campaign %>
<aside class='u-marginBottom--15 pastelBox--grey'>
<a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='/peer-to-peer?campaign_id=<%= @peer_to_peer_campaign_param %>'>
@ -101,9 +98,6 @@
</aside>
<% end %>
=======
>>>>>>> custom-layout
>>>>>>> p2p-campaigns
<!-- flimflam gift options javascript gets rendered into this div: -->
<div class='ff-sidebar'></div>
@ -116,9 +110,6 @@
</section>
<<<<<<< HEAD
=======
<<<<<<< HEAD
<% if @campaign.parent_campaign %>
<section class='box'>
@ -149,46 +140,6 @@
</section>
</section>
<% end %>
=======
>>>>>>> p2p-campaigns
<section class='box'>
<section class="campaigner-profile">
<figure>
<div class="avatar">
<img src=<%= @campaign.profile.get_profile_picture %> />
</div>
<figcaption>
<p><%= @campaign.profile.name %></p>
<p><%= @campaign.profile.city %></p>
</figcaption>
</figure>
<section class='u-marginTop--15 u-marginBottom--15 pastelBox--grey'>
<header>I am supporting the Y because…</header>
<div class='pastelBox-body'>
(customizable reason)
</div>
<<<<<<< HEAD
<% unless current_campaign_editor? %>
<a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='/peer-to-peer?campaign_id=<%= @campaign.id %>'>
Start Your Own Campaign for <%= @nonprofit.name %>
</a>
<% end %>
</section>
</section>
</section>
=======
<a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='/peer-to-peer?campaign_id=<%= @campaign.id %>'>
Start Your Own Campaign for <%= @nonprofit.name %>
</a>
</section>
</section>
</section>
>>>>>>> custom-layout
>>>>>>> p2p-campaigns
<section class='box'>
<h1><%= @campaign.name %></h1>

View file

@ -1,121 +1,3 @@
<<<<<<< HEAD
// License: LGPL-3.0-or-later
require('../new/wizard')
var request = require("../../common/client")
require('../../common/onboard')
// setting up some default values
appl.def('is_signing_up', true)
.def('selected_result_index', -1)
appl.def('search_nonprofits', function(value){
// keyCode 13 is the return key.
// this conditional just clears the dropdown
if(event.keyCode === 13) {
appl.def('search_results', [])
return
}
// when the user starts typing,
// it sets the selected_results key to false
appl.def('selected_result', false)
// if the the input is empty, it clears the dropdown
if (!value) {
appl.def('search_results', [])
return
}
// logic for controlling the dropdown options with up
// and down arrows
if (returnUpOrDownArrow() && appl.search_results && appl.search_results.length) {
event.preventDefault()
setIndexWithArrows(returnUpOrDownArrow())
return
}
// if the input is not an up or down arrow or an empty string
// or a return key, then it searches for nonprofits
utils.delay(300, function(){ajax_nonprofit_search(value)})
})
function ajax_nonprofit_search(value){
request.get('/nonprofits/search?npo_name=' + value).end(function(err, resp){
if(!resp.body) {
appl.def('search_results', [])
appl.notify("Sorry, we couldn't find any nonprofits containing the word '" + value + "'")
} else {
appl.def('selected_result_index', -1)
appl.def('search_results', resp.body)
}
})
}
function returnUpOrDownArrow() {
var keyCode = event.keyCode
if(keyCode === 38)
return 'up'
if(keyCode === 40)
return 'down'
}
function setIndexWithArrows(dir) {
if(dir === 'down') {
var search_length = appl.search_results.length -1
appl.def('selected_result_index', appl.selected_result_index === search_length
? search_length
: appl.selected_result_index += 1)
} else {
appl.def('selected_result_index', appl.selected_result_index === 0
? 0
: appl.selected_result_index -= 1)
}
}
appl.def('select_result', {
with_arrows: function(i, node) {
addSelectedClass(appl.prev_elem(node))
var selected = appl.search_results[appl.selected_result_index]
app.nonprofit_id = selected.id
appl.def('selected_result', selected)
utils.change_url_param('npo_id', selected.id, '/peer-to-peer')
},
with_click: function(i, node) {
appl.def('selected_result_index', i)
addSelectedClass(appl.prev_elem(node))
var selected = appl.search_results[i]
app.nonprofit_id = selected.id
appl.def('selected_result', selected)
appl.def('search_results', [])
utils.change_url_param('npo_id', selected.id, '/peer-to-peer')
}
})
function addSelectedClass(node) {
if(!node || !node.parentElement) return
var siblings = node.parentElement.querySelectorAll('li')
var len = siblings.length
while(len--){siblings[len].className=''}
node.className = 'is-selected'
}
// this is for clearing the dropdown
var main = document.querySelector('main')
main.onclick = function(ev) {
var node = ev.target.nodeName
if(node === 'INPUT' || node === 'BUTTON') {
return
}
appl.def('search_results', [])
}
=======
require('../new/peer_to_peer_wizard')
require('../../common/image_uploader')
>>>>>>> 2dc48070e... Merge branch 'p2p-campaigns' into h-custom-layout

View file

@ -1,5 +0,0 @@
class AddBannerToCampaign < ActiveRecord::Migration
def change
add_column :campaigns, :custom_banner, :string
end
end

View file

@ -102,14 +102,14 @@ SELECT supporters.id, concat_ws(' '
, payments.kind
, payments.towards
) AS search_blob
FROM supporters
FROM supporters
LEFT OUTER JOIN payments
ON payments.supporter_id=supporters.id
ON payments.supporter_id=supporters.id
LEFT OUTER JOIN donations
ON donations.supporter_id=supporters.id
ON donations.supporter_id=supporters.id
LEFT OUTER JOIN (
SELECT string_agg(value::text, ' ') AS value, supporter_id
FROM custom_field_joins
FROM custom_field_joins
GROUP BY supporter_id) AS custom_field_joins
ON custom_field_joins.supporter_id=supporters.id
WHERE (supporters.id=NEW.supporter_id)) AS data
@ -438,13 +438,9 @@ CREATE TABLE public.campaigns (
show_recurring_amount boolean DEFAULT false,
end_datetime timestamp without time zone,
external_identifier character varying(255),
<<<<<<< HEAD
campaign_template_id integer
=======
campaign_template_id integer,
parent_campaign_id integer,
reason_for_supporting text
>>>>>>> p2p-campaigns
);
@ -4419,8 +4415,4 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124316');
INSERT INTO schema_migrations (version) VALUES ('201810202124317');
<<<<<<< HEAD
=======
INSERT INTO schema_migrations (version) VALUES ('201810202124318');
>>>>>>> p2p-campaigns