voluntary 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/voluntary/application.js +1 -1
- data/app/assets/javascripts/voluntary/base.js.coffee +30 -1
- data/app/assets/stylesheets/voluntary/application.css +1 -0
- data/app/assets/stylesheets/voluntary/base.css.sass +1 -1
- data/app/controllers/areas_controller.rb +6 -5
- data/app/controllers/candidatures_controller.rb +15 -10
- data/app/controllers/concerns/voluntary/v1/base_controller.rb +95 -0
- data/app/controllers/devise_extensions/registrations_controller.rb +2 -2
- data/app/controllers/organizations_controller.rb +7 -6
- data/app/controllers/professions_controller.rb +6 -5
- data/app/controllers/projects_controller.rb +11 -6
- data/app/controllers/users_controller.rb +2 -2
- data/app/controllers/vacancies_controller.rb +14 -5
- data/app/controllers/voluntary/api/v1/api_controller.rb +9 -0
- data/app/controllers/voluntary/application_controller.rb +2 -66
- data/app/controllers/workflow/candidatures_controller.rb +1 -1
- data/app/controllers/workflow/products_controller.rb +7 -7
- data/app/controllers/workflow/stories_controller.rb +1 -1
- data/app/controllers/workflow/tasks_controller.rb +2 -2
- data/app/controllers/workflow/user/product/areas_controller.rb +2 -2
- data/app/controllers/workflow/user/projects_controller.rb +10 -2
- data/app/helpers/voluntary/application_helper.rb +79 -0
- data/app/helpers/voluntary/collection_helper.rb +45 -0
- data/app/helpers/voluntary/comments_helper.rb +13 -0
- data/app/helpers/voluntary/form_helper.rb +46 -0
- data/app/helpers/voluntary/language_helper.rb +17 -0
- data/app/helpers/voluntary/layout_helper.rb +42 -0
- data/app/helpers/voluntary/product_helper.rb +36 -0
- data/app/helpers/voluntary/show_helper.rb +67 -0
- data/app/helpers/voluntary/wizard_helper.rb +29 -0
- data/app/models/ability.rb +20 -4
- data/app/models/candidature.rb +10 -7
- data/app/models/column.rb +1 -0
- data/app/models/concerns/user/extensions.rb +5 -0
- data/app/models/concerns/user/listable.rb +10 -0
- data/app/models/list.rb +30 -0
- data/app/models/list_item.rb +22 -0
- data/app/models/organization.rb +1 -0
- data/app/models/page.rb +2 -1
- data/app/models/product.rb +3 -2
- data/app/models/project.rb +2 -2
- data/app/models/result.rb +1 -0
- data/app/models/role.rb +1 -1
- data/app/models/state_machines/candidature.rb +17 -1
- data/app/models/state_machines/story.rb +15 -2
- data/app/models/state_machines/task.rb +33 -0
- data/app/models/story.rb +3 -2
- data/app/models/task.rb +44 -6
- data/app/models/thing.rb +3 -0
- data/app/models/user.rb +15 -4
- data/app/models/vacancy.rb +7 -5
- data/app/presenters/resources/general/wizards/story/steps/setup_tasks_presenter.rb +1 -1
- data/app/presenters/shared/collection/table_presenter.rb +1 -1
- data/app/views/candidatures/index.html.erb +1 -1
- data/app/views/candidatures/show.html.erb +1 -1
- data/app/views/columns/_collection.html.erb +0 -0
- data/app/views/comments/_resource.html.erb +1 -1
- data/app/views/layouts/application.html.erb +12 -0
- data/app/views/layouts/shared/_navigation.html.erb +3 -3
- data/app/views/organizations/show.html.erb +0 -1
- data/app/views/products/index.html.erb +53 -4
- data/app/views/projects/_form.html.erb +1 -0
- data/app/views/projects/show.html.erb +2 -1
- data/app/views/shared/collection/_list.html.erb +1 -1
- data/app/views/shared/resource/_actions.html.erb +2 -2
- data/app/views/stories/_column_fields.html.erb +0 -0
- data/app/views/stories/_form.html.erb +1 -1
- data/app/views/stories/steps/_activate.html.erb +1 -1
- data/app/views/workflow/products/show.html.erb +1 -1
- data/app/views/workflow/project_owner/_candidatures.html.erb +2 -1
- data/app/views/workflow/tasks/_work_head.html.erb +1 -1
- data/app/views/workflow/tasks/steps/_complete.html.erb +6 -2
- data/app/views/workflow/tasks/steps/_review.html.erb +6 -2
- data/app/views/workflow/tasks/steps/_work.html.erb +4 -2
- data/app/views/workflow/user/product/areas/show.html.erb +0 -0
- data/app/views/workflow/user/projects/show.html.erb +0 -0
- data/config/initializers/devise.rb +2 -5
- data/config/initializers/filter_parameters_logging.rb +1 -0
- data/config/initializers/friendly_id.rb +88 -0
- data/config/initializers/wrap_parameters.rb +15 -0
- data/config/locales/general/en.yml +15 -9
- data/config/locales/resources/story/en.yml +1 -0
- data/config/routes.rb +9 -0
- data/config/routes/workflow.rb +15 -15
- data/db/migrate/20120907144853_create_schema.rb +1 -1
- data/db/migrate/20120922201955_create_mongo_db_documents.rb +1 -1
- data/db/migrate/20121004132105_create_professions.rb +1 -1
- data/db/migrate/20121006162913_add_public_attribute_to_roles.rb +20 -1
- data/db/migrate/20130817090734_create_lists.rb +33 -0
- data/db/migrate/20131018143613_replace_user_by_polymorphic_resource_in_candidatures.rb +46 -0
- data/db/migrate/20140307113214_add_user_id_to_organizations.rb +5 -0
- data/lib/api_constraints.rb +10 -0
- data/lib/applicat/mvc/model/tree.rb +1 -1
- data/lib/concerns/model/base_list_item.rb +30 -0
- data/lib/concerns/model/base_thing.rb +50 -0
- data/lib/db_seed.rb +15 -4
- data/lib/generators/voluntary/install/install_generator.rb +17 -16
- data/lib/generators/voluntary/install/templates/app/views/layouts/application.html.erb +17 -1
- data/lib/generators/voluntary/install/templates/config/main_navigation.rb +1 -260
- data/lib/generators/voluntary/install/templates/features/support/integration_sessions_controller.rb +1 -2
- data/lib/generators/voluntary/install/templates/spec/factories.rb +19 -0
- data/lib/generators/voluntary/install/templates/spec/support/mongo_database_cleaner.rb +14 -4
- data/lib/generators/voluntary/product_dummy/product_dummy_generator.rb +23 -17
- data/lib/generators/voluntary/product_dummy/templates/config/database.example.yml +1 -1
- data/lib/generators/voluntary/product_dummy/templates/dummy/spec/factories.rb +19 -0
- data/lib/generators/voluntary/product_dummy/templates/dummy/spec/spec_helper.rb +75 -0
- data/lib/generators/voluntary/product_dummy/templates/features/support/integration_sessions_controller.rb +1 -2
- data/lib/generators/voluntary/product_dummy/templates/spec/factories.rb +19 -0
- data/lib/voluntary.rb +10 -22
- data/lib/voluntary/engine.rb +27 -3
- data/lib/voluntary/navigation.rb +358 -0
- data/lib/voluntary/test/rspec_helpers/factories.rb +123 -0
- data/lib/voluntary/version.rb +1 -1
- data/vendor_extensions/active_model/naming.rb +1 -1
- metadata +526 -308
- data/app/helpers/application_helper.rb +0 -65
- data/app/helpers/collection_helper.rb +0 -35
- data/app/helpers/comments_helper.rb +0 -11
- data/app/helpers/form_helper.rb +0 -43
- data/app/helpers/language_helper.rb +0 -15
- data/app/helpers/layout_helper.rb +0 -39
- data/app/helpers/product_helper.rb +0 -34
- data/app/helpers/show_helper.rb +0 -65
- data/app/helpers/wizard_helper.rb +0 -27
- data/app/observers/candidature_observer.rb +0 -29
- data/app/observers/story_observer.rb +0 -6
- data/app/observers/task_observer.rb +0 -34
- data/lib/voluntary/helpers/application.rb +0 -69
- data/lib/voluntary/helpers/collection.rb +0 -35
- data/lib/voluntary/helpers/comments.rb +0 -15
- data/lib/voluntary/helpers/form.rb +0 -43
- data/lib/voluntary/helpers/language.rb +0 -19
- data/lib/voluntary/helpers/layout.rb +0 -28
- data/lib/voluntary/helpers/product.rb +0 -36
- data/lib/voluntary/helpers/show.rb +0 -69
- data/lib/voluntary/helpers/wizard.rb +0 -31
@@ -1,35 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Collection
|
4
|
-
def table_cell column, resource, alternative_value = nil
|
5
|
-
value = '-'
|
6
|
-
|
7
|
-
if column == 'name'
|
8
|
-
value = resource.send(column)
|
9
|
-
|
10
|
-
if alternative_value.is_a?(Proc)
|
11
|
-
return alternative_value.call(resource)
|
12
|
-
elsif value.blank? && alternative_value.present?
|
13
|
-
value = eval("resource.#{alternative_value}")
|
14
|
-
elsif value.blank?
|
15
|
-
value = '-'
|
16
|
-
end
|
17
|
-
|
18
|
-
link_to value, eval("#{root_model_class_name(resource).tableize.singularize}_path(resource)")
|
19
|
-
elsif column.match('_id')
|
20
|
-
association = nil
|
21
|
-
|
22
|
-
begin
|
23
|
-
association = resource.send(column.gsub('_id', ''))
|
24
|
-
rescue
|
25
|
-
association = eval("resource.#{alternative_value}") if alternative_value.present?
|
26
|
-
end
|
27
|
-
|
28
|
-
association ? link_to(association.name, association) : value
|
29
|
-
else
|
30
|
-
resource.send(column)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Comments
|
4
|
-
def nested_comments(comments)
|
5
|
-
comments.map do |comment, sub_comments|
|
6
|
-
next if comment.id.blank?
|
7
|
-
|
8
|
-
content = render(partial: 'comments/resource', locals: { resource: comment })
|
9
|
-
content += content_tag(:div, nested_comments(sub_comments), class: 'nested_comments')
|
10
|
-
content
|
11
|
-
end.join.html_safe
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Form
|
4
|
-
def link_to_add_fields(name, f, association, options = {})
|
5
|
-
attributes = {
|
6
|
-
"#{root_model_class_name(f.object).tableize.singularize}_id".to_sym => f.object.id
|
7
|
-
}
|
8
|
-
|
9
|
-
new_object = if f.object.respond_to? "#{association.to_s.singularize}_class"
|
10
|
-
f.object.tasks.new(attributes)
|
11
|
-
else
|
12
|
-
f.object.send(association).new(attributes)
|
13
|
-
end
|
14
|
-
|
15
|
-
id = new_object.object_id
|
16
|
-
|
17
|
-
fields = f.fields_for(association, new_object, child_index: id) do |builder|
|
18
|
-
render_product_specific_partial_if_available(
|
19
|
-
new_object, "#{controller_name}/#{association.to_s.singularize}_fields",
|
20
|
-
f: builder
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
data = {id: id, fields: fields.gsub("\n", '')}
|
25
|
-
data[:target] = options[:target] if options.has_key?(:target)
|
26
|
-
|
27
|
-
link_to(name, '#', class: 'add_fields', data: data)
|
28
|
-
end
|
29
|
-
|
30
|
-
def remove_fields(f)
|
31
|
-
if f.object.try(:new_record?)
|
32
|
-
link_to t('general.remove'), '#', class: 'remove_fields'
|
33
|
-
else
|
34
|
-
f.check_box(:_destroy) + f.label(:_destroy, t('general.destroy'))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def autocomplete_input(f, field)
|
39
|
-
f.input "#{field}_name", input_html: { data: {autocomplete: eval("autocomplete_#{field.to_s.tableize}_path")} }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Language
|
4
|
-
def available_language_options
|
5
|
-
options = []
|
6
|
-
|
7
|
-
AVAILABLE_LANGUAGES.each do |locale, language|
|
8
|
-
options << [language, locale]
|
9
|
-
end
|
10
|
-
|
11
|
-
options.sort_by { |o| o[0] }
|
12
|
-
end
|
13
|
-
|
14
|
-
def all_language_options
|
15
|
-
User.languages.sort_by { |o| o[0] }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Layout
|
4
|
-
def breadcrumbs
|
5
|
-
result = render_navigation context: :main, renderer: :breadcrumbs_without_method_links, join_with: ' > '
|
6
|
-
result && result.split('<a').length > 2 ? result : ''
|
7
|
-
end
|
8
|
-
|
9
|
-
def sidenav
|
10
|
-
result = render_navigation context: :main, renderer: :twitter_sidenav, level: @twitter_sidenav_level
|
11
|
-
result && result.split('<a').length > 2 ? result : ''
|
12
|
-
end
|
13
|
-
|
14
|
-
def footer_navigation
|
15
|
-
links = []
|
16
|
-
|
17
|
-
['privacy-policy', 'terms-of-use', 'about-us'].each do |page_name|
|
18
|
-
text = t("pages.#{page_name.gsub('-', '_')}.title")
|
19
|
-
path = "#{controller_name}/#{params[:id]}"
|
20
|
-
active = path == "#{controller_name}/#{page_name}"
|
21
|
-
links << (active ? text : link_to(text, page_path(page_name)))
|
22
|
-
end
|
23
|
-
|
24
|
-
raw links.join(' | ')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Product
|
4
|
-
def render_product_specific_presenter_if_available(resource, partial_path, method, options = {})
|
5
|
-
if @presenter.respond_to?(method)
|
6
|
-
@step_presenter = @presenter.send(method)
|
7
|
-
else
|
8
|
-
@step_presenter = nil
|
9
|
-
end
|
10
|
-
|
11
|
-
render_product_specific_partial_if_available(resource, "#{partial_path}/#{method}", options)
|
12
|
-
end
|
13
|
-
|
14
|
-
def render_product_specific_partial_if_available(resource, partial_path, options = {})
|
15
|
-
path = nil
|
16
|
-
partial_path = partial_path.split('/')
|
17
|
-
file_name = partial_path.pop
|
18
|
-
partial_path = partial_path.join('/')
|
19
|
-
|
20
|
-
if resource && resource.respond_to?(:product) && resource.product
|
21
|
-
path = "products/types/#{directory_for_resource(resource.product)}/#{partial_path}"
|
22
|
-
|
23
|
-
if File.exist?("#{Rails.root.to_s}/app/views/#{path}/_#{file_name}.html.erb")
|
24
|
-
path = [path, file_name].join('/')
|
25
|
-
else
|
26
|
-
path = nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
path = [partial_path, file_name].join('/') if path.blank?
|
31
|
-
|
32
|
-
render path, options
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Show
|
4
|
-
def show_attributes(*attributes)
|
5
|
-
result = ''
|
6
|
-
|
7
|
-
attributes.each {|attribute| result += show_attribute attribute}
|
8
|
-
|
9
|
-
raw result
|
10
|
-
end
|
11
|
-
|
12
|
-
def show_attribute(attribute, options = {})
|
13
|
-
title = options[:title] || attribute_translation(attribute)
|
14
|
-
value = options[:value] || resource.send(attribute)
|
15
|
-
|
16
|
-
value.blank? ? '' : content_tag(:dt, title) + content_tag(:dd, value)
|
17
|
-
end
|
18
|
-
|
19
|
-
def show_associations(*associations)
|
20
|
-
result = ''
|
21
|
-
|
22
|
-
associations.each {|association| result += show_association association}
|
23
|
-
|
24
|
-
raw result
|
25
|
-
end
|
26
|
-
|
27
|
-
def show_association(association)
|
28
|
-
if association.to_s == association.to_s.pluralize
|
29
|
-
return show_attribute(
|
30
|
-
association,
|
31
|
-
title: t("#{association}.index.title"),
|
32
|
-
value: raw(resource.send(association).map{|a| link_to a.name, a}.join(', '))
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
title = if general_attribute?(:parent)
|
37
|
-
t("activerecord.attributes.general.#{association}")
|
38
|
-
else
|
39
|
-
if resource.send(association)
|
40
|
-
t("activerecord.models.#{root_model_class_name(resource.send(association)).underscore}")
|
41
|
-
else
|
42
|
-
t("activerecord.models.#{association}")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
if resource.send(association)
|
47
|
-
show_attribute(
|
48
|
-
association,
|
49
|
-
title: title,
|
50
|
-
value: link_to(resource.send(association).try(:name), resource.send(association))
|
51
|
-
)
|
52
|
-
else
|
53
|
-
''
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def show_actions
|
58
|
-
result = content_tag :dt, raw(' ')
|
59
|
-
result += content_tag :dd, render(
|
60
|
-
partial: 'shared/resource/actions', locals: {
|
61
|
-
type: root_model_class_name(resource).tableize, resource: resource
|
62
|
-
}
|
63
|
-
)
|
64
|
-
|
65
|
-
raw result
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Voluntary
|
2
|
-
module Helpers
|
3
|
-
module Wizard
|
4
|
-
def section_header(wizard_step)
|
5
|
-
wizard_step_index = wizard_steps.index(wizard_step) + 1
|
6
|
-
|
7
|
-
content = ["#{wizard_step_index} / #{wizard_steps.length}"]
|
8
|
-
content << t("stories.steps.#{wizard_step}.title")
|
9
|
-
content << (future_step?(wizard_step) ? t('general.not_available') : '')
|
10
|
-
|
11
|
-
content.join(' ')
|
12
|
-
end
|
13
|
-
|
14
|
-
def step_pane(wizard_step)
|
15
|
-
return if future_step?(wizard_step)
|
16
|
-
|
17
|
-
partial_path = wizard_step == :initialization ? 'form' : "steps/#{wizard_step}"
|
18
|
-
|
19
|
-
if @presenter.respond_to?(wizard_step)
|
20
|
-
@step_presenter = @presenter.send(wizard_step)
|
21
|
-
else
|
22
|
-
@step_presenter = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
render_product_specific_partial_if_available(
|
26
|
-
resource, "#{controller_name}/#{partial_path}"
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|