-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
292 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS | ||
* files in this directory. Styles in this file should be added after the last require_* statement. | ||
* It is generally better to create a new file per style scope. | ||
* | ||
*= require_tree . | ||
*= require_self | ||
*/ | ||
@import "bootstrap-sprockets"; | ||
@import "bootstrap"; | ||
|
||
/* forms */ | ||
|
||
form { | ||
margin-left: 20px; | ||
} | ||
input, textarea, select, .undentable-input { | ||
border: 1px solid black; | ||
width: 20%; | ||
margin-bottom: 15px; | ||
box-sizing: border-box; | ||
} | ||
|
||
input { | ||
height: auto !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# frozen_string_literal: true | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery with: :exception | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
class VacanciesController < ApplicationController | ||
before_action :set_vacancy, only: [:edit, :show] | ||
def new | ||
@vacancy = Vacancy.new | ||
end | ||
|
||
def index | ||
@vacancy = Vacancy.all | ||
end | ||
|
||
def create | ||
@vacancy = Vacancy.new(vacancy_params) | ||
if @vacancy.save | ||
redirect_to vacancy_path(@vacancy), notice: "You vacancy created successfully" | ||
else | ||
render 'new' | ||
end | ||
end | ||
|
||
def update | ||
if @vacancy.update_attributes(params[:id]) | ||
redirect_to @vacancy | ||
else | ||
render 'edit' | ||
end | ||
end | ||
|
||
def edit | ||
|
||
end | ||
|
||
def show | ||
|
||
end | ||
|
||
private | ||
|
||
def set_vacancy | ||
@vacancy = Vacancy.find(params[:id]) | ||
end | ||
|
||
def vacancy_params | ||
params.require(:vacancy).permit(:name, :kind, :description, :location, :remote, :company, | ||
:site, :phone) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# frozen_string_literal: true | ||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module VacanciesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# frozen_string_literal: true | ||
class ApplicationJob < ActiveJob::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# frozen_string_literal: true | ||
class ApplicationRecord < ActiveRecord::Base | ||
self.abstract_class = true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
class Vacancy < ApplicationRecord | ||
validates :name, presence: true | ||
validates :kind, presence: true | ||
validates :description, presence: true | ||
validates :contact_to, presence: true | ||
validates :expire, presence: true | ||
|
||
def expire_dates | ||
expire_dates = [7, 14, 30] | ||
expire_at = DateTime.now + expire_dates[params[:expire]].days | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<div class="row-fluid"> | ||
<div class="span4 well"> | ||
<%= form_for(@vacancy) do |f| %> | ||
<%= f.label :name %><br> | ||
<%= f.text_field :name %><br> | ||
|
||
<%= f.label :kind %><br> | ||
<%= f.text_field :kind %><br> | ||
|
||
<%= f.label :description %><br> | ||
<%= f.text_field :description %><br> | ||
|
||
<%= f.label :location %><br> | ||
<%= f.text_field :location %><br> | ||
|
||
<%= f.label :remote %><br> | ||
<%= f.text_field :remote %><br> | ||
|
||
<%= f.label :company %><br> | ||
<%= f.text_field :company %><br> | ||
|
||
<%= f.label :site %><br> | ||
<%= f.url_field :site %><br> | ||
|
||
<%= f.label :phone %><br> | ||
<%= f.telephone_field :phone %><br> | ||
|
||
<%= f.label :contact_to %><br> | ||
<%= f.text_field :contact_to %><br> | ||
|
||
<%= f.label :expire %><br> | ||
<%= f.select(:expire, options_for_select( [[7],[14],[30]] )) %><br> | ||
|
||
<%= f.submit "Create vacancy", class: "btn btn-large btn-primary" %> | ||
|
||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h1>Edit Vacancy</h1> | ||
|
||
<%= render 'form' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<h1>All vacancy</h1> | ||
|
||
<% @vacancy.each do |v| %> | ||
<h2><%= link_to v.name, v %><h2/> | ||
<% end %> | ||
|
||
<%= link_to "New Vacancy", new_vacancy_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h1>Create a new vacancy</h1> | ||
|
||
<%= render 'form' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h1>Vacancy</h1> | ||
|
||
<h2><%= @vacancy.name %></h2> | ||
<%= link_to 'Edit', edit_vacancy_path(@vacancy) %> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Rails.application.routes.draw do | ||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html | ||
resources :vacancies | ||
root 'vacancies#index' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class CreateVacancies < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :vacancies do |t| | ||
t.string :name | ||
t.string :kind | ||
t.text :description | ||
t.string :location | ||
t.boolean :remote | ||
t.string :company | ||
t.string :site | ||
t.string :phone | ||
t.string :contact_to | ||
t.integer :user_id | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddExpireColumnsToVacancies < ActiveRecord::Migration[5.0] | ||
def change | ||
add_column :vacancies, :expire, :integer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangeColunmVacancies < ActiveRecord::Migration[5.0] | ||
def change_table vacancies | ||
rename :expire, :expire_at | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangeTableVacancies < ActiveRecord::Migration[5.0] | ||
def change | ||
change_column :vacancies, :expire, :DateTime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangesVacancyColmns < ActiveRecord::Migration[5.0] | ||
def change | ||
change_column :vacancies, :expire, :integer | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddExpireAtToVacancies < ActiveRecord::Migration[5.0] | ||
def change | ||
add_column :vacancies, :expire_at, :DateTime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file is auto-generated from the current state of the database. Instead | ||
# of editing this file, please use the migrations feature of Active Record to | ||
# incrementally modify your database, and then regenerate this schema definition. | ||
# | ||
# Note that this schema.rb definition is the authoritative source for your | ||
# database schema. If you need to create the application database on another | ||
# system, you should be using db:schema:load, not running all the migrations | ||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
# you'll amass, the slower it'll run and the greater likelihood for issues). | ||
# | ||
# It's strongly recommended that you check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(version: 20160903085743) do | ||
|
||
create_table "vacancies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| | ||
t.string "name" | ||
t.string "kind" | ||
t.text "description", limit: 65535 | ||
t.string "location" | ||
t.boolean "remote" | ||
t.string "company" | ||
t.string "site" | ||
t.string "phone" | ||
t.string "contact_to" | ||
t.integer "user_id" | ||
t.datetime "created_at", null: false | ||
t.datetime "updated_at", null: false | ||
t.integer "expire" | ||
t.datetime "expire_at" | ||
end | ||
|
||
end |
Oops, something went wrong.