added quartert to dates
This commit is contained in:
parent
a7c3ea2742
commit
b2f188bc5f
|
|
@ -108,6 +108,7 @@ class DotationsController < ApplicationController
|
|||
:date_of_recruitment, :min_amount_curr_id,
|
||||
:max_amount_curr_id, :min_dot_ammount, :max_dot_ammount,
|
||||
:min_dot_amount_curr_id, :max_dot_amount_curr_id,
|
||||
:start_date_quarter, :end_date_quarter, :ann_date_quarter,
|
||||
project_ids: [], tag_ids: [], company_activity_ids: [],
|
||||
company_size_ids: [], expense_ids: [])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ class HomeController < ApplicationController
|
|||
before_action :check_status
|
||||
|
||||
def check_status
|
||||
redirect_to '/construction.html'
|
||||
if defined?(current_user) && user_signed_in?
|
||||
else
|
||||
redirect_to '/construction.html'
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ class Dotation < ApplicationRecord
|
|||
has_and_belongs_to_many :tags
|
||||
has_and_belongs_to_many :company_activities
|
||||
# == Validations ==========================================================
|
||||
validates :name, presence: true
|
||||
validates :formal_name, presence: true
|
||||
validates :name, presence: true, length: { maximum: 255 }
|
||||
validates :formal_name, presence: true, length: { maximum: 255 }
|
||||
# == Scopes ===============================================================
|
||||
scope :search, (lambda do |search_value|
|
||||
where('name LIKE :value OR formal_name LIKE :value',
|
||||
|
|
@ -98,8 +98,44 @@ class Dotation < ApplicationRecord
|
|||
ret = ret.by_projects(filters[:projects]) unless filters[:projects].blank?
|
||||
ret
|
||||
end
|
||||
|
||||
def self.display_as_quarter(date)
|
||||
ret = case date.month
|
||||
when 1, 2, 3 then 'I '
|
||||
when 4, 5, 6 then 'II '
|
||||
when 7, 8, 9 then 'III '
|
||||
when 10, 11, 12 then 'IV '
|
||||
end
|
||||
ret += "kwartał #{date.year}"
|
||||
ret
|
||||
end
|
||||
|
||||
# == Instance Methods =====================================================
|
||||
|
||||
def start_date_ret
|
||||
if start_date_quarter.eql?(true)
|
||||
Dotation.display_as_quarter(start_date)
|
||||
else
|
||||
start_date.strftime("%d-%m-%Y")
|
||||
end
|
||||
end
|
||||
|
||||
def end_date_ret
|
||||
if end_date_quarter.eql?(true)
|
||||
Dotation.display_as_quarter(end_date)
|
||||
else
|
||||
end_date.strftime("%d-%m-%Y")
|
||||
end
|
||||
end
|
||||
|
||||
def ann_date_ret
|
||||
if ann_date_quarter.eql?(true)
|
||||
Dotation.display_as_quarter(announcement_date)
|
||||
else
|
||||
announcement_date.strftime("%d-%m-%Y")
|
||||
end
|
||||
end
|
||||
|
||||
def safe_id
|
||||
friendly_id
|
||||
end
|
||||
|
|
|
|||
|
|
@ -64,9 +64,29 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<%= form.check_box(:start_date_quarter, { class: 'form-check-input' }) %>
|
||||
<%= form.label :start_date_quarter %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<%= form.check_box(:end_date_quarter, { class: 'form-check-input' }) %>
|
||||
<%= form.label :end_date_quarter %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-check">
|
||||
<%= form.check_box(:ann_date_quarter, { class: 'form-check-input' }) %>
|
||||
<%= form.label :ann_date_quarter %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= form.label :localization %>
|
||||
<%= form.text_field :localization, class: 'form-control', placeholder: 'Wprowadź region' %>
|
||||
<%= form.label :localization %>
|
||||
<%= form.text_field :localization, class: 'form-control', placeholder: 'Wprowadź region' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Strona ktorej szukasz nie istnieje (404)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
.rails-default-error-page {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
.rails-default-error-page h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="rails-default-error-page">
|
||||
<!-- This file lives in public/404.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>Strona której szukasz nie istnieje.</h1>
|
||||
<p>Możliwe, że adres został wpisany niepoprawnie lub strona została przeniesiona.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<h4><strong>Składanie wniosków</strong></h4>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<h4>od <%= dotation.start_date.strftime("%d-%m-%Y") %> do <%= dotation.end_date.strftime("%d-%m-%Y") %></h4>
|
||||
<h4>od <%= dotation.start_date_ret %><br />do <%= dotation.end_date_ret %></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<tr>
|
||||
<td><strong>Składanie wniosków</strong></td>
|
||||
<td>od <%= dotation.start_date.strftime("%d-%m-%Y") %> do <%= dotation.end_date.strftime("%d-%m-%Y") %></td>
|
||||
<td>od <%= dotation.start_date_ret %><br />do <%= dotation.end_date_ret %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Lokalizacja: </td>
|
||||
|
|
|
|||
|
|
@ -54,19 +54,19 @@
|
|||
<td width="30%">
|
||||
<b>Ogłoszenie aktualnego/najbliższego naboru</b>
|
||||
</td>
|
||||
<td><%= @dotation.announcement_date.strftime("%Y-%m-%d") unless @dotation.announcement_date.blank? %></td>
|
||||
<td><%= @dotation.ann_date_ret unless @dotation.announcement_date.blank? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b>Rozpoczęcie aktualnego/najbliższego naboru</b>
|
||||
</td>
|
||||
<td><%= @dotation.start_date.strftime("%Y-%m-%d") unless @dotation.start_date.blank? %></td>
|
||||
<td><%= @dotation.start_date_ret unless @dotation.start_date.blank? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b>Zakończenie aktualnego/najbliższego naboru</b>
|
||||
</td>
|
||||
<td><%= @dotation.end_date.strftime("%Y-%m-%d") unless @dotation.end_date.blank? %></td>
|
||||
<td><%= @dotation.end_date_ret unless @dotation.end_date.blank? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -51,19 +51,19 @@
|
|||
<td width="30%">
|
||||
<b>Ogłoszenie aktualnego/najbliższego naboru</b>
|
||||
</td>
|
||||
<td><%= dotation.announcement_date.strftime("%Y-%m-%d") unless dotation.announcement_date.blank? %></td>
|
||||
<td><%= dotation.ann_date_ret unless dotation.announcement_date.blank? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b>Rozpoczęcie aktualnego/najbliższego naboru</b>
|
||||
</td>
|
||||
<td><%= dotation.start_date.strftime("%Y-%m-%d") unless dotation.start_date.blank? %></td>
|
||||
<td><%= dotation.start_date_ret unless dotation.start_date.blank? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b>Zakończenie aktualnego/najbliższego naboru</b>
|
||||
</td>
|
||||
<td><%= dotation.end_date.strftime("%Y-%m-%d") unless dotation.end_date.blank? %></td>
|
||||
<td><%= dotation.end_date_ret unless dotation.end_date.blank? %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ pl:
|
|||
start_date: Data najbliższego naboru
|
||||
end_date: Data końca naboru
|
||||
announcement_date: Data ogłoszenia naboru
|
||||
start_date_quarter: Wyświetl jako kwartał
|
||||
end_date_quarter: Wyświetl jako kwartał
|
||||
ann_date_quarter: Wyświetl jako kwartał
|
||||
tags: Tagi
|
||||
full_descr: Pełny opis dotacji
|
||||
positioning_text: Tekst pozycjonujący
|
||||
|
|
@ -39,7 +42,9 @@ pl:
|
|||
attributes:
|
||||
name:
|
||||
blank: nie może być pusta
|
||||
too_long: jest za długa (max 255 znaków)
|
||||
formal_name:
|
||||
blank: nie może być pusta
|
||||
too_long: jest za długa (max 255 znaków)
|
||||
partner:
|
||||
required: jest wymagany
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
class AddQuarterToDotations < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :dotations, :start_date_quarter, :boolean, default: false
|
||||
add_column :dotations, :end_date_quarter, :boolean, default: false
|
||||
add_column :dotations, :ann_date_quarter, :boolean, default: false
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_04_04_150629) do
|
||||
ActiveRecord::Schema.define(version: 2022_04_29_113929) do
|
||||
|
||||
create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
|
|
@ -112,6 +112,9 @@ ActiveRecord::Schema.define(version: 2022_04_04_150629) do
|
|||
t.integer "min_dot_amount_curr_id", default: 1
|
||||
t.bigint "max_dot_ammount"
|
||||
t.integer "max_dot_amount_curr_id", default: 1
|
||||
t.boolean "start_date_quarter"
|
||||
t.boolean "end_date_quarter"
|
||||
t.boolean "ann_date_quarter"
|
||||
t.index ["active"], name: "index_dotations_on_active"
|
||||
t.index ["announcement_date"], name: "index_dotations_on_announcement_date"
|
||||
t.index ["arch"], name: "index_dotations_on_arch"
|
||||
|
|
|
|||
Loading…
Reference in New Issue