[#878] add liste of dossier in backoffice
This commit is contained in:
parent
ca4e5130c2
commit
5b9acf3875
12 changed files with 54 additions and 25 deletions
1
Gemfile
1
Gemfile
|
@ -68,6 +68,7 @@ group :test do
|
|||
gem 'shoulda-matchers', require: false
|
||||
gem 'simplecov', require: false
|
||||
gem 'poltergeist'
|
||||
gem 'timecop'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
@ -292,6 +292,7 @@ GEM
|
|||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
timecop (0.7.3)
|
||||
turbolinks (2.5.3)
|
||||
coffee-rails
|
||||
tzinfo (1.2.2)
|
||||
|
@ -365,6 +366,7 @@ DEPENDENCIES
|
|||
simplecov
|
||||
spring
|
||||
spring-commands-rspec
|
||||
timecop
|
||||
turbolinks
|
||||
uglifier (>= 1.3.0)
|
||||
unicorn
|
||||
|
|
|
@ -2,6 +2,6 @@ class BackofficeController < ApplicationController
|
|||
|
||||
def index
|
||||
redirect_to(controller: '/gestionnaires/sessions', action: :new) unless gestionnaire_signed_in?
|
||||
@dossiers = Dossier.all.decorate
|
||||
end
|
||||
|
||||
end
|
|
@ -6,4 +6,8 @@ class DossierDecorator < Draper::Decorator
|
|||
rescue
|
||||
'dd/mm/YYYY'
|
||||
end
|
||||
|
||||
def last_update
|
||||
updated_at.localtime.strftime('%d/%m/%Y %H:%M')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
%th Dossier
|
||||
%th etat
|
||||
%th Date de mise à jour
|
||||
%row
|
||||
%td Demande de subventions
|
||||
%td dossier n°34 Demande de subvention
|
||||
%td Mise à jour
|
||||
%td 24/12/2015
|
||||
- @dossiers.each do |dossier|
|
||||
%tr
|
||||
%td= dossier.procedure.libelle
|
||||
%td= dossier.nom_projet
|
||||
%td Mise à jour
|
||||
%td= dossier.last_update
|
|
@ -77,4 +77,6 @@ fr:
|
|||
not_locked: "n'était pas verrouillé(e)"
|
||||
not_saved:
|
||||
one: "1 erreur a empêché ce(tte) %{resource} d'être sauvegardé(e) :"
|
||||
other: "%{count} erreurs ont empêché ce(tte) %{resource} d'être sauvegardé(e) :"
|
||||
other: "%{count} erreurs ont empêché ce(tte) %{resource} d'être sauvegardé(e) :"
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class AddTimeStampToDossier < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :dossiers, :created_at, :datetime
|
||||
add_column :dossiers, :updated_at, :datetime
|
||||
add_column :dossiers, :created_at, :datetime, default: Time.now
|
||||
add_column :dossiers, :updated_at, :datetime, default: Time.now
|
||||
end
|
||||
end
|
||||
|
|
30
db/schema.rb
30
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150922082416) do
|
||||
ActiveRecord::Schema.define(version: 20150922085811) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -34,19 +34,21 @@ ActiveRecord::Schema.define(version: 20150922082416) do
|
|||
add_index "commentaires", ["dossier_id"], name: "index_commentaires_on_dossier_id", using: :btree
|
||||
|
||||
create_table "dossiers", force: :cascade do |t|
|
||||
t.string "description"
|
||||
t.boolean "autorisation_donnees"
|
||||
t.string "position_lat"
|
||||
t.string "position_lon"
|
||||
t.string "ref_dossier"
|
||||
t.string "nom_projet"
|
||||
t.string "montant_projet"
|
||||
t.string "montant_aide_demande"
|
||||
t.string "lien_plus_infos"
|
||||
t.string "mail_contact"
|
||||
t.boolean "dossier_termine"
|
||||
t.integer "procedure_id"
|
||||
t.date "date_previsionnelle"
|
||||
t.string "description"
|
||||
t.boolean "autorisation_donnees"
|
||||
t.string "position_lat"
|
||||
t.string "position_lon"
|
||||
t.string "ref_dossier"
|
||||
t.string "nom_projet"
|
||||
t.string "montant_projet"
|
||||
t.string "montant_aide_demande"
|
||||
t.string "lien_plus_infos"
|
||||
t.string "mail_contact"
|
||||
t.boolean "dossier_termine"
|
||||
t.integer "procedure_id"
|
||||
t.date "date_previsionnelle"
|
||||
t.datetime "created_at", default: '2015-09-22 09:25:29'
|
||||
t.datetime "updated_at", default: '2015-09-22 09:25:29'
|
||||
end
|
||||
|
||||
add_index "dossiers", ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe DossierDecorator do
|
||||
let(:dossier) { create(:dossier) }
|
||||
subject { dossier.decorate }
|
||||
describe 'last_update' do
|
||||
subject { Timecop.freeze(Time.new(2015, 12, 24, 14, 10)) { super().last_update } }
|
||||
it { is_expected.to eq('24/12/2015 14:10') }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
FactoryGirl.define do
|
||||
factory :procedure do
|
||||
lien_demarche 'http://localhost'
|
||||
libelle 'Demande de subvention'
|
||||
description "Demande de subvention à l'intention des associations"
|
||||
|
||||
trait :with_two_type_de_piece_justificative do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'when gestionnaire come to /backoffice and is not authenticated' do
|
||||
let(:procedure) { create(:procedure) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure) }
|
||||
before do
|
||||
visit backoffice_path
|
||||
end
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'backoffice/index.html.haml', type: :view do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
let!(:decorated_dossier) { create(:dossier, procedure: procedure).decorate }
|
||||
before do
|
||||
assign(:dossiers, [decorated_dossier])
|
||||
render
|
||||
end
|
||||
it { expect(rendered).to have_css('#backoffice') }
|
||||
|
||||
subject { rendered }
|
||||
it { is_expected.to have_css('#backoffice') }
|
||||
it { is_expected.to have_content('Demande de subvention') }
|
||||
it { is_expected.to have_content(procedure.libelle) }
|
||||
it { is_expected.to have_content(decorated_dossier.nom_projet) }
|
||||
it { is_expected.to have_content(decorated_dossier.last_update) }
|
||||
end
|
Loading…
Reference in a new issue