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

table responsive class added for companies and users listing #26

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.rspec
.rvmrc
.bundle/
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/log/*.log
spec/dummy/tmp/
spec/dummy/.sass-cache
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem 'bootstrap-datepicker-rails'
gem 'colorbox-rails'
gem 'remotipart', '~> 1.2'
gem 'turbolinks'

gem 'office_automation_invoice', path: '../office_automation_invoice'

group :development do
gem 'better_errors'
Expand All @@ -41,7 +41,7 @@ group :test do
gem 'mongoid-rspec'
gem 'factory_girl_rails'
gem 'database_cleaner'
gem 'simplecov', '~> 0.7.1'
gem 'simplecov', '~> 0.7.1', require: false
end

# Declare any dependencies that are still in development here instead of in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
//= require jquery_nested_form
//= require bootstrap-datepicker/core
//= require colorbox-rails
//= require office_automation_invoice/application
//= require_tree .
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
ready = ->
len = undefined
len = $(".remove_nested_fields:visible").length
$(".remove_nested_fields").hide() if len is 1
$(".remove_nested_fields").click ->
$(".remove_nested_fields").on 'click', ->
len = $(".remove_nested_fields:visible").length
$(".remove_nested_fields").hide() if len is 2
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*= require bootstrap
*= require bootstrap-datepicker
*= require colorbox-rails
*= require office_automation_invoice/application
*= require_self
*= require_tree .
*/
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def index
@company = Company.find params[:company_id]
@users = @company.users.full_text_search(params[:q])
@failure_message = 'No Result Found' if @users.count == 0
@users = @users.page(params[:page])
@users = @users.page(params[:page])
end

def destroy
Expand Down
2 changes: 0 additions & 2 deletions app/models/office_automation_employee/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class Company
accepts_nested_attributes_for :users
before_update :delete_address

accepts_nested_attributes_for :users

private

# If current address is same as registered address then update current address
Expand Down
22 changes: 0 additions & 22 deletions app/models/office_automation_employee/private_profile.rb

This file was deleted.

22 changes: 0 additions & 22 deletions app/models/office_automation_employee/public_profile.rb

This file was deleted.

17 changes: 8 additions & 9 deletions app/models/office_automation_employee/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class User

## Database authenticatable
field :email, default: ""
slug :username
field :encrypted_password, default: ""

## Recoverable
Expand Down Expand Up @@ -56,30 +55,30 @@ class User
# field :unlock_token, :type => String # Only if unlock strategy is :email or :both
# field :locked_at, :type => Time

# user-fields
## Fields
slug :username
field :status, default: 'Pending'
field :roles, type: Array
field :invalid_csv_data, type: Array
field :csv_downloaded, type: Boolean, default: true
field :image

# validations
## Validations
validates :roles, presence: true


# relationships
## Relationships
embeds_one :profile, class_name: 'OfficeAutomationEmployee::Profile'
embeds_one :personal_profile, class_name: 'OfficeAutomationEmployee::PersonalProfile'
belongs_to :company, class_name: 'OfficeAutomationEmployee::Company'
embeds_many :attachments, class_name: 'OfficeAutomationEmployee::Attachment', cascade_callbacks: true

accepts_nested_attributes_for :profile
accepts_nested_attributes_for :personal_profile
accepts_nested_attributes_for :attachments

search_in :email, profile: [ :first_name, :last_name ]
accepts_nested_attributes_for :profile, :personal_profile, :attachments

## Callbacks
after_update :send_mail

search_in :email, profile: [ :first_name, :last_name ]

def role?(role)
roles.include? role.humanize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%li.dropdown
= link_to content_tag(:span, "", class: "glyphicon glyphicon-cog") + " #{current_user.company.name} admin" + content_tag(:b, "", class: "caret"), "#", class: "dropdown-toggle", data: { toggle: "dropdown" }

%ul.dropdown-menu.pull-right
%ul.dropdown-menu
%li= link_to content_tag(:span, "", class: "glyphicon glyphicon-wrench") + " Company Profile", office_automation_employee.edit_company_path(current_user.company)

%li.divider
Expand All @@ -17,7 +17,7 @@
%li.dropdown
= link_to image_tag(current_user.image.small) + content_tag(:b, "", class: "caret"), "#", class: "data-toggle", data: { toggle: "dropdown" }

%ul.dropdown-menu.pull-right
%ul.dropdown-menu
- unless can? :manage, OfficeAutomationEmployee::Company
%li= link_to content_tag(:span, "", class: "glyphicon glyphicon-edit") + " Profile", office_automation_employee.edit_company_user_path(current_user.company, current_user)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
%table.table.table-hover
%thead
%tr
%th #
%th Logo
%th Name
%th
%center Employee Count
%th
%center URL
%th Status
%th Remove

%tbody.rowlink{ "data-link" => "row" }
- companies.each_with_index do |company, index|
.table-responsive
%table.table.table-hover
%thead
%tr
%td= index + 1
%th #
%th Logo
%th Name
%th
%center Employee Count
%th
%center URL
%th Status
%th Remove

%tbody.rowlink{ "data-link" => "row" }
- companies.each_with_index do |company, index|
%tr
%td= index + 1

%td= link_to image_tag(company.logo.square, class: "img"), office_automation_employee.edit_company_path(company)
%td= link_to image_tag(company.logo.square, class: "img"), office_automation_employee.edit_company_path(company)

%td= company.name
%td= company.name

%td.rowlink-skip
%center= link_to company.users.count, office_automation_employee.company_users_path(company)
%td.rowlink-skip
%center= link_to company.users.count, office_automation_employee.company_users_path(company)

%td.rowlink-skip
%center= link_to "#{company.company_url}", company.company_url, target: :_blank
%td.rowlink-skip
%center= link_to "#{company.company_url}", company.company_url, target: :_blank

%td.rowlink-skip= link_to (company.status.eql?("Active")? "Deactivate" : "Activate"), office_automation_employee.activation_company_path(company), class: "btn btn-xs btn-warning"
%td.rowlink-skip= link_to (company.status.eql?("Active")? "Deactivate" : "Activate"), office_automation_employee.activation_company_path(company), class: "btn btn-xs btn-warning"

%td.rowlink-skip= link_to content_tag(:span, "", class: "glyphicon glyphicon-remove"), office_automation_employee.company_path(company), method: :delete, class: "btn btn-xs btn-danger"
%td.rowlink-skip= link_to content_tag(:span, "", class: "glyphicon glyphicon-remove"), office_automation_employee.company_path(company), method: :delete, class: "btn btn-xs btn-danger"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%h1 "Hello"
= "Your #{@user.company.name} password was changed"

%h1= "Hello #{@user.email}"
= "Your #{@user.company.name} password was changed."
%p= raw "If you haven't done this, #{link_to("click", office_automation_employee.new_user_password_url)} here to reset your password."
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.col-md-12
%table.table.table-hover
.table-responsive
%table.table.table-hover.table-condensed
%thead
%tr
%th #
Expand All @@ -17,7 +17,7 @@
%td= index + 1
%td= link_to image_tag(user.image.thumb.url, class: "img-circle"), office_automation_employee.company_user_path(user.company, user)
%td= user.fullname
%td= user.email
%td.col-xs-1= user.email
%td= user.roles.to_sentence
%td= user.status if can? :edit, user.company
%td.rowlink-skip= link_to(content_tag(:span, "", class: "glyphicon glyphicon-edit"), office_automation_employee.edit_company_user_path(user.company, user), class: "btn btn-default") if can?(:edit,user.company) and (cannot? :manage, user.company) and current_user != user
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OfficeAutomationEmployee::Engine.routes.draw do

mount OfficeAutomationInvoice::Engine => '/invoice'
resources :companies, except: ['new', 'create'] do
get 'activation', on: :member
resources :users, except: ['new', 'create'] do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class Ability < OfficeAutomationEmployee::Ability
include CanCan::Ability

def initialize(user)
super
end
Expand Down
1 change: 1 addition & 0 deletions lib/office_automation_employee.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "office_automation_employee/engine"
require "office_automation_employee/version"

module OfficeAutomationEmployee
end
5 changes: 4 additions & 1 deletion lib/office_automation_employee/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
require 'sidekiq'
require 'kaminari'
require 'mongoid'
require 'mongoid_search'
require 'mongoid_slug'
require 'mongoid_search'
require 'carrierwave/mongoid'
require 'cancan'
require 'haml-rails'
Expand All @@ -16,6 +16,9 @@
require 'colorbox-rails'
require 'country_select'
require 'remotipart'
require 'jquery-rails'
require 'turbolinks'
require 'therubyracer'

module OfficeAutomationEmployee
class Engine < ::Rails::Engine
Expand Down
10 changes: 6 additions & 4 deletions office_automation_employee.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Gem::Specification.new do |s|
s.authors = ["yogesh", "shweta"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/joshsoftware/office_automation_employee"
s.summary = "A Mountable engine for Employee management"
s.description = "A Mountable Engine for Employee management tasks like creating company, adding multiple roles, inviting new employees, monitoring status of invitations etc."
s.summary = "Mountable engine for Employee management."
s.description = "Mountable Engine for Employee management tasks like creating company, adding multiple roles, inviting new employees, monitoring status of invitations etc."

s.files = Dir["{app,config,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]

s.add_dependency "rails", "~> 4.0.3"
s.add_dependency "mongoid"
Expand All @@ -24,7 +24,9 @@ Gem::Specification.new do |s|
s.add_dependency "sidekiq"
s.add_dependency "kaminari"
s.add_dependency "jquery-rails"
s.add_dependency "sass-rails", ">= 3.2"
s.add_dependency "turbolinks"
s.add_dependency "therubyracer"
s.add_dependency "sass-rails", "~> 4.0.2"
s.add_dependency "bootstrap-sass"
s.add_dependency "bootstrap-datepicker-rails"
s.add_dependency "colorbox-rails"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module OfficeAutomationEmployee

devise_mapping
include_engine_routes

let(:admin) { create(:admin) }
let(:user) { create(:user) }

Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

config.action_mailer.default_url_options = { host:"localhost:3000" }
config.action_mailer.default_url_options = { host:"localhost:3001" }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Rails.application.routes.draw do
mount OfficeAutomationEmployee::Engine => '/office_automation_employee'
mount OfficeAutomationEmployee::Engine => '/employee'
root to: 'office_automation_employee/companies#show'
end
12 changes: 0 additions & 12 deletions spec/models/office_automation_employee/private_profile_spec.rb

This file was deleted.

9 changes: 0 additions & 9 deletions spec/models/office_automation_employee/public_profile_spec.rb

This file was deleted.