Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch 2 #3

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
251332b
• Employees should be able to login using their Service Numbers.
Jun 17, 2015
fec87f6
• Design should be reorganised for effective use on mobile phones
Jun 17, 2015
1b47915
• Competencies and Employees should have a many-to-many association, …
Jun 17, 2015
915ca8f
• Qualifications and Employees should have a many-to-many association…
Jun 17, 2015
25fdb93
• Spouses should be changed to “Dependants” and a column “relation” s…
Jun 17, 2015
dfb4910
• An additional class of “Promotion Date” should be added as a one-to…
Jun 17, 2015
d7f4664
• Date Pickers seem to always lose the date when editing details.
Jun 17, 2015
f01d886
• Avatars should be adjusted to fit well into the view
Jun 19, 2015
7507a6d
• Information for employees that they are able to see should be immed…
Jun 22, 2015
1e3eedd
• Each entity should have its own Index page where records are search…
Jun 23, 2015
42d62b9
• Admin should be able to activate and deactivate employees (allowing…
Jul 1, 2015
716b03e
• Records should automatically archive on a weekly basis in order to …
Jul 1, 2015
fb029ad
• A graph Gem such as Chartkick or Googlegraph to create graphs on pa…
Jul 1, 2015
ff6accc
Graphs.
Jul 7, 2015
0146836
Add Suggestions.
Jul 11, 2015
953e9c8
Announcements.
Jul 13, 2015
1aecbe3
• Geo Chart of UK with locations of all addresses of type Home
Jul 13, 2015
d287ce7
• Pie Chart of gender
Jul 13, 2015
5f9ebf3
• Column Chart of ages, with frequency along the left and age along t…
Jul 13, 2015
f6adf1f
• Bar Chart of each competence type, this should count the number of …
Jul 13, 2015
b2753e1
• Chart to show the number of each rank in the organisation, relative…
Jul 13, 2015
0a0afb8
Can you also add in a function which adds all the days where an emplo…
Jul 13, 2015
5b93438
Fix admin suggestions link.
Jul 13, 2015
6ab021b
and if a Report’s Next Date or Medical Record End Date is within 2 mo…
Jul 13, 2015
6e1163e
Use GB region in geo graphs and exclude admin from statistics.
Jul 13, 2015
bd18c7e
Fix geo graphs.
Jul 13, 2015
cc7b47e
Fix gendre field on employee form.
Jul 13, 2015
d201db4
Fix date in event graphs.
Jul 13, 2015
d38187b
Application html / undefined method `admin?' for nil:NilClass.
Jul 13, 2015
31f63f5
Fixes
Jul 13, 2015
3f08c9e
Change date format for announcements.
Jul 14, 2015
7fe2966
Fix link on log.
Jul 14, 2015
1edf6b6
Away messages add days.
Jul 14, 2015
ec37c60
Fix annouc.
Jul 14, 2015
e2aacfd
Fix
Jul 14, 2015
ad05e51
Config airbrake.
Jul 14, 2015
39e46f9
Fix abilty.
Jul 14, 2015
45bef4e
City Geo graph by markers.
Jul 14, 2015
7bf90ce
Exclude columns from resources.
Jul 14, 2015
4fb615a
Add responsive tables.
Jul 14, 2015
255f53b
Add Edit/Delete tp resources.
Jul 14, 2015
a1840ab
Fix expire date.
Jul 14, 2015
aeb0853
Show admin flashed only on home page.
Jul 14, 2015
98a2125
• Change all date selects to date-picker, including Passport expiry w…
Jul 20, 2015
ad61c35
• Remove timezone from datestamp views.
Jul 20, 2015
a57bd8d
Add devise invation.
Jul 20, 2015
8611ab7
Config s3 for paperclip.
Jul 20, 2015
3010d8c
Remove confirmate.
Jul 20, 2015
228c2dc
Fix meta.
Jul 20, 2015
55ae7c9
Just noticed that it seems that the admin can no longer create Qualif…
Jul 22, 2015
09fa719
undefined method `strftime' for nil:NilClass.
Jul 22, 2015
fd956ad
Remove AWS credentials.
Jul 22, 2015
af4e445
Fix datepicker.
Aug 19, 2015
d3b982a
Promotion dates graphs.
Aug 20, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
AWS_ACCESS_KEY_ID=AKIAJVTWCDBNIHNMJ6QQ
AWS_SECRET_ACCESS_KEY=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
S3_BUCKET=1rlclad
AWS_BUCKET=1rlclad
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gem 'formtastic', '~> 3.0'
gem 'formtastic-bootstrap'
gem 'cocoon'
gem 'country_select'
gem 'ransack'
gem 'cancancan', '~> 1.10'
gem 'responders'
# Use SCSS for stylesheets
Expand All @@ -34,14 +35,25 @@ gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', :group => :doc

gem 'birthday'
gem 'devise', '3.4.1'
gem 'devise-bootstrap-views'
gem 'devise_invitable'
gem 'bootstrap-datepicker-rails', :require => 'bootstrap-datepicker-rails',
:git => 'git://github.com/Nerian/bootstrap-datepicker-rails.git'
gem 'modernizr-rails'

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
gem 'unicorn'
gem 'paranoia', '~> 2.0'
gem 'chartkick'
gem 'groupdate'
gem 'airbrake'
gem 'aws-sdk'


group :development do
gem 'letter_opener'
Expand Down
45 changes: 45 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: git://github.com/Nerian/bootstrap-datepicker-rails.git
revision: 486f26e0c4cbbc6e55a1d8a477a550f5a6594a8d
specs:
bootstrap-datepicker-rails (1.4.0)
railties (>= 3.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -37,10 +44,21 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
airbrake (4.3.0)
builder
multi_json
arel (6.0.0)
aws-sdk (1.64.0)
aws-sdk-v1 (= 1.64.0)
aws-sdk-v1 (1.64.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
bcrypt (3.1.10)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
birthday (0.3.1)
activerecord
activesupport
bootstrap-sass (3.2.0.0)
sass (~> 3.2)
bootstrap-will_paginate (0.0.10)
Expand All @@ -58,6 +76,7 @@ GEM
capybara-screenshot (1.0.9)
capybara (>= 1.0, < 3)
launchy
chartkick (1.3.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.7)
Expand Down Expand Up @@ -88,6 +107,9 @@ GEM
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-bootstrap-views (0.0.5)
devise_invitable (1.5.1)
actionmailer (>= 3.2.6, < 5)
devise (>= 3.2.0)
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.5.2)
Expand All @@ -104,6 +126,8 @@ GEM
formtastic (>= 3.0)
globalid (0.3.5)
activesupport (>= 4.1.0)
groupdate (2.4.0)
activesupport (>= 3)
haml (4.0.6)
tilt
haml-rails (0.9.0)
Expand Down Expand Up @@ -139,6 +163,7 @@ GEM
mime-types (2.5)
mini_portile (0.6.2)
minitest (5.6.1)
modernizr-rails (2.7.1)
multi_json (1.11.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
Expand All @@ -148,7 +173,11 @@ GEM
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
paranoia (2.1.3)
activerecord (~> 4.0)
pg (0.18.2)
polyamorous (1.2.0)
activerecord (>= 3.0)
rack (1.6.1)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -184,6 +213,12 @@ GEM
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.4.2)
ransack (1.6.6)
actionpack (>= 3.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
i18n
polyamorous (~> 1.2)
rdoc (4.2.0)
json (~> 1.4)
responders (2.1.0)
Expand Down Expand Up @@ -259,32 +294,42 @@ PLATFORMS
ruby

DEPENDENCIES
airbrake
aws-sdk
bcrypt (~> 3.1.7)
birthday
bootstrap-datepicker-rails!
bootstrap-sass (= 3.2.0.0)
bootstrap-will_paginate (= 0.0.10)
byebug
cancancan (~> 1.10)
capybara
capybara-screenshot
chartkick
cocoon
coffee-rails (~> 4.1.0)
country_select
database_cleaner
devise (= 3.4.1)
devise-bootstrap-views
devise_invitable
factory_girl_rails
figaro
formtastic (~> 3.0)
formtastic-bootstrap
groupdate
haml-rails (~> 0.9)
jbuilder (~> 2.0)
jquery-rails
letter_opener
modernizr-rails
paperclip
paranoia (~> 2.0)
pg
rack-timeout
rails (= 4.2.0)
rails_12factor (= 0.0.2)
ransack
responders
rspec-mocks (~> 3.2.1)
rspec-rails (~> 3.0)
Expand Down
12 changes: 11 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require modernizr
//= require jquery
//= require jquery_ujs
//= require cocoon
//= require bootstrap
//= require turbolinks
//= require bootstrap-datepicker
//= require_tree .


$(function(){
$('.date_picker input').datepicker({format: "dd/mm/yyyy"});
})



4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@import "custom";
@import "employees";
@import "screen";
@import "search";
@import 'tables';


6 changes: 5 additions & 1 deletion app/assets/stylesheets/custom.css.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "bootstrap-sprockets";
@import "bootstrap";

@import "bootstrap-datepicker";
/* mixins, variables, etc. */

$gray-medium-light: #eaeaea;
Expand Down Expand Up @@ -32,6 +32,10 @@ textarea {
}
}

.form-inline input {
margin-bottom: 0;
}

/* typography */

h1, h2, h3, h4, h5, h6 {
Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/search.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.search-form {
label { width: 100px; }
.form-group {
margin-bottom: 10px;
margin-left: 10px;
}
.form-control { margin-bottom: 0; }
select { width: 80% !important; }
}
36 changes: 36 additions & 0 deletions app/assets/stylesheets/tables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@media only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {

/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
}

/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}

tr { border: 1px solid #ccc; }

td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
}

td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
}
}
3 changes: 2 additions & 1 deletion app/controllers/addresses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class AddressesController < ApplicationController
# GET /addresses
# GET /addresses.json
def index
@addresses = @parent.addresses
@search = Address.search(params[:q])
@results = @search.result.includes(:employee)
end

# GET /addresses/1
Expand Down
63 changes: 63 additions & 0 deletions app/controllers/announcements_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
class AnnouncementsController < ApplicationController
include EmployeeAsParent

before_action :set_announcement, only: [:show, :edit, :update, :destroy]

def index
@search = Announcement.search(params[:q])
@results = @search.result.includes(:employee)
end

def show
end

def new
@announcement = @parent.announcements.build
end

def edit
end

def create
@announcement = @parent.announcements.build(announcement_params)

respond_to do |format|
if @announcement.save
format.html { redirect_to employee_announcements_path(@parent), notice: 'Announcement was successfully created.' }
format.json { render :show, status: :created, location: [@parent, @announcement] }
else
format.html { render :new }
format.json { render json: @announcement.errors, status: :unprocessable_entity }
end
end
end

def update
respond_to do |format|
if @announcement.update(announcement_params)
format.html { redirect_to [@parent, @announcement], notice: 'Announcement was successfully updated.' }
format.json { render :show, status: :ok, location: [@parent, @announcement] }
else
format.html { render :edit }
format.json { render json: @announcement.errors, status: :unprocessable_entity }
end
end
end

def destroy
@announcement.destroy
respond_to do |format|
format.html { redirect_to employee_announcements_path(@parent), notice: 'Announcement was successfully destroyed.' }
format.json { head :no_content }
end
end

private
def set_announcement
@announcement = Announcement.find(params[:id])
end

def announcement_params
params.require(:announcement).permit(:title, :body)
end
end
10 changes: 10 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#require 'application_responder'

class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?

#self.responder = ApplicationResponder TODO:
respond_to :html

Expand All @@ -15,4 +17,12 @@ def current_ability
rescue_from CanCan::AccessDenied do |exception|
redirect_to root_path, alert: exception.message
end

protected

def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) }
end
end
3 changes: 2 additions & 1 deletion app/controllers/competencies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class CompetenciesController < ApplicationController
# GET /competencies
# GET /competencies.json
def index
@competencies = @parent.competencies
@search = Competency.search(params[:q])
@results = @search.result.includes(:employee)
end

# GET /competencies/1
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/concerns/employee_as_parent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ module EmployeeAsParent
extend ActiveSupport::Concern

included do
load_and_authorize_resource :employee
load_and_authorize_resource through: :employee
load_and_authorize_resource through: :current_employee#, shallow: true

before_action :set_parent
end
Expand Down
Loading