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
@@ -0,0 +1,33 @@
|
|
1
|
+
class CreateLists < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :lists, force: true do |t|
|
4
|
+
t.integer :user_id
|
5
|
+
t.string :name
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :lists, :user_id
|
10
|
+
|
11
|
+
create_table :list_items, force: true do |t|
|
12
|
+
t.integer :list_id
|
13
|
+
t.integer :user_id
|
14
|
+
t.string :thing_type
|
15
|
+
t.integer :thing_id
|
16
|
+
t.integer :position
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
#add_index :list_items, [:list_id, :position], unique: true
|
21
|
+
|
22
|
+
create_table :things, force: true do |t|
|
23
|
+
t.string :name
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index :things, :name, unique: true
|
28
|
+
end
|
29
|
+
|
30
|
+
def down
|
31
|
+
[:lists, :list_items, :things].each {|table| drop_table table }
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class ReplaceUserByPolymorphicResourceInCandidatures < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :vacancies, :resource_type, :string
|
4
|
+
add_column :vacancies, :resource_id, :integer
|
5
|
+
|
6
|
+
Vacancy.update_all(resource_type: "User")
|
7
|
+
Vacancy.update_all('resource_id = user_id')
|
8
|
+
|
9
|
+
remove_column :vacancies, :user_id
|
10
|
+
|
11
|
+
add_column :candidatures, :resource_type, :string
|
12
|
+
add_column :candidatures, :resource_id, :integer
|
13
|
+
|
14
|
+
Candidature.update_all(resource_type: "User")
|
15
|
+
Candidature.update_all('resource_id = user_id')
|
16
|
+
|
17
|
+
remove_column :candidatures, :user_id
|
18
|
+
|
19
|
+
begin
|
20
|
+
remove_index :candidatures, [:user_id, :vacancy_id]
|
21
|
+
rescue
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index :candidatures, [:resource_id, :resource_type, :vacancy_id], unique: true, name: 'index_candidatures_on_resource_and_vacancy'
|
25
|
+
end
|
26
|
+
|
27
|
+
def down
|
28
|
+
add_column :vacancies, :user_id, :integer
|
29
|
+
|
30
|
+
Vacancy.where('resource_type = "User"').update_all('user_id = resource_id')
|
31
|
+
Vacancy.where('resource_type <> "User"').destroy_all
|
32
|
+
|
33
|
+
remove_column :vacancies, :resource_type
|
34
|
+
remove_column :vacancies, :resource_id
|
35
|
+
|
36
|
+
add_column :candidatures, :user_id, :integer
|
37
|
+
|
38
|
+
add_index :candidatures, [:user_id, :vacancy_id]
|
39
|
+
|
40
|
+
Candidature.where('resource_type = "User"').update_all('user_id = resource_id')
|
41
|
+
Candidature.where('resource_type <> "User"').destroy_all
|
42
|
+
|
43
|
+
remove_column :candidatures, :resource_type
|
44
|
+
remove_column :candidatures, :resource_id
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Concerns
|
2
|
+
module Model
|
3
|
+
module BaseListItem
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
belongs_to :list
|
8
|
+
belongs_to :thing, polymorphic: true
|
9
|
+
|
10
|
+
validates :list_id, presence: true
|
11
|
+
validates :thing_type, presence: true
|
12
|
+
validates :thing_id, presence: true
|
13
|
+
|
14
|
+
#pusherable "#{Rails.env}_channel"
|
15
|
+
|
16
|
+
def thing=(thing)
|
17
|
+
thing.save if thing.new_record?
|
18
|
+
|
19
|
+
self.thing_type = thing.class.name; self.thing_id = thing.id
|
20
|
+
|
21
|
+
if self.respond_to?(:list_item_id) && self.list.present?
|
22
|
+
self.list_item ||= self.list.items.find_or_create_by_thing_type_and_thing_id(thing_type, thing_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
thing
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Concerns
|
2
|
+
module Model
|
3
|
+
module BaseThing
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
# find or create movies list
|
8
|
+
class_attribute :list_instance
|
9
|
+
|
10
|
+
#LIST_ID = list.id
|
11
|
+
|
12
|
+
has_many :list_items, as: :thing, dependent: :destroy
|
13
|
+
has_many :user_list_items, as: :thing
|
14
|
+
has_many :users, through: :user_list_items
|
15
|
+
|
16
|
+
attr_accessible :name
|
17
|
+
|
18
|
+
validates :name, presence: true, uniqueness: true
|
19
|
+
|
20
|
+
#pusherable "#{Rails.env}_channel"
|
21
|
+
end
|
22
|
+
|
23
|
+
module ClassMethods
|
24
|
+
def list
|
25
|
+
#if self.to_s.constantize.const_defined?('LIST_ID') && LIST_ID.present?
|
26
|
+
# self.to_s.constantize.list_instance ||= List.find(LIST_ID)
|
27
|
+
#end
|
28
|
+
|
29
|
+
return self.to_s.constantize.list_instance if self.to_s.constantize.list_instance.present?
|
30
|
+
|
31
|
+
attributes = {
|
32
|
+
adjective: 'best', topic: self.to_s, scope: 'ever', thing_type: self.to_s,
|
33
|
+
negative_adjective: 'worst'
|
34
|
+
}
|
35
|
+
|
36
|
+
self.to_s.constantize.list_instance = List.where(attributes).first
|
37
|
+
|
38
|
+
unless self.to_s.constantize.list_instance.present?
|
39
|
+
self.to_s.constantize.list_instance = List.create!(attributes)
|
40
|
+
end
|
41
|
+
|
42
|
+
self.to_s.constantize.list_instance
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# custom associations
|
47
|
+
def lists; List.where(thing_type: self.to_s); end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/db_seed.rb
CHANGED
@@ -28,8 +28,11 @@ class DbSeed
|
|
28
28
|
@users = {}
|
29
29
|
|
30
30
|
self.class::USER_ROLES.each do |role,attributes|
|
31
|
+
name = role.to_s.humanize
|
32
|
+
name += ' user' unless name == 'User'
|
33
|
+
|
31
34
|
@users[role] = attributes
|
32
|
-
@users[role][:id] = User.find_by_name(
|
35
|
+
@users[role][:id] = User.find_by_name(name).id
|
33
36
|
end
|
34
37
|
|
35
38
|
@users
|
@@ -65,7 +68,9 @@ class DbSeed
|
|
65
68
|
Role.import([:name], self.class::USER_ROLES.keys.map{|role| [role.to_s.humanize]})
|
66
69
|
|
67
70
|
self.class::USER_ROLES.keys.each do |role|
|
68
|
-
attributes = { name: role.to_s.humanize
|
71
|
+
attributes = { name: role.to_s.humanize }
|
72
|
+
|
73
|
+
attributes[:public] = [:project_owner, :user].include?(role) if Role.new.respond_to? :public
|
69
74
|
|
70
75
|
"Role::#{role.to_s.classify}".constantize.create(attributes)
|
71
76
|
end
|
@@ -73,11 +78,17 @@ class DbSeed
|
|
73
78
|
|
74
79
|
def create_users
|
75
80
|
self.class::USER_ROLES.each do |role, settings|
|
81
|
+
name = role.to_s.humanize
|
82
|
+
name += ' user' unless name == 'User'
|
83
|
+
|
76
84
|
attributes = {
|
77
|
-
name:
|
85
|
+
name: name, first_name: 'Mister', last_name: role.to_s.humanize, email: "#{role}@volontari.at",
|
78
86
|
password: "#{role}2012", language: 'en', country: 'Germany', interface_language: 'en'
|
79
87
|
}
|
88
|
+
|
89
|
+
attributes.reject!{|key,value| !User.new.respond_to? key }
|
80
90
|
attributes[:password_confirmation] = attributes[:password]
|
91
|
+
|
81
92
|
create_record(User, attributes) # events: ['skip_confirmation!']
|
82
93
|
end
|
83
94
|
end
|
@@ -102,7 +113,7 @@ class DbSeed
|
|
102
113
|
|
103
114
|
send_events(record, events) if events.any?
|
104
115
|
|
105
|
-
record.save! if record.new_record?
|
116
|
+
record.save!(validate: false) if record.new_record?
|
106
117
|
|
107
118
|
record
|
108
119
|
end
|
@@ -18,7 +18,7 @@ module Voluntary
|
|
18
18
|
|
19
19
|
# model
|
20
20
|
gem 'settingslogic', git: 'https://github.com/binarylogic/settingslogic.git'
|
21
|
-
|
21
|
+
|
22
22
|
# view
|
23
23
|
gem 'acts_as_markup', git: 'git://github.com/vigetlabs/acts_as_markup.git'
|
24
24
|
gem 'auto_html', git: 'git://github.com/Applicat/auto_html'
|
@@ -43,42 +43,43 @@ module Voluntary
|
|
43
43
|
# gem 'markerb', git: 'https://github.com/plataformatec/markerb.git'
|
44
44
|
|
45
45
|
gem_group :development do
|
46
|
+
gem 'mysql2', '~> 0.3.13'
|
46
47
|
gem 'linecache', '0.46', platforms: :mri_18
|
47
|
-
gem 'capistrano', require: false
|
48
|
-
gem 'capistrano_colors', require: false
|
49
|
-
gem 'capistrano-ext', require: false
|
50
|
-
gem 'yard', require: false
|
48
|
+
gem 'capistrano', '~> 2.15.5', require: false
|
49
|
+
gem 'capistrano_colors', '~> 0.5.5', require: false
|
50
|
+
gem 'capistrano-ext', '~> 1.2.1', require: false
|
51
|
+
gem 'yard', '~> 0.7', require: false
|
51
52
|
end
|
52
53
|
|
53
54
|
gem_group :test do
|
54
|
-
gem 'cucumber-rails', '1.3.0', require: false
|
55
|
-
gem 'rspec-instafail', '
|
56
|
-
gem 'webmock', '~> 1.
|
57
|
-
gem 'simplecov', require: false
|
55
|
+
gem 'cucumber-rails', '~> 1.3.0', require: false
|
56
|
+
gem 'rspec-instafail', '~> 0.2.4', require: false
|
57
|
+
gem 'webmock', '~> 1.8.11', require: false
|
58
|
+
gem 'simplecov', '~> 0.7.1', require: false
|
58
59
|
end
|
59
60
|
|
60
61
|
gem_group :development, :test do
|
61
62
|
gem 'debugger', platforms: :mri_19
|
62
|
-
gem 'ruby-debug', platforms: :mri_18
|
63
|
+
gem 'ruby-debug', '~> 0.10.4', platforms: :mri_18
|
63
64
|
end
|
64
65
|
|
65
66
|
gem_group :assets do
|
66
|
-
gem 'therubyracer', platforms: :ruby
|
67
|
+
gem 'therubyracer', '~> 0.12.0', platforms: :ruby
|
67
68
|
|
68
69
|
# asset_sync is required as needed by application.rb
|
69
|
-
gem 'asset_sync', require: nil
|
70
|
+
gem 'asset_sync', '~> 0.5.0', require: nil
|
70
71
|
end
|
71
72
|
|
72
73
|
gem_group :production do
|
73
74
|
# dependency nokogiri is incompatible with cucumber-rails
|
74
75
|
# gem 'rails_admin', git: 'git://github.com/halida/rails_admin.git'
|
75
|
-
gem 'fastercsv', '1.5.5', require: false
|
76
|
-
gem 'rack-ssl', require: 'rack/ssl'
|
76
|
+
gem 'fastercsv', '~> 1.5.5', require: false
|
77
|
+
gem 'rack-ssl', '~> 1.3.3', require: 'rack/ssl'
|
77
78
|
gem 'rack-rewrite', '~> 1.2.1', require: false
|
78
79
|
|
79
80
|
# analytics
|
80
|
-
gem 'rack-google-analytics', require: 'rack/google-analytics'
|
81
|
-
gem 'rack-piwik', require: 'rack/piwik', require: false
|
81
|
+
gem 'rack-google-analytics', '~> 0.11.0', require: 'rack/google-analytics'
|
82
|
+
gem 'rack-piwik', '~> 0.1.3', require: 'rack/piwik', require: false
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
@@ -4,12 +4,19 @@
|
|
4
4
|
<title><%= t('layout.title') %></title>
|
5
5
|
<meta charset='utf-8'>
|
6
6
|
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
8
|
<%= stylesheet_link_tag 'voluntary/application', media: 'all' %>
|
8
9
|
<%= stylesheet_link_tag 'application', media: 'all' %>
|
10
|
+
<link href="//netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css" rel="stylesheet"/>
|
9
11
|
</head>
|
10
12
|
<body>
|
11
13
|
<%= render 'layouts/shared/navigation' %>
|
12
14
|
|
15
|
+
<section id="dialog">
|
16
|
+
<img alt="Ajax-loader-small" class="hide " id="dialog_body_spinner" src="<%=image_path('voluntary/spinner.gif')%>"/>
|
17
|
+
<div id="dialog_body"/>
|
18
|
+
</section>
|
19
|
+
|
13
20
|
<div class="container-fluid">
|
14
21
|
<% unless flash.empty? %>
|
15
22
|
<div class="row-fluid">
|
@@ -19,14 +26,22 @@
|
|
19
26
|
</div>
|
20
27
|
<% end %>
|
21
28
|
<div class="row-fluid">
|
29
|
+
<% if sidenav(@sidenav_links_count).present? %>
|
22
30
|
<div class="span9">
|
23
31
|
<%= breadcrumbs %>
|
24
32
|
|
25
33
|
<%= yield %>
|
26
34
|
</div>
|
27
35
|
<div class="span3">
|
28
|
-
<%= sidenav %>
|
36
|
+
<%= sidenav(@sidenav_links_count) %>
|
29
37
|
</div>
|
38
|
+
<% else %>
|
39
|
+
<div class="span12">
|
40
|
+
<%= breadcrumbs %>
|
41
|
+
|
42
|
+
<%= yield %>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
30
45
|
</div>
|
31
46
|
</div>
|
32
47
|
<div class="container-fluid">
|
@@ -38,6 +53,7 @@
|
|
38
53
|
</div>
|
39
54
|
<%= javascript_include_tag 'voluntary/application' %>
|
40
55
|
<%= javascript_include_tag 'application' %>
|
56
|
+
<%= yield :javascript_includes %>
|
41
57
|
<%= csrf_meta_tags %>
|
42
58
|
<%= javascript_tag do %>
|
43
59
|
<%= yield :top_javascript %>
|
@@ -1,262 +1,3 @@
|
|
1
1
|
SimpleNavigation::Configuration.run do |navigation|
|
2
|
-
navigation.
|
3
|
-
primary.dom_class = 'nav'
|
4
|
-
primary.item :root, t('general.index.title'), root_path
|
5
|
-
|
6
|
-
primary.item :areas, t('areas.index.title'), areas_path do |areas|
|
7
|
-
areas.item :new, t('general.new'), new_area_path
|
8
|
-
|
9
|
-
unless (@area.new_record? rescue true)
|
10
|
-
areas.item :show, @area.name, area_path(@area) do |area|
|
11
|
-
if can? :destroy, @area
|
12
|
-
area.item :destroy, t('general.destroy'), area_path(@area), method: :delete, confirm: t('general.questions.are_you_sure')
|
13
|
-
end
|
14
|
-
|
15
|
-
area.item :show, t('general.details'), "#{area_path(@area)}#top"
|
16
|
-
area.item :edit, t('general.edit'), edit_area_path(@area) if can? :edit, @area
|
17
|
-
area.item :users, t('users.index.title'), area_users_path(@area)
|
18
|
-
area.item :projects, t('projects.index.title'), area_projects_path(@area)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
primary.item :products, t('products.index.title'), products_path do |products|
|
24
|
-
products.item :new, t('general.new'), new_product_path
|
25
|
-
|
26
|
-
unless (@product.new_record? rescue true)
|
27
|
-
products.item :show, @product.name, product_path(@product) do |product|
|
28
|
-
if can? :edit, @product
|
29
|
-
product.item :destroy, t('general.destroy'), product_path(@product), method: :delete, confirm: t('general.questions.are_you_sure')
|
30
|
-
end
|
31
|
-
|
32
|
-
product.item :show, t('general.details'), "#{product_path(@product)}#top"
|
33
|
-
product.item :edit, t('general.edit'), edit_product_path(@product) if can? :edit, @product
|
34
|
-
|
35
|
-
product.item :projects, t('projects.index.title'), product_projects_path(@product)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
primary.item :projects, t('projects.index.title'), projects_path do |projects|
|
41
|
-
projects.item :new, t('general.new'), new_project_path
|
42
|
-
|
43
|
-
unless (@project.new_record? rescue true)
|
44
|
-
projects.item :show, @project.name, project_path(@project) do |project|
|
45
|
-
if can? :destroy, @project
|
46
|
-
project.item :destroy, t('general.destroy'), project_path(@project), method: :delete, confirm: t('general.questions.are_you_sure')
|
47
|
-
end
|
48
|
-
|
49
|
-
project.item :show, t('general.details'), "#{project_path(@project)}#top"
|
50
|
-
project.item :edit, t('general.edit'), edit_project_path(@project) if can? :edit, @project
|
51
|
-
|
52
|
-
project.item :users, t('users.index.title'), project_users_path(@project)
|
53
|
-
|
54
|
-
project.item :vacancies, t('vacancies.index.title'), project_vacancies_path(@project) do |vacancy|
|
55
|
-
vacancy.item :new, t('general.new'), new_project_vacancy_path(@project)
|
56
|
-
end
|
57
|
-
|
58
|
-
project.item :stories, t('stories.index.title'), project_stories_path(@project) do |stories|
|
59
|
-
stories.item :new, t('general.new'), new_project_story_path(@project)
|
60
|
-
|
61
|
-
unless (@story.new_record? rescue true)
|
62
|
-
stories.item(:show, @story.name, story_path(@story)) do |story|
|
63
|
-
if can? :destroy, @story
|
64
|
-
story.item :destroy, t('general.destroy'), story_path(@story), method: :delete, confirm: t('general.questions.are_you_sure')
|
65
|
-
end
|
66
|
-
|
67
|
-
story.item :show, t('general.details'), "#{story_path(@story)}#top"
|
68
|
-
story.item :edit, t('general.edit'), edit_story_path(@story) if can? :edit, @story
|
69
|
-
|
70
|
-
story.item :steps, t('general.steps'), setup_tasks_story_path(@story) do |steps|
|
71
|
-
steps.item :setup_tasks, t('stories.steps.setup_tasks.title'), setup_tasks_story_path(@story)
|
72
|
-
steps.item :activate, t('general.events.activate'), activate_story_path(@story)
|
73
|
-
end
|
74
|
-
|
75
|
-
story.item :tasks, t('tasks.index.title'), story_tasks_path(@story) do |tasks|
|
76
|
-
tasks.item :new, t('general.new'), new_story_task_path(@story)
|
77
|
-
|
78
|
-
unless (@task.new_record? rescue true)
|
79
|
-
tasks.item(:show, @task.name, task_path(@task)) do |task|
|
80
|
-
if can? :destroy, @task
|
81
|
-
task.item :destroy, t('general.destroy'), task_path(@task), method: :delete, confirm: t('general.questions.are_you_sure')
|
82
|
-
end
|
83
|
-
|
84
|
-
task.item :show, t('general.details'), "#{task_path(@task)}#top"
|
85
|
-
task.item :edit, t('general.edit'), edit_task_path(@task) if can? :edit, @task
|
86
|
-
|
87
|
-
task.item :results, t('results.index.title'), task_results_path(@task) do |results|
|
88
|
-
results.item :new, t('general.new'), new_task_result_path(@task)
|
89
|
-
|
90
|
-
unless (@result.new_record? rescue true)
|
91
|
-
results.item(:show, @result.name, result_path(@result)) do |result|
|
92
|
-
if can? :destroy, @result
|
93
|
-
result.item :destroy, t('general.destroy'), result_path(@result), method: :delete, confirm: t('general.questions.are_you_sure')
|
94
|
-
end
|
95
|
-
|
96
|
-
result.item :show, t('general.details'), "#{result_path(@result)}#top"
|
97
|
-
result.item :edit, t('general.edit'), edit_result_path(@result) if can? :edit, @result
|
98
|
-
|
99
|
-
result.item :comments, t('comments.index.title'), "#{story_path(@story)}#comments" do |comments|
|
100
|
-
comments.item(:new, t('general.new'), new_story_comment_path(@story)) if @comment
|
101
|
-
|
102
|
-
if can? :edit, @comment
|
103
|
-
comments.item(:edit, t('general.edit'), edit_comment_path(@comment)) if @comment.try(:id)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
task.item :comments, t('comments.index.title'), "#{story_path(@story)}#comments" do |comments|
|
111
|
-
comments.item(:new, t('general.new'), new_story_comment_path(@story)) if @comment
|
112
|
-
|
113
|
-
if @comment.try(:id) && can?(:edit, @comment)
|
114
|
-
comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
story.item :comments, t('comments.index.title'), "#{story_path(@story)}#comments" do |comments|
|
122
|
-
comments.item(:new, t('general.new'), new_story_comment_path(@story)) if @comment
|
123
|
-
|
124
|
-
if @comment.try(:id) && can?(:edit, @comment)
|
125
|
-
comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
project.item :comments, t('comments.index.title'), "#{project_path(@project)}#comments" do |comments|
|
133
|
-
comments.item(:new, t('general.new'), new_project_comment_path(@project)) if @comment
|
134
|
-
|
135
|
-
if @comment.try(:id) && can?(:edit, @comment)
|
136
|
-
comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
primary.item :vacancies, t('vacancies.index.title'), vacancies_path do |vacancies|
|
144
|
-
vacancies.item :new, t('general.new'), new_vacancy_path
|
145
|
-
|
146
|
-
unless (@vacancy.new_record? rescue true)
|
147
|
-
vacancies.item :show, "#{@vacancy.name} @ #{@vacancy.project.name}", vacancy_path(@vacancy) do |vacancy|
|
148
|
-
|
149
|
-
if can? :destroy, @vacancy
|
150
|
-
vacancy.item :destroy, t('general.destroy'), vacancy_path(@vacancy), method: :delete, confirm: t('general.questions.are_you_sure')
|
151
|
-
end
|
152
|
-
|
153
|
-
vacancy.item :show, t('general.details'), "#{vacancy_path(@vacancy)}#top"
|
154
|
-
vacancy.item :edit, t('general.edit'), edit_vacancy_path(@vacancy) if can? :edit, @vacancy
|
155
|
-
|
156
|
-
vacancy.item :candidatures, t('candidatures.index.title'), vacancy_candidatures_path(@vacancy) do |candidatures|
|
157
|
-
candidatures.item :new, t('general.new'), new_vacancy_candidature_path(@vacancy)
|
158
|
-
|
159
|
-
unless (@candidature.new_record? rescue true)
|
160
|
-
candidatures.item(
|
161
|
-
:show, t('activerecord.models.candidature') + " of #{@candidature.user.name} @ #{@candidature.vacancy.project.name}",
|
162
|
-
candidature_path(@candidature)
|
163
|
-
) do |candidature|
|
164
|
-
if can? :destroy, @candidature
|
165
|
-
candidature.item :destroy, t('general.destroy'), candidature_path(@candidature), method: :delete, confirm: t('general.questions.are_you_sure')
|
166
|
-
end
|
167
|
-
|
168
|
-
candidature.item :show, t('general.details'), "#{candidature_path(@candidature)}#top"
|
169
|
-
candidature.item :edit, t('general.edit'), edit_candidature_path(@candidature) if can? :edit, @candidature
|
170
|
-
|
171
|
-
candidature.item :comments, t('comments.index.title'), "#{candidature_path(@candidature)}#comments" do |comments|
|
172
|
-
comments.item(:new, t('general.new'), new_candidature_comment_path(@candidature)) if @comment
|
173
|
-
|
174
|
-
if @comment.try(:id) && can?(:edit, @comment)
|
175
|
-
comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
vacancy.item :comments, t('comments.index.title'), "#{vacancy_path(@vacancy)}#comments" do |comments|
|
183
|
-
comments.item(:new, t('general.new'), new_vacancy_comment_path(@vacancy)) if @comment && !@candidature
|
184
|
-
|
185
|
-
if @comment.try(:id) && can?(:edit, @comment)
|
186
|
-
comments.item(:edit, t('general.edit'), edit_comment_path(@comment))
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
primary.item :users, t('users.index.title'), users_path do |users|
|
194
|
-
unless (@user.new_record? rescue true) || current_user.try(:id) == @user.id
|
195
|
-
users.item :show, t('general.details'), "#{user_path(@user)}#top"
|
196
|
-
|
197
|
-
users.item :projects, t('projects.index.title'), user_projects_path(@user)
|
198
|
-
users.item :candidatures, t('candidatures.index.title'), user_candidatures_path(@user)
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
if user_signed_in?
|
203
|
-
primary.item :workflow, t('workflow.index.title'), workflow_path do |workflow|
|
204
|
-
workflow.item :project_owner, t('workflow.project_owner.index.title'), workflow_project_owner_index_path do |project_owner|
|
205
|
-
project_owner.item :vacancies, t('vacancies.index.title'), open_workflow_vacancies_path do |vacancies|
|
206
|
-
Vacancy::STATES.each do |state|
|
207
|
-
vacancies.item state, t("vacancies.show.states.#{state}"), eval("#{state}_workflow_vacancies_path")
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
project_owner.item :candidatures, t('candidatures.index.title'), new_workflow_candidatures_path do |candidatures|
|
212
|
-
Candidature::STATES.each do |state|
|
213
|
-
candidatures.item state, t("candidatures.show.states.#{state}"), eval("#{state}_workflow_candidatures_path")
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
workflow.item :user, t('workflow.user.index.title'), workflow_user_index_path do |user|
|
219
|
-
{
|
220
|
-
'no-name' => t('workflow.user.products.no_name.title')
|
221
|
-
}.each do |slug, text|
|
222
|
-
user.item slug.gsub('-', '_').to_sym, text, product_workflow_user_index_path(slug) do |product|
|
223
|
-
product_slug = @story ? (@story.product.try(:to_param) || 'no-name') : 'no-name'
|
224
|
-
|
225
|
-
unless (@story.new_record? rescue true) || product_slug != slug
|
226
|
-
product.item(:show, @story.name, story_path(@story)) do |story|
|
227
|
-
story.item :show, t('general.details'), "#{story_path(@story)}#top"
|
228
|
-
|
229
|
-
story.item :tasks, t('tasks.index.title'), tasks_workflow_user_index_path(@story) do |tasks|
|
230
|
-
unless (@task.new_record? rescue true)
|
231
|
-
tasks.item(:edit, @task.name, edit_task_workflow_user_index_path(@task))
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
product.item :next_task, t('workflow.user.tasks.next.title'), next_task_workflow_user_index_path('text-creation')
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
primary.item :profile, t('users.show.title'), user_path(current_user) do |profile|
|
244
|
-
profile.item :show, t('users.show.title'), user_path(current_user) do |user|
|
245
|
-
user.item :show, t('users.show.title'), "#{user_path(current_user)}#top"
|
246
|
-
user.item :settings, t('users.edit.title'), edit_user_path(current_user)
|
247
|
-
user.item :preferences, t('users.preferences.title'), preferences_user_path(current_user)
|
248
|
-
user.item :projects, t('projects.index.title'), user_projects_path(current_user)
|
249
|
-
user.item :candidatures, t('candidatures.index.title'), user_candidatures_path(current_user)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
primary.item :sign_out, t('authentication.sign_out'), destroy_user_session_path, method: :delete
|
254
|
-
else
|
255
|
-
primary.item :authentication, t('authentication.title'), new_user_session_path do |authentication|
|
256
|
-
authentication.item :sign_in, t('authentication.sign_in'), new_user_session_path
|
257
|
-
#authentication.item :rpx_sign_in, t('authentication.rpx_sign_in'), 'a' # link_to_rpx
|
258
|
-
authentication.item :sign_up, t('authentication.sign_up'), new_user_registration_path
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
2
|
+
instance_exec navigation, &Voluntary::Navigation.code
|
262
3
|
end
|