alchemy_crm 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.travis.yml +12 -0
- data/Gemfile +21 -0
- data/Guardfile +13 -0
- data/LICENSE +24 -0
- data/README.md +82 -0
- data/Rakefile +27 -0
- data/alchemy_crm.gemspec +31 -0
- data/app/assets/images/.DS_Store +0 -0
- data/app/assets/images/alchemy_crm/.DS_Store +0 -0
- data/app/assets/images/alchemy_crm/contact-icons.png +0 -0
- data/app/assets/images/alchemy_crm/fill_content.gif +0 -0
- data/app/assets/images/alchemy_crm/group-icons.png +0 -0
- data/app/assets/images/alchemy_crm/mailing-icons.png +0 -0
- data/app/assets/images/alchemy_crm/module_icon.png +0 -0
- data/app/assets/images/alchemy_crm/newsletter-icons.png +0 -0
- data/app/assets/images/alchemy_crm/statistic.png +0 -0
- data/app/assets/images/alchemy_crm/tag-icons.png +0 -0
- data/app/assets/javascripts/alchemy_crm/alchemy_crm.base.js +65 -0
- data/app/assets/javascripts/alchemy_crm/scripts.js +2 -0
- data/app/assets/stylesheets/alchemy_crm/base.css.scss +473 -0
- data/app/assets/stylesheets/alchemy_crm/styles.css +3 -0
- data/app/controllers/alchemy_crm/admin/base_controller.rb +7 -0
- data/app/controllers/alchemy_crm/admin/contact_groups_controller.rb +23 -0
- data/app/controllers/alchemy_crm/admin/contacts_controller.rb +112 -0
- data/app/controllers/alchemy_crm/admin/deliveries_controller.rb +80 -0
- data/app/controllers/alchemy_crm/admin/elements_controller_extension.rb +32 -0
- data/app/controllers/alchemy_crm/admin/mailings_controller.rb +47 -0
- data/app/controllers/alchemy_crm/admin/newsletters_controller.rb +24 -0
- data/app/controllers/alchemy_crm/admin/tags_controller.rb +62 -0
- data/app/controllers/alchemy_crm/base_controller.rb +5 -0
- data/app/controllers/alchemy_crm/contacts_controller.rb +103 -0
- data/app/controllers/alchemy_crm/mailings_controller.rb +20 -0
- data/app/controllers/alchemy_crm/recipients_controller.rb +35 -0
- data/app/controllers/alchemy_crm/subscriptions_controller.rb +57 -0
- data/app/helpers/alchemy/pages_helper_extension.rb +18 -0
- data/app/helpers/alchemy_crm/admin/base_helper.rb +12 -0
- data/app/helpers/alchemy_crm/mailings_helper.rb +190 -0
- data/app/mailers/alchemy_crm/bounce_receiver.rb +13 -0
- data/app/mailers/alchemy_crm/contacts_mailer.rb +26 -0
- data/app/mailers/alchemy_crm/mailings_mailer.rb +48 -0
- data/app/mailers/alchemy_crm/subscriptions_mailer.rb +17 -0
- data/app/models/alchemy/essence_element_teaser.rb +19 -0
- data/app/models/alchemy_crm/contact.rb +264 -0
- data/app/models/alchemy_crm/contact_group.rb +26 -0
- data/app/models/alchemy_crm/contact_group_filter.rb +26 -0
- data/app/models/alchemy_crm/delivery.rb +57 -0
- data/app/models/alchemy_crm/element_extension.rb +28 -0
- data/app/models/alchemy_crm/mailing.rb +93 -0
- data/app/models/alchemy_crm/newsletter.rb +48 -0
- data/app/models/alchemy_crm/reaction.rb +9 -0
- data/app/models/alchemy_crm/recipient.rb +48 -0
- data/app/models/alchemy_crm/subscription.rb +8 -0
- data/app/views/alchemy/admin/elements/_view_not_found.text.erb +0 -0
- data/app/views/alchemy/admin/elements/fill.js.erb +13 -0
- data/app/views/alchemy/admin/elements/link.js.erb +1 -0
- data/app/views/alchemy/elements/_newsletter_article_editor.html.erb +4 -0
- data/app/views/alchemy/elements/_newsletter_article_view.html.erb +16 -0
- data/app/views/alchemy/elements/_newsletter_article_view.text.erb +5 -0
- data/app/views/alchemy/elements/_newsletter_greeting_editor.html.erb +3 -0
- data/app/views/alchemy/elements/_newsletter_greeting_view.html.erb +11 -0
- data/app/views/alchemy/elements/_newsletter_greeting_view.text.erb +6 -0
- data/app/views/alchemy/elements/_newsletter_signout_form_editor.html.erb +3 -0
- data/app/views/alchemy/elements/_newsletter_signout_form_view.html.erb +32 -0
- data/app/views/alchemy/elements/_newsletter_signout_mail_editor.html.erb +4 -0
- data/app/views/alchemy/elements/_newsletter_signup_form_editor.html.erb +6 -0
- data/app/views/alchemy/elements/_newsletter_signup_form_view.html.erb +78 -0
- data/app/views/alchemy/elements/_newsletter_signup_mail_editor.html.erb +4 -0
- data/app/views/alchemy/essences/_essence_date_view.text.erb +3 -0
- data/app/views/alchemy/essences/_essence_element_teaser_editor.html.erb +31 -0
- data/app/views/alchemy/essences/_essence_element_teaser_view.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_element_teaser_view.text.erb +3 -0
- data/app/views/alchemy/essences/_essence_richtext_view.text.erb +1 -0
- data/app/views/alchemy/essences/_essence_text_view.text.erb +1 -0
- data/app/views/alchemy/newsletter_layouts/_standard.html.erb +39 -0
- data/app/views/alchemy/newsletter_layouts/_standard.text.erb +5 -0
- data/app/views/alchemy_crm/admin/contact_groups/_contact_group.html.erb +32 -0
- data/app/views/alchemy_crm/admin/contact_groups/_filter.html.erb +30 -0
- data/app/views/alchemy_crm/admin/contact_groups/_form.html.erb +47 -0
- data/app/views/alchemy_crm/admin/contact_groups/_tag.html.erb +6 -0
- data/app/views/alchemy_crm/admin/contact_groups/add_filter.js.erb +9 -0
- data/app/views/alchemy_crm/admin/contact_groups/destroy.rjs +1 -0
- data/app/views/alchemy_crm/admin/contact_groups/edit.html.erb +1 -0
- data/app/views/alchemy_crm/admin/contact_groups/index.html.erb +41 -0
- data/app/views/alchemy_crm/admin/contact_groups/new.html.erb +1 -0
- data/app/views/alchemy_crm/admin/contacts/_contact.html.erb +44 -0
- data/app/views/alchemy_crm/admin/contacts/_form.html.erb +86 -0
- data/app/views/alchemy_crm/admin/contacts/destroy.rjs +1 -0
- data/app/views/alchemy_crm/admin/contacts/edit.html.erb +1 -0
- data/app/views/alchemy_crm/admin/contacts/import.html.erb +33 -0
- data/app/views/alchemy_crm/admin/contacts/import.js.erb +2 -0
- data/app/views/alchemy_crm/admin/contacts/index.html.erb +51 -0
- data/app/views/alchemy_crm/admin/contacts/new.html.erb +1 -0
- data/app/views/alchemy_crm/admin/contacts/vcf_import_result.html.erb +49 -0
- data/app/views/alchemy_crm/admin/deliveries/_delivery.html.erb +41 -0
- data/app/views/alchemy_crm/admin/deliveries/_form.html.erb +65 -0
- data/app/views/alchemy_crm/admin/deliveries/_recipient.html.erb +40 -0
- data/app/views/alchemy_crm/admin/deliveries/edit.html.erb +1 -0
- data/app/views/alchemy_crm/admin/deliveries/index.html.erb +29 -0
- data/app/views/alchemy_crm/admin/deliveries/new.html.erb +1 -0
- data/app/views/alchemy_crm/admin/deliveries/show.html.erb +66 -0
- data/app/views/alchemy_crm/admin/elements/link.rjs +4 -0
- data/app/views/alchemy_crm/admin/elements/teasables.html.erb +57 -0
- data/app/views/alchemy_crm/admin/mailings/_form.html.erb +43 -0
- data/app/views/alchemy_crm/admin/mailings/_mailing.html.erb +75 -0
- data/app/views/alchemy_crm/admin/mailings/edit.html.erb +1 -0
- data/app/views/alchemy_crm/admin/mailings/edit_content.html.erb +194 -0
- data/app/views/alchemy_crm/admin/mailings/import_result.html.erb +37 -0
- data/app/views/alchemy_crm/admin/mailings/index.html.erb +39 -0
- data/app/views/alchemy_crm/admin/mailings/new.html.erb +1 -0
- data/app/views/alchemy_crm/admin/mailings/show.html.erb +1 -0
- data/app/views/alchemy_crm/admin/mailings/show.text.erb +1 -0
- data/app/views/alchemy_crm/admin/newsletters/_form.html.erb +54 -0
- data/app/views/alchemy_crm/admin/newsletters/_newsletter.html.erb +42 -0
- data/app/views/alchemy_crm/admin/newsletters/_tag_with_radiobutton.html.erb +7 -0
- data/app/views/alchemy_crm/admin/newsletters/destroy.rjs +1 -0
- data/app/views/alchemy_crm/admin/newsletters/edit.html.erb +1 -0
- data/app/views/alchemy_crm/admin/newsletters/index.html.erb +42 -0
- data/app/views/alchemy_crm/admin/newsletters/new.html.erb +10 -0
- data/app/views/alchemy_crm/admin/tags/_radio_tag.html.erb +6 -0
- data/app/views/alchemy_crm/admin/tags/_tag.html.erb +32 -0
- data/app/views/alchemy_crm/admin/tags/edit.html.erb +40 -0
- data/app/views/alchemy_crm/admin/tags/index.html.erb +35 -0
- data/app/views/alchemy_crm/admin/tags/new.html.erb +16 -0
- data/app/views/alchemy_crm/contacts_mailer/signout_mail.html.erb +8 -0
- data/app/views/alchemy_crm/contacts_mailer/signout_mail.text.erb +4 -0
- data/app/views/alchemy_crm/contacts_mailer/signup_mail.html.erb +11 -0
- data/app/views/alchemy_crm/contacts_mailer/signup_mail.text.erb +4 -0
- data/app/views/alchemy_crm/mailings/show.html.erb +1 -0
- data/app/views/alchemy_crm/mailings_mailer/verification_mail.html.erb +11 -0
- data/app/views/alchemy_crm/subscriptions/index.html.erb +23 -0
- data/app/views/alchemy_crm/subscriptions_mailer/overview_mail.html.erb +27 -0
- data/app/views/alchemy_crm/subscriptions_mailer/overview_mail.text.erb +19 -0
- data/app/views/csv_magic/import_errors.html.erb +44 -0
- data/app/views/csv_magic/mapper.html.erb +62 -0
- data/app/views/layouts/alchemy_crm/mailings.html.erb +212 -0
- data/app/views/layouts/alchemy_crm/mailings.text.erb +3 -0
- data/config/alchemy_crm.config.yml +21 -0
- data/config/authorization_rules.rb +37 -0
- data/config/initializers/assets.rb +4 -0
- data/config/initializers/delayed_job.rb +6 -0
- data/config/locales/alchemy.de.yml +55 -0
- data/config/locales/alchemy.en.yml +52 -0
- data/config/locales/alchemy_crm.de.yml +196 -0
- data/config/locales/alchemy_crm.en.yml +53 -0
- data/config/locales/localized_country_select.de.rb +268 -0
- data/config/locales/localized_country_select.en.rb +282 -0
- data/config/module_definition.yml +30 -0
- data/config/routes.rb +71 -0
- data/db/migrate/20100708220434_create_mailings.rb +19 -0
- data/db/migrate/20100708220534_create_contacts.rb +27 -0
- data/db/migrate/20100708220812_create_contact_groups.rb +13 -0
- data/db/migrate/20100708221009_create_newsletters.rb +15 -0
- data/db/migrate/20100708221319_create_sent_mailings.rb +15 -0
- data/db/migrate/20100708221529_create_recipients.rb +21 -0
- data/db/migrate/20100708222620_acts_as_taggable_migration.rb +28 -0
- data/db/migrate/20100708223324_create_contact_group_filters.rb +17 -0
- data/db/migrate/20100708223727_create_newsletter_subscriptions.rb +14 -0
- data/db/migrate/20100708223922_create_essence_element_teasers.rb +15 -0
- data/db/migrate/20100714172207_create_contact_groups_newsletters.rb +12 -0
- data/db/migrate/20100927152601_create_reactions.rb +14 -0
- data/db/migrate/20111028091722_acts_as_taggable_on_migration.rb +15 -0
- data/db/migrate/20111028200710_add_counter_cache_columns_for_tags.rb +11 -0
- data/db/migrate/20111030204931_create_delayed_jobs.rb +21 -0
- data/db/migrate/20111104105854_add_deliver_at_to_sent_mailings.rb +9 -0
- data/db/migrate/20111104125306_remove_sent_mailing_pdf_id_from_sent_mailings.rb +9 -0
- data/db/migrate/20111104131912_add_delivered_at_to_sent_mailings.rb +9 -0
- data/db/migrate/20111124145923_namespace_alchemy_crm_models.rb +17 -0
- data/db/migrate/20120306115555_add_disabled_to_alchemy_crm_contacts.rb +5 -0
- data/db/migrate/20120307160721_rename_alchemy_crm_recipients_sent_mailing_id.rb +5 -0
- data/db/migrate/20120315113522_add_url_to_alchemy_crm_reactions.rb +5 -0
- data/db/migrate/20120316161333_add_sha1_and_salt_to_alchemy_crm_recipients.rb +6 -0
- data/db/migrate/20120320103412_add_indexes_to_alchemy_crm_sha1_columns.rb +7 -0
- data/db/migrate/20120321105455_add_queue_to_delayed_jobs.rb +9 -0
- data/db/migrate/20120327174301_add_more_indexes_to_alchemy_crm_tables.rb +12 -0
- data/lib/alchemy_crm.rb +18 -0
- data/lib/alchemy_crm/bounced_delivery.rb +46 -0
- data/lib/alchemy_crm/config.rb +28 -0
- data/lib/alchemy_crm/engine.rb +40 -0
- data/lib/alchemy_crm/i18n_helpers.rb +35 -0
- data/lib/alchemy_crm/newsletter_layout.rb +40 -0
- data/lib/alchemy_crm/seeder.rb +30 -0
- data/lib/alchemy_crm/version.rb +3 -0
- data/lib/generators/alchemy_crm/scaffold/files/_standard.html.erb +1 -0
- data/lib/generators/alchemy_crm/scaffold/files/_standard.text.erb +1 -0
- data/lib/generators/alchemy_crm/scaffold/files/elements.yml +51 -0
- data/lib/generators/alchemy_crm/scaffold/files/newsletter_layouts.yml +3 -0
- data/lib/generators/alchemy_crm/scaffold/files/newsletters.html.erb +22 -0
- data/lib/generators/alchemy_crm/scaffold/files/newsletters.text.erb +4 -0
- data/lib/generators/alchemy_crm/scaffold/files/page_layouts.yml +19 -0
- data/lib/generators/alchemy_crm/scaffold/scaffold_generator.rb +26 -0
- data/lib/tasks/alchemy_crm.rake +28 -0
- data/lib/tasks/routes.rake +29 -0
- data/rails/init.rb +1 -0
- data/recipes/alchemy-mailings-capistrano-tasks.rb +12 -0
- data/spec/alchemy_mailings_spec.rb +7 -0
- data/spec/config_spec.rb +28 -0
- data/spec/controllers/alchemy_crm/contacts_controller_spec.rb +210 -0
- data/spec/controllers/alchemy_crm/mailings_controller_spec.rb +89 -0
- data/spec/controllers/alchemy_crm/recipients_controller_spec.rb +155 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/alchemy/config.yml +142 -0
- data/spec/dummy/config/alchemy/elements.yml +79 -0
- data/spec/dummy/config/alchemy/newsletter_layouts.yml +4 -0
- data/spec/dummy/config/alchemy/page_layouts.yml +55 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/schema.rb +452 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/helpers/alchemy_crm/mailings_helper_spec.rb +169 -0
- data/spec/mailers/alchemy_crm/contacts_mailer_spec.rb +88 -0
- data/spec/mailers/alchemy_crm/mailings_mailer_spec.rb +42 -0
- data/spec/models/alchemy_crm/contact_group_spec.rb +41 -0
- data/spec/models/alchemy_crm/contact_spec.rb +108 -0
- data/spec/models/alchemy_crm/delivery_spec.rb +55 -0
- data/spec/models/alchemy_crm/mailing_spec.rb +63 -0
- data/spec/models/alchemy_crm/newsletter_spec.rb +45 -0
- data/spec/spec_helper.rb +58 -0
- data/vendor/assets/javascripts/autocomplete-rails.js +16 -0
- metadata +438 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module AlchemyCrm
|
4
|
+
describe MailingsController do
|
5
|
+
|
6
|
+
describe '#show' do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@newsletter = Newsletter.create!(:name => 'Newsletter', :layout => 'newsletter_layout_standard')
|
10
|
+
@mailing = Mailing.create!(:name => 'Mailing', :newsletter => @newsletter)
|
11
|
+
end
|
12
|
+
|
13
|
+
context "receiving an id" do
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
get :show, {:id => @mailing.id, :use_route => :alchemy_crm}
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a recipient" do
|
20
|
+
assigns(:recipient).should_not be(nil)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have a fake contact" do
|
24
|
+
assigns(:contact).email.should == Contact.fake.email
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
context "receiving a hash and email from recipient with contact" do
|
30
|
+
|
31
|
+
before(:each) do
|
32
|
+
@contact = Contact.create!({:email => 'jon@doe.com', :firstname => 'Jon', :lastname => 'Doe', :salutation => 'mr', :verified => true}, :as => :admin)
|
33
|
+
@recipient = Recipient.create!(:email => 'foo@baz.org', :contact => @contact)
|
34
|
+
@delivery = Delivery.create!(:recipients => [@recipient], :mailing => @mailing)
|
35
|
+
get :show, {:m => @mailing.sha1, :r => @recipient.sha1, :use_route => :alchemy_crm}
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should assign recipient" do
|
39
|
+
assigns(:recipient).should == @recipient
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should assign contact from recipient" do
|
43
|
+
assigns(:contact).should == @contact
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
context "receiving a hash and email from recipient without contact" do
|
49
|
+
|
50
|
+
before(:each) do
|
51
|
+
@recipient = Recipient.create!(:email => 'foo@baz.org')
|
52
|
+
@delivery = Delivery.create!(:recipients => [@recipient], :mailing => @mailing)
|
53
|
+
get :show, {:m => @mailing.sha1, :r => @recipient.sha1, :use_route => :alchemy_crm}
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should assign recipient" do
|
57
|
+
assigns(:recipient).should == @recipient
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should assign new contact from recipients email" do
|
61
|
+
assigns(:contact).should be_a_new(Contact)
|
62
|
+
assigns(:contact).email.should == "foo@baz.org"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
context "rendering" do
|
68
|
+
|
69
|
+
render_views
|
70
|
+
|
71
|
+
before(:each) do
|
72
|
+
@contact = Contact.create!({:email => 'jon@doe.com', :firstname => 'Jon', :lastname => 'Doe', :salutation => 'mr', :verified => true}, :as => :admin)
|
73
|
+
@recipient = Recipient.create!(:email => 'foo@baz.org', :contact => @contact)
|
74
|
+
@delivery = Delivery.create!(:recipients => [@recipient], :mailing => @mailing)
|
75
|
+
@language_root = Alchemy::Page.create!(:name => 'Language Root', :page_layout => 'standard', :language => Alchemy::Language.get_default, :parent_id => Alchemy::Page.root.id)
|
76
|
+
@unsubscribe_page = Alchemy::Page.create!(:name => 'Unsubscribe Page', :page_layout => 'newsletter_signout', :parent_id => @language_root.id, :language => Alchemy::Language.get_default)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should render the view." do
|
80
|
+
lambda {
|
81
|
+
get :show, {:m => @mailing.sha1, :r => @recipient.sha1, :use_route => :alchemy_crm}
|
82
|
+
}.should_not raise_error
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module AlchemyCrm
|
4
|
+
describe RecipientsController do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@recipient = Recipient.create!(:email => 'foo@baz.org')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#reads' do
|
11
|
+
|
12
|
+
context "receiving a recipient hash" do
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
get :reads, {:h => @recipient.sha1, :use_route => :alchemy_crm}
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should record the read and read_at date." do
|
19
|
+
@recipient.reload
|
20
|
+
@recipient.read.should be_true
|
21
|
+
@recipient.read_at.should_not be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not render anything." do
|
25
|
+
response.code.should == "200"
|
26
|
+
response.body.should == " "
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "reading multiple times" do
|
32
|
+
|
33
|
+
it "should not record the reading any more." do
|
34
|
+
@recipient.update_attributes(:read => true)
|
35
|
+
get :reads, {:h => @recipient.sha1, :use_route => :alchemy_crm}
|
36
|
+
@recipient.read_at_changed?.should == false
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
context "not receiving a recipient hash" do
|
42
|
+
|
43
|
+
it "should not raise 404 / RecordNotFound error." do
|
44
|
+
lambda {
|
45
|
+
get :reads, {:use_route => :alchemy_crm}
|
46
|
+
}.should_not raise_error(ActiveRecord::RecordNotFound)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should not record any reading." do
|
50
|
+
get :reads, {:use_route => :alchemy_crm}
|
51
|
+
@recipient.reload
|
52
|
+
@recipient.read.should be_false
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#reacts' do
|
60
|
+
|
61
|
+
before(:each) do
|
62
|
+
Alchemy::PageLayout.add({"name" => 'standard', "elements" => ['headline']})
|
63
|
+
@language_root = Alchemy::Page.create!(:name => 'Language Root', :page_layout => 'standard', :parent_id => Alchemy::Page.root.id, :language => Alchemy::Language.get_default)
|
64
|
+
@page = Alchemy::Page.create!(:name => 'Page 1', :page_layout => 'standard', :parent_id => @language_root.id, :language => @language_root.language)
|
65
|
+
end
|
66
|
+
|
67
|
+
context "receiving a redirect url" do
|
68
|
+
|
69
|
+
before(:each) do
|
70
|
+
get :reacts, {:h => @recipient.sha1, :r => "http://google.de", :use_route => 'alchemy_crm'}
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should record the url as reaction for recipient." do
|
74
|
+
@recipient.reactions.collect(&:url).should include("http://google.de")
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should redirect to url." do
|
78
|
+
response.code.should == "302"
|
79
|
+
response.should redirect_to('http://google.de')
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
context "receiving a page id" do
|
85
|
+
|
86
|
+
before(:each) do
|
87
|
+
get :reacts, {:h => @recipient.sha1, :page_id => @page.id, :use_route => 'alchemy_crm'}
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should record the page id as reaction for recipient." do
|
91
|
+
@recipient.reactions.collect(&:page_id).should include(@page.id)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should redirect to page path." do
|
95
|
+
response.code.should == "302"
|
96
|
+
response.should redirect_to('/page-1')
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
context "not receiving a page id" do
|
102
|
+
|
103
|
+
it "should raise 404 / RecordNotFound." do
|
104
|
+
lambda {
|
105
|
+
get :reacts, {:h => @recipient.sha1, :use_route => 'alchemy_crm'}
|
106
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
context "receiving page id and element id" do
|
112
|
+
|
113
|
+
before(:each) do
|
114
|
+
Alchemy::Element.stub!(:descriptions).and_return([{"name" => "headline"}])
|
115
|
+
@element = Alchemy::Element.create!(:name => 'headline', :page => @page)
|
116
|
+
get :reacts, {:h => @recipient.sha1, :page_id => @page.id, :element_id => @element.id, :use_route => 'alchemy_crm'}
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should record the page id and element id as reaction for recipient." do
|
120
|
+
@recipient.reactions.collect(&:page_id).should include(@page.id)
|
121
|
+
@recipient.reactions.collect(&:element_id).should include(@element.id)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should redirect to page path with element dom id as anchor." do
|
125
|
+
response.code.should == "302"
|
126
|
+
response.should redirect_to("/page-1##{@element.dom_id}")
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
context "not receiving a recipient id" do
|
132
|
+
|
133
|
+
it "should not raise 404 / RecordNotFound." do
|
134
|
+
lambda {
|
135
|
+
get :reacts, {:r => "http://google.de", :use_route => 'alchemy_crm'}
|
136
|
+
}.should_not raise_error(ActiveRecord::RecordNotFound)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should not record any reactions." do
|
140
|
+
get :reacts, {:r => "http://google.de", :use_route => 'alchemy_crm'}
|
141
|
+
@recipient.reactions.should be_empty
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should redirect." do
|
145
|
+
get :reacts, {:r => "http://google.de", :use_route => 'alchemy_crm'}
|
146
|
+
response.code.should == "302"
|
147
|
+
response.should redirect_to('http://google.de')
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag :all %>
|
6
|
+
<%= javascript_include_tag :defaults %>
|
7
|
+
<%= csrf_meta_tag %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1>Welcome to Alchemy CRM Dummy App</h1>
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# = Configuration
|
4
|
+
#
|
5
|
+
# == This is the global Alchemy configuration file
|
6
|
+
# Please override your apps settings in your config/alchemy/config.yml file.
|
7
|
+
# You can use a handy rake task to generate it.
|
8
|
+
#
|
9
|
+
# rake alchemy:app_structure:create:config
|
10
|
+
|
11
|
+
# The amount of time of inactivity in minutes after which the user is kicked out of his current session.
|
12
|
+
# Only active in production environment!!!
|
13
|
+
:auto_logout_time: 30
|
14
|
+
|
15
|
+
# === Redirect options
|
16
|
+
# redirect_index: You can set to redirect (an 301 permanent, for all you SEO geeks ^_^) to first child page (typically the homepage) the index/intro page if it's not visible.
|
17
|
+
# So you don't get an 404 error if the language root page is not visible.
|
18
|
+
# redirect_to_public_child: Alchemy redirects to the first public child page found, if a page is not visible.
|
19
|
+
:redirect_index: true
|
20
|
+
:redirect_to_public_child: true
|
21
|
+
|
22
|
+
# Enabling the Ferret fulltext search engine.
|
23
|
+
# Tip! For best performance and stability install a crontab that reindexes ferrets search index periodly.
|
24
|
+
# Example: cd ~/html/alchemy/current && RAILS_ENV=production rake ferret:rebuild_index
|
25
|
+
:ferret: true
|
26
|
+
|
27
|
+
# === Pagecaching
|
28
|
+
# Enable/Disable pagecaching globally.
|
29
|
+
# Hint: You can enable/disable page caching for single Alchemy::PageLayouts in the page_layout.yml file.
|
30
|
+
:cache_pages: true
|
31
|
+
|
32
|
+
# === Sitemap
|
33
|
+
# Alchemy renders a nice HTML (<ul><li> style) and XML (Google conform!) Sitemap for you.
|
34
|
+
# Just place a sitemap element for a page layout in your page_layouts.yml file. Alchemy does the rest.
|
35
|
+
# ==== Options:
|
36
|
+
# show_root: Show language root page in sitemap?
|
37
|
+
# show_flag: enables the Checkbox in Page#update overlay. So your customer can set the visibilit of pages in the sitemap.
|
38
|
+
:sitemap:
|
39
|
+
:show_root: true
|
40
|
+
:show_flag: false
|
41
|
+
|
42
|
+
# === URL nesting
|
43
|
+
# By default Alchemy does not nest page urls respectivley to their page tree position.
|
44
|
+
# Enable +url_nesting+ to get nested urls.
|
45
|
+
# ==== Example of a nested url:
|
46
|
+
# +http://homepage.com/company/history/the-early-years+
|
47
|
+
# Alchemy supports url nesting up to three levels deep. We think that's more then enough,
|
48
|
+
# because URLs like this are possible:
|
49
|
+
# +http://homepage.com/en/2011/12/08/my-post
|
50
|
+
url_nesting: false
|
51
|
+
|
52
|
+
# === Picture rendering settings
|
53
|
+
# Alchemy uses Fleximage and RMagick to render images. Use {:image_size => "XXXxYYY", :crop => BOOLEAN [true]} to resize images.
|
54
|
+
# See https://github.com/Squeegy/fleximage for further infos.
|
55
|
+
# ==== Options:
|
56
|
+
# output_image_jpg_quality: If rendered as JPG this is the quality setting for it.
|
57
|
+
# preprocess_image_resize: Large images are downsized after upload to save diskspace.
|
58
|
+
# image_store_format: Masterimage storage format. Images are rendered from this master image, so a lossless format (png) is strongly recommended.
|
59
|
+
# image_output_format: Globally image output format setting.
|
60
|
+
# TIP: You can always override the output format in the options of your Essence. I.e. {:format => :gif}
|
61
|
+
:output_image_jpg_quality: 85
|
62
|
+
:preprocess_image_resize: 1000x1000
|
63
|
+
:image_store_format: png
|
64
|
+
:image_output_format: jpg
|
65
|
+
|
66
|
+
# Default language for the seeder.
|
67
|
+
default_language:
|
68
|
+
code: de
|
69
|
+
name: Deutsch
|
70
|
+
page_layout: intro
|
71
|
+
frontpage_name: Intro
|
72
|
+
|
73
|
+
# === Mailer Settings:
|
74
|
+
#
|
75
|
+
# To send Mails via contact forms you can create your form fields here and set which fields are to be validated.
|
76
|
+
#
|
77
|
+
# ==== Options:
|
78
|
+
#
|
79
|
+
# fields: An Array from Hashes with fieldname as keys and type as values. Types are ActiveRecord column types (i.e. string, text, boolean, etc.).
|
80
|
+
# validate_fields: A Hash with fieldname as key and a Hash (with :message as key and a message_id as value) as value
|
81
|
+
#
|
82
|
+
# ==== Translating validation messages:
|
83
|
+
#
|
84
|
+
# The message_id is passed through Alchemy::I18n.t so you can translate it in your language yml file.
|
85
|
+
#
|
86
|
+
# Example:
|
87
|
+
#
|
88
|
+
# de:
|
89
|
+
# alchemy:
|
90
|
+
# contactform:
|
91
|
+
# validations:
|
92
|
+
# enter_name: 'Bitte geben Sie einen Namen an'
|
93
|
+
#
|
94
|
+
:mailer:
|
95
|
+
:page_layout_name: contact
|
96
|
+
:forward_to_page: false
|
97
|
+
:mail_success_page: thanks
|
98
|
+
:mail_from: your.mail@your-domain.com
|
99
|
+
:mail_to: your.mail@your-domain.com
|
100
|
+
:fields: [salutation, firstname, lastname, address, zip, city, phone, email, message]
|
101
|
+
:validate_fields:
|
102
|
+
:lastname:
|
103
|
+
:message: enter_name
|
104
|
+
:email:
|
105
|
+
:message: enter_mail
|
106
|
+
|
107
|
+
# === User roles
|
108
|
+
# You can add own user roles. To set permissions for this roles please add an authorization_rules.rb file in your config folder.
|
109
|
+
# Further documentation for the auth system used please visit:
|
110
|
+
# https://github.com/stffn/declarative_authorization/blob/master/README.rdoc
|
111
|
+
#
|
112
|
+
# ==== Translating Userroles
|
113
|
+
# Userroles can be translated inside your the language yml file under:
|
114
|
+
# alchemy:
|
115
|
+
# user_roles:
|
116
|
+
# rolename: Name of the role
|
117
|
+
:user_roles: [registered, author, editor, admin]
|
118
|
+
|
119
|
+
# === Uploader Settings
|
120
|
+
# upload_limit: Integer Set an amount of files upload limit of files which can be uploaded at once. Set 0 for unlimited.
|
121
|
+
# file_size_limit: Integer Set a file size limit in megabytes for a per file limit.
|
122
|
+
# Allow filetypes to upload.
|
123
|
+
# Pass * to allow all kind of files.
|
124
|
+
:uploader:
|
125
|
+
:upload_limit: 50
|
126
|
+
:file_size_limit: 100
|
127
|
+
:allowed_filetypes:
|
128
|
+
:pictures: [jpg, jpeg, gif, png, psd, pdf]
|
129
|
+
:attachments: ['*']
|
130
|
+
|
131
|
+
# === Link Target Options
|
132
|
+
# Values for the link target selectbox inside the page link overlay.
|
133
|
+
# The value gets attached as a data-link-target attribute to the link.
|
134
|
+
#
|
135
|
+
# == Example:
|
136
|
+
# Open all links set to overlay inside an jQuery UI Dialog Window.
|
137
|
+
#
|
138
|
+
# jQuery(a[data-link-target="overlay"]).dialog();
|
139
|
+
:link_target_options: [blank]
|
140
|
+
|
141
|
+
# Should pages that redirect to an external url open the link in a new tab/window?
|
142
|
+
:open_external_links_in_new_tab: true
|
@@ -0,0 +1,79 @@
|
|
1
|
+
- name: newsletter_greeting
|
2
|
+
unique: true
|
3
|
+
contents:
|
4
|
+
- name: male_greeting
|
5
|
+
type: EssenceText
|
6
|
+
- name: female_greeting
|
7
|
+
type: EssenceText
|
8
|
+
- name: text
|
9
|
+
type: EssenceRichtext
|
10
|
+
|
11
|
+
- name: newsletter_article
|
12
|
+
contents:
|
13
|
+
- name: image
|
14
|
+
type: EssencePicture
|
15
|
+
- name: headline
|
16
|
+
type: EssenceText
|
17
|
+
- name: text
|
18
|
+
type: EssenceRichtext
|
19
|
+
- name: link
|
20
|
+
type: EssenceLink
|
21
|
+
|
22
|
+
# These elements are added by the Alchemy CRM module.
|
23
|
+
|
24
|
+
- name: newsletter_signup_form
|
25
|
+
unique: true
|
26
|
+
contents:
|
27
|
+
- name: choose_newsletter_text
|
28
|
+
type: EssenceRichtext
|
29
|
+
- name: signed_up_text
|
30
|
+
type: EssenceRichtext
|
31
|
+
validate:
|
32
|
+
- presence
|
33
|
+
- name: verified_text
|
34
|
+
type: EssenceRichtext
|
35
|
+
validate:
|
36
|
+
- presence
|
37
|
+
- name: newsletter_signup_mail
|
38
|
+
unique: true
|
39
|
+
contents:
|
40
|
+
- name: mail_from
|
41
|
+
type: EssenceText
|
42
|
+
validate:
|
43
|
+
- presence
|
44
|
+
- name: subject
|
45
|
+
type: EssenceText
|
46
|
+
validate:
|
47
|
+
- presence
|
48
|
+
take_me_for_preview: true
|
49
|
+
- name: text
|
50
|
+
type: EssenceRichtext
|
51
|
+
validate:
|
52
|
+
- presence
|
53
|
+
- name: newsletter_signout_form
|
54
|
+
unique: true
|
55
|
+
contents:
|
56
|
+
- name: signed_out_text
|
57
|
+
type: EssenceRichtext
|
58
|
+
validate:
|
59
|
+
- presence
|
60
|
+
- name: disabled_text
|
61
|
+
type: EssenceRichtext
|
62
|
+
validate:
|
63
|
+
- presence
|
64
|
+
- name: newsletter_signout_mail
|
65
|
+
unique: true
|
66
|
+
contents:
|
67
|
+
- name: mail_from
|
68
|
+
type: EssenceText
|
69
|
+
validate:
|
70
|
+
- presence
|
71
|
+
- name: subject
|
72
|
+
type: EssenceText
|
73
|
+
validate:
|
74
|
+
- presence
|
75
|
+
take_me_for_preview: true
|
76
|
+
- name: text
|
77
|
+
type: EssenceRichtext
|
78
|
+
validate:
|
79
|
+
- presence
|