recruiter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +2 -0
  4. data/app/assets/images/ruby.png +0 -0
  5. data/app/assets/images/ruby_72x72.png +0 -0
  6. data/app/assets/images/ruby_rotated.png +0 -0
  7. data/app/assets/images/ruby_worker.png +0 -0
  8. data/app/assets/javascripts/recruiter/application.js +3 -0
  9. data/app/assets/javascripts/recruiter/filters.js +35 -0
  10. data/app/assets/javascripts/recruiter/site.js +3 -0
  11. data/app/assets/stylesheets/recruiter/application.css.scss +7 -0
  12. data/app/assets/stylesheets/recruiter/foundation_and_overrides.scss +1251 -0
  13. data/app/assets/stylesheets/recruiter/gh-fork-ribbon.css +140 -0
  14. data/app/assets/stylesheets/recruiter/site.css.sass +116 -0
  15. data/app/assets/stylesheets/recruiter/variables.css.sass +6 -0
  16. data/app/controllers/recruiter/filters_controller.rb +14 -0
  17. data/app/controllers/recruiter/jobs_controller.rb +18 -0
  18. data/app/controllers/recruiter/omniauth_callbacks_controller.rb +45 -0
  19. data/app/controllers/recruiter/users/jobs_controller.rb +59 -0
  20. data/app/controllers/recruiter/users/user_controller.rb +8 -0
  21. data/app/controllers/recruiter_controller.rb +13 -0
  22. data/app/decorators/recruiter/job_decorator.rb +49 -0
  23. data/app/decorators/recruiter/user_decorator.rb +22 -0
  24. data/app/helpers/recruiter/crud_flash_messager_helper.rb +21 -0
  25. data/app/helpers/recruiter/form_helper.rb +29 -0
  26. data/app/helpers/recruiter/header_helper.rb +13 -0
  27. data/app/helpers/recruiter/icons_helper.rb +29 -0
  28. data/app/helpers/recruiter/links_helper.rb +59 -0
  29. data/app/helpers/recruiter/markdown_helper.rb +12 -0
  30. data/app/helpers/recruiter/oauth_providers_helper.rb +23 -0
  31. data/app/helpers/recruiter/show_helper.rb +29 -0
  32. data/app/models/recruiter/city.rb +9 -0
  33. data/app/models/recruiter/custom_devise_failure.rb +7 -0
  34. data/app/models/recruiter/filters.rb +44 -0
  35. data/app/models/recruiter/filters/city_filter.rb +21 -0
  36. data/app/models/recruiter/filters/job_filter.rb +21 -0
  37. data/app/models/recruiter/filters/state_filter.rb +17 -0
  38. data/app/models/recruiter/job.rb +34 -0
  39. data/app/{helpers/recruiter/application_helper.rb → models/recruiter/oauth.rb} +1 -1
  40. data/app/models/recruiter/oauth/base.rb +24 -0
  41. data/app/models/recruiter/oauth/facebook.rb +6 -0
  42. data/app/models/recruiter/oauth/github.rb +6 -0
  43. data/app/models/recruiter/oauth/google.rb +9 -0
  44. data/app/models/recruiter/state.rb +9 -0
  45. data/app/models/recruiter/tag.rb +6 -0
  46. data/app/models/recruiter/user.rb +11 -0
  47. data/app/views/devise/sessions/new.html.erb +8 -0
  48. data/app/views/kaminari/_first_page.html.erb +11 -0
  49. data/app/views/kaminari/_gap.html.erb +8 -0
  50. data/app/views/kaminari/_last_page.html.erb +11 -0
  51. data/app/views/kaminari/_next_page.html.erb +11 -0
  52. data/app/views/kaminari/_page.html.erb +12 -0
  53. data/app/views/kaminari/_paginator.html.erb +23 -0
  54. data/app/views/kaminari/_prev_page.html.erb +11 -0
  55. data/app/views/layouts/recruiter/application.html.erb +28 -10
  56. data/app/views/recruiter/_analytics.html.erb +10 -0
  57. data/app/views/recruiter/_filters.html.erb +17 -0
  58. data/app/views/recruiter/_flashes.html.erb +14 -0
  59. data/app/views/recruiter/_footer.html.erb +7 -0
  60. data/app/views/recruiter/_form_actions.html.erb +4 -0
  61. data/app/views/recruiter/_javascript.html.erb +10 -0
  62. data/app/views/recruiter/_login_button.html.erb +15 -0
  63. data/app/views/recruiter/_login_links.html.erb +7 -0
  64. data/app/views/recruiter/_login_status.html.erb +8 -0
  65. data/app/views/recruiter/_show_actions.html.erb +6 -0
  66. data/app/views/recruiter/_show_item.html.erb +8 -0
  67. data/app/views/recruiter/_tags.html.erb +6 -0
  68. data/app/views/recruiter/_top_menu.html.erb +28 -0
  69. data/app/views/recruiter/jobs/_job.html.erb +14 -0
  70. data/app/views/recruiter/jobs/index.html.erb +14 -0
  71. data/app/views/recruiter/jobs/show.html.erb +1 -0
  72. data/app/views/recruiter/users/jobs/_form.html.erb +30 -0
  73. data/app/views/recruiter/users/jobs/_job.html.erb +35 -0
  74. data/app/views/recruiter/users/jobs/edit.html.erb +3 -0
  75. data/app/views/recruiter/users/jobs/index.html.erb +24 -0
  76. data/app/views/recruiter/users/jobs/new.html.erb +3 -0
  77. data/app/views/recruiter/users/jobs/show.html.erb +4 -0
  78. data/config/initializers/devise.rb +272 -0
  79. data/config/initializers/simple_form.rb +145 -0
  80. data/config/routes.rb +19 -0
  81. data/config/spring.rb +1 -0
  82. data/db/migrate/20140617180316_create_recruiter_states.rb +12 -0
  83. data/db/migrate/20140617180934_create_recruiter_cities.rb +14 -0
  84. data/db/migrate/20140618164609_create_recruiter_users.rb +51 -0
  85. data/db/migrate/20140618165301_add_name_to_users.rb +5 -0
  86. data/db/migrate/20140618165802_create_recruiter_jobs.rb +14 -0
  87. data/db/migrate/20140618170815_create_recruiter_tags.rb +13 -0
  88. data/db/migrate/20140618170904_create_recruiter_jobs_tags.rb +10 -0
  89. data/lib/generators/templates/locales/devise.en.yml +59 -0
  90. data/lib/generators/templates/locales/devise.pt-BR.yml +60 -0
  91. data/lib/generators/templates/locales/en.yml +11 -0
  92. data/lib/generators/templates/locales/pt-BR.yml +237 -0
  93. data/lib/generators/templates/locales/recruiter.pt-BR.yml +78 -0
  94. data/lib/generators/templates/locales/simple_form.en.yml +26 -0
  95. data/lib/recruiter.rb +12 -0
  96. data/lib/recruiter/engine.rb +31 -0
  97. data/lib/recruiter/version.rb +1 -1
  98. metadata +362 -11
  99. data/app/assets/stylesheets/recruiter/application.css +0 -15
  100. data/app/controllers/recruiter/application_controller.rb +0 -4
@@ -0,0 +1,140 @@
1
+ /*!
2
+ * "Fork me on GitHub" CSS ribbon v0.1.1 | MIT License
3
+ * https://github.com/simonwhitaker/github-fork-ribbon-css
4
+ */
5
+
6
+ /* Left will inherit from right (so we don't need to duplicate code) */
7
+ .github-fork-ribbon {
8
+ /* The right and left classes determine the side we attach our banner to */
9
+ position: absolute;
10
+
11
+ /* Add a bit of padding to give some substance outside the "stitching" */
12
+ padding: 2px 0;
13
+
14
+ /* Set the base colour */
15
+ background-color: #a00;
16
+
17
+ /* Set a gradient: transparent black at the top to almost-transparent black at the bottom */
18
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15)));
19
+ background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
20
+ background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
21
+ background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
22
+ background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
23
+ background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
24
+
25
+ /* Add a drop shadow */
26
+ -webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
27
+ -moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
28
+ box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
29
+
30
+ /* Set the font */
31
+ font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif;
32
+
33
+ z-index: 9999;
34
+ pointer-events: auto;
35
+ }
36
+
37
+ .github-fork-ribbon a,
38
+ .github-fork-ribbon a:hover {
39
+ /* Set the text properties */
40
+ color: #fff;
41
+ text-decoration: none;
42
+ text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
43
+ text-align: center;
44
+
45
+ /* Set the geometry. If you fiddle with these you'll also need
46
+ to tweak the top and right values in .github-fork-ribbon. */
47
+ width: 200px;
48
+ line-height: 20px;
49
+
50
+ /* Set the layout properties */
51
+ display: inline-block;
52
+ padding: 2px 0;
53
+
54
+ /* Add "stitching" effect */
55
+ border-width: 1px 0;
56
+ border-style: dotted;
57
+ border-color: #fff;
58
+ border-color: rgba(255, 255, 255, 0.7);
59
+ }
60
+
61
+ .github-fork-ribbon-wrapper {
62
+ width: 150px;
63
+ height: 150px;
64
+ position: absolute;
65
+ overflow: hidden;
66
+ top: 0;
67
+ z-index: 9999;
68
+ pointer-events: none;
69
+ }
70
+
71
+ .github-fork-ribbon-wrapper.fixed {
72
+ position: fixed;
73
+ }
74
+
75
+ .github-fork-ribbon-wrapper.left {
76
+ left: 0;
77
+ }
78
+
79
+ .github-fork-ribbon-wrapper.right {
80
+ right: 0;
81
+ }
82
+
83
+ .github-fork-ribbon-wrapper.left-bottom {
84
+ position: fixed;
85
+ top: inherit;
86
+ bottom: 0;
87
+ left: 0;
88
+ }
89
+
90
+ .github-fork-ribbon-wrapper.right-bottom {
91
+ position: fixed;
92
+ top: inherit;
93
+ bottom: 0;
94
+ right: 0;
95
+ }
96
+
97
+ .github-fork-ribbon-wrapper.right .github-fork-ribbon {
98
+ top: 42px;
99
+ right: -43px;
100
+
101
+ -webkit-transform: rotate(45deg);
102
+ -moz-transform: rotate(45deg);
103
+ -ms-transform: rotate(45deg);
104
+ -o-transform: rotate(45deg);
105
+ transform: rotate(45deg);
106
+ }
107
+
108
+ .github-fork-ribbon-wrapper.left .github-fork-ribbon {
109
+ top: 42px;
110
+ left: -43px;
111
+
112
+ -webkit-transform: rotate(-45deg);
113
+ -moz-transform: rotate(-45deg);
114
+ -ms-transform: rotate(-45deg);
115
+ -o-transform: rotate(-45deg);
116
+ transform: rotate(-45deg);
117
+ }
118
+
119
+
120
+ .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon {
121
+ top: 80px;
122
+ left: -43px;
123
+
124
+ -webkit-transform: rotate(45deg);
125
+ -moz-transform: rotate(45deg);
126
+ -ms-transform: rotate(45deg);
127
+ -o-transform: rotate(45deg);
128
+ transform: rotate(45deg);
129
+ }
130
+
131
+ .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon {
132
+ top: 80px;
133
+ right: -43px;
134
+
135
+ -webkit-transform: rotate(-45deg);
136
+ -moz-transform: rotate(-45deg);
137
+ -ms-transform: rotate(-45deg);
138
+ -o-transform: rotate(-45deg);
139
+ transform: rotate(-45deg);
140
+ }
@@ -0,0 +1,116 @@
1
+ // @import 'variables'
2
+ $soft-gray: #eeeeee
3
+ $dark-gray: #333333
4
+ $dark-red: #980905
5
+ $red: #C52F24
6
+ $soft-blue: #D5E9F6
7
+ $soft-yellow: #FFF9D8
8
+ @import 'foundation_and_overrides'
9
+ body
10
+ // background: $soft-gray
11
+
12
+ .list.no-buttons
13
+ list-style: none
14
+
15
+ table.wide
16
+ width: 100%
17
+
18
+ button, .button
19
+ margin: 0
20
+ .actions
21
+ max-width: 80px
22
+
23
+ .wrapper
24
+ margin: 10px 0
25
+
26
+ #middle
27
+ padding: 20px 0
28
+ background: white
29
+
30
+ #main_content
31
+ #after_menu
32
+ background: $red
33
+ h1
34
+ color: white
35
+ img
36
+ width: 10%
37
+
38
+ #job
39
+ .how-to-apply
40
+ background: $soft-yellow
41
+ margin: 20px 0
42
+ padding: 20px
43
+ .main, footer
44
+ background: $soft-blue
45
+ margin: 20px 0
46
+ padding: 20px
47
+
48
+ footer
49
+ background: $soft-gray
50
+ #jobs
51
+ article
52
+ background: $soft-blue
53
+ .job
54
+ margin: 5px
55
+ // border-bottom: 1px solid #ccc
56
+ .wrapper
57
+ margin: 10px 0 15px 0
58
+ .published_date
59
+ font-size: 0.75em
60
+ h2
61
+ color: $dark-gray
62
+
63
+ .black
64
+ color: black
65
+
66
+ .fi-social-github
67
+ &.medium
68
+ font-size: 30px
69
+ &.large
70
+ font-size: 50px
71
+
72
+ body > footer
73
+ background: white
74
+ padding-top: 20px
75
+ position: relative
76
+ min-height: 70px
77
+
78
+ .line
79
+ padding: 5px 0
80
+ font-size: 0.8em
81
+
82
+ @media #{$medium-up}
83
+ font-size: 1em
84
+
85
+ .tags
86
+ margin-bottom: 5px
87
+
88
+ i
89
+ margin-right: 5px
90
+
91
+ .tag
92
+ background: $red
93
+ width: none
94
+ padding: 5px
95
+ color: white
96
+ font-size: 0.75em
97
+
98
+ @media #{$medium-up}
99
+ font-size: 0.8em
100
+
101
+ .github-fork-ribbon-wrapper.right-bottom
102
+ position: absolute
103
+ .github-fork-ribbon
104
+ background: $dark-gray
105
+
106
+ form
107
+ .hint
108
+ margin: -10px 0 10px 0
109
+ font-size: 0.7em
110
+ display: block
111
+ color: $red
112
+
113
+ @media #{$medium-up}
114
+ font-size: 0.8em
115
+ a
116
+ text-decoration: underline
@@ -0,0 +1,6 @@
1
+ $soft-gray: #eeeeee
2
+ $dark-gray: #333333
3
+ $dark-red: #980905
4
+ $red: #C52F24
5
+ $soft-blue: #D5E9F6
6
+ $soft-yellow: #FFF9D8
@@ -0,0 +1,14 @@
1
+ module Recruiter
2
+ class FiltersController < ::RecruiterController
3
+ def index
4
+ @records = ::Recruiter::Filters.filter(type, params).map do |record|
5
+ { id: record.id, name: record.name }
6
+ end
7
+ render json: @records
8
+ end
9
+
10
+ def type
11
+ params.require(:filter)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ module Recruiter
2
+ class JobsController < ::RecruiterController
3
+ def index
4
+ @jobs = ::Recruiter::Filters::JobFilter.filter(filter_params).
5
+ open.page(page).per(per_page)
6
+ end
7
+
8
+ def show
9
+ @job = Job.find(params[:id])
10
+ end
11
+
12
+ private
13
+
14
+ def filter_params
15
+ params.select { |k, v| v.present? }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ module Recruiter
2
+ class OmniauthCallbacksController < ::Devise::OmniauthCallbacksController
3
+ # For handling errors
4
+ def new_session_path(scope)
5
+ new_user_session_path
6
+ end
7
+
8
+ def facebook
9
+ login_with(Oauth::Facebook)
10
+ end
11
+
12
+ def google_oauth2
13
+ login_with(Oauth::Google)
14
+ end
15
+
16
+ def github
17
+ login_with(Oauth::Github)
18
+ end
19
+
20
+ def login_with(klass)
21
+ env = request.env["omniauth.auth"]
22
+ origin = request.env["omniauth.origin"]
23
+ user = klass.find_or_build_user(env)
24
+ redirect_url = redirect_url_for(user, origin)
25
+ message = login_message(user)
26
+ user.save!(validate: false)
27
+ sign_in(user, event: :authentication)
28
+ redirect_to redirect_url, notice: message, only_path: true
29
+ end
30
+
31
+ def login_message(user)
32
+ key = user.new_record? ? 'account_created' : 'login_succeed'
33
+ I18n.t("recruiter.messages.#{key}")
34
+ end
35
+
36
+ def redirect_url_for(user, origin = nil)
37
+ origin || root_url
38
+ end
39
+
40
+ def relative_path(url)
41
+ matches = url.match(/^http(s)?:\/\/[^\/]+(.*)/)
42
+ matches ? matches[2] : url
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,59 @@
1
+ module Recruiter
2
+ module Users
3
+ class JobsController < UserController
4
+ before_action :set_job, only: [:show, :edit, :update, :destroy]
5
+
6
+ def index
7
+ @jobs = scope.page(page).per(per_page)
8
+ respond_with(@jobs)
9
+ end
10
+
11
+ def show
12
+ respond_with(@job)
13
+ end
14
+
15
+ def edit
16
+ respond_with(@job)
17
+ end
18
+
19
+ def new
20
+ # TODO: This fixes issue #10. Not a beautiful think to do here
21
+ flash.delete(:alert)
22
+ @job = scope.new
23
+ respond_with(@job)
24
+ end
25
+
26
+ def create
27
+ @job = scope.build(job_params)
28
+ crud_flash @job.save
29
+ respond_with(@job)
30
+ end
31
+
32
+ def update
33
+ crud_flash @job.update(job_params)
34
+ respond_with(@job)
35
+ end
36
+
37
+ def destroy
38
+ crud_flash @job.destroy
39
+ respond_with(@job)
40
+ end
41
+
42
+ private
43
+
44
+ def scope
45
+ current_user.jobs
46
+ end
47
+
48
+ def set_job
49
+ @job = scope.find(params[:id])
50
+ end
51
+
52
+ def job_params
53
+ params.require(:job).permit(
54
+ :title, :description, :how_to_apply, :city_id, :state_id, tag_ids: []
55
+ ).to_hash.reverse_merge(tag_ids: [])
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,8 @@
1
+ module Recruiter
2
+ module Users
3
+ class UserController < ::RecruiterController
4
+ before_action :authenticate_user!
5
+ respond_to :html, :json
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ class RecruiterController < ApplicationController
2
+ include Recruiter::CrudFlashMessagerHelper
3
+
4
+ layout 'recruiter/application'
5
+
6
+ def page
7
+ params[:page]
8
+ end
9
+
10
+ def per_page
11
+ params[:per_page]
12
+ end
13
+ end
@@ -0,0 +1,49 @@
1
+ module Recruiter
2
+ class JobDecorator < Draper::Decorator
3
+ delegate_all
4
+
5
+ def created_at_ago
6
+ h.time_ago_in_words(object.created_at)
7
+ end
8
+
9
+ def title
10
+ object.title.titleize
11
+ end
12
+
13
+ def updated_at_ago
14
+ h.time_ago_in_words(object.created_at)
15
+ end
16
+
17
+ def updated?
18
+ object.created_at < object.updated_at
19
+ end
20
+
21
+ def published_at
22
+ h.t('recruiter.messages.posts.published_at', time: created_at_ago)
23
+ end
24
+
25
+ def updated_at
26
+ h.t('recruiter.messages.posts.updated_at', time: updated_at_ago)
27
+ end
28
+
29
+ def city
30
+ object.city.name
31
+ end
32
+
33
+ def state
34
+ object.city.state.name
35
+ end
36
+
37
+ def location
38
+ "#{city}/#{short_state}"
39
+ end
40
+
41
+ def short_state
42
+ object.city.state.short
43
+ end
44
+
45
+ def tag_names
46
+ tags.map(&:name)
47
+ end
48
+ end
49
+ end