Last active
August 29, 2015 14:16
-
-
Save gaygenius/a0af2745dbf64b0335bf to your computer and use it in GitHub Desktop.
Figuring out what is currently needed to render Sponsored Petitions (upsells) on Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REDIRECTS (301 http status code) | |
/p (petitions_path) if | |
user not identified | |
no previous signature | |
no lead-in petition found (missing or incorrect petition_id param) | |
(already happening -- we do nothing) OTHER DESTINATIONS per upsell_list_redirect | |
SUCCESS (200 http status code) | |
lead_in_petition: | |
id: originating_petition.id | |
sponsored_petitions: [ | |
id: petition.id, | |
sign_url: sign_petition_upsell_url(id: petition.id, petition_id: lead_in_petition.id, alert_id: params[:alert_id]), | |
skip_url: skip_petition_upsell_url(id: petition.id, petition_id: lead_in_petition.id, prompt_record_id: prompt_record.try(:id)), | |
prompt_record_id: prompt_record.try(:id), | |
organization_id: petition.organization_id | |
title: prompted_petition_title(petition, mvtp) | |
description: prompted_petition_description(petition, mvtp, nil) # nil = don’t truncate | |
photo_url: some_photo_helper(mobile?) # USING SIZE: desktop => :column_3, mobile => (phone_number: :mobile_upsell, other: :mobile) | |
photo_alt_title: # new helper reusing petition_photo_image_tag(:column_3, petition, :alt => petition.widget_title, :class => 'petition-image', :url_options => {:mvtp => mvtp}) | |
is_created_by_organization: petition.created_by_organization? | |
ad_type: petition.ad_type | |
displayed_signature_count: petition.displayed_signature_count | |
optin_text: petition_optin_text(petition, :include_name => true) | |
sign_button_text: sign_button_text(petition) | |
letter_body: petition.letter_body | |
organization: | |
name: petition.organization.name | |
logo: place_organization_logo(petition) # default size, EXCEPT for mobile phone_number USE :mobile_upsell | |
] | |
finish_petition_upsells_url: finish_petition_upsells_url(petition_id: originating_petition.id) | |
user: | |
is_user_international: current_user.intl? | |
phone_number_placeholder: I18n::PhoneNumberValidator.placeholder | |
Cookies -- is it sufficient to include the cookies in response headers? need to include in JSON? | |
cookies["prompted_petitions"] = { :value => 'true', :expires => 12.hours.from_now, :domain => base_domain } | |
@petition -- lead-in petition | |
@petitions -- collection of: | |
[ | |
petition, | |
multivariate_test_permutation (or nil) | |
petition_data | |
] | |
petition_data is used below (comes from prompted_petition_data) | |
:id => petition.id, | |
:sign_url => sign_petition_upsell_url(id: petition.id, petition_id: lead_in_petition.id, alert_id: params[:alert_id]), | |
:skip_url => skip_petition_upsell_url(id: petition.id, petition_id: lead_in_petition.id, prompt_record_id: prompt_record.try(:id)), | |
:prompt_record_id => prompt_record.try(:id), | |
:organization_id => petition.organization_id | |
NOTE: mobile requests from Rendr: (params[:is_mobile] == 'true' && params[:source] == 'fe-services-app') | |
> petitions/upsells/index.html.haml | |
> widgets/_upsells.html.haml -- desktop | |
# NOT NEEDED IN JSON presenter.flash_text | |
finish_petition_upsells_url(:petition_id => originating_petition.id) -- 'Skip' | |
> widgets/upsells_standard_listing/petition_upsell | |
?? current_user.profile.phone_number (aka presenter.user_phone_number) | |
> widgets/upsells_standard_listing/phone_number_upsell | |
SIGNATURE FORM url: petition_data[:sign_url] | |
(hidden) ?? all petition_data attributes | |
(hidden) upsell_position | |
(hidden) upsells_served | |
prompted_petition_title(petition, mvtp) | |
petition_photo_image_tag(:column_3, petition, :alt => petition.widget_title, :class => 'petition-image', :url_options => {:mvtp => mvtp}) | |
prompted_petition_description(petition, mvtp, 300) | |
petition.created_by_organization? | |
(always 'phone_number') petition.ad_type | |
petition.id | |
> widgets/upsells_standard_listing/optin_phone_number | |
I18n::PhoneNumberValidator.format | |
I18n::PhoneNumberValidator.placeholder | |
user_phone_number (from presenter.user_phone_number) | |
current_user.intl? | |
place_organization_logo(petition) | |
petition.organization.name | |
> widgets/upsells_standard_listing/upsell_default | |
SIGNATURE FORM url: petition_data[:sign_url] | |
(hidden) ?? all petition_data attributes | |
(hidden) upsell_position | |
(hidden) upsells_served | |
prompted_petition_title(petition, mvtp) | |
petition_photo_image_tag(:column_3, petition, :alt => petition.widget_title, :class => 'petition-image', :url_options => {:mvtp => mvtp}) | |
prompted_petition_description(petition, mvtp, 250) | |
petition.created_by_organization? | |
('automatic', 'peer_2_peer', 'yes_no') petition.ad_type | |
petition.displayed_signature_count | |
petition.id | |
> widgets/upsells_standard_listing/optin_automatic | |
place_organization_logo(petition) | |
petition.organization.name | |
# (NOT USED) petition.organization.organization_supporters.size | |
petition_optin_text(petition, :include_name => true) | |
sign_button_text(petition) | |
> widgets/upsells_standard_listing/optin_action_required (same data as optin_automatic) | |
> widgets/upsells_standard_listing/optin_peer_2_peer | |
place_organization_logo(petition) | |
petition.organization.name | |
petition_optin_text(petition, :include_name => true) | |
> widgets/upsells_standard_listing/optin_yes_no_disabled_sign | |
petition_optin_text(petition, :include_name => true) | |
:signatures_badge | |
petition.displayed_signature_count | |
> widgets/upsells_standard_listing/ad_flag | |
petition.id | |
lead_in.id | |
prompt_record_id (petition_data[:prompt_record_id]) | |
?? same as non-modal > widgets/upsells_standard_listing/petition_upsell_modal | |
> petitions/upsells/index.mobile.haml | |
petition.ad_type | |
> petitions/upsells/phone_upsell | |
finish_petition_upsells_url(petition_id: lead_petition.id) | |
petition_photo_image_tag(:mobile_upsell, petition, class: 'right', url_options: {mvtp: mvtp}) | |
prompted_petition_title(petition, mvtp) | |
place_organization_logo(petition, size: :mobile_upsell) | |
petition.organization.name | |
prompted_petition_description(petition, mvtp, nil) | |
lead_petition.id | |
I18n::PhoneNumberValidator.placeholder | |
I18n::PhoneNumberValidator.format | |
current_user.intl? | |
> petitions/upsells/upsell | |
lead_petition.id | |
petition_photo_image_tag(:mobile, petition, style: 'square', url_options: {mvtp: mvtp}) | |
prompted_petition_title(petition, mvtp) | |
place_organization_logo(petition) | |
petition.organization.name | |
petition.ad_type | |
sign_button_text(petition) | |
finish_petition_upsells_url(:petition_id => lead_petition.id) | |
(hidden) ?? all petition_data attributes | |
petition.acts_as_pledge? | |
petition.all_targets | |
> widgets/upsells_standard_listing/optin_automatic | |
petition_optin_text(petition, :from_span => true) | |
> widgets/upsells_standard_listing/optin_action_required (same data as optin_automatic) | |
> widgets/upsells_standard_listing/optin_peer_2_peer (same data as optin_automatic) | |
> widgets/upsells_standard_listing/optin_yes_no_disabled_sign (no mobile-specific partial) | |
> petitions/mobile/overview | |
prompted_petition_description(petition, mvtp, 200) | |
> petitions/mobile/letter | |
petition.html_formatted_letter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment