artfully_ose 1.0.0.rc4 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +661 -0
- data/app/assets/fonts/FontAwesome.otf +0 -0
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +284 -0
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/images/chosen-sprite.png +0 -0
- data/app/assets/javascripts/application.js +88 -44
- data/app/assets/javascripts/box-office.js +7 -3
- data/app/assets/javascripts/custom/grouped-form.js +1 -1
- data/app/assets/javascripts/custom/modernizr.custom.12828.js +4 -0
- data/app/assets/javascripts/custom/people.js +30 -1
- data/app/assets/javascripts/jquery-lib/chosen.jquery.js +1026 -0
- data/app/assets/javascripts/jquery-lib/jquery.jeditable.js +1 -1
- data/app/assets/javascripts/jquery-lib/jquery.mask-money.js +90 -60
- data/app/assets/javascripts/store/store.js +112 -67
- data/app/assets/stylesheets/application.sass +174 -1
- data/app/assets/stylesheets/bootstrap-overrides.css +51 -13
- data/app/assets/stylesheets/bootstrap.css +4 -379
- data/app/assets/stylesheets/font-awesome.sass +759 -0
- data/app/assets/stylesheets/jquery/chosen.scss +397 -0
- data/app/assets/stylesheets/printing.css +5 -1
- data/app/assets/stylesheets/sass/store.sass +18 -3
- data/app/concerns/itemable.rb +11 -0
- data/app/concerns/oh_noes.rb +24 -0
- data/app/controllers/actions_controller.rb +39 -20
- data/app/controllers/addresses_controller.rb +2 -2
- data/app/controllers/artfully_ose_controller.rb +15 -1
- data/app/controllers/charts_controller.rb +6 -2
- data/app/controllers/contributions_controller.rb +28 -1
- data/app/controllers/discounts_controller.rb +65 -0
- data/app/controllers/discounts_reports_controller.rb +22 -0
- data/app/controllers/events_controller.rb +48 -45
- data/app/controllers/exchanges_controller.rb +10 -10
- data/app/controllers/imports_controller.rb +38 -20
- data/app/controllers/index_controller.rb +1 -1
- data/app/controllers/memberships_controller.rb +1 -0
- data/app/controllers/merges_controller.rb +1 -1
- data/app/controllers/orders_controller.rb +6 -12
- data/app/controllers/organizations_controller.rb +0 -1
- data/app/controllers/people_controller.rb +10 -12
- data/app/controllers/refunds_controller.rb +2 -2
- data/app/controllers/returns_controller.rb +0 -1
- data/app/controllers/sales_controller.rb +9 -6
- data/app/controllers/searches_controller.rb +53 -0
- data/app/controllers/sections_controller.rb +12 -1
- data/app/controllers/segments_controller.rb +23 -10
- data/app/controllers/shows_controller.rb +37 -28
- data/app/controllers/slices_controller.rb +37 -0
- data/app/controllers/statements_controller.rb +4 -4
- data/app/controllers/store/checkouts_controller.rb +14 -12
- data/app/controllers/store/events_controller.rb +1 -1
- data/app/controllers/store/orders_controller.rb +32 -5
- data/app/controllers/store/store_controller.rb +4 -0
- data/app/controllers/venues_controller.rb +6 -2
- data/app/helpers/artfully_ose_helper.rb +31 -5
- data/app/helpers/discounts_helper.rb +3 -0
- data/app/helpers/people_helper.rb +2 -19
- data/app/mailers/order_mailer.rb +21 -3
- data/app/mailers/producer_mailer.rb +9 -1
- data/app/mailers/reports_mailer.rb +12 -0
- data/app/models/action.rb +29 -3
- data/app/models/actions/get_action.rb +4 -0
- data/app/models/actions/go_action.rb +18 -0
- data/app/models/actions/refund_action.rb +14 -0
- data/app/models/address.rb +6 -16
- data/app/models/adjustments.rb +10 -0
- data/app/models/box_office.rb +1 -1
- data/app/models/carts/cart.rb +35 -24
- data/app/models/chart.rb +16 -8
- data/app/models/checkout.rb +32 -9
- data/app/models/comp.rb +2 -8
- data/app/models/contribution.rb +111 -25
- data/app/models/daily_donation_report.rb +45 -0
- data/app/models/daily_ticket_report.rb +51 -0
- data/app/models/discount.rb +137 -0
- data/app/models/discounts/buy_one_get_one_free_discount_type.rb +20 -0
- data/app/models/discounts/discount_type.rb +66 -0
- data/app/models/discounts/dollars_off_tickets_discount_type.rb +32 -0
- data/app/models/discounts/percentage_off_tickets_discount_type.rb +25 -0
- data/app/models/discounts_report.rb +87 -0
- data/app/models/donation.rb +2 -0
- data/app/models/door_list.rb +5 -4
- data/app/models/event.rb +45 -16
- data/app/models/exchange.rb +26 -15
- data/app/models/ext/delayed_indexing.rb +24 -0
- data/app/models/ext/due.rb +7 -0
- data/app/models/ext/ext.rb +37 -0
- data/app/models/ext/integrations.rb +30 -0
- data/app/models/ext/resellable.rb +8 -1
- data/app/models/gateway_transaction.rb +47 -0
- data/app/models/import.rb +83 -101
- data/app/models/import_error.rb +1 -1
- data/app/models/import_row.rb +1 -1
- data/app/models/imports/donations_import.rb +103 -0
- data/app/models/imports/events_import.rb +207 -0
- data/app/models/imports/people_import.rb +41 -0
- data/app/models/imports/processing.rb +53 -0
- data/app/models/imports/rollback.rb +11 -0
- data/app/models/imports/status.rb +48 -0
- data/app/models/imports/validations.rb +31 -0
- data/app/models/item.rb +112 -29
- data/app/models/job/action_job.rb +29 -0
- data/app/models/job/daily_email_report_job.rb +11 -0
- data/app/models/job/tag_job.rb +15 -0
- data/app/models/kit.rb +14 -6
- data/app/models/kits/mailchimp_kit.rb +448 -0
- data/app/models/kits/reseller_kit.rb +2 -2
- data/app/models/kits/sponsored_donation_kit.rb +2 -2
- data/app/models/orders/application_order.rb +3 -1
- data/app/models/orders/comp_order.rb +15 -2
- data/app/models/orders/exchange_order.rb +8 -0
- data/app/models/orders/imported_order.rb +7 -0
- data/app/models/orders/order.rb +164 -51
- data/app/models/orders/refund_order.rb +14 -1
- data/app/models/orders/unrefundable.rb +5 -0
- data/app/models/orders/web_order.rb +1 -1
- data/app/models/organization.rb +38 -7
- data/app/models/parsed_row.rb +167 -0
- data/app/models/payments/comp_payment.rb +10 -1
- data/app/models/payments/credit_card_payment.rb +63 -10
- data/app/models/payments/payment.rb +28 -0
- data/app/models/person.rb +115 -43
- data/app/models/refund.rb +28 -28
- data/app/models/return.rb +2 -0
- data/app/models/sale.rb +8 -5
- data/app/models/search.rb +117 -0
- data/app/models/section.rb +18 -0
- data/app/models/segment.rb +14 -4
- data/app/models/show.rb +14 -4
- data/app/models/slices.rb +82 -0
- data/app/models/statement.rb +170 -3
- data/app/models/temp_discount.rb +14 -0
- data/app/models/ticket.rb +42 -134
- data/app/models/ticket/pricing.rb +45 -0
- data/app/models/ticket/reports.rb +10 -7
- data/app/models/ticket/sale_transitions.rb +44 -0
- data/app/models/ticket/transfers.rb +50 -0
- data/app/models/user.rb +10 -2
- data/app/models/valuation/lifetime_donations.rb +35 -0
- data/app/models/venue.rb +12 -1
- data/app/presenters/event_presenter.rb +41 -0
- data/app/views/actions/_list.html.haml +1 -2
- data/app/views/actions/new.html.haml +1 -1
- data/app/views/contributions/_form.html.haml +40 -0
- data/app/views/contributions/_sidebar.html.haml +12 -0
- data/app/views/contributions/edit.html.haml +11 -0
- data/app/views/contributions/index.html.haml +2 -2
- data/app/views/contributions/new.html.haml +5 -35
- data/app/views/discounts/_discount_section_fields.html.haml +25 -0
- data/app/views/discounts/_form.html.haml +95 -0
- data/app/views/discounts/edit.html.haml +16 -0
- data/app/views/discounts/index.html.haml +33 -0
- data/app/views/discounts/new.html.haml +16 -0
- data/app/views/discounts_reports/index.html.haml +76 -0
- data/app/views/events/_discount_section_fields.html.haml +25 -0
- data/app/views/events/_glance.html.haml +4 -1
- data/app/views/events/_list.html.haml +2 -4
- data/app/views/events/_menu.html.haml +3 -3
- data/app/views/events/_section_fields.html.haml +32 -15
- data/app/views/events/_share_and_sell.haml +2 -1
- data/app/views/events/edit.html.haml +7 -6
- data/app/views/events/image.html.haml +1 -0
- data/app/views/events/index.html.haml +3 -1
- data/app/views/events/messages.html.haml +1 -0
- data/app/views/events/prices.html.haml +2 -1
- data/app/views/events/resell.html.haml +1 -1
- data/app/views/events/show.html.haml +25 -1
- data/app/views/events/storefront_link.html.haml +1 -1
- data/app/views/events/temp_discount_form.html.haml +108 -0
- data/app/views/events/temp_discounts_index.html.haml +38 -0
- data/app/views/events/widget.html.haml +14 -1
- data/app/views/exchanges/new.html.haml +50 -73
- data/app/views/imports/{_imported.html.haml → donations/_approved.html.haml} +2 -5
- data/app/views/imports/donations/_caching.html.haml +17 -0
- data/app/views/imports/donations/_failed.html.haml +5 -0
- data/app/views/imports/donations/_imported.html.haml +9 -0
- data/app/views/imports/donations/_importing.html.haml +12 -0
- data/app/views/imports/donations/_invalid.html.haml +5 -0
- data/app/views/imports/donations/_new.html.haml +99 -0
- data/app/views/imports/donations/_pending.html.haml +41 -0
- data/app/views/imports/events/_approved.html.haml +10 -0
- data/app/views/imports/events/_caching.html.haml +17 -0
- data/app/views/imports/events/_failed.html.haml +5 -0
- data/app/views/imports/events/_imported.html.haml +9 -0
- data/app/views/imports/events/_importing.html.haml +12 -0
- data/app/views/imports/events/_invalid.html.haml +5 -0
- data/app/views/imports/events/_new.html.haml +95 -0
- data/app/views/imports/events/_pending.html.haml +35 -0
- data/app/views/imports/index.html.haml +41 -18
- data/app/views/imports/new.html.haml +1 -93
- data/app/views/imports/{_approved.html.haml → people/_approved.html.haml} +0 -1
- data/app/views/imports/{_caching.html.haml → people/_caching.html.haml} +0 -0
- data/app/views/imports/people/_failed.html.haml +5 -0
- data/app/views/imports/people/_imported.html.haml +25 -0
- data/app/views/imports/{_importing.html.haml → people/_importing.html.haml} +1 -2
- data/app/views/imports/people/_invalid.html.haml +5 -0
- data/app/views/imports/people/_new.html.haml +120 -0
- data/app/views/imports/people/_pending.html.haml +39 -0
- data/app/views/imports/shared/_date_format.html.haml +14 -0
- data/app/views/imports/shared/_failed.html.haml +18 -0
- data/app/views/imports/shared/_inspect_modal.html.haml +11 -0
- data/app/views/imports/shared/_invalid.html.haml +18 -0
- data/app/views/imports/shared/_knowledge_base.haml +2 -0
- data/app/views/imports/shared/_sidebar.html.haml +5 -0
- data/app/views/imports/show.html.haml +2 -2
- data/app/views/index/dashboard.html.haml +4 -2
- data/app/views/layouts/_custom_css_includes.haml +0 -0
- data/app/views/layouts/_custom_js_includes.haml +0 -0
- data/app/views/layouts/_google_analytics.html.haml +3 -3
- data/app/views/layouts/_menu.html.haml +6 -2
- data/app/views/layouts/application.html.haml +4 -0
- data/app/views/layouts/{devise.html.haml → devise_layout.html.haml} +0 -0
- data/app/views/order_mailer/confirmation_for.html.haml +3 -2
- data/app/views/order_mailer/confirmation_for.text.haml +3 -2
- data/app/views/orders/_grouped_form_help.haml +4 -0
- data/app/views/orders/_item_table.haml +15 -4
- data/app/views/orders/_order_sidebar.html.haml +27 -6
- data/app/views/orders/index.html.haml +1 -12
- data/app/views/orders/show.html.haml +1 -1
- data/app/views/organizations/_form.html.haml +20 -6
- data/app/views/organizations/edit.html.haml +2 -1
- data/app/views/organizations/new.html.haml +1 -0
- data/app/views/organizations/show.html.haml +7 -1
- data/app/views/people/_form.html.haml +5 -2
- data/app/views/people/_key_relationships.html.haml +1 -1
- data/app/views/people/_list.html.haml +1 -12
- data/app/views/people/_person_summary_sidebar.html.haml +82 -50
- data/app/views/people/_relationship_table_row.html.haml +1 -1
- data/app/views/people/edit.html.haml +3 -1
- data/app/views/people/index.html.haml +7 -1
- data/app/views/people/new.html.haml +2 -0
- data/app/views/people/show.html.haml +2 -0
- data/app/views/refunds/new.html.haml +4 -6
- data/app/views/reports_mailer/daily.html.haml +67 -0
- data/app/views/reports_mailer/daily.text.erb +16 -0
- data/app/views/sales/new.html.haml +5 -20
- data/app/views/searches/_form.html.haml +43 -0
- data/app/views/searches/_person.html.haml +7 -0
- data/app/views/searches/new.html.haml +10 -0
- data/app/views/searches/show.html.haml +64 -0
- data/app/views/sections/edit.html.haml +12 -0
- data/app/views/segments/index.html.haml +8 -4
- data/app/views/segments/show.html.haml +39 -5
- data/app/views/shared/_door_list_table.haml +24 -0
- data/app/views/shared/_event_image_icon.html.haml +1 -1
- data/app/views/shared/_preload_assets.html.haml +2 -0
- data/app/views/shared/_tags.html.haml +3 -2
- data/app/views/shows/_glance.html.haml +8 -2
- data/app/views/shows/_ticket_table.html.haml +17 -10
- data/app/views/shows/_upcoming.html.haml +1 -1
- data/app/views/shows/door_list.html.haml +2 -24
- data/app/views/shows/index.html.haml +3 -3
- data/app/views/shows/new.html.haml +2 -2
- data/app/views/shows/show.html.haml +1 -1
- data/app/views/slices/_data.json +50 -0
- data/app/views/slices/index.html.haml +58 -0
- data/app/views/statements/_discounts_table.html.haml +26 -0
- data/app/views/statements/_order_location_table.html.haml +20 -0
- data/app/views/statements/_payment_method_table.haml +20 -0
- data/app/views/statements/{_played_shows.html.haml → _shows.html.haml} +3 -3
- data/app/views/statements/_ticket_type_table.haml +20 -0
- data/app/views/statements/_top_stats.haml +12 -0
- data/app/views/statements/show.html.haml +24 -32
- data/app/views/store/events/_show.html.haml +11 -5
- data/app/views/store/events/show.html.haml +24 -5
- data/app/views/users/registrations/edit.html.erb +1 -1
- data/app/views/venues/edit.html.haml +1 -0
- data/config/artfully.yml.sample +3 -0
- data/config/initializers/active_model_serializer.rb +3 -0
- data/config/initializers/braintree_error_mapping.rb +5 -0
- data/config/initializers/devise.rb +1 -1
- data/config/locales/en.yml +1 -0
- data/config/routes.rb +31 -8
- data/db/migrate/0000_set_up_artfully.rb +9 -11
- data/db/migrate/20120809212802_add_do_not_email_to_people.rb +5 -0
- data/db/migrate/20120831200120_create_advanced_search.rb +30 -0
- data/db/migrate/20120926201927_add_email_to_organization.rb +5 -0
- data/db/migrate/20121001143351_add_import_id_orders_events.rb +6 -0
- data/db/migrate/20121006024736_add_import_to_actions.rb +5 -0
- data/db/migrate/20121011180654_add_type_to_imports.rb +14 -0
- data/db/migrate/20121024143846_create_discounts.rb +15 -0
- data/db/migrate/20121026131454_deleted_at_to_orders_items_actions.rb +7 -0
- data/db/migrate/20121026203948_add_initial_price_to_tickets.rb +5 -0
- data/db/migrate/20121029183949_change_initial_price_to_cart_price.rb +5 -0
- data/db/migrate/20121113144826_migrate_donation_types.rb +41 -0
- data/db/migrate/20121115020441_add_salutation_to_people.rb +5 -0
- data/db/migrate/20121130004314_add_visibility_to_sections.rb +6 -0
- data/db/migrate/20121205184343_add_discount_to_ticket.rb +6 -0
- data/db/migrate/20121206212835_add_discount_to_carts_and_items.rb +7 -0
- data/db/migrate/20121211193728_add_deleted_at_to_discounts.rb +5 -0
- data/db/migrate/20121212022026_add_uuid_to_show_and_event.rb +9 -0
- data/db/migrate/20121212023203_set_uuids.rb +11 -0
- data/db/migrate/20121217201422_add_minimum_ticket_count_to_discounts.rb +5 -0
- data/db/migrate/20121221154152_add_shows_and_sections_to_discounts.rb +5 -0
- data/db/migrate/20130103153946_make_shows_and_sections_habtm.rb +19 -0
- data/db/migrate/20130108213102_add_original_price_to_items.rb +10 -0
- data/db/migrate/20130111211929_convert_discounts_sections_to_array_of_strings.rb +14 -0
- data/db/migrate/20130114200128_add_discount_code_to_search.rb +5 -0
- data/db/migrate/20130114212408_add_limit_to_discounts.rb +5 -0
- data/db/migrate/20130116203331_add_title_to_person.rb +5 -0
- data/db/migrate/20130122143845_install_audited.rb +28 -0
- data/db/migrate/20130131024955_add_gateway_transactions.rb +13 -0
- data/db/migrate/20130301144159_add_receive_daily_sales_report_boolean_to_organizations.rb +5 -0
- data/db/migrate/20130306213416_add_subscribed_lists_to_people.rb +5 -0
- data/db/migrate/20130308193328_people_arent_dummies.rb +6 -0
- data/db/migrate/20130312173340_add_categories_to_events.rb +6 -0
- data/db/migrate/20130319110520_add_transaction_id_index.rb +6 -0
- data/db/migrate/20130320192827_add_index_to_notes.rb +8 -0
- data/db/migrate/20130324173939_add_index_to_import_rows.rb +5 -0
- data/db/migrate/20130325190110_add_indexes_to_actions.rb +9 -0
- data/db/migrate/20130326173653_add_lifetime_donations_to_people_and_searches.rb +9 -0
- data/lib/artfully_ose.rb +5 -1
- data/lib/artfully_ose/common_abilities.rb +6 -9
- data/lib/artfully_ose/engine.rb +19 -5
- data/lib/artfully_ose/version.rb +1 -1
- data/lib/email_validator.rb +6 -0
- metadata +442 -138
- data/MIT-LICENSE +0 -20
- data/app/controllers/pages_controller.rb +0 -29
- data/app/models/import_person.rb +0 -78
- data/app/views/imports/_failed.html.haml +0 -20
- data/app/views/imports/_pending.html.haml +0 -35
- data/app/views/index/splash.html.erb +0 -160
- data/app/views/segments/new.html.haml +0 -20
@@ -10,7 +10,7 @@ class ShowsController < ArtfullyOseController
|
|
10
10
|
|
11
11
|
def index
|
12
12
|
authorize! :manage, @event
|
13
|
-
@shows = Show.where(:event_id => @event.id).includes(:tickets
|
13
|
+
@shows = Show.where(:event_id => @event.id).includes(:tickets, :chart, :event => :venue).order('datetime ASC')
|
14
14
|
end
|
15
15
|
|
16
16
|
def duplicate
|
@@ -29,28 +29,39 @@ class ShowsController < ArtfullyOseController
|
|
29
29
|
def create
|
30
30
|
@event = Event.find(params[:event_id])
|
31
31
|
@show = @event.next_show
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
(render :new and return) unless valid_datetime?
|
33
|
+
ActiveRecord::Base.transaction do
|
34
|
+
chart_params = params[:show].delete(:chart)
|
35
|
+
if(chart_params.nil? || chart_params.empty?)
|
36
|
+
flash[:error] = "Please specify at least one ticket type for your show."
|
37
|
+
render :new and return
|
38
|
+
end
|
39
|
+
|
40
|
+
#clear the sections and replace them with whatever they entered
|
41
|
+
@show.chart.sections = []
|
42
|
+
@show.chart.update_attributes_from_params(chart_params)
|
43
|
+
@show.update_attributes(params[:show])
|
44
|
+
@show.organization = current_organization
|
45
|
+
@show.chart_id = @show.chart.id
|
46
|
+
@show.datetime = ActiveSupport::TimeZone.create(@event.time_zone).parse(params[:show][:datetime])
|
47
|
+
|
48
|
+
if @show.go!(publishing_show?)
|
49
|
+
flash[:notice] = "Show created on #{l @show.datetime_local_to_event, :format => :date_at_time}"
|
50
|
+
redirect_to event_show_path(@event, @show)
|
51
|
+
else
|
52
|
+
flash[:error] = "There was a problem creating your show: #{@show.errors.full_messages.reject{|e| e.end_with? "be blank"}.to_sentence}"
|
53
|
+
render :new
|
54
|
+
raise ActiveRecord::Rollback
|
55
|
+
end
|
37
56
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
@
|
42
|
-
|
43
|
-
|
44
|
-
@show.chart_id = @show.chart.id
|
45
|
-
@show.datetime = ActiveSupport::TimeZone.create(@event.time_zone).parse(params[:show][:datetime])
|
46
|
-
|
47
|
-
if @show.go!(publishing_show?)
|
48
|
-
flash[:notice] = "Show created on #{l @show.datetime_local_to_event, :format => :date_at_time}"
|
49
|
-
redirect_to event_show_path(@event, @show)
|
50
|
-
else
|
51
|
-
flash[:error] = "There was a problem creating your show: #{@show.errors.full_messages.reject{|e| e.end_with? "be blank"}.to_sentence}"
|
52
|
-
render :new
|
57
|
+
end
|
58
|
+
|
59
|
+
def valid_datetime?
|
60
|
+
if ActiveSupport::TimeZone.create(@event.time_zone).parse(params[:show][:datetime]) < Time.now
|
61
|
+
flash[:error] = "Please pick a date and time that is in the future."
|
62
|
+
return false
|
53
63
|
end
|
64
|
+
true
|
54
65
|
end
|
55
66
|
|
56
67
|
def publishing_show?
|
@@ -58,11 +69,9 @@ class ShowsController < ArtfullyOseController
|
|
58
69
|
end
|
59
70
|
|
60
71
|
def show
|
61
|
-
@show = Show.find(params[:id])
|
72
|
+
@show = Show.includes(:event => :venue, :tickets => :section).find(params[:id])
|
62
73
|
authorize! :view, @show
|
63
|
-
|
64
|
-
@show.tickets = @show.tickets
|
65
|
-
@tickets = @show.tickets.includes(:section)
|
74
|
+
@tickets = @show.tickets
|
66
75
|
end
|
67
76
|
|
68
77
|
def edit
|
@@ -125,7 +134,7 @@ class ShowsController < ArtfullyOseController
|
|
125
134
|
@show.publish!
|
126
135
|
respond_to do |format|
|
127
136
|
format.html { redirect_to event_show_url(@show.event, @show), :notice => 'Your show is now published.' }
|
128
|
-
format.json { render :json => @show.as_json
|
137
|
+
format.json { render :json => @show.as_json }
|
129
138
|
end
|
130
139
|
end
|
131
140
|
end
|
@@ -138,7 +147,7 @@ class ShowsController < ArtfullyOseController
|
|
138
147
|
@show.unpublish!
|
139
148
|
respond_to do |format|
|
140
149
|
format.html { redirect_to event_show_url(@show.event, @show), :notice => 'Your show is now unpublished.' }
|
141
|
-
format.json { render :json => @show.as_json
|
150
|
+
format.json { render :json => @show.as_json }
|
142
151
|
end
|
143
152
|
end
|
144
153
|
end
|
@@ -192,7 +201,7 @@ class ShowsController < ArtfullyOseController
|
|
192
201
|
|
193
202
|
private
|
194
203
|
def find_event
|
195
|
-
@event = Event.includes(:shows).find(params[:event_id])
|
204
|
+
@event = Event.includes(:shows => [:event => :venue]).find(params[:event_id])
|
196
205
|
end
|
197
206
|
|
198
207
|
def upcoming_shows
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class SlicesController < ArtfullyOseController
|
2
|
+
before_filter :load_statement
|
3
|
+
|
4
|
+
def index
|
5
|
+
@select_options = [
|
6
|
+
["", ""],
|
7
|
+
["Location", "order_location_proc"],
|
8
|
+
["Payment Method", "payment_method_proc"],
|
9
|
+
["Ticket Type", "ticket_type_proc"],
|
10
|
+
["Discount", "discount_code_proc"],
|
11
|
+
["First time/Repeat", "first_time_buyer_proc"]
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# TODO TODO TODO
|
17
|
+
# - Dollar amounts on ticket types
|
18
|
+
# - Select all drop downs then de-select them
|
19
|
+
#
|
20
|
+
|
21
|
+
def data
|
22
|
+
# convert URL string slice[] into procs
|
23
|
+
slices = Array.wrap(params[:slice]).map { |s| Slices.send(s) }
|
24
|
+
data = Slicer.slice(Slice.new("All Sales"), @items, slices)
|
25
|
+
|
26
|
+
respond_to do |format|
|
27
|
+
format.json { render :json => data.children }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_statement
|
32
|
+
@show = Show.includes(:event, :tickets => [:items => :order]).find(params[:statement_id])
|
33
|
+
@total_tickets = @show.tickets.select{|t| t.sold?}.size + @show.tickets.select{|t| t.comped?}.size
|
34
|
+
authorize! :view, @show.event
|
35
|
+
@items = Item.includes(:product, :order, :show => :event).where(:show_id => params[:statement_id])
|
36
|
+
end
|
37
|
+
end
|
@@ -5,7 +5,7 @@ class StatementsController < ArtfullyOseController
|
|
5
5
|
if params[:event_id].present?
|
6
6
|
@event = Event.find(params[:event_id])
|
7
7
|
authorize! :view, @event
|
8
|
-
@
|
8
|
+
@shows = @event.shows
|
9
9
|
@statement = nil
|
10
10
|
render :show and return
|
11
11
|
else
|
@@ -15,11 +15,11 @@ class StatementsController < ArtfullyOseController
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def show
|
18
|
-
@show = Show.find(params[:id])
|
18
|
+
@show = ::Show.includes(:event => :venue, :items => [:order, :discount, :product => :section]).find(params[:id])
|
19
19
|
authorize! :view, @show
|
20
20
|
@event = @show.event
|
21
|
-
@
|
22
|
-
@statement = Statement.for_show(@show,
|
21
|
+
@shows = @event.shows.includes(:event => :venue)
|
22
|
+
@statement = Statement.for_show(@show, @show.imported?)
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
@@ -8,23 +8,25 @@ class Store::CheckoutsController < Store::StoreController
|
|
8
8
|
|
9
9
|
@payment = CreditCardPayment.new(params[:payment])
|
10
10
|
@payment.user_agreement = params[:payment][:user_agreement]
|
11
|
-
current_cart.special_instructions = params[:special_instructions]
|
11
|
+
current_cart.special_instructions = params[:special_instructions]
|
12
12
|
|
13
13
|
@checkout = Checkout.new(current_cart, @payment)
|
14
14
|
|
15
15
|
if @checkout.valid? && @checkout.finish
|
16
16
|
render :json => @checkout.to_json
|
17
|
-
else
|
18
|
-
|
19
|
-
message = message.gsub('customer', 'contact info')
|
20
|
-
message = message.gsub('credit card is', 'payment details are')
|
21
|
-
message = message[0].upcase + message[1..message.length] unless message.blank? #capitalize first word
|
22
|
-
|
23
|
-
if message.blank?
|
24
|
-
message = "We had a problem contacting our payment processor. Wait a few moments and try again or contact us to complete your purchase"
|
25
|
-
end
|
26
|
-
|
27
|
-
render :json => message, :status => :unprocessable_entity
|
17
|
+
else
|
18
|
+
render :json => @checkout.message, :status => :unprocessable_entity
|
28
19
|
end
|
20
|
+
rescue Exception => e
|
21
|
+
Exceptional.context(:params => filter(params))
|
22
|
+
Exceptional.handle(e, "Checkout failed!")
|
23
|
+
message = "We're sorry but we could not process the sale. Please make sure all fields are filled out accurately"
|
24
|
+
render :json => message, :status => :unprocessable_entity
|
25
|
+
end
|
26
|
+
|
27
|
+
def filter(params)
|
28
|
+
filters = Rails.application.config.filter_parameters
|
29
|
+
f = ActionDispatch::Http::ParameterFilter.new filters
|
30
|
+
f.filter params
|
29
31
|
end
|
30
32
|
end
|
@@ -25,18 +25,37 @@ class Store::OrdersController < Store::StoreController
|
|
25
25
|
order_params = order_params.merge(:tickets => ticket_ids) if ticket_ids.any?
|
26
26
|
end
|
27
27
|
order_params = order_params.merge(:donation => params[:donation]) if params[:donation]
|
28
|
+
|
28
29
|
handle_order(order_params)
|
30
|
+
if params[:discount].present?
|
31
|
+
begin
|
32
|
+
handle_discount(params)
|
33
|
+
rescue RuntimeError => e
|
34
|
+
discount_error = e.message
|
35
|
+
params[:discount] = nil
|
36
|
+
@discount_amount = 0
|
37
|
+
rescue NoMethodError => e
|
38
|
+
discount_error = "We could not find your discount. Please try again."
|
39
|
+
params[:discount] = nil
|
40
|
+
@discount_amount = 0
|
41
|
+
end
|
42
|
+
end
|
29
43
|
|
30
44
|
response = current_cart.as_json
|
31
45
|
response = response.merge(:total => current_cart.total)
|
32
46
|
response = response.merge(:service_charge => current_cart.fee_in_cents)
|
33
|
-
response = response.merge(:over_section_limit => over_section_limit)
|
34
|
-
|
47
|
+
response = response.merge(:over_section_limit => over_section_limit)
|
48
|
+
response = response.merge(:discount_error => discount_error)
|
49
|
+
if params[:discount].present? && discount_error.blank?
|
50
|
+
response = response.merge(:discount_name => params[:discount])
|
51
|
+
response = response.merge(:discount_amount => current_cart.discount_amount)
|
52
|
+
end
|
53
|
+
render :json => response.to_json
|
35
54
|
end
|
36
55
|
|
37
56
|
private
|
38
57
|
|
39
|
-
def handle_order(params)
|
58
|
+
def handle_order(params)
|
40
59
|
handle_tickets(params[:tickets]) if params.has_key? :tickets
|
41
60
|
handle_donation(params[:donation]) if params.has_key? :donation
|
42
61
|
|
@@ -45,6 +64,12 @@ class Store::OrdersController < Store::StoreController
|
|
45
64
|
end
|
46
65
|
end
|
47
66
|
|
67
|
+
def handle_discount(params)
|
68
|
+
discount = Discount.find_by_code_and_event_id(params[:discount].upcase, event.id)
|
69
|
+
discount.apply_discount_to_cart(current_cart)
|
70
|
+
current_cart = discount.cart
|
71
|
+
end
|
72
|
+
|
48
73
|
def handle_tickets(ids)
|
49
74
|
Ticket.find(ids).each do |ticket|
|
50
75
|
if current_cart.can_hold? ticket
|
@@ -62,10 +87,12 @@ class Store::OrdersController < Store::StoreController
|
|
62
87
|
end
|
63
88
|
|
64
89
|
donation = Donation.new
|
65
|
-
|
66
90
|
donation.amount = data[:amount]
|
67
91
|
donation.organization = Organization.find(data.delete(:organization_id))
|
68
|
-
|
69
92
|
current_cart.donations << donation
|
70
93
|
end
|
94
|
+
|
95
|
+
def event
|
96
|
+
current_cart.tickets.first.event
|
97
|
+
end
|
71
98
|
end
|
@@ -10,6 +10,10 @@ class VenuesController < ArtfullyOseController
|
|
10
10
|
authorize! :edit, @event
|
11
11
|
@venue = @event.venue
|
12
12
|
@venue.update_attributes(params[:venue])
|
13
|
-
|
13
|
+
if params[:commit].try(:downcase) =~ /next/
|
14
|
+
redirect_to prices_event_path(@event)
|
15
|
+
else
|
16
|
+
redirect_to event_url(@event)
|
17
|
+
end
|
14
18
|
end
|
15
|
-
end
|
19
|
+
end
|
@@ -12,6 +12,18 @@ module ArtfullyOseHelper
|
|
12
12
|
"✓".html_safe
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def build_order_location(order)
|
17
|
+
order.location
|
18
|
+
end
|
19
|
+
|
20
|
+
def channel_checkbox(channel)
|
21
|
+
channel.to_s.eql?("storefront") ? "Storefront & Widgets" : channel.to_s.humanize
|
22
|
+
end
|
23
|
+
|
24
|
+
def channel_text(channel)
|
25
|
+
channel.to_s.humanize
|
26
|
+
end
|
15
27
|
|
16
28
|
#
|
17
29
|
# For use with the nav-pills to select an intem based on a current selection
|
@@ -36,12 +48,18 @@ module ArtfullyOseHelper
|
|
36
48
|
def icon_link_to(text, href, icon, class_names, id, html_attributes={})
|
37
49
|
s = "<a href='#{href}' class='#{class_names}' id='#{id}' "
|
38
50
|
html_attributes.each do |k,v|
|
39
|
-
s = s + " #{k}=#{v} "
|
51
|
+
s = s + " #{k}=#{v} "
|
40
52
|
end
|
41
53
|
s = s + "><i class='#{icon}'></i> #{text}</a>"
|
42
54
|
s.html_safe
|
43
55
|
end
|
44
56
|
|
57
|
+
def action_and_subtype(action)
|
58
|
+
s = "#{action.action_type.capitalize}"
|
59
|
+
s = s + " - #{action.subtype}" unless action.subtype.nil?
|
60
|
+
s
|
61
|
+
end
|
62
|
+
|
45
63
|
#
|
46
64
|
# just name the image, this method will prepend the path and append the .png
|
47
65
|
# icon_tag('111-logo')
|
@@ -56,7 +74,7 @@ module ArtfullyOseHelper
|
|
56
74
|
|
57
75
|
#This is for the widget generator, DO NOT use anywhere else
|
58
76
|
def fully_qualified_asset_path(asset)
|
59
|
-
"#{
|
77
|
+
"#{asset_path(asset, :digest => false)}"
|
60
78
|
end
|
61
79
|
|
62
80
|
def events_to_options(selected_event_id = nil)
|
@@ -216,17 +234,17 @@ module ArtfullyOseHelper
|
|
216
234
|
end
|
217
235
|
|
218
236
|
def link_to_remove_fields(name, f)
|
219
|
-
f.hidden_field(:_destroy) +
|
237
|
+
f.hidden_field(:_destroy) + link_to(name, "#", :onclick => "remove_fields(this); return false;")
|
220
238
|
end
|
221
239
|
|
222
|
-
def link_to_add_fields(name, f, association, view_path = '')
|
240
|
+
def link_to_add_fields(name, f, association, view_path = '', additional_javascript=nil)
|
223
241
|
new_object = f.object.class.reflect_on_association(association).klass.new
|
224
242
|
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
|
225
243
|
view_path = view_path + '/' unless view_path.blank?
|
226
244
|
template_path = view_path + association.to_s.singularize + "_fields"
|
227
245
|
render(template_path, :f => builder)
|
228
246
|
end
|
229
|
-
|
247
|
+
link_to name, "#", :onclick => "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\"); #{additional_javascript} return false;"
|
230
248
|
end
|
231
249
|
|
232
250
|
def ticket_seller_name(ticket)
|
@@ -234,4 +252,12 @@ module ArtfullyOseHelper
|
|
234
252
|
|
235
253
|
def credit_card_message
|
236
254
|
end
|
255
|
+
|
256
|
+
def date_field_tag(name, value = nil, options = {})
|
257
|
+
text_field_tag(name, value, options.stringify_keys.update("type" => "date"))
|
258
|
+
end
|
259
|
+
|
260
|
+
def datetime_field_tag(name, value = nil, options = {})
|
261
|
+
text_field_tag(name, value, options.stringify_keys.update("type" => "datetime"))
|
262
|
+
end
|
237
263
|
end
|
@@ -1,22 +1,5 @@
|
|
1
|
-
module PeopleHelper
|
2
|
-
def relationship_name_display(person)
|
3
|
-
link_to person.first_name + ' ' + person.last_name, person_path(person)
|
4
|
-
end
|
5
|
-
|
6
|
-
def display_name(person)
|
7
|
-
if person.nil?
|
8
|
-
"(none)"
|
9
|
-
elsif person.dummy?
|
10
|
-
"Anonymous"
|
11
|
-
elsif person.last_name.blank? && person.first_name.blank?
|
12
|
-
person.email
|
13
|
-
else
|
14
|
-
"#{person.first_name} #{person.last_name}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
#yuck
|
1
|
+
module PeopleHelper
|
19
2
|
def link_to_person(person)
|
20
|
-
link_to
|
3
|
+
link_to person, person
|
21
4
|
end
|
22
5
|
end
|
data/app/mailers/order_mailer.rb
CHANGED
@@ -1,12 +1,30 @@
|
|
1
1
|
class OrderMailer < ActionMailer::Base
|
2
|
-
default :from => "support@artful.ly"
|
3
2
|
layout "mail"
|
4
3
|
|
5
|
-
# TODO: Send using only information from Order
|
6
4
|
def confirmation_for(order)
|
7
5
|
@order = order
|
8
6
|
@person = order.person
|
7
|
+
options = Hash.new.tap do |o|
|
8
|
+
o[:to] = @person.email
|
9
|
+
o[:from] = from(@order)
|
10
|
+
o[:subject] = "Your Order"
|
11
|
+
if order.contact_email.present?
|
12
|
+
o[:reply_to] = order.contact_email
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
mail(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
9
20
|
|
10
|
-
|
21
|
+
def from(order)
|
22
|
+
if ARTFULLY_CONFIG[:contact_email].present?
|
23
|
+
ARTFULLY_CONFIG[:contact_email]
|
24
|
+
elsif order.contact_email.present?
|
25
|
+
order.contact_email
|
26
|
+
else
|
27
|
+
order.organization.email
|
28
|
+
end
|
11
29
|
end
|
12
30
|
end
|