Skip to content
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
9 changes: 2 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

ruby '2.1.2'
gem 'rails', '4.2.0.beta1'
gem 'rails', '4.2.0'
gem 'cancan'
#gem 'devise'
# https://github.com/plataformatec/devise/pull/3153
Expand All @@ -22,9 +22,7 @@ gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'bootstrap-wysihtml5-rails'
#gem 'bootstrap-sass', '>= 3.2.0.1'
# Temporary fix
gem 'bootstrap-sass', github: 'everaldo/bootstrap-sass'
gem 'bootstrap-sass', '>= 3.2.0.2'
gem 'html2haml'
gem 'quiet_assets'
gem 'rails_layout'
Expand All @@ -42,9 +40,6 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use Rails Html Sanitizer for HTML sanitization
gem 'rails-html-sanitizer', '~> 1.0'

gem 'mina'
gem 'mina-scp', require: false


group :development, :test do
# Call 'debugger' anywhere in the code to stop execution and get a debugger console
Expand Down
131 changes: 64 additions & 67 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
GIT
remote: git://github.com/everaldo/bootstrap-sass.git
revision: 21bff940bec205d641a818e08fce699810277d42
specs:
bootstrap-sass (3.2.0.1)
sass (~> 3.2)

GIT
remote: git://github.com/mongoid/mongoid.git
revision: 4e3b39e9bbcf1b36d0472c6b09f8f394c55065f4
Expand All @@ -31,48 +24,52 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0.beta1)
actionpack (= 4.2.0.beta1)
actionview (= 4.2.0.beta1)
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.2)
actionpack (4.2.0.beta1)
actionview (= 4.2.0.beta1)
activesupport (= 4.2.0.beta1)
rack (~> 1.6.0.beta)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-deprecated_sanitizer (~> 1.0, >= 1.0.2)
rails-dom-testing (~> 1.0, >= 1.0.2)
actionview (4.2.0.beta1)
activesupport (= 4.2.0.beta1)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-deprecated_sanitizer (~> 1.0, >= 1.0.2)
rails-dom-testing (~> 1.0, >= 1.0.2)
activejob (4.2.0.beta1)
globalid (>= 0.2.3)
activemodel (4.2.0.beta1)
activesupport (= 4.2.0.beta1)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0.beta1)
activemodel (= 4.2.0.beta1)
activesupport (= 4.2.0.beta1)
arel (>= 6.0.0.beta1, < 6.1)
activesupport (4.2.0.beta1)
i18n (>= 0.7.0.beta1, < 0.8)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.6)
arel (6.0.0.beta1)
arel (6.0.0)
bcrypt (3.1.7)
better_errors (2.0.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.2.0.2)
sass (~> 3.2)
bootstrap-wysihtml5-rails (0.3.2.100)
railties (>= 3.0)
bson (2.3.0)
Expand Down Expand Up @@ -132,7 +129,7 @@ GEM
rails (>= 3, < 5)
formatador (0.2.5)
geocoder (1.2.4)
globalid (0.2.3)
globalid (0.3.0)
activesupport (>= 4.1.0)
guard (2.6.1)
formatador (>= 0.2.4)
Expand All @@ -157,7 +154,7 @@ GEM
haml (>= 4.0.0.rc.1)
hpricot (~> 0.8.6)
ruby_parser (~> 3.1.1)
i18n (0.7.0.beta1)
i18n (0.7.0)
jbuilder (2.1.3)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
Expand All @@ -176,16 +173,16 @@ GEM
loofah (2.0.1)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.1)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.3)
mime-types (2.4.3)
mina (0.3.0)
open4
rake
mina-scp (0.1.1)
mini_portile (0.6.0)
minitest (5.4.1)
mini_portile (0.6.2)
minitest (5.5.0)
mongoid-grid_fs (2.1.0)
mime-types (>= 1.0, < 3.0)
mongoid (>= 3.0, < 5.0)
Expand All @@ -197,8 +194,8 @@ GEM
connection_pool (~> 2.0)
optionable (~> 0.2.0)
multi_json (1.10.1)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
nokogiri (1.6.5)
mini_portile (~> 0.6.0)
open4 (1.3.4)
optionable (0.2.0)
origin (2.1.1)
Expand All @@ -214,36 +211,36 @@ GEM
pry (>= 0.9.10)
quiet_assets (1.0.3)
railties (>= 3.1, < 5.0)
rack (1.6.0.beta)
rack (1.6.0)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.2.0.beta1)
actionmailer (= 4.2.0.beta1)
actionpack (= 4.2.0.beta1)
actionview (= 4.2.0.beta1)
activejob (= 4.2.0.beta1)
activemodel (= 4.2.0.beta1)
activerecord (= 4.2.0.beta1)
activesupport (= 4.2.0.beta1)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0.beta1)
sprockets-rails (~> 3.0.0.beta1)
rails-deprecated_sanitizer (1.0.2)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.2)
activesupport
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.0)
rails-html-sanitizer (1.0.1)
loofah (~> 2.0)
rails_layout (1.0.21)
railties (4.2.0.beta1)
actionpack (= 4.2.0.beta1)
activesupport (= 4.2.0.beta1)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.3.2)
rake (10.4.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
Expand Down Expand Up @@ -296,15 +293,15 @@ GEM
activemodel (~> 4.0)
slop (3.6.0)
spring (1.1.3)
sprockets (2.12.1)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (3.0.0.beta1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (~> 2.8)
sprockets-rails (2.2.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
Expand Down Expand Up @@ -347,7 +344,7 @@ PLATFORMS
DEPENDENCIES
better_errors
binding_of_caller
bootstrap-sass!
bootstrap-sass (>= 3.2.0.2)
bootstrap-wysihtml5-rails
byebug
cancan
Expand All @@ -372,7 +369,7 @@ DEPENDENCIES
pry-byebug
pry-rails
quiet_assets
rails (= 4.2.0.beta1)
rails (= 4.2.0)
rails-html-sanitizer (~> 1.0)
rails_layout
rmagick
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ def set_category

# Never trust parameters from the scary internet, only allow the white list through.
def category_params
params.require(:category).permit(:category_name)
params.require(:category).permit(:name)
end
end
1 change: 1 addition & 0 deletions app/controllers/admin/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class Admin::DashboardController < Admin::AdminController
def index
@categories = Category.all
end
end
10 changes: 10 additions & 0 deletions app/helpers/show_attributes_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module ShowAttributesHelper
def show_attributes(resource, *attributes)
render partial: 'show_attributes', locals: {resource: resource, attributes: attributes}
end

def show_attribute(resource, attribute)
render partial: 'show_attribute', locals: {resource: resource, attribute: attribute}
end
end

5 changes: 5 additions & 0 deletions app/helpers/translations_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module TranslationsHelper
def attribute_name_for(resource_class, attribute)
resource_class.human_attribute_name attribute
end
end
2 changes: 1 addition & 1 deletion app/models/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Category
include Mongoid::Timestamps

#Validations
validates :name, presence: true
validates :name, presence: true, uniqueness: true

#Relationships
has_many :jobs
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/categories/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= simple_form_for [:admin, @category] do |f|
= f.error_notification
.form-inputs
= f.input :category_name
= f.input :name
.form-actions
= f.submit 'Save'
6 changes: 3 additions & 3 deletions app/views/admin/categories/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%h1 Editing category
%h1= t('admin.categories.edit.title')

= render 'form'

= link_to 'Show', [:admin,@category]
= link_to t('actions.show'), [:admin,@category]
\|
= link_to 'Back', admin_categories_path
= link_to t('actions.back'), admin_categories_path
20 changes: 9 additions & 11 deletions app/views/admin/categories/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
.page-header
%h1 Listing Jobs Categories
%h1= t('admin.categories.title')

%table.table.table-striped
%tr
%th Category Id
%th Category Name
%th Created At
%th Actions
%th= attribute_name_for Category, :name
%th= attribute_name_for Category, :created_at
%th= t('actions.title')

- @categories.each do |category|
%tr
%td= category.id
%td= category.category_name
%td= category.name
%td= category.created_at
%td
.btn-group.btn-group-sm
= link_to 'Show', [:admin,category], class: 'btn btn-default'
= link_to 'Edit', edit_admin_category_path(category), class: 'btn btn-default'
= link_to 'Destroy', [:admin,category], :method => :delete, :data => { :confirm => 'Are you sure?' }, class: 'btn btn-default'
= link_to t('actions.show'), [:admin,category], class: 'btn btn-default'
= link_to t('actions.edit'), edit_admin_category_path(category), class: 'btn btn-default'
= link_to t('actions.destroy'), [:admin,category], :method => :delete, :data => { :confirm => t('actions.confirm_destroy') }, class: 'btn btn-default'

%br

= link_to 'New Jobs category', new_admin_category_path, class: 'btn btn-primary'
= link_to t('admin.categories.new'), new_admin_category_path, class: 'btn btn-primary'
2 changes: 1 addition & 1 deletion app/views/admin/categories/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

= render 'form'

= link_to 'Back', admin_jobs_categories_path
= link_to 'Back', admin_categories_path
7 changes: 5 additions & 2 deletions app/views/admin/categories/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
%p#notice= notice

%h1= t('actions.show')

= link_to 'Edit', edit_admin_jobs_category_path(@jobs_category)
= show_attributes @category, :name, :created_at

= link_to t('actions.edit'), edit_admin_category_path(@category)
\|
= link_to 'Back', admin_jobs_categories_path
= link_to t('actions.back'), admin_categories_path
1 change: 1 addition & 0 deletions app/views/admin/dashboard/_category.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%li.list-group-item= category.name
8 changes: 5 additions & 3 deletions app/views/admin/dashboard/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.page-header
%h1 Dashboard
%h1= t('admin.dashboard.title')
.col-lg-6
.panel.panel-default
.panel-heading
%h3.panel-title Jobs
%h3.panel-title= t('admin.dashboard.jobs')
.panel-body
.col-lg-6
.panel.panel-default
.panel-heading
%h3.panel-title Jobs Categories
%h3.panel-title= t('admin.dashboard.categories')
.panel-body
%ul
= render partial: 'category', collection: @categories

Loading