diff --git a/app/assets/images/logo_kd.png b/app/assets/images/logo_kd.png new file mode 100644 index 0000000..10bb2a2 Binary files /dev/null and b/app/assets/images/logo_kd.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e0afb62..80fcaba 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,3 +13,13 @@ //= require rails-ujs //= require activestorage //= require turbolinks +function reloadFunctionsOnAjax() { + $(".tooltip").tooltip("hide"); + //$('.popover').popover('hide'); + + // Reload tootltips + $('[data-toggle="tooltip"]').tooltip({ trigger : 'hover' }) + + // Reload popovers + //$('[data-toggle="popover"]').popover() +} diff --git a/app/assets/javascripts/home.js b/app/assets/javascripts/home.js new file mode 100644 index 0000000..dee720f --- /dev/null +++ b/app/assets/javascripts/home.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3a0a730..aaa3eb3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,10 +2,13 @@ # App class ApplicationController < ActionController::Base - before_action :authenticate_user! layout :layout_by_resource def layout_by_resource devise_controller? ? 'devise' : 'application' end + + def after_sign_in_path_for(resource) + dotations_path # your path + end end diff --git a/app/controllers/company_activities_controller.rb b/app/controllers/company_activities_controller.rb index a29c451..83b5b73 100644 --- a/app/controllers/company_activities_controller.rb +++ b/app/controllers/company_activities_controller.rb @@ -1,4 +1,5 @@ class CompanyActivitiesController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_company_activity, only: %i[show edit update destroy] diff --git a/app/controllers/company_sizes_controller.rb b/app/controllers/company_sizes_controller.rb index df2fbb9..4105f43 100644 --- a/app/controllers/company_sizes_controller.rb +++ b/app/controllers/company_sizes_controller.rb @@ -1,4 +1,5 @@ class CompanySizesController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_company_size, only: %i[show edit update destroy] diff --git a/app/controllers/dotations_controller.rb b/app/controllers/dotations_controller.rb index 9e61575..7be3372 100644 --- a/app/controllers/dotations_controller.rb +++ b/app/controllers/dotations_controller.rb @@ -1,4 +1,5 @@ class DotationsController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_dotation, only: %i[show edit update destroy activate] @@ -104,6 +105,6 @@ class DotationsController < ApplicationController :announcement_date, :full_descr, :positioning_text, :points, :date_of_recruitment, :min_amount_curr_id, :max_amount_curr_id, project_ids: [], tag_ids: [], company_activity_ids: [], - company_size_ids: []) + company_size_ids: [], expense_ids: []) end end diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 4da248a..001cb90 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,6 +1,7 @@ class ExpensesController < ApplicationController + before_action :authenticate_user! include ApplicationHelper - before_action :check_access + before_action :check_access before_action :set_expense, only: %i[show edit update destroy] def check_access diff --git a/app/controllers/experts_controller.rb b/app/controllers/experts_controller.rb index ba4b6fb..a36251f 100644 --- a/app/controllers/experts_controller.rb +++ b/app/controllers/experts_controller.rb @@ -1,4 +1,5 @@ class ExpertsController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_expert, only: %i[show edit update destroy] diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..d0d340f --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Home +class HomeController < ApplicationController + layout 'home_layout' + + def index + prepare_filters + @dotations = Dotation.extra_search(params[:search]).public_dot + .point_desc.end_date_asc.page(params[:page]) + end + + def contact; end + + def show + @dotation = Dotation.find(params[:id]) + @company_sizes = CompanySize.all + end + + private + + def prepare_filters + @company_sizes = CompanySize.all + @company_activities = CompanyActivity.all + @projects = Project.all + end +end diff --git a/app/controllers/partners_controller.rb b/app/controllers/partners_controller.rb index 18bcfb1..851cc7b 100644 --- a/app/controllers/partners_controller.rb +++ b/app/controllers/partners_controller.rb @@ -1,4 +1,5 @@ class PartnersController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_partner, only: %i[show edit update destroy] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 93c4089..b0d2a5f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,4 +1,5 @@ class ProjectsController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_project, only: %i[show edit update destroy] diff --git a/app/controllers/settings/users_controller.rb b/app/controllers/settings/users_controller.rb index ea4a96d..651f9a1 100644 --- a/app/controllers/settings/users_controller.rb +++ b/app/controllers/settings/users_controller.rb @@ -4,6 +4,7 @@ module Settings # Users class UsersController < ApplicationController + before_action :authenticate_user! before_action :set_user, only: %i[show edit update destroy] # GET /users or /users.json diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index fcfbce0..ecad231 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,4 +1,5 @@ class TagsController < ApplicationController + before_action :authenticate_user! include ApplicationHelper before_action :check_access before_action :set_tag, only: %i[show edit update destroy] diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index f9b859b..9c916c8 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -1,4 +1,5 @@ class WelcomeController < ApplicationController + before_action :authenticate_user! def index end end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..fbc9ba4 --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# helper for home +module HomeHelper + def change_ammount(ammount) + ret = if ammount >= 1_000_000 + "#{ammount / 1_000_000} mln" + else + "#{ammount / 1_000} tyś" + end + ret + end +end diff --git a/app/models/dotation.rb b/app/models/dotation.rb index d044e82..3cd7bf0 100644 --- a/app/models/dotation.rb +++ b/app/models/dotation.rb @@ -28,6 +28,13 @@ class Dotation < ApplicationRecord where('name LIKE :value OR formal_name LIKE :value', value: "%#{search_value}%") end) + scope :extra_search, (lambda do |search_value| + where('name LIKE :value OR formal_name LIKE :value', + value: "%#{search_value}%") + end) + scope :point_desc, -> { order(points: :desc) } + scope :end_date_asc, -> { order(end_date: :asc) } + scope :public_dot, -> { where(active: true) } # == Callbacks ============================================================ # == Class Methods ======================================================== diff --git a/app/models/expense.rb b/app/models/expense.rb index a991346..2a80366 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -2,6 +2,7 @@ # Expanse class Expense < ApplicationRecord + default_scope { order(name: :asc) } # == Constants ============================================================ # == Attributes =========================================================== diff --git a/app/views/dotations/_form.html.erb b/app/views/dotations/_form.html.erb index 8349110..31ca9ad 100644 --- a/app/views/dotations/_form.html.erb +++ b/app/views/dotations/_form.html.erb @@ -118,6 +118,10 @@ <%= form.label :projects %> <%= form.select(:project_ids, @projects.collect {|p| [ p.name, p.id ] }, { include_blank: false }, { class: 'form-control duallistbox', multiple: true } ) %> +
Wyszukiwana fraza:
+ <%= params[:search] %>
| Subiektywna opinia eksperta | |
|---|---|
| + <%= render '/experts/expert_show', expert: @dotation.expert %> + | +<%= raw @dotation.expert_info %> | +
| + Ogłoszenie aktualnego/najbliższego naboru + | +<%= @dotation.announcement_date.strftime("%Y-%m-%d") unless @dotation.announcement_date.blank? %> | +
| + Rozpoczęcie aktualnego/najbliższego naboru + | +<%= @dotation.start_date.strftime("%Y-%m-%d") unless @dotation.start_date.blank? %> | +
| + Zakończenie aktualnego/najbliższego naboru + | +<%= @dotation.end_date.strftime("%Y-%m-%d") unless @dotation.end_date.blank? %> | +
| + Co można dofinansować? + | +
+
|
+
| + Miejsce realizacji projektu + | +<%= @dotation.localization %> | +
| + Minimalna wartość projektu (wydatków) + | +<%= change_ammount(@dotation.min_amount) %> <%= @dotation.min_amount_curr.name %> | +
| + Maksymalna wartość projektu (wydatków) + | +<%= change_ammount(@dotation.max_amount) %> <%= @dotation.max_amount_curr.name %> | +
Tutaj jakieś informacje co znajduje się na tej stronie czego można się spodziewać itd, może jakieś zdjęcie? coś do przemyślenia
+