ecm_staff2 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +17 -0
- data/app/assets/javascripts/ecm/staff/application.js +13 -0
- data/app/assets/stylesheets/ecm/staff/application.css +14 -0
- data/app/controllers/ecm/staff/application_controller.rb +6 -0
- data/app/controllers/ecm/staff/people_controller.rb +33 -0
- data/app/helpers/ecm/staff/application_helper.rb +6 -0
- data/app/models/ecm/staff/base.rb +9 -0
- data/app/models/ecm/staff/business_unit.rb +55 -0
- data/app/models/ecm/staff/organisation.rb +40 -0
- data/app/models/ecm/staff/person.rb +92 -0
- data/app/models/ecm/staff/person_position.rb +22 -0
- data/app/models/ecm/staff/position.rb +48 -0
- data/app/views/ecm/staff/people/_person.haml +12 -0
- data/app/views/ecm/staff/people/_person_in_index.haml +13 -0
- data/app/views/ecm/staff/people/_person_positions_table.haml +9 -0
- data/app/views/ecm/staff/people/index.haml +3 -0
- data/app/views/ecm/staff/people/show.haml +5 -0
- data/app/views/ecm/staff/person_positions/_person_position_as_table_row.haml +4 -0
- data/app/views/layouts/ecm/staff/application.html.erb +14 -0
- data/config/locales/de.yml +60 -0
- data/config/routes.rb +7 -0
- data/db/migrate/001_create_ecm_staff_organisations.rb +16 -0
- data/db/migrate/002_create_ecm_staff_business_units.rb +26 -0
- data/db/migrate/003_create_ecm_staff_positions.rb +23 -0
- data/db/migrate/004_create_ecm_staff_person_positions.rb +17 -0
- data/db/migrate/005_create_ecm_staff_people.rb +22 -0
- data/db/migrate/006_create_ecm_staff_organisation_translations.rb +13 -0
- data/db/migrate/007_create_ecm_staff_business_unit_translations.rb +13 -0
- data/db/migrate/008_create_ecm_staff_position_translations.rb +13 -0
- data/db/migrate/009_create_ecm_staff_person_translations.rb +13 -0
- data/lib/ecm/staff/configuration.rb +14 -0
- data/lib/ecm/staff/engine.rb +7 -0
- data/lib/ecm/staff/routing.rb +19 -0
- data/lib/ecm/staff/version.rb +5 -0
- data/lib/ecm/staff.rb +7 -0
- data/lib/ecm_staff2.rb +8 -0
- data/lib/tasks/ecm/staff_tasks.rake +4 -0
- data/spec/factories/ecm_staff_business_units.rb +8 -0
- data/spec/factories/ecm_staff_organisations.rb +7 -0
- data/spec/factories/ecm_staff_people.rb +8 -0
- data/spec/factories/ecm_staff_person_positions.rb +10 -0
- data/spec/factories/ecm_staff_positions.rb +7 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 73e0d2d49ee3f23509b2aad6066a246e1b365f31
|
4
|
+
data.tar.gz: 0af59c59fa11cae833bebf0c203f332ecd16a730
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 874fe0ce6afa7e56652cfd407933d633322435d9ad6dc22dad7d58320c5ccd2f197d10eb35b691179f032b0e649cd06907c9062aad5493d05183a43c219b3a68
|
7
|
+
data.tar.gz: eaf0d6b13abb46b5ddef179dc684a2f25710a1315a0bcd17ec9f3ca9bfe97e4dfb794b6e7367b2b548fb4d062779254e737dfef13680906c95a857cde3d23c1d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Roberto Vasquez Angel
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Ecm::Staff'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. It is generally better to create a new file per style scope.
|
11
|
+
*
|
12
|
+
*= require_tree .
|
13
|
+
*= require_self
|
14
|
+
*/
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Ecm::Staff
|
2
|
+
class PeopleController < ApplicationController
|
3
|
+
def self.resource_class
|
4
|
+
Person
|
5
|
+
end
|
6
|
+
|
7
|
+
def index
|
8
|
+
@collection = load_collection
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@resource = load_resource
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def resource_class
|
18
|
+
self.class.resource_class
|
19
|
+
end
|
20
|
+
|
21
|
+
def resource_scope
|
22
|
+
resource_class.includes(person_positions: :position)
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_collection
|
26
|
+
resource_scope.all
|
27
|
+
end
|
28
|
+
|
29
|
+
def load_resource
|
30
|
+
resource_scope.find(params[:id])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class Ecm::Staff::BusinessUnit < Ecm::Staff::Base
|
2
|
+
# associations
|
3
|
+
belongs_to :organisation
|
4
|
+
has_many :person_positions, dependent: :restrict_with_error
|
5
|
+
has_many :people, through: :person_positions
|
6
|
+
|
7
|
+
# # attributes
|
8
|
+
# attr_accessible :description,
|
9
|
+
# :name,
|
10
|
+
# :markup_language,
|
11
|
+
# :organisation_id,
|
12
|
+
# :parent_id,
|
13
|
+
# :slug
|
14
|
+
|
15
|
+
# callbacks
|
16
|
+
after_initialize :set_defaults, if: :new_record?
|
17
|
+
|
18
|
+
# globalization support
|
19
|
+
translates :description, :name, :slug
|
20
|
+
# attr_accessible :translations, :translations_attributes
|
21
|
+
accepts_nested_attributes_for :translations
|
22
|
+
|
23
|
+
# default scope
|
24
|
+
# default_scope order: 'lft'
|
25
|
+
|
26
|
+
# friendly id support
|
27
|
+
extend FriendlyId
|
28
|
+
friendly_id :name, use: [:slugged, :finders]
|
29
|
+
|
30
|
+
# markup support
|
31
|
+
acts_as_markup language: :variable,
|
32
|
+
columns: [:description]
|
33
|
+
|
34
|
+
# nested set support
|
35
|
+
acts_as_nested_set
|
36
|
+
|
37
|
+
# validations
|
38
|
+
validates :organisation, presence: true
|
39
|
+
validates :name, presence: true,
|
40
|
+
uniqueness: { scope: [:organisation_id] }
|
41
|
+
|
42
|
+
def people_count
|
43
|
+
people.count
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
name
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def set_defaults
|
53
|
+
self.markup_language ||= Ecm::Staff::Configuration.default_markup_language
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class Ecm::Staff::Organisation < Ecm::Staff::Base
|
2
|
+
# associations
|
3
|
+
has_many :business_units
|
4
|
+
|
5
|
+
# # attributes
|
6
|
+
# attr_accessible :description,
|
7
|
+
# :markup_language,
|
8
|
+
# :name
|
9
|
+
|
10
|
+
# callbacks
|
11
|
+
after_initialize :set_defaults, if: :new_record?
|
12
|
+
|
13
|
+
# globalization support
|
14
|
+
translates :description, :name, :slug
|
15
|
+
# attr_accessible :translations, :translations_attributes
|
16
|
+
accepts_nested_attributes_for :translations
|
17
|
+
|
18
|
+
# friendly id support
|
19
|
+
extend FriendlyId
|
20
|
+
friendly_id :name, use: [:slugged, :globalize, :finders]
|
21
|
+
|
22
|
+
# markup support
|
23
|
+
acts_as_markup language: :variable,
|
24
|
+
columns: [:description]
|
25
|
+
|
26
|
+
# validations
|
27
|
+
validates :markup_language, inclusion: Ecm::Staff::Configuration.markup_languages.map(&:to_s)
|
28
|
+
validates :name, presence: true,
|
29
|
+
uniqueness: true
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
name
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def set_defaults
|
38
|
+
self.markup_language ||= Ecm::Staff::Configuration.default_markup_language
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
class Ecm::Staff::Person < Ecm::Staff::Base
|
2
|
+
# associations
|
3
|
+
has_many :person_positions, ->() { order(begin_at: :desc) },
|
4
|
+
class_name: Ecm::Staff::PersonPosition,
|
5
|
+
inverse_of: :person
|
6
|
+
accepts_nested_attributes_for :person_positions, allow_destroy: true
|
7
|
+
|
8
|
+
has_many :positions, through: :person_positions,
|
9
|
+
class_name: Ecm::Staff::Position
|
10
|
+
|
11
|
+
has_many :attached_pictures, as: :pictureable,
|
12
|
+
class_name: Ecm::Pictures::AttachedPicture,
|
13
|
+
inverse_of: :pictureable
|
14
|
+
has_many :pictures, through: :attached_pictures,
|
15
|
+
class_name: Ecm::Pictures::Picture
|
16
|
+
|
17
|
+
accepts_nested_attributes_for :attached_pictures, allow_destroy: true
|
18
|
+
accepts_nested_attributes_for :pictures, allow_destroy: true
|
19
|
+
|
20
|
+
# # attributes
|
21
|
+
# attr_accessible :attached_pictures_attributes,
|
22
|
+
# :birthdate,
|
23
|
+
# :description,
|
24
|
+
# :firstname,
|
25
|
+
# :lastname,
|
26
|
+
# :markup_language,
|
27
|
+
# :person_positions_attributes,
|
28
|
+
# :pictures_attributes,
|
29
|
+
# :position,
|
30
|
+
# :prefix
|
31
|
+
|
32
|
+
# acts as list
|
33
|
+
acts_as_list
|
34
|
+
# default_scope order: 'position ASC'
|
35
|
+
|
36
|
+
# callbacks
|
37
|
+
after_initialize :set_defaults, if: :new_record?
|
38
|
+
|
39
|
+
# globalization support
|
40
|
+
translates :description, :prefix, :slug
|
41
|
+
# attr_accessible :translations, :translations_attributes
|
42
|
+
accepts_nested_attributes_for :translations
|
43
|
+
|
44
|
+
# friendly id support
|
45
|
+
extend FriendlyId
|
46
|
+
friendly_id :fullname, use: [:slugged, :finders]
|
47
|
+
|
48
|
+
# markup support
|
49
|
+
acts_as_markup language: :variable,
|
50
|
+
columns: [:description]
|
51
|
+
|
52
|
+
# validations
|
53
|
+
validates :markup_language, presence: true,
|
54
|
+
inclusion: Ecm::Staff::Configuration.markup_languages.map(&:to_s)
|
55
|
+
validates :firstname, presence: true
|
56
|
+
validates :lastname, presence: true
|
57
|
+
|
58
|
+
def age
|
59
|
+
return if birthdate.nil?
|
60
|
+
if (Time.zone.now.month < birthdate.month) || (Time.zone.now.month == birthdate.month && birthdate.day >= Time.zone.now.day)
|
61
|
+
Time.zone.now.year - birthdate.year - 1
|
62
|
+
else
|
63
|
+
Time.zone.now.year - birthdate.year
|
64
|
+
end
|
65
|
+
end # def
|
66
|
+
|
67
|
+
def fullname
|
68
|
+
"#{firstname} #{lastname}"
|
69
|
+
end # def
|
70
|
+
|
71
|
+
def fullname_with_prefix
|
72
|
+
prefix.present? ? "#{prefix} #{fullname}" : fullname
|
73
|
+
end # def
|
74
|
+
|
75
|
+
def preview_picture
|
76
|
+
pictures.first
|
77
|
+
end # def
|
78
|
+
|
79
|
+
def preview_picture_image_url(style = nil)
|
80
|
+
preview_picture.image.url(style) if preview_picture.respond_to?(:image) && preview_picture.image.respond_to?(:url)
|
81
|
+
end # def
|
82
|
+
|
83
|
+
def to_s
|
84
|
+
fullname
|
85
|
+
end # def
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def set_defaults
|
90
|
+
self.markup_language ||= Ecm::Staff::Configuration.default_markup_language
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Ecm::Staff::PersonPosition < Ecm::Staff::Base
|
2
|
+
# associations
|
3
|
+
has_one :organisation, through: :business_unit
|
4
|
+
belongs_to :business_unit
|
5
|
+
belongs_to :person, class_name: Ecm::Staff::Configuration.person_class_name
|
6
|
+
belongs_to :position
|
7
|
+
|
8
|
+
# # attributes
|
9
|
+
# attr_accessible :begin_at,
|
10
|
+
# :business_unit_id,
|
11
|
+
# :end_at,
|
12
|
+
# :organisation_id,
|
13
|
+
# :person_id,
|
14
|
+
# :position_id
|
15
|
+
|
16
|
+
# validations
|
17
|
+
# @TODO: Validate end_at > begin_at if present
|
18
|
+
validates :begin_at, presence: true
|
19
|
+
validates :business_unit, presence: true
|
20
|
+
validates :person, presence: true
|
21
|
+
validates :position, presence: true
|
22
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class Ecm::Staff::Position < Ecm::Staff::Base
|
2
|
+
# associations
|
3
|
+
has_many :person_positions, dependent: :restrict_with_error
|
4
|
+
has_many :people, through: :person_positions,
|
5
|
+
class_name: Ecm::Staff::Configuration.person_class_name
|
6
|
+
|
7
|
+
# # attributes
|
8
|
+
# attr_accessible :description,
|
9
|
+
# :name,
|
10
|
+
# :parent_id
|
11
|
+
|
12
|
+
# callbacks
|
13
|
+
after_initialize :set_defaults, if: :new_record?
|
14
|
+
|
15
|
+
# globalization support
|
16
|
+
translates :description, :name, :slug
|
17
|
+
# attr_accessible :translations, :translations_attributes
|
18
|
+
accepts_nested_attributes_for :translations
|
19
|
+
|
20
|
+
# friendly id support
|
21
|
+
extend FriendlyId
|
22
|
+
friendly_id :name, use: [:slugged, :finders]
|
23
|
+
|
24
|
+
# markup support
|
25
|
+
acts_as_markup language: :variable,
|
26
|
+
columns: [:description]
|
27
|
+
|
28
|
+
# nested set support
|
29
|
+
acts_as_nested_set
|
30
|
+
|
31
|
+
# validations
|
32
|
+
validates :name, presence: true,
|
33
|
+
uniqueness: true
|
34
|
+
|
35
|
+
def people_count
|
36
|
+
people.count
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s
|
40
|
+
name
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def set_defaults
|
46
|
+
self.markup_language ||= Ecm::Staff::Configuration.default_markup_language
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
.media.person-preview.well{:id => dom_id(person)}
|
2
|
+
.preview-picture.pull-left
|
3
|
+
- if person.preview_picture.present?
|
4
|
+
= image_tag(person.preview_picture_image_url(:medium_thumb))
|
5
|
+
- else
|
6
|
+
.preview-picture-placeholder.well
|
7
|
+
☺
|
8
|
+
.media-heading
|
9
|
+
.person-description
|
10
|
+
= person.description.to_html.html_safe if person.description.present?
|
11
|
+
.person-positions
|
12
|
+
= render 'person_positions_table', person: person if person.person_positions.present?
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.media.person-preview.well{ id: dom_id(person) }
|
2
|
+
.preview-picture.pull-left
|
3
|
+
- if person.preview_picture.present?
|
4
|
+
= link_to person do
|
5
|
+
= image_tag(person.preview_picture_image_url(:medium_thumb))
|
6
|
+
- else
|
7
|
+
.preview-picture-placeholder.well= link_to "☺".html_safe, person
|
8
|
+
.media-heading
|
9
|
+
%h4= link_to person.fullname_with_prefix, person
|
10
|
+
.person-description
|
11
|
+
= person.description.to_html.html_safe if person.description.present?
|
12
|
+
.person-positions
|
13
|
+
= render 'person_positions_table', person: person if person.person_positions.present?
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%table.table
|
2
|
+
%thead
|
3
|
+
%tr
|
4
|
+
%th= Ecm::Staff::PersonPosition.human_attribute_name(:position)
|
5
|
+
%th= Ecm::Staff::PersonPosition.human_attribute_name(:begin_at)
|
6
|
+
%th= Ecm::Staff::PersonPosition.human_attribute_name(:end_at)
|
7
|
+
%tbody
|
8
|
+
- person.person_positions.each do |person_position|
|
9
|
+
= render 'ecm/staff/person_positions/person_position_as_table_row', person_position: person_position
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Staff</title>
|
5
|
+
<%= stylesheet_link_tag "ecm/staff/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "ecm/staff/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
de:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
ecm/staff/business_unit:
|
5
|
+
one: Abteilung
|
6
|
+
other: Abteilungen
|
7
|
+
ecm/staff/organisation:
|
8
|
+
one: Unternehmen
|
9
|
+
other: Unternehmen
|
10
|
+
ecm/staff/person:
|
11
|
+
one: Mitarbeiter
|
12
|
+
other: Mitarbeiter
|
13
|
+
ecm/staff/position:
|
14
|
+
one: Stelle
|
15
|
+
other: Stellen
|
16
|
+
attributes:
|
17
|
+
ecm/staff/business_unit:
|
18
|
+
description: Beschreibung
|
19
|
+
markup_language: Markupsprache
|
20
|
+
name: Name
|
21
|
+
organisation_id: Unternehmen
|
22
|
+
parent_id: Übergeordnete Abteilung
|
23
|
+
created_at: Erstellt am
|
24
|
+
updated_at: Aktualisiert am
|
25
|
+
ecm/staff/organisation:
|
26
|
+
description: Beschreibung
|
27
|
+
markup_language: Markupsprache
|
28
|
+
name: Name
|
29
|
+
created_at: Erstellt am
|
30
|
+
updated_at: Aktualisiert am
|
31
|
+
ecm/staff/person:
|
32
|
+
age: Alter
|
33
|
+
birthdate: Geburtsdatum
|
34
|
+
description: Beschreibung
|
35
|
+
firstname: Vorname
|
36
|
+
fullname: Name
|
37
|
+
lastname: Nachname
|
38
|
+
markup_language: Markupsprache
|
39
|
+
person_positions: Stellen
|
40
|
+
position: Position
|
41
|
+
prefix: Prefix
|
42
|
+
preview_picture: Bild
|
43
|
+
created_at: Erstellt am
|
44
|
+
updated_at: Aktualisiert am
|
45
|
+
ecm/staff/position:
|
46
|
+
description: Beschreibung
|
47
|
+
markup_language: Markupsprache
|
48
|
+
name: Name
|
49
|
+
parent_id: Übergeordnete Position
|
50
|
+
created_at: Erstellt am
|
51
|
+
updated_at: Aktualisiert am
|
52
|
+
ecm:
|
53
|
+
staff:
|
54
|
+
people:
|
55
|
+
show:
|
56
|
+
back: 'Zurück'
|
57
|
+
routes:
|
58
|
+
business_units: 'abteilungen'
|
59
|
+
organsiations: 'organisationen'
|
60
|
+
people: 'mitarbeiter'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateEcmStaffOrganisations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_staff_organisations do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :description
|
6
|
+
|
7
|
+
# acts as markup
|
8
|
+
t.string :markup_language
|
9
|
+
|
10
|
+
# friendly id
|
11
|
+
t.string :slug
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateEcmStaffBusinessUnits < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_staff_business_units do |t|
|
4
|
+
t.references :organisation
|
5
|
+
|
6
|
+
t.string :name
|
7
|
+
t.text :description
|
8
|
+
|
9
|
+
# acts as markup
|
10
|
+
t.string :markup_language
|
11
|
+
|
12
|
+
# friendly id
|
13
|
+
t.string :slug
|
14
|
+
|
15
|
+
# awesome nested set
|
16
|
+
t.references :parent
|
17
|
+
t.integer :lft
|
18
|
+
t.integer :rgt
|
19
|
+
t.integer :depth
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
add_index :ecm_staff_business_units, :organisation_id
|
24
|
+
add_index :ecm_staff_business_units, :parent_id
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateEcmStaffPositions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_staff_positions do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :description
|
6
|
+
|
7
|
+
# acts as markup
|
8
|
+
t.string :markup_language
|
9
|
+
|
10
|
+
# awesome nested set
|
11
|
+
t.references :parent
|
12
|
+
t.integer :lft
|
13
|
+
t.integer :rgt
|
14
|
+
t.integer :depth
|
15
|
+
|
16
|
+
# friendly id
|
17
|
+
t.string :slug
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
add_index :ecm_staff_positions, :parent_id
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateEcmStaffPersonPositions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_staff_person_positions do |t|
|
4
|
+
t.references :person
|
5
|
+
t.references :business_unit
|
6
|
+
t.references :position
|
7
|
+
|
8
|
+
t.date :begin_at
|
9
|
+
t.date :end_at
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
add_index :ecm_staff_person_positions, :person_id
|
14
|
+
add_index :ecm_staff_person_positions, :business_unit_id
|
15
|
+
add_index :ecm_staff_person_positions, :position_id
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateEcmStaffPeople < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ecm_staff_people do |t|
|
4
|
+
t.string :prefix
|
5
|
+
t.string :firstname
|
6
|
+
t.string :lastname
|
7
|
+
t.date :birthdate
|
8
|
+
t.text :description
|
9
|
+
|
10
|
+
# acts as list
|
11
|
+
t.integer :position
|
12
|
+
|
13
|
+
# acts as markup
|
14
|
+
t.string :markup_language
|
15
|
+
|
16
|
+
# friendly id
|
17
|
+
t.string :slug
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEcmStaffOrganisationTranslations < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Ecm::Staff::Organisation.create_translation_table!({
|
4
|
+
name: :string,
|
5
|
+
description: :text,
|
6
|
+
slug: :string
|
7
|
+
}, migrate_data: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
Ecm::Staff::Organisation.drop_translation_table!(migrate_data: true)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEcmStaffBusinessUnitTranslations < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Ecm::Staff::BusinessUnit.create_translation_table!({
|
4
|
+
name: :string,
|
5
|
+
description: :text,
|
6
|
+
slug: :string
|
7
|
+
}, migrate_data: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
Ecm::Staff::BusinessUnit.drop_translation_table!(migrate_data: true)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEcmStaffPositionTranslations < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Ecm::Staff::Position.create_translation_table!({
|
4
|
+
name: :string,
|
5
|
+
description: :text,
|
6
|
+
slug: :string
|
7
|
+
}, migrate_data: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
Ecm::Staff::Position.drop_translation_table!(migrate_data: true)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateEcmStaffPersonTranslations < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Ecm::Staff::Person.create_translation_table!({
|
4
|
+
prefix: :string,
|
5
|
+
description: :text,
|
6
|
+
slug: :string
|
7
|
+
}, migrate_data: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
Ecm::Staff::Person.drop_translation_table!(migrate_data: true)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Ecm
|
2
|
+
module Staff
|
3
|
+
module Configuration
|
4
|
+
def configure
|
5
|
+
yield self
|
6
|
+
end
|
7
|
+
|
8
|
+
mattr_accessor(:default_markup_language) { :textile }
|
9
|
+
mattr_accessor(:markup_languages) { [:textile] }
|
10
|
+
mattr_accessor(:person_class_name) { 'Person' }
|
11
|
+
mattr_accessor(:base_controller) { '::ApplicationController' }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Ecm::Staff
|
2
|
+
class Routing
|
3
|
+
def self.routes(router, options = {})
|
4
|
+
options.reverse_merge!(
|
5
|
+
{ organisations_actions: [:index, :show],
|
6
|
+
business_units_actions: [:index, :show],
|
7
|
+
people_actions: [:index, :show],
|
8
|
+
}
|
9
|
+
)
|
10
|
+
|
11
|
+
router.resources :ecm_staff_organisations, only: options[:organisations_actions],
|
12
|
+
controller: 'ecm/staff/organisations'
|
13
|
+
router.resources :ecm_staff_business_units, only: options[:business_units_actions],
|
14
|
+
controller: 'ecm/staff/business_units'
|
15
|
+
router.resources :ecm_staff_people, only: options[:people_actions],
|
16
|
+
controller: 'ecm/staff/people'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/ecm/staff.rb
ADDED
data/lib/ecm_staff2.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :ecm_staff_business_unit, class: Ecm::Staff::BusinessUnit do
|
5
|
+
association :organisation, factory: :ecm_staff_organisation
|
6
|
+
sequence(:name) { |i| "Business Unit ##{i}" }
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Read about factories at https://github.com/thoughtbot/factory_girl
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :ecm_staff_person_position, class: Ecm::Staff::PersonPosition do
|
5
|
+
association :person, factory: :ecm_staff_person
|
6
|
+
association :business_unit, factory: :ecm_staff_business_unit
|
7
|
+
association :position, factory: :ecm_staff_position
|
8
|
+
begin_at 1.year.ago
|
9
|
+
end
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ecm_staff2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roberto Vasquez Angel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: awesome_nested_set
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: friendly_id
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: globalize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: route_translator
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Ecm::Staff Module.
|
84
|
+
email:
|
85
|
+
- roberto@vasquez-angel.de
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- MIT-LICENSE
|
91
|
+
- README.rdoc
|
92
|
+
- Rakefile
|
93
|
+
- app/assets/javascripts/ecm/staff/application.js
|
94
|
+
- app/assets/stylesheets/ecm/staff/application.css
|
95
|
+
- app/controllers/ecm/staff/application_controller.rb
|
96
|
+
- app/controllers/ecm/staff/people_controller.rb
|
97
|
+
- app/helpers/ecm/staff/application_helper.rb
|
98
|
+
- app/models/ecm/staff/base.rb
|
99
|
+
- app/models/ecm/staff/business_unit.rb
|
100
|
+
- app/models/ecm/staff/organisation.rb
|
101
|
+
- app/models/ecm/staff/person.rb
|
102
|
+
- app/models/ecm/staff/person_position.rb
|
103
|
+
- app/models/ecm/staff/position.rb
|
104
|
+
- app/views/ecm/staff/people/_person.haml
|
105
|
+
- app/views/ecm/staff/people/_person_in_index.haml
|
106
|
+
- app/views/ecm/staff/people/_person_positions_table.haml
|
107
|
+
- app/views/ecm/staff/people/index.haml
|
108
|
+
- app/views/ecm/staff/people/show.haml
|
109
|
+
- app/views/ecm/staff/person_positions/_person_position_as_table_row.haml
|
110
|
+
- app/views/layouts/ecm/staff/application.html.erb
|
111
|
+
- config/locales/de.yml
|
112
|
+
- config/routes.rb
|
113
|
+
- db/migrate/001_create_ecm_staff_organisations.rb
|
114
|
+
- db/migrate/002_create_ecm_staff_business_units.rb
|
115
|
+
- db/migrate/003_create_ecm_staff_positions.rb
|
116
|
+
- db/migrate/004_create_ecm_staff_person_positions.rb
|
117
|
+
- db/migrate/005_create_ecm_staff_people.rb
|
118
|
+
- db/migrate/006_create_ecm_staff_organisation_translations.rb
|
119
|
+
- db/migrate/007_create_ecm_staff_business_unit_translations.rb
|
120
|
+
- db/migrate/008_create_ecm_staff_position_translations.rb
|
121
|
+
- db/migrate/009_create_ecm_staff_person_translations.rb
|
122
|
+
- lib/ecm/staff.rb
|
123
|
+
- lib/ecm/staff/configuration.rb
|
124
|
+
- lib/ecm/staff/engine.rb
|
125
|
+
- lib/ecm/staff/routing.rb
|
126
|
+
- lib/ecm/staff/version.rb
|
127
|
+
- lib/ecm_staff2.rb
|
128
|
+
- lib/tasks/ecm/staff_tasks.rake
|
129
|
+
- spec/factories/ecm_staff_business_units.rb
|
130
|
+
- spec/factories/ecm_staff_organisations.rb
|
131
|
+
- spec/factories/ecm_staff_people.rb
|
132
|
+
- spec/factories/ecm_staff_person_positions.rb
|
133
|
+
- spec/factories/ecm_staff_positions.rb
|
134
|
+
homepage: https://github.com/robotex82/ecm_staff2
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.4.8
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Ecm::Staff.
|
158
|
+
test_files: []
|
159
|
+
has_rdoc:
|