voluntary 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/README.md +0 -1
- data/app/assets/javascripts/voluntary/base.js.coffee +13 -12
- data/app/assets/stylesheets/voluntary/application.css +1 -1
- data/app/assets/stylesheets/voluntary/base.css.sass +3 -3
- data/app/assets/stylesheets/voluntary/bootstrap_and_overrides.css.sass +0 -1
- data/app/assets/stylesheets/voluntary/sticky_footer.css +1 -1
- data/app/controllers/products_controller.rb +2 -2
- data/app/controllers/voluntary/api/v1/base_controller.rb +24 -4
- data/app/controllers/voluntary/api/v1/tasks_controller.rb +50 -0
- data/app/controllers/voluntary/application_controller.rb +0 -4
- data/app/helpers/voluntary/show_helper.rb +2 -1
- data/app/models/area.rb +1 -2
- data/app/models/product.rb +1 -0
- data/app/models/project.rb +0 -1
- data/app/models/project_user.rb +1 -2
- data/app/models/result.rb +4 -0
- data/app/models/story.rb +21 -2
- data/app/models/task.rb +14 -1
- data/app/models/thing.rb +11 -0
- data/app/models/user.rb +9 -8
- data/app/models/wikidata.rb +20 -0
- data/app/views/areas/_form.html.erb +7 -6
- data/app/views/comments/_form.html.erb +7 -7
- data/app/views/layouts/application.html.erb +10 -10
- data/app/views/layouts/shared/_flash_messages.html.erb +1 -1
- data/app/views/layouts/shared/_navigation.html.erb +7 -9
- data/app/views/organizations/_form.html.erb +6 -6
- data/app/views/pages/_form.html.erb +7 -7
- data/app/views/products/_form.html.erb +19 -20
- data/app/views/projects/_form.html.erb +12 -12
- data/app/views/shared/form/_error_messages.html.erb +1 -1
- data/app/views/shared/layouts/twitter_bootstrap/_control_group.html.erb +5 -5
- data/app/views/shared/layouts/twitter_bootstrap/control_group/_boolean.html.erb +4 -4
- data/app/views/shared/resource/_actions.html.erb +2 -1
- data/app/views/stories/_form.html.erb +4 -14
- data/app/views/stories/show.html.erb +1 -0
- data/app/views/stories/steps/_activate.html.erb +6 -9
- data/app/views/stories/steps/_setup_tasks.html.erb +19 -18
- data/app/views/tasks/show.html.erb +20 -0
- data/app/views/users/_form.html.erb +6 -10
- data/app/views/users/preferences.html.erb +6 -8
- data/app/views/users/show.html.erb +1 -0
- data/app/views/workflow/project_owner/index.html.erb +2 -2
- data/app/views/workflow/tasks/_work_form.html.erb +5 -7
- data/app/views/workflow/tasks/steps/_complete.html.erb +9 -5
- data/app/views/workflow/tasks/steps/_review.html.erb +11 -6
- data/app/views/workflow/tasks/steps/_work.html.erb +15 -10
- data/app/views/workflow/user/index.html.erb +4 -4
- data/config/initializers/simple_form.rb +10 -10
- data/config/initializers/simple_form_bootstrap.rb +136 -0
- data/config/locales/general/en.yml +3 -10
- data/config/locales/resources/story/en.yml +5 -0
- data/config/locales/resources/thing/en.yml +8 -0
- data/config/locales/resources/user/en.yml +13 -1
- data/config/routes/api.rb +4 -3
- data/db/migrate/20120907144853_create_schema.rb +0 -2
- data/db/migrate/20131018143613_replace_user_by_polymorphic_resource_in_candidatures.rb +16 -8
- data/db/migrate/20150802141840_drop_recruiting_unless_recruiting_plugin_present.rb +3 -2
- data/db/migrate/20150808155719_add_api_key_to_users.rb +13 -0
- data/db/migrate/20150809120211_remove_roles_model.rb +63 -0
- data/lib/applicat/mvc/model/resource/base.rb +0 -8
- data/lib/concerns/model/base_thing.rb +9 -0
- data/lib/generators/voluntary/install/install_generator.rb +0 -15
- data/lib/generators/voluntary/product_dummy/product_dummy_generator.rb +0 -15
- data/lib/voluntary/test/rspec_helpers/factories.rb +0 -11
- data/lib/voluntary/version.rb +1 -1
- data/lib/voluntary.rb +3 -5
- metadata +48 -94
- data/app/models/role/admin.rb +0 -2
- data/app/models/role/master.rb +0 -2
- data/app/models/role/project_owner.rb +0 -2
- data/app/models/role/user.rb +0 -2
- data/app/models/role.rb +0 -8
- data/app/models/user_role.rb +0 -6
- data/db/seeds.rb +0 -14
- data/lib/db_seed.rb +0 -166
- data/lib/generators/voluntary/install/templates/db/seeds.rb +0 -14
- data/lib/generators/voluntary/install/templates/lib/volontariat_seed.rb +0 -36
- data/lib/volontariat_seed.rb +0 -27
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
|
2
|
+
SimpleForm.setup do |config|
|
|
3
|
+
config.error_notification_class = 'alert alert-danger'
|
|
4
|
+
config.button_class = 'btn btn-default'
|
|
5
|
+
config.boolean_label_class = nil
|
|
6
|
+
|
|
7
|
+
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
8
|
+
b.use :html5
|
|
9
|
+
b.use :placeholder
|
|
10
|
+
b.optional :maxlength
|
|
11
|
+
b.optional :pattern
|
|
12
|
+
b.optional :min_max
|
|
13
|
+
b.optional :readonly
|
|
14
|
+
b.use :label, class: 'control-label'
|
|
15
|
+
|
|
16
|
+
b.use :input, class: 'form-control'
|
|
17
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
18
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
22
|
+
b.use :html5
|
|
23
|
+
b.use :placeholder
|
|
24
|
+
b.optional :maxlength
|
|
25
|
+
b.optional :readonly
|
|
26
|
+
b.use :label, class: 'control-label'
|
|
27
|
+
|
|
28
|
+
b.use :input
|
|
29
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
30
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
34
|
+
b.use :html5
|
|
35
|
+
b.optional :readonly
|
|
36
|
+
|
|
37
|
+
b.wrapper tag: 'div', class: 'checkbox' do |ba|
|
|
38
|
+
ba.use :label_input
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
42
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
46
|
+
b.use :html5
|
|
47
|
+
b.optional :readonly
|
|
48
|
+
b.use :label, class: 'control-label'
|
|
49
|
+
b.use :input
|
|
50
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
51
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
55
|
+
b.use :html5
|
|
56
|
+
b.use :placeholder
|
|
57
|
+
b.optional :maxlength
|
|
58
|
+
b.optional :pattern
|
|
59
|
+
b.optional :min_max
|
|
60
|
+
b.optional :readonly
|
|
61
|
+
b.use :label, class: 'col-sm-3 control-label'
|
|
62
|
+
|
|
63
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
|
64
|
+
ba.use :input, class: 'form-control'
|
|
65
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
66
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
71
|
+
b.use :html5
|
|
72
|
+
b.use :placeholder
|
|
73
|
+
b.optional :maxlength
|
|
74
|
+
b.optional :readonly
|
|
75
|
+
b.use :label, class: 'col-sm-3 control-label'
|
|
76
|
+
|
|
77
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
|
78
|
+
ba.use :input
|
|
79
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
80
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
85
|
+
b.use :html5
|
|
86
|
+
b.optional :readonly
|
|
87
|
+
|
|
88
|
+
b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
|
|
89
|
+
wr.wrapper tag: 'div', class: 'checkbox' do |ba|
|
|
90
|
+
ba.use :label_input, class: 'col-sm-9'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
94
|
+
wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
99
|
+
b.use :html5
|
|
100
|
+
b.optional :readonly
|
|
101
|
+
|
|
102
|
+
b.use :label, class: 'col-sm-3 control-label'
|
|
103
|
+
|
|
104
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
|
105
|
+
ba.use :input
|
|
106
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
107
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
|
112
|
+
b.use :html5
|
|
113
|
+
b.use :placeholder
|
|
114
|
+
b.optional :maxlength
|
|
115
|
+
b.optional :pattern
|
|
116
|
+
b.optional :min_max
|
|
117
|
+
b.optional :readonly
|
|
118
|
+
b.use :label, class: 'sr-only'
|
|
119
|
+
|
|
120
|
+
b.use :input, class: 'form-control'
|
|
121
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
|
122
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Wrappers for forms and inputs using the Bootstrap toolkit.
|
|
126
|
+
# Check the Bootstrap docs (http://getbootstrap.com)
|
|
127
|
+
# to learn about the different styles for forms and inputs,
|
|
128
|
+
# buttons and other elements.
|
|
129
|
+
config.default_wrapper = :vertical_form
|
|
130
|
+
config.wrapper_mappings = {
|
|
131
|
+
check_boxes: :vertical_radio_and_checkboxes,
|
|
132
|
+
radio_buttons: :vertical_radio_and_checkboxes,
|
|
133
|
+
file: :vertical_file_input,
|
|
134
|
+
boolean: :vertical_boolean,
|
|
135
|
+
}
|
|
136
|
+
end
|
|
@@ -49,7 +49,8 @@ en:
|
|
|
49
49
|
sticky_footer: Sticky footer style from
|
|
50
50
|
license: Code licensed under %{link}
|
|
51
51
|
|
|
52
|
-
attributes:
|
|
52
|
+
attributes:
|
|
53
|
+
id: ID
|
|
53
54
|
name: Name
|
|
54
55
|
text: Text
|
|
55
56
|
parent: Parent
|
|
@@ -76,15 +77,7 @@ en:
|
|
|
76
77
|
attributes:
|
|
77
78
|
comment:
|
|
78
79
|
name: Subject
|
|
79
|
-
|
|
80
|
-
area_tokens: Areas
|
|
81
|
-
country: Country
|
|
82
|
-
employment_relationship: Employment relationship
|
|
83
|
-
foreign_language: Foreign language
|
|
84
|
-
interface_language: Interface language
|
|
85
|
-
language: Mother tongue
|
|
86
|
-
profession: Profession
|
|
87
|
-
|
|
80
|
+
|
|
88
81
|
errors:
|
|
89
82
|
models:
|
|
90
83
|
general:
|
|
@@ -21,12 +21,17 @@ en:
|
|
|
21
21
|
title: Criteria
|
|
22
22
|
setup_tasks:
|
|
23
23
|
title: Setup Tasks
|
|
24
|
+
import: Import Tasks
|
|
24
25
|
add_task: Add Task
|
|
25
26
|
update: Update Tasks
|
|
26
27
|
activate:
|
|
27
28
|
title: Activate
|
|
28
29
|
|
|
29
30
|
activerecord:
|
|
31
|
+
attributes:
|
|
32
|
+
story:
|
|
33
|
+
tasks_file: Tasks file
|
|
34
|
+
|
|
30
35
|
errors:
|
|
31
36
|
models:
|
|
32
37
|
story:
|
|
@@ -11,4 +11,16 @@ en:
|
|
|
11
11
|
edit:
|
|
12
12
|
title: Settings
|
|
13
13
|
preferences:
|
|
14
|
-
title: Preferences
|
|
14
|
+
title: Preferences
|
|
15
|
+
|
|
16
|
+
activerecord:
|
|
17
|
+
attributes:
|
|
18
|
+
user:
|
|
19
|
+
area_tokens: Areas
|
|
20
|
+
country: Country
|
|
21
|
+
employment_relationship: Employment relationship
|
|
22
|
+
foreign_language: Foreign language
|
|
23
|
+
interface_language: Interface language
|
|
24
|
+
language: Mother tongue
|
|
25
|
+
profession: Profession
|
|
26
|
+
api_key: API Key
|
data/config/routes/api.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
namespace :
|
|
3
|
-
|
|
1
|
+
namespace :voluntary, path: 'api', module: 'voluntary/api', defaults: {format: 'json'} do
|
|
2
|
+
namespace :v1 do
|
|
3
|
+
resources :stories, only: [] do
|
|
4
|
+
resources :tasks, only: [:index, :create]
|
|
4
5
|
end
|
|
5
6
|
end
|
|
6
7
|
end
|
|
@@ -213,8 +213,6 @@ class CreateSchema < ActiveRecord::Migration
|
|
|
213
213
|
add_index :friendly_id_slugs, :sluggable_id
|
|
214
214
|
add_index :friendly_id_slugs, [:slug, :sluggable_type], :unique => true
|
|
215
215
|
add_index :friendly_id_slugs, :sluggable_type
|
|
216
|
-
|
|
217
|
-
VolontariatSeed.new.create_fixtures
|
|
218
216
|
end
|
|
219
217
|
|
|
220
218
|
def down
|
|
@@ -3,16 +3,20 @@ class ReplaceUserByPolymorphicResourceInCandidatures < ActiveRecord::Migration
|
|
|
3
3
|
add_column :vacancies, :resource_type, :string
|
|
4
4
|
add_column :vacancies, :resource_id, :integer
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
if (Product::Recruiting rescue nil)
|
|
7
|
+
Vacancy.where('user_id IS NOT NULL').update_all(resource_type: "User")
|
|
8
|
+
Vacancy.where('user_id IS NOT NULL').update_all('resource_id = user_id')
|
|
9
|
+
end
|
|
8
10
|
|
|
9
11
|
remove_column :vacancies, :user_id
|
|
10
12
|
|
|
11
13
|
add_column :candidatures, :resource_type, :string
|
|
12
14
|
add_column :candidatures, :resource_id, :integer
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
if (Product::Recruiting rescue nil)
|
|
17
|
+
Candidature.where('user_id IS NOT NULL').update_all(resource_type: "User")
|
|
18
|
+
Candidature.where('user_id IS NOT NULL').update_all('resource_id = user_id')
|
|
19
|
+
end
|
|
16
20
|
|
|
17
21
|
remove_column :candidatures, :user_id
|
|
18
22
|
|
|
@@ -27,8 +31,10 @@ class ReplaceUserByPolymorphicResourceInCandidatures < ActiveRecord::Migration
|
|
|
27
31
|
def down
|
|
28
32
|
add_column :vacancies, :user_id, :integer
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
if (Product::Recruiting rescue nil)
|
|
35
|
+
Vacancy.where('resource_type = "User"').update_all('user_id = resource_id')
|
|
36
|
+
Vacancy.where('resource_type <> "User"').destroy_all
|
|
37
|
+
end
|
|
32
38
|
|
|
33
39
|
remove_column :vacancies, :resource_type
|
|
34
40
|
remove_column :vacancies, :resource_id
|
|
@@ -37,8 +43,10 @@ class ReplaceUserByPolymorphicResourceInCandidatures < ActiveRecord::Migration
|
|
|
37
43
|
|
|
38
44
|
add_index :candidatures, [:user_id, :vacancy_id]
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
if (Product::Recruiting rescue nil)
|
|
47
|
+
Candidature.where('resource_type = "User"').update_all('user_id = resource_id')
|
|
48
|
+
Candidature.where('resource_type <> "User"').destroy_all
|
|
49
|
+
end
|
|
42
50
|
|
|
43
51
|
remove_column :candidatures, :resource_type
|
|
44
52
|
remove_column :candidatures, :resource_id
|
|
@@ -3,8 +3,8 @@ class DropRecruitingUnlessRecruitingPluginPresent < ActiveRecord::Migration
|
|
|
3
3
|
unless (Product::Recruiting rescue nil)
|
|
4
4
|
drop_table :vacancies
|
|
5
5
|
drop_table :candidatures
|
|
6
|
-
remove_index name: 'index_projects_users_on_project_id_and_user_id_and_vacancy_id'
|
|
7
|
-
|
|
6
|
+
remove_index 'projects_users', name: 'index_projects_users_on_project_id_and_user_id_and_vacancy_id'
|
|
7
|
+
remove_column :projects_users, :vacancy_id
|
|
8
8
|
add_index 'projects_users', ['project_id', 'user_id'], name: 'index_projects_users_on_project_id_and_user_id', unique: true, using: :btree
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -53,6 +53,7 @@ class DropRecruitingUnlessRecruitingPluginPresent < ActiveRecord::Migration
|
|
|
53
53
|
add_index 'candidatures', ['vacancy_id'], name: 'index_candidatures_on_vacancy_id', using: :btree
|
|
54
54
|
|
|
55
55
|
add_column 'projects_users', 'vacancy_id', :integer
|
|
56
|
+
remove_index 'projects_users', name: 'index_projects_users_on_project_id_and_user_id'
|
|
56
57
|
add_index 'projects_users', ['project_id', 'user_id', 'vacancy_id'], name: 'index_projects_users_on_project_id_and_user_id_and_vacancy_id', unique: true, using: :btree
|
|
57
58
|
end
|
|
58
59
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class AddApiKeyToUsers < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
add_column :users, :api_key, :string, limit: 32
|
|
4
|
+
|
|
5
|
+
User.where('api_key IS NULL').find_each do |user|
|
|
6
|
+
begin
|
|
7
|
+
user.api_key = SecureRandom.uuid.tr('-', '')
|
|
8
|
+
end while User.where(api_key: user.api_key).any?
|
|
9
|
+
|
|
10
|
+
user.save!
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
class Role < ActiveRecord::Base
|
|
2
|
+
attr_accessible :name
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
class Role::Master < Role
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class UserRole < ActiveRecord::Base
|
|
9
|
+
self.table_name = 'users_roles'
|
|
10
|
+
|
|
11
|
+
belongs_to :user
|
|
12
|
+
|
|
13
|
+
attr_accessible :user_id, :role_id
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class RemoveRolesModel < ActiveRecord::Migration
|
|
17
|
+
def up
|
|
18
|
+
add_column :users, :roles, :integer, limit: 8, null: false, default: 0
|
|
19
|
+
|
|
20
|
+
if role = Role.where(name: 'Master').first
|
|
21
|
+
UserRole.where(role_id: role.id).find_each do |user_role|
|
|
22
|
+
if user_role.role_id == role.id
|
|
23
|
+
ActiveRecord::Base.connection.execute "UPDATE users SET roles = 1 WHERE id = #{user_role.user_id}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
drop_table :roles
|
|
29
|
+
drop_table :users_roles
|
|
30
|
+
remove_column :projects_users, :role_id
|
|
31
|
+
remove_column :users, :main_role_id
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def down
|
|
35
|
+
create_table "roles", force: :cascade do |t|
|
|
36
|
+
t.string "name", limit: 255
|
|
37
|
+
t.string "state", limit: 255
|
|
38
|
+
t.datetime "created_at", null: false
|
|
39
|
+
t.datetime "updated_at", null: false
|
|
40
|
+
t.boolean "public", default: false
|
|
41
|
+
t.string "type", limit: 255
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
create_table "users_roles", force: :cascade do |t|
|
|
45
|
+
t.integer "role_id", limit: 4
|
|
46
|
+
t.integer "user_id", limit: 4
|
|
47
|
+
t.string "state", limit: 255
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
role = Role::Master.create(name: 'Master')
|
|
51
|
+
|
|
52
|
+
User.with_roles(:master).each {|user| UserRole.create(user_id: user.id, role_id: role.id) }
|
|
53
|
+
|
|
54
|
+
remove_column :users, :roles
|
|
55
|
+
|
|
56
|
+
add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", unique: true, using: :btree
|
|
57
|
+
|
|
58
|
+
add_column :projects_users, :role_id, :integer, limit: 4
|
|
59
|
+
add_index "projects_users", ["role_id"], name: "index_projects_users_on_role_id", using: :btree
|
|
60
|
+
|
|
61
|
+
add_column :users, :main_role_id, :integer, limit: 4
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -5,8 +5,6 @@ module Applicat
|
|
|
5
5
|
module Base
|
|
6
6
|
def self.included(base)
|
|
7
7
|
base.class_eval do
|
|
8
|
-
#has_many :role_assignments, :class_name => 'Role', :as => :authorizable
|
|
9
|
-
|
|
10
8
|
cattr_reader :per_page
|
|
11
9
|
@@per_page = 20
|
|
12
10
|
|
|
@@ -43,12 +41,6 @@ module Applicat
|
|
|
43
41
|
end
|
|
44
42
|
end
|
|
45
43
|
|
|
46
|
-
#def role_for?(role_name, user)
|
|
47
|
-
# return true if new_record?
|
|
48
|
-
#
|
|
49
|
-
# role_assignments.joins(:users).where('roles.name = ? AND users.id = ?', role_name, user.id).any?
|
|
50
|
-
#end
|
|
51
|
-
|
|
52
44
|
def to_s
|
|
53
45
|
self.name rescue self.class.name.humanize
|
|
54
46
|
end
|
|
@@ -16,6 +16,7 @@ module Concerns
|
|
|
16
16
|
attr_accessible :name
|
|
17
17
|
|
|
18
18
|
validates :name, presence: true, uniqueness: true
|
|
19
|
+
validate :special_characters_excluded
|
|
19
20
|
|
|
20
21
|
#pusherable "#{Rails.env}_channel"
|
|
21
22
|
end
|
|
@@ -45,6 +46,14 @@ module Concerns
|
|
|
45
46
|
|
|
46
47
|
# custom associations
|
|
47
48
|
def lists; List.where(thing_type: self.to_s); end
|
|
49
|
+
|
|
50
|
+
def special_characters_excluded
|
|
51
|
+
if name.match(/\//)
|
|
52
|
+
errors[:name] << I18n.t(
|
|
53
|
+
'activerecord.errors.models.thing.attributes.name.unwanted_special_characters_included'
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
48
57
|
end
|
|
49
58
|
end
|
|
50
59
|
end
|
|
@@ -82,21 +82,6 @@ module Voluntary
|
|
|
82
82
|
gem 'rack-piwik', '~> 0.1.3', require: 'rack/piwik', require: false
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
|
-
|
|
86
|
-
def append_load_seed_data
|
|
87
|
-
create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
|
|
88
|
-
append_file 'db/seeds.rb', :verbose => true do
|
|
89
|
-
<<-EOH
|
|
90
|
-
delivery_method_was = ActionMailer::Base.delivery_method
|
|
91
|
-
ActionMailer::Base.delivery_method = :test
|
|
92
|
-
|
|
93
|
-
db_seed = VolontariatSeed.new
|
|
94
|
-
db_seed.create_fixtures
|
|
95
|
-
|
|
96
|
-
ActionMailer::Base.delivery_method = delivery_method_was
|
|
97
|
-
EOH
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
85
|
end
|
|
101
86
|
end
|
|
102
87
|
end
|
|
@@ -93,21 +93,6 @@ gemspec path: File.expand_path(File.dirname(__FILE__) + "/../")
|
|
|
93
93
|
gem 'rack-piwik', '~> 0.1.3', require: 'rack/piwik', require: false
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
|
-
|
|
97
|
-
def append_load_seed_data
|
|
98
|
-
create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
|
|
99
|
-
append_file 'db/seeds.rb', :verbose => true do
|
|
100
|
-
<<-EOH
|
|
101
|
-
delivery_method_was = ActionMailer::Base.delivery_method
|
|
102
|
-
ActionMailer::Base.delivery_method = :test
|
|
103
|
-
|
|
104
|
-
db_seed = VolontariatSeed.new
|
|
105
|
-
db_seed.create_fixtures
|
|
106
|
-
|
|
107
|
-
ActionMailer::Base.delivery_method = delivery_method_was
|
|
108
|
-
EOH
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
96
|
end
|
|
112
97
|
end
|
|
113
98
|
end
|
|
@@ -14,17 +14,6 @@ module Voluntary
|
|
|
14
14
|
interface_language 'en'
|
|
15
15
|
password 'password'
|
|
16
16
|
password_confirmation { |u| u.password }
|
|
17
|
-
|
|
18
|
-
#after_create do |user|
|
|
19
|
-
# User.confirm_by_token(user.confirmation_token)
|
|
20
|
-
#end
|
|
21
|
-
|
|
22
|
-
factory :master_user do
|
|
23
|
-
after_create do |user|
|
|
24
|
-
role = Role.find_or_create_by(name: 'Master')
|
|
25
|
-
user.roles << role
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
17
|
end
|
|
29
18
|
|
|
30
19
|
factory_girl.factory :area do
|
data/lib/voluntary/version.rb
CHANGED
data/lib/voluntary.rb
CHANGED
|
@@ -25,7 +25,6 @@ require 'mongoid/history'
|
|
|
25
25
|
require 'mongoid_slug'
|
|
26
26
|
require 'has_scope'
|
|
27
27
|
require 'friendly_id'
|
|
28
|
-
require 'wicked'
|
|
29
28
|
require 'simple-navigation'
|
|
30
29
|
require 'facebox-rails'
|
|
31
30
|
require 'simple_form'
|
|
@@ -35,7 +34,6 @@ require 'will_paginate'
|
|
|
35
34
|
require 'will_paginate_mongoid'
|
|
36
35
|
require 'gon'
|
|
37
36
|
require 'json'
|
|
38
|
-
require 'acts_as_api'
|
|
39
37
|
require 'i18n-inflector-rails'
|
|
40
38
|
require 'rails-i18n'
|
|
41
39
|
require 'slim'
|
|
@@ -59,12 +57,12 @@ require 'coffee-script'
|
|
|
59
57
|
require 'font-awesome-rails'
|
|
60
58
|
require 'thor'
|
|
61
59
|
require 'selectize-rails'
|
|
60
|
+
require 'bitmask_attributes'
|
|
61
|
+
require 'csv'
|
|
62
|
+
require 'httparty'
|
|
62
63
|
|
|
63
64
|
require 'voluntary/navigation'
|
|
64
65
|
|
|
65
|
-
require 'db_seed'
|
|
66
|
-
require 'volontariat_seed'
|
|
67
|
-
|
|
68
66
|
if Rails.env == 'test'
|
|
69
67
|
require 'voluntary/test/rspec_helpers/factories'
|
|
70
68
|
end
|