dotations
This commit is contained in:
parent
5d72dd7304
commit
cdc9d63c17
|
|
@ -9,7 +9,10 @@ class HomeController < ApplicationController
|
||||||
prepare_filters
|
prepare_filters
|
||||||
cookies[:filter] = JSON.generate(build_filter_hash)
|
cookies[:filter] = JSON.generate(build_filter_hash)
|
||||||
@dotations = Dotation.extra_search(params[:search]).public_dot
|
@dotations = Dotation.extra_search(params[:search]).public_dot
|
||||||
.point_desc.end_date_asc.page(params[:page])
|
.point_desc.end_date_asc.page(params[:page]).per(2)
|
||||||
|
# count on all
|
||||||
|
@dotations_size = Dotation.extra_search(params[:search]).public_dot
|
||||||
|
.point_desc.end_date_asc.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
|
|
@ -17,7 +20,10 @@ class HomeController < ApplicationController
|
||||||
prepare_filters
|
prepare_filters
|
||||||
cookies[:filter] = JSON.generate(build_filter_hash)
|
cookies[:filter] = JSON.generate(build_filter_hash)
|
||||||
@dotations = Dotation.search_with_filters(build_filter_hash).public_dot
|
@dotations = Dotation.search_with_filters(build_filter_hash).public_dot
|
||||||
.point_desc.end_date_asc.page(params[:page])
|
.point_desc.end_date_asc.page(params[:page]).per(2)
|
||||||
|
# count on all
|
||||||
|
@dotations_size = Dotation.search_with_filters(build_filter_hash).public_dot
|
||||||
|
.point_desc.end_date_asc.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def contact
|
def contact
|
||||||
|
|
@ -33,7 +39,7 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
def order_meeting
|
def order_meeting
|
||||||
@dotation = Dotation.friendly.find(params[:d])
|
@dotation = Dotation.friendly.find(params[:d])
|
||||||
@consultation_email = ConsultationEmail.new()
|
@consultation_email = ConsultationEmail.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def order_meeting_save
|
def order_meeting_save
|
||||||
|
|
@ -47,6 +53,8 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@dotation = Dotation.friendly.find(params[:id])
|
@dotation = Dotation.friendly.find(params[:id])
|
||||||
|
@intersting_dotations = Dotation.public_dot.point_desc
|
||||||
|
.where.not(id: @dotation.id).limit(4)
|
||||||
@company_sizes = CompanySize.all
|
@company_sizes = CompanySize.all
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ class Dotation < ApplicationRecord
|
||||||
scope :end_date_asc, -> { order(end_date: :asc) }
|
scope :end_date_asc, -> { order(end_date: :asc) }
|
||||||
scope :public_dot, -> { where(active: true) }
|
scope :public_dot, -> { where(active: true) }
|
||||||
scope :by_id, ->(val) { where(id: val) }
|
scope :by_id, ->(val) { where(id: val) }
|
||||||
|
scope :open_recruitment, -> { where('dotations.dotation_start_date <= :dat AND dotations.dotation_end_date >= :dat', dat: Time.now) }
|
||||||
# == Callbacks ============================================================
|
# == Callbacks ============================================================
|
||||||
|
|
||||||
# == Class Methods ========================================================
|
# == Class Methods ========================================================
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<%= render 'filter_form' %>
|
<%= render 'filter_form' %>
|
||||||
|
|
@ -25,7 +24,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="callout callout-info">
|
<div class="callout callout-info">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6"><h5>Znalezionych dotacji: <span class="badge badge-pill badge-info"><%= @dotations.count %></span></h5></div>
|
<div class="col-md-6"><h5>Znalezionych aktywnych dotacji: <span class="badge badge-pill badge-info"><%= @dotations_size %></span></h5></div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<button type="button" class="btn btn-block btn-outline-success" data-toggle="modal" data-target="#modal-lg">
|
<button type="button" class="btn btn-block btn-outline-success" data-toggle="modal" data-target="#modal-lg">
|
||||||
<i class="fas fa-bullhorn"></i> Powiadom mnie gdy pojawią się nowe dotacje
|
<i class="fas fa-bullhorn"></i> Powiadom mnie gdy pojawią się nowe dotacje
|
||||||
|
|
@ -41,6 +40,7 @@
|
||||||
<%= render 'dotation_card', dotation: dotation %>
|
<%= render 'dotation_card', dotation: dotation %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= paginate @dotations, params: {controller: :home, action: :index}, theme: 'twitter-bootstrap-4' %>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,20 @@
|
||||||
<div id="consultation_form_id"></div>
|
<div id="consultation_form_id"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p> </p>
|
||||||
|
<h3>Inne dotacje, które mogą Ciebie zainteresować</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<% @intersting_dotations.each do |interesting_dotation| %>
|
||||||
|
<%= render 'dotation_card', dotation: interesting_dotation %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue