fakecrm 0.9.9.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +76 -0
- data/Rakefile +113 -0
- data/bin/fakecrm +37 -0
- data/fakecrm.gemspec +34 -0
- data/lib/fakecrm/application.rb +85 -0
- data/lib/fakecrm/configuration.rb +8 -0
- data/lib/fakecrm/drop.rb +59 -0
- data/lib/fakecrm/embedded.rb +32 -0
- data/lib/fakecrm/fetch.rb +139 -0
- data/lib/fakecrm/initialize.rb +16 -0
- data/lib/fakecrm/localized_dm.rb +12 -0
- data/lib/fakecrm/resource/account.rb +33 -0
- data/lib/fakecrm/resource/activity.rb +57 -0
- data/lib/fakecrm/resource/contact.rb +51 -0
- data/lib/fakecrm/resource/custom_attribute.rb +20 -0
- data/lib/fakecrm/resource/custom_type.rb +96 -0
- data/lib/fakecrm/resource/event.rb +52 -0
- data/lib/fakecrm/resource/event_contact.rb +21 -0
- data/lib/fakecrm/resource/extensions/kinds.rb +26 -0
- data/lib/fakecrm/resource/extensions/type_extender.rb +42 -0
- data/lib/fakecrm/resource/extensions/type_extension.rb +55 -0
- data/lib/fakecrm/resource/mailing.rb +30 -0
- data/lib/fakecrm/resource/password.rb +17 -0
- data/lib/fakecrm/resource/role.rb +18 -0
- data/lib/fakecrm/resource/template.rb +41 -0
- data/lib/fakecrm/resource/views/resource_view.rb +90 -0
- data/lib/fakecrm/resources.rb +11 -0
- data/lib/fakecrm/server/accounts.rb +39 -0
- data/lib/fakecrm/server/activities.rb +39 -0
- data/lib/fakecrm/server/contacts.rb +118 -0
- data/lib/fakecrm/server/custom_types.rb +34 -0
- data/lib/fakecrm/server/event_contacts.rb +38 -0
- data/lib/fakecrm/server/events.rb +47 -0
- data/lib/fakecrm/server/mailings.rb +44 -0
- data/lib/fakecrm/server/roles.rb +44 -0
- data/lib/fakecrm/server/templates.rb +24 -0
- data/lib/fakecrm/server.rb +37 -0
- data/lib/fakecrm/version.rb +5 -0
- data/lib/fakecrm.rb +36 -0
- data/locales/de.yml +25 -0
- data/locales/en.yml +25 -0
- data/test/embedded/.gitignore +15 -0
- data/test/embedded/Gemfile +6 -0
- data/test/embedded/Rakefile +7 -0
- data/test/embedded/app/models/.gitkeep +0 -0
- data/test/embedded/config/application.rb +44 -0
- data/test/embedded/config/boot.rb +6 -0
- data/test/embedded/config/environment.rb +5 -0
- data/test/embedded/config/environments/development.rb +20 -0
- data/test/embedded/config/environments/test.rb +21 -0
- data/test/embedded/config/initializers/fakecrm.rb +8 -0
- data/test/embedded/config/initializers/secret_token.rb +7 -0
- data/test/embedded/config/initializers/session_store.rb +8 -0
- data/test/embedded/config/initializers/wrap_parameters.rb +14 -0
- data/test/embedded/config/locales/en.yml +5 -0
- data/test/embedded/config/routes.rb +2 -0
- data/test/embedded/config.ru +4 -0
- data/test/embedded/lib/assets/.gitkeep +0 -0
- data/test/embedded/lib/tasks/.gitkeep +0 -0
- data/test/embedded/log/.gitkeep +0 -0
- data/test/embedded/script/rails +6 -0
- metadata +301 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Accounts
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
|
8
|
+
get '/crm/api/accounts.?:format?' do
|
9
|
+
fetch_many(Account)
|
10
|
+
end
|
11
|
+
|
12
|
+
get '/crm/api/accounts/search.?:format?' do |format|
|
13
|
+
search(Account, [:account_group], [:name], params[:sort_by], params[:sort_order])
|
14
|
+
end
|
15
|
+
|
16
|
+
get '/crm/api/accounts/:id.?:format?' do |id, format|
|
17
|
+
fetch_one(Account, id.to_i)
|
18
|
+
end
|
19
|
+
|
20
|
+
put '/crm/api/accounts/:id.?:format?' do |id, format|
|
21
|
+
update_one(Account, id.to_i, params["account"])
|
22
|
+
end
|
23
|
+
|
24
|
+
post '/crm/api/accounts.?:format?' do
|
25
|
+
create_one(Account, params["account"])
|
26
|
+
end
|
27
|
+
|
28
|
+
delete '/crm/api/accounts/:id.?:format?' do |id, format|
|
29
|
+
destroy_one(Account, id.to_i)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Activities
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
|
8
|
+
get '/crm/api/activities.?:format?' do
|
9
|
+
fetch_many(Activity)
|
10
|
+
end
|
11
|
+
|
12
|
+
get '/crm/api/activities/search.?:format?' do |format|
|
13
|
+
search(Activity, [:account_id, :contact_id, :kind, :state], [:title], params[:sort_by], params[:sort_order])
|
14
|
+
end
|
15
|
+
|
16
|
+
get '/crm/api/activities/:id.?:format?' do |id, format|
|
17
|
+
fetch_one(Activity, id.to_i)
|
18
|
+
end
|
19
|
+
|
20
|
+
put '/crm/api/activities/:id.?:format?' do |id, format|
|
21
|
+
update_one(Activity, id.to_i, params["activity"])
|
22
|
+
end
|
23
|
+
|
24
|
+
post '/crm/api/activities.?:format?' do
|
25
|
+
create_one(Activity, params["activity"])
|
26
|
+
end
|
27
|
+
|
28
|
+
delete '/crm/api/activities/:id.?:format?' do |id, format|
|
29
|
+
destroy_one(Activity, id.to_i)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Contacts
|
4
|
+
|
5
|
+
def password_request(primary_key)
|
6
|
+
contact = Contact.get!(primary_key)
|
7
|
+
if contact.email.nil? || contact.email.empty?
|
8
|
+
status 422
|
9
|
+
else
|
10
|
+
Password.all(:contact => contact).destroy
|
11
|
+
password = Password.create(:contact => contact)
|
12
|
+
if params["only_get_token"].to_s == 'true'
|
13
|
+
status 200
|
14
|
+
body password.token.to_json
|
15
|
+
else
|
16
|
+
# TODO: send email?
|
17
|
+
::Fakecrm.logger.info("Sending email with password change token (not really)")
|
18
|
+
status 200
|
19
|
+
body ''.to_json
|
20
|
+
end
|
21
|
+
end
|
22
|
+
rescue ::DataMapper::ObjectNotFoundError => e
|
23
|
+
status 404
|
24
|
+
end
|
25
|
+
|
26
|
+
def password_clear(primary_key)
|
27
|
+
contact = Contact.get!(primary_key)
|
28
|
+
Password.all(:contact => contact).destroy
|
29
|
+
status 200
|
30
|
+
rescue ::DataMapper::ObjectNotFoundError => e
|
31
|
+
status 404
|
32
|
+
end
|
33
|
+
|
34
|
+
def password_set
|
35
|
+
password = Password.first(:token => params["token"])
|
36
|
+
|
37
|
+
if password.nil?
|
38
|
+
status 404
|
39
|
+
else
|
40
|
+
password.password = params['password']
|
41
|
+
if password.save
|
42
|
+
status 200
|
43
|
+
body ''.to_json
|
44
|
+
else
|
45
|
+
status 422
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def authenticate
|
51
|
+
contact = Contact.first(:login => params['login'])
|
52
|
+
if !contact.nil?
|
53
|
+
password = Password.first(:contact => contact)
|
54
|
+
|
55
|
+
if !password.nil?
|
56
|
+
status 200
|
57
|
+
return body({:id => contact.id}.to_json)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
status 422
|
62
|
+
body({'error' => "Authentication failed."}.to_json)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.included(base)
|
66
|
+
base.class_eval do
|
67
|
+
|
68
|
+
get '/crm/api/contacts.?:format?' do |format|
|
69
|
+
fetch_many(Contact)
|
70
|
+
end
|
71
|
+
|
72
|
+
get '/crm/api/contacts/search.?:format?' do |format|
|
73
|
+
search(Contact, [:account_id, :email, :login], [:first_name, :last_name, :job_title],
|
74
|
+
params.fetch("sort_by", :updated_at).to_sym,
|
75
|
+
params.fetch("sort_order", 'asc').to_s)
|
76
|
+
end
|
77
|
+
|
78
|
+
get '/crm/api/contacts/:id.?:format?' do |id, format|
|
79
|
+
fetch_one(Contact, id.to_i)
|
80
|
+
end
|
81
|
+
|
82
|
+
put '/crm/api/contacts/:id.?:format?' do |id, format|
|
83
|
+
update_one(Contact, id.to_i, params["contact"])
|
84
|
+
end
|
85
|
+
|
86
|
+
post '/crm/api/contacts.?:format?' do |format|
|
87
|
+
create_one(Contact, params["contact"])
|
88
|
+
end
|
89
|
+
|
90
|
+
delete '/crm/api/contacts/:id.?:format?' do |id, format|
|
91
|
+
# TODO: role check ~> 422
|
92
|
+
destroy_one(Contact, id.to_i)
|
93
|
+
end
|
94
|
+
|
95
|
+
# --- password ---
|
96
|
+
post '/crm/api/contacts/:id/password_clear.?:format?' do |id, format|
|
97
|
+
password_clear(id.to_i)
|
98
|
+
end
|
99
|
+
|
100
|
+
post '/crm/api/contacts/:id/password_request.?:format?' do |id, format|
|
101
|
+
password_request(id.to_i)
|
102
|
+
end
|
103
|
+
|
104
|
+
post '/crm/api/contacts/password_set.?:format?' do |format|
|
105
|
+
password_set
|
106
|
+
end
|
107
|
+
|
108
|
+
post '/crm/api/contacts/authenticate.?:format?' do |format|
|
109
|
+
authenticate
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'fakecrm/resource/extensions/type_extender'
|
3
|
+
|
4
|
+
module Fakecrm
|
5
|
+
module CustomTypes
|
6
|
+
def self.included(base)
|
7
|
+
base.class_eval do
|
8
|
+
|
9
|
+
get '/crm/api/custom_types.?:format?' do
|
10
|
+
fetch_many(CustomType)
|
11
|
+
end
|
12
|
+
|
13
|
+
get '/crm/api/custom_types/:id.?:format?' do |id, format|
|
14
|
+
fetch_one(CustomType, id)
|
15
|
+
end
|
16
|
+
|
17
|
+
put '/crm/api/custom_types/:id.?:format?' do |id, format|
|
18
|
+
update_one(CustomType, id, params["custom_type"])
|
19
|
+
end
|
20
|
+
|
21
|
+
post '/crm/api/custom_types.?:format?' do
|
22
|
+
create_one(CustomType, params["custom_type"])
|
23
|
+
end
|
24
|
+
|
25
|
+
delete '/crm/api/custom_types/:id.?:format?' do |id, format|
|
26
|
+
destroy_one(CustomType, id)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module EventContacts
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
|
8
|
+
get '/crm/api/event_contacts.?:format?' do
|
9
|
+
fetch_many(EventContact)
|
10
|
+
end
|
11
|
+
|
12
|
+
get '/crm/api/event_contacts/search.?:format?' do
|
13
|
+
search(EventContact, [:event_id, :contact_id, :state], [],
|
14
|
+
params.fetch("sort_by", :updated_at).to_sym,
|
15
|
+
params.fetch("sort_order", 'asc').to_s)
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/crm/api/event_contacts/:id.?:format?' do |id, _|
|
19
|
+
fetch_one(EventContact, id.to_i)
|
20
|
+
end
|
21
|
+
|
22
|
+
post '/crm/api/event_contacts.?:format?' do
|
23
|
+
create_one(EventContact, params["event_contact"])
|
24
|
+
end
|
25
|
+
|
26
|
+
put '/crm/api/event_contacts/:id.?:format?' do |id, _|
|
27
|
+
update_one(EventContact, id.to_i, params["event_contact"])
|
28
|
+
end
|
29
|
+
|
30
|
+
delete '/crm/api/event_contacts/:id.?:format?' do |id|
|
31
|
+
destroy_one(EventContact, id.to_i)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Events
|
4
|
+
|
5
|
+
def event_params
|
6
|
+
event = params["event"].dup
|
7
|
+
event.delete("name")
|
8
|
+
event
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.included(base)
|
12
|
+
base.class_eval do
|
13
|
+
|
14
|
+
get '/crm/api/events.?:format?' do
|
15
|
+
fetch_many(Event)
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/crm/api/events/search.?:format?' do
|
19
|
+
search(Event, [:event_set, :kind], [:title],
|
20
|
+
params.fetch("sort_by", :updated_at).to_sym,
|
21
|
+
params.fetch("sort_order", 'asc').to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
get '/crm/api/events/:id.?:format?' do |id, _|
|
25
|
+
fetch_one(Event, id.to_i)
|
26
|
+
end
|
27
|
+
|
28
|
+
post '/crm/api/events.?:format?' do
|
29
|
+
create_one(Event, event_params)
|
30
|
+
end
|
31
|
+
|
32
|
+
put '/crm/api/events/:id.?:format?' do |id, _|
|
33
|
+
update_one(Event, id.to_i, event_params)
|
34
|
+
end
|
35
|
+
|
36
|
+
delete '/crm/api/events/:id.?:format?' do |id|
|
37
|
+
destroy_one(Event, id.to_i)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Mailings
|
4
|
+
|
5
|
+
def mailing_params
|
6
|
+
mailing = params["mailing"].dup
|
7
|
+
mailing.delete("name")
|
8
|
+
mailing
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.included(base)
|
12
|
+
base.class_eval do
|
13
|
+
|
14
|
+
get '/crm/api/mailings.?:format?' do
|
15
|
+
fetch_many(Mailing)
|
16
|
+
end
|
17
|
+
|
18
|
+
get '/crm/api/mailings/search.?:format?' do
|
19
|
+
search(Mailing, [:event_id, :mailing_type], [:title, :body],
|
20
|
+
params.fetch("sort_by", :updated_at).to_sym,
|
21
|
+
params.fetch("sort_order", 'asc').to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
get '/crm/api/mailings/:id.?:format?' do |id, _|
|
25
|
+
fetch_one(Mailing, id.to_i)
|
26
|
+
end
|
27
|
+
|
28
|
+
post '/crm/api/mailings.?:format?' do
|
29
|
+
create_one(Mailing, mailing_params)
|
30
|
+
end
|
31
|
+
|
32
|
+
put '/crm/api/mailings/:id.?:format?' do |id, _|
|
33
|
+
update_one(Mailing, id.to_i, mailing_params)
|
34
|
+
end
|
35
|
+
|
36
|
+
delete '/crm/api/mailings/:id.?:format?' do |id, _|
|
37
|
+
destroy_one(Mailing, id.to_i)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Roles
|
4
|
+
|
5
|
+
def role_params
|
6
|
+
allowed_keys = Role.properties.map(&:name)
|
7
|
+
allowed = {}
|
8
|
+
params.fetch("role", {}).each do |key, value|
|
9
|
+
allowed[key] = value if allowed_keys.include?(key.to_sym)
|
10
|
+
end
|
11
|
+
allowed
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.included(base)
|
15
|
+
base.class_eval do
|
16
|
+
|
17
|
+
get '/crm/api/roles.?:format?' do |format|
|
18
|
+
fetch_many(Role)
|
19
|
+
end
|
20
|
+
|
21
|
+
get '/crm/api/roles/:id.?:format?' do |id, format|
|
22
|
+
fetch_one(Role, id)
|
23
|
+
end
|
24
|
+
|
25
|
+
put '/crm/api/roles/:id.?:format?' do |id, format|
|
26
|
+
update_one(Role, id, role_params)
|
27
|
+
end
|
28
|
+
|
29
|
+
post '/crm/api/roles.?:format?' do |format|
|
30
|
+
create_one(Role, role_params)
|
31
|
+
end
|
32
|
+
|
33
|
+
delete '/crm/api/roles/:id.?:format?' do |id, format|
|
34
|
+
destroy_one(Role, id)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fakecrm
|
3
|
+
module Templates
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
|
8
|
+
get '/crm/api/templates.?:format?' do
|
9
|
+
template = Template.first_or_create
|
10
|
+
template.templates.to_json
|
11
|
+
end
|
12
|
+
|
13
|
+
put '/crm/api/templates.?:format?' do
|
14
|
+
template = Template.first_or_create
|
15
|
+
template.body = params['templates']
|
16
|
+
template.save
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'fakecrm/fetch'
|
3
|
+
require 'fakecrm/drop'
|
4
|
+
|
5
|
+
require 'fakecrm/server/accounts'
|
6
|
+
require 'fakecrm/server/activities'
|
7
|
+
require 'fakecrm/server/contacts'
|
8
|
+
require 'fakecrm/server/custom_types'
|
9
|
+
require 'fakecrm/server/events'
|
10
|
+
require 'fakecrm/server/event_contacts'
|
11
|
+
require 'fakecrm/server/mailings'
|
12
|
+
require 'fakecrm/server/roles'
|
13
|
+
require 'fakecrm/server/templates'
|
14
|
+
|
15
|
+
module Fakecrm
|
16
|
+
class Server < Sinatra::Base
|
17
|
+
use Rack::PostBodyContentTypeParser
|
18
|
+
use Rack::Locale
|
19
|
+
|
20
|
+
include Fetch
|
21
|
+
include Drop
|
22
|
+
|
23
|
+
include Accounts
|
24
|
+
include Activities
|
25
|
+
include Contacts
|
26
|
+
include CustomTypes
|
27
|
+
include Events
|
28
|
+
include EventContacts
|
29
|
+
include Mailings
|
30
|
+
include Roles
|
31
|
+
include Templates
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
|
data/lib/fakecrm.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'singleton'
|
3
|
+
require 'logger'
|
4
|
+
require 'data_mapper'
|
5
|
+
require 'thin'
|
6
|
+
require 'i18n'
|
7
|
+
require 'rack/commonlogger'
|
8
|
+
require 'base64'
|
9
|
+
require 'json'
|
10
|
+
require 'sinatra/base'
|
11
|
+
require 'rack/contrib/post_body_content_type_parser'
|
12
|
+
require 'rack/contrib/locale'
|
13
|
+
|
14
|
+
require 'fakecrm/version'
|
15
|
+
require 'fakecrm/configuration'
|
16
|
+
require 'fakecrm/application'
|
17
|
+
require 'fakecrm/server'
|
18
|
+
|
19
|
+
# dynamic_require 'fakecrm/resource'
|
20
|
+
# dynamic_require 'fakecrm/initialize'
|
21
|
+
|
22
|
+
module Fakecrm
|
23
|
+
# fix for retared rack/commonlogger
|
24
|
+
class Logger < ::Logger
|
25
|
+
alias_method :write, :<<
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.logger
|
29
|
+
Application.instance.logger
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.run!
|
33
|
+
Application.instance.run!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
data/locales/de.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#:absent => '%s must be absent',
|
2
|
+
#:inclusion => '%s must be one of %s',
|
3
|
+
#:invalid => '%s has an invalid format',
|
4
|
+
#:confirmation => '%s does not match the confirmation',
|
5
|
+
#:accepted => '%s is not accepted',
|
6
|
+
#:nil => '%s must not be nil',
|
7
|
+
#:blank => '%s must not be blank',
|
8
|
+
#:length_between => '%s must be between %s and %s characters long',
|
9
|
+
#:too_long => '%s must be at most %s characters long',
|
10
|
+
#:too_short => '%s must be at least %s characters long',
|
11
|
+
#:wrong_length => '%s must be %s characters long',
|
12
|
+
#:taken => '%s is already taken',
|
13
|
+
#:not_a_number => '%s must be a number',
|
14
|
+
#:not_an_integer => '%s must be an integer',
|
15
|
+
#:greater_than => '%s must be greater than %s',
|
16
|
+
#:greater_than_or_equal_to => '%s must be greater than or equal to %s',
|
17
|
+
#:equal_to => '%s must be equal to %s',
|
18
|
+
#:not_equal_to => '%s must not be equal to %s',
|
19
|
+
#:less_than => '%s must be less than %s',
|
20
|
+
#:less_than_or_equal_to => '%s must be less than or equal to %s',
|
21
|
+
#:value_between => '%s must be between %s and %s',
|
22
|
+
#:primitive => '%s must be of type %s'
|
23
|
+
de:
|
24
|
+
messages:
|
25
|
+
blank: 'muss ausgefüllt werden'
|
data/locales/en.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#:absent => '%s must be absent',
|
2
|
+
#:inclusion => '%s must be one of %s',
|
3
|
+
#:invalid => '%s has an invalid format',
|
4
|
+
#:confirmation => '%s does not match the confirmation',
|
5
|
+
#:accepted => '%s is not accepted',
|
6
|
+
#:nil => '%s must not be nil',
|
7
|
+
#:blank => '%s must not be blank',
|
8
|
+
#:length_between => '%s must be between %s and %s characters long',
|
9
|
+
#:too_long => '%s must be at most %s characters long',
|
10
|
+
#:too_short => '%s must be at least %s characters long',
|
11
|
+
#:wrong_length => '%s must be %s characters long',
|
12
|
+
#:taken => '%s is already taken',
|
13
|
+
#:not_a_number => '%s must be a number',
|
14
|
+
#:not_an_integer => '%s must be an integer',
|
15
|
+
#:greater_than => '%s must be greater than %s',
|
16
|
+
#:greater_than_or_equal_to => '%s must be greater than or equal to %s',
|
17
|
+
#:equal_to => '%s must be equal to %s',
|
18
|
+
#:not_equal_to => '%s must not be equal to %s',
|
19
|
+
#:less_than => '%s must be less than %s',
|
20
|
+
#:less_than_or_equal_to => '%s must be less than or equal to %s',
|
21
|
+
#:value_between => '%s must be between %s and %s',
|
22
|
+
#:primitive => '%s must be of type %s'
|
23
|
+
en:
|
24
|
+
messages:
|
25
|
+
blank: "can't be blank"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
|
13
|
+
# Ignore all logfiles and tempfiles.
|
14
|
+
/log/*.log
|
15
|
+
/tmp
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
FakecrmTest::Application.load_tasks
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
#require 'rails/all'
|
4
|
+
require "active_resource/railtie"
|
5
|
+
require "rails/test_unit/railtie"
|
6
|
+
|
7
|
+
if defined?(Bundler)
|
8
|
+
# If you precompile assets before deploying to production, use this line
|
9
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
10
|
+
# If you want your assets lazily compiled in production, use this line
|
11
|
+
# Bundler.require(:default, :assets, Rails.env)
|
12
|
+
end
|
13
|
+
|
14
|
+
module FakecrmTest
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
28
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
29
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
30
|
+
|
31
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
32
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
33
|
+
# config.i18n.default_locale = :de
|
34
|
+
|
35
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
36
|
+
config.encoding = "utf-8"
|
37
|
+
|
38
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
39
|
+
config.filter_parameters += [:password]
|
40
|
+
|
41
|
+
# Enable escaping HTML in JSON.
|
42
|
+
config.active_support.escape_html_entities_in_json = true
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
FakecrmTest::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Print deprecation notices to the Rails logger
|
16
|
+
config.active_support.deprecation = :log
|
17
|
+
|
18
|
+
# Only use best-standards-support built into browsers
|
19
|
+
config.action_dispatch.best_standards_support = :builtin
|
20
|
+
end
|