expense_gun 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/expense_gun/application_controller.rb +2 -0
- data/app/controllers/expense_gun/expense_lines_controller.rb +3 -3
- data/app/controllers/expense_gun/expenses_controller.rb +6 -6
- data/app/models/expense_gun/expense.rb +1 -1
- data/app/models/expense_gun/expense_line.rb +3 -0
- data/app/views/expense_gun/expense_lines/_form.html.slim +3 -5
- data/app/views/expense_gun/expense_lines/edit.html.slim +6 -2
- data/app/views/expense_gun/expense_lines/new.html.slim +9 -2
- data/app/views/expense_gun/expenses/_form.html.slim +2 -2
- data/app/views/expense_gun/expenses/edit.html.slim +5 -2
- data/app/views/expense_gun/expenses/index.html.slim +21 -22
- data/app/views/expense_gun/expenses/new.html.slim +5 -2
- data/app/views/expense_gun/expenses/show.html.slim +29 -24
- data/config/locales/expense_gun.fr.yml +72 -0
- data/lib/expense_gun/admin/category.rb +2 -2
- data/lib/expense_gun/version.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/initializers/simple_form.rb +2 -0
- data/spec/models/expense_line_spec.rb +7 -7
- data/spec/models/expense_spec.rb +13 -3
- data/spec/spec_helper.rb +5 -0
- metadata +6 -4
- data/config/initializers/formtastic.rb +0 -78
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 15ea68e1ac6d8376cfe784db24395eac0609e67d
         | 
| 4 | 
            +
              data.tar.gz: f129be42141bda107a8f8172fa3fa13bb1cc24d4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 58cf6db79447a2f426b864d727c6815b96b117a1e05cd9cc7cf40493d4aef5da975ac1f4a94822ac93188a7ac3ed69ac6e0f327ef0fca7eb49bf9d0d9ec969a9
         | 
| 7 | 
            +
              data.tar.gz: 9ac44f6a0586f92ed36d519079c1cb65b5ff57625d41f13d0f4ead85fc7ffddbfd4064fc290227004512fb1fe702fe6445ff80202d7663b223dd9e84ed782e54
         | 
| @@ -20,7 +20,7 @@ module ExpenseGun | |
| 20 20 | 
             
                  @expense_line = @expense.expense_lines.new(expense_line_params)
         | 
| 21 21 |  | 
| 22 22 | 
             
                  if @expense_line.save
         | 
| 23 | 
            -
                    flash[:success] = " | 
| 23 | 
            +
                    flash[:success] = t("expense_gun.expense_line.flash.created")
         | 
| 24 24 | 
             
                    redirect_to expense_path(@expense)
         | 
| 25 25 | 
             
                  else
         | 
| 26 26 | 
             
                    render :new
         | 
| @@ -35,7 +35,7 @@ module ExpenseGun | |
| 35 35 | 
             
                  authorize! :edit, @expense
         | 
| 36 36 |  | 
| 37 37 | 
             
                  if @expense_line.update_attributes(expense_line_params)
         | 
| 38 | 
            -
                    flash[:success] = " | 
| 38 | 
            +
                    flash[:success] = t("expense_gun.expense_line.flash.created")
         | 
| 39 39 | 
             
                    redirect_to expense_path(@expense)
         | 
| 40 40 | 
             
                  else
         | 
| 41 41 | 
             
                    render :edit
         | 
| @@ -46,7 +46,7 @@ module ExpenseGun | |
| 46 46 | 
             
                  authorize! :edit, @expense
         | 
| 47 47 |  | 
| 48 48 | 
             
                  @expense_line.destroy
         | 
| 49 | 
            -
                  flash[:success] = " | 
| 49 | 
            +
                  flash[:success] = t("expense_gun.expense_line.flash.created")
         | 
| 50 50 | 
             
                  redirect_to expense_path(@expense)
         | 
| 51 51 | 
             
                end
         | 
| 52 52 |  | 
| @@ -34,7 +34,7 @@ module ExpenseGun | |
| 34 34 | 
             
                  @expense ||= Expense.new(expense_params)
         | 
| 35 35 |  | 
| 36 36 | 
             
                  if @expense.save
         | 
| 37 | 
            -
                    flash[:success] = " | 
| 37 | 
            +
                    flash[:success] = t("expense_gun.expense.flash.created")
         | 
| 38 38 | 
             
                    redirect_to expense_path(@expense)
         | 
| 39 39 | 
             
                  else
         | 
| 40 40 | 
             
                    render :new
         | 
| @@ -55,7 +55,7 @@ module ExpenseGun | |
| 55 55 | 
             
                  authorize! :edit, @expense
         | 
| 56 56 |  | 
| 57 57 | 
             
                  if @expense.update_attributes(expense_params)
         | 
| 58 | 
            -
                    flash[:success] = " | 
| 58 | 
            +
                    flash[:success] = t("expense_gun.expense.flash.updated")
         | 
| 59 59 | 
             
                    redirect_to expense_path(@expense)
         | 
| 60 60 | 
             
                  else
         | 
| 61 61 | 
             
                    render :edit
         | 
| @@ -66,7 +66,7 @@ module ExpenseGun | |
| 66 66 | 
             
                  authorize! :submit, @expense
         | 
| 67 67 |  | 
| 68 68 | 
             
                  @expense.submit!
         | 
| 69 | 
            -
                  flash[:success] = " | 
| 69 | 
            +
                  flash[:success] = t("expense_gun.expense.flash.submited")
         | 
| 70 70 | 
             
                  redirect_to expenses_path
         | 
| 71 71 | 
             
                end
         | 
| 72 72 |  | 
| @@ -74,7 +74,7 @@ module ExpenseGun | |
| 74 74 | 
             
                  authorize! :accept, @expense
         | 
| 75 75 |  | 
| 76 76 | 
             
                  @expense.accept!
         | 
| 77 | 
            -
                  flash[:success] = " | 
| 77 | 
            +
                  flash[:success] = t("expense_gun.expense.flash.accepted")
         | 
| 78 78 | 
             
                  redirect_to expense_path(@expense)
         | 
| 79 79 | 
             
                end
         | 
| 80 80 |  | 
| @@ -82,7 +82,7 @@ module ExpenseGun | |
| 82 82 | 
             
                  authorize! :refuse, @expense
         | 
| 83 83 |  | 
| 84 84 | 
             
                  @expense.refuse!
         | 
| 85 | 
            -
                  flash[:success] = " | 
| 85 | 
            +
                  flash[:success] = t("expense_gun.expense.flash.refused")
         | 
| 86 86 | 
             
                  redirect_to expenses_path
         | 
| 87 87 | 
             
                end
         | 
| 88 88 |  | 
| @@ -90,7 +90,7 @@ module ExpenseGun | |
| 90 90 | 
             
                  authorize! :cancel, @expense
         | 
| 91 91 |  | 
| 92 92 | 
             
                  @expense.cancel!
         | 
| 93 | 
            -
                  flash[:success] = " | 
| 93 | 
            +
                  flash[:success] = t("expense_gun.expense.flash.canceled")
         | 
| 94 94 | 
             
                  redirect_to expenses_path
         | 
| 95 95 | 
             
                end
         | 
| 96 96 |  | 
| @@ -15,6 +15,9 @@ module ExpenseGun | |
| 15 15 | 
             
                validates :vat,             presence: true, numericality: {greater_than_or_equal_to: 1.0}
         | 
| 16 16 | 
             
                validates :company_part,    presence: true, numericality: {greater_than_or_equal_to: 1.0, less_than_or_equal_to: 100.0}
         | 
| 17 17 |  | 
| 18 | 
            +
                # simple_form
         | 
| 19 | 
            +
                validates :category_id, presence: true
         | 
| 20 | 
            +
                
         | 
| 18 21 | 
             
                def employee_payback
         | 
| 19 22 | 
             
                  (total_all_taxes * company_part / 100)
         | 
| 20 23 | 
             
                end
         | 
| @@ -1,16 +1,14 @@ | |
| 1 | 
            -
            =  | 
| 1 | 
            +
            = horizontal_form_for [expense_gun, @expense, @expense_line] do |f|
         | 
| 2 2 | 
             
              .panel.panel-default
         | 
| 3 3 | 
             
                .panel-body
         | 
| 4 4 | 
             
                  .row
         | 
| 5 5 | 
             
                    .col-md-6
         | 
| 6 6 | 
             
                      = f.input :name
         | 
| 7 7 | 
             
                      = f.input :date, as: :string, input_html: {type: :date}
         | 
| 8 | 
            -
                      . | 
| 9 | 
            -
                        label for="expense_line_category_id" Category
         | 
| 10 | 
            -
                        = f.collection_select :category_id, ExpenseGun::Category.all, :id, :name, {include_blank: true}, {class: "form-control"}
         | 
| 8 | 
            +
                      = f.input :category_id, collection: ExpenseGun::Category.all
         | 
| 11 9 | 
             
                    .col-md-6
         | 
| 12 10 | 
             
                      = f.input :total_all_taxes
         | 
| 13 11 | 
             
                      = f.input :vat
         | 
| 14 12 | 
             
                      = f.input :company_part
         | 
| 15 13 |  | 
| 16 | 
            -
              =  | 
| 14 | 
            +
              = form_buttons back_url: false
         | 
| @@ -1,4 +1,8 @@ | |
| 1 | 
            -
            h1 Edit expense line
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            .expenses.expense_lines
         | 
| 2 | 
            +
              .actions-block
         | 
| 3 | 
            +
                = link_to t("expense_gun.expense_line.back_to_expense"), expense_gun.expense_path(@expense), class: "btn btn-default"
         | 
| 4 | 
            +
                = link_to t("expense_gun.expense.list"), expense_gun.expenses_path, class: "btn btn-default"
         | 
| 5 | 
            +
                
         | 
| 6 | 
            +
              h1 = t("expense_gun.expense_line.edit")
         | 
| 7 | 
            +
              
         | 
| 4 8 | 
             
              = render "form"
         | 
| @@ -1,4 +1,11 @@ | |
| 1 | 
            -
            h1 = "#{@expense.name} : New expense line"
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            .expenses.expense_lines
         | 
| 2 | 
            +
              .actions-block
         | 
| 3 | 
            +
                = link_to t("expense_gun.expense_line.back_to_expense"), expense_gun.expense_path(@expense), class: "btn btn-default"
         | 
| 4 | 
            +
                = link_to t("expense_gun.expense.list"), expense_gun.expenses_path, class: "btn btn-default"
         | 
| 5 | 
            +
              
         | 
| 6 | 
            +
              h1
         | 
| 7 | 
            +
                = @expense.name
         | 
| 8 | 
            +
                = " : "
         | 
| 9 | 
            +
                = t("expense_gun.expense_line.new")
         | 
| 10 | 
            +
              
         | 
| 4 11 | 
             
              = render "form"
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            h1  | 
| 1 | 
            +
            h1 = t("expense_gun.expense.list")
         | 
| 2 2 |  | 
| 3 3 | 
             
            .row.expenses
         | 
| 4 4 | 
             
              .col-md-4
         | 
| @@ -6,17 +6,17 @@ h1 Expenses list | |
| 6 6 | 
             
                  - for state in %w(submited new accepted refused canceled)
         | 
| 7 7 | 
             
                    li class=("active" if params[:state] == state)
         | 
| 8 8 | 
             
                      a href=expense_gun.url_for(state: state)
         | 
| 9 | 
            -
                        = state. | 
| 9 | 
            +
                        = t("labels.states.#{state}").pluralize
         | 
| 10 10 | 
             
                        span.badge.pull-right = @all_expenses.where(state: state).count
         | 
| 11 11 |  | 
| 12 12 | 
             
                  li class=("active" if params[:state] == "all")
         | 
| 13 13 | 
             
                    a href=expense_gun.url_for(state: "all")
         | 
| 14 | 
            -
                      = " | 
| 14 | 
            +
                      = t("labels.states.all")
         | 
| 15 15 | 
             
                      span.badge.pull-right = @all_expenses.count
         | 
| 16 16 |  | 
| 17 17 | 
             
                hr
         | 
| 18 18 |  | 
| 19 | 
            -
                p = link_to " | 
| 19 | 
            +
                p = link_to t("expense_gun.expense.new"), expense_gun.new_expense_path, class: "btn btn-success"
         | 
| 20 20 |  | 
| 21 21 | 
             
              .col-md-8
         | 
| 22 22 | 
             
                - for expense in @expenses
         | 
| @@ -28,36 +28,35 @@ h1 Expenses list | |
| 28 28 | 
             
                        .col-md-4
         | 
| 29 29 | 
             
                          .date = expense.date
         | 
| 30 30 | 
             
                    .panel-body
         | 
| 31 | 
            -
                       | 
| 32 | 
            -
                         | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
                         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
                         | 
| 41 | 
            -
             | 
| 42 | 
            -
                          = "#{expense.total_all_taxes} €"
         | 
| 31 | 
            +
                      p
         | 
| 32 | 
            +
                        strong = t("labels.employee") + " : "
         | 
| 33 | 
            +
                        = expense.user.full_name if expense.respond_to?(:user)
         | 
| 34 | 
            +
                      
         | 
| 35 | 
            +
                      p
         | 
| 36 | 
            +
                        strong = t("labels.state") + " : "
         | 
| 37 | 
            +
                        = t("labels.states.#{expense.current_state}")
         | 
| 38 | 
            +
                      
         | 
| 39 | 
            +
                      p
         | 
| 40 | 
            +
                        strong = t("labels.total_all_taxes") + " : "
         | 
| 41 | 
            +
                        = "#{expense.total_all_taxes} €"
         | 
| 43 42 |  | 
| 44 43 | 
             
                    .panel-footer
         | 
| 45 | 
            -
                      = link_to " | 
| 44 | 
            +
                      = link_to t("expense_gun.expense.show"), expense_gun.expense_path(expense), class: "btn btn-default"
         | 
| 46 45 |  | 
| 47 46 | 
             
                      - if can? :edit, expense
         | 
| 48 | 
            -
                        = link_to " | 
| 47 | 
            +
                        = link_to t("expense_gun.expense.edit"), expense_gun.edit_expense_path(expense), class: "btn btn-default"
         | 
| 49 48 |  | 
| 50 49 | 
             
                      - if can? :submit, expense
         | 
| 51 | 
            -
                        = link_to " | 
| 50 | 
            +
                        = link_to t("expense_gun.expense.submit"), expense_gun.submit_expense_path(expense), data: {method: "patch"}, class: "btn btn-primary"
         | 
| 52 51 |  | 
| 53 52 | 
             
                      - if can? :accept, expense
         | 
| 54 | 
            -
                        = link_to " | 
| 53 | 
            +
                        = link_to t("expense_gun.expense.accept"), expense_gun.accept_expense_path(expense), data: {method: "patch"}, class: "btn btn-success"
         | 
| 55 54 |  | 
| 56 55 | 
             
                      - if can? :refuse, expense
         | 
| 57 | 
            -
                        = link_to " | 
| 56 | 
            +
                        = link_to t("expense_gun.expense.refuse"), expense_gun.refuse_expense_path(expense), data: {method: "patch"}, class: "btn btn-danger"
         | 
| 58 57 |  | 
| 59 58 | 
             
                      - if can? :cancel, expense
         | 
| 60 | 
            -
                        = link_to " | 
| 59 | 
            +
                        = link_to t("expense_gun.expense.cancel"), expense_gun.cancel_expense_path(expense), data: {method: "patch"}, class: "btn btn-warning"
         | 
| 61 60 |  | 
| 62 61 |  | 
| 63 62 | 
             
            == paginate @expenses, theme: "bootstrap3"
         | 
| @@ -1,25 +1,30 @@ | |
| 1 1 | 
             
            .expenses
         | 
| 2 2 | 
             
              .actions-block.hidden-print
         | 
| 3 3 | 
             
                - if can? :edit, @expense
         | 
| 4 | 
            -
                  = link_to " | 
| 5 | 
            -
                  = link_to " | 
| 6 | 
            -
                 | 
| 7 | 
            -
                 | 
| 4 | 
            +
                  = link_to t("expense_gun.expense_line.new"), expense_gun.new_expense_expense_line_path(@expense), class: "btn btn-success"
         | 
| 5 | 
            +
                  = link_to t("expense_gun.expense.edit"), expense_gun.edit_expense_path(@expense), class: "btn btn-default"
         | 
| 6 | 
            +
                
         | 
| 7 | 
            +
                = link_to t("expense_gun.expense.list"), expense_gun.expenses_path, class: "btn btn-default"
         | 
| 8 | 
            +
                
         | 
| 9 | 
            +
                a.btn.btn-default href="#" onclick="print(); return false;" = t("expense_gun.expense.print")
         | 
| 8 10 |  | 
| 9 | 
            -
              h1 | 
| 11 | 
            +
              h1
         | 
| 12 | 
            +
                = t("expense_gun.expense.label")
         | 
| 13 | 
            +
                = " : "
         | 
| 14 | 
            +
                = @expense.name
         | 
| 10 15 |  | 
| 11 16 | 
             
              p
         | 
| 12 17 | 
             
                span.date
         | 
| 13 | 
            -
                  strong = " | 
| 18 | 
            +
                  strong = t("labels.date") + " : "
         | 
| 14 19 | 
             
                  = @expense.date
         | 
| 15 20 | 
             
                  br
         | 
| 16 21 | 
             
                span.user
         | 
| 17 | 
            -
                  strong = " | 
| 22 | 
            +
                  strong = t("labels.employee") + " : "
         | 
| 18 23 | 
             
                  = @expense.user.full_name if @expense.respond_to?(:user)
         | 
| 19 24 | 
             
                  br
         | 
| 20 | 
            -
                span.state
         | 
| 21 | 
            -
                  strong = " | 
| 22 | 
            -
                  = @expense.state | 
| 25 | 
            +
                span.state class="#{@expense.state}"
         | 
| 26 | 
            +
                  strong = t("labels.state") + " : "
         | 
| 27 | 
            +
                  = t "labels.states." + @expense.state
         | 
| 23 28 |  | 
| 24 29 | 
             
              hr
         | 
| 25 30 |  | 
| @@ -30,39 +35,39 @@ | |
| 30 35 | 
             
                    .row
         | 
| 31 36 | 
             
                      .col-md-6
         | 
| 32 37 | 
             
                        p
         | 
| 33 | 
            -
                          strong = " | 
| 38 | 
            +
                          strong = t("labels.name") + " : "
         | 
| 34 39 | 
             
                          = expense_line.name
         | 
| 35 40 | 
             
                        p
         | 
| 36 | 
            -
                          strong = " | 
| 41 | 
            +
                          strong = t("labels.date") + " : "
         | 
| 37 42 | 
             
                          = expense_line.date
         | 
| 38 43 | 
             
                        p
         | 
| 39 | 
            -
                          strong = " | 
| 44 | 
            +
                          strong = t("labels.category") + " : "
         | 
| 40 45 | 
             
                          = expense_line.category.name
         | 
| 41 46 | 
             
                          - if expense_line.category.code.present?
         | 
| 42 47 | 
             
                            = " (#{expense_line.category.code})"
         | 
| 43 48 | 
             
                      .col-md-6
         | 
| 44 49 | 
             
                        p
         | 
| 45 | 
            -
                          strong = " | 
| 50 | 
            +
                          strong = t("labels.total_all_taxes") + " : "
         | 
| 46 51 | 
             
                          = "#{expense_line.total_all_taxes} €"
         | 
| 47 52 | 
             
                        p
         | 
| 48 | 
            -
                          strong = " | 
| 53 | 
            +
                          strong = t("labels.vat") + " : "
         | 
| 49 54 | 
             
                          = "#{expense_line.vat} €"
         | 
| 50 55 | 
             
                        p
         | 
| 51 | 
            -
                          strong = " | 
| 56 | 
            +
                          strong = t("labels.company_part") + " : "
         | 
| 52 57 | 
             
                          = "#{expense_line.company_part} %"
         | 
| 53 58 |  | 
| 54 59 | 
             
                  .panel-footer
         | 
| 55 60 | 
             
                    .row
         | 
| 56 61 | 
             
                      .col-md-6.hidden-print
         | 
| 57 62 | 
             
                        - if can? :edit, @expense
         | 
| 58 | 
            -
                          = link_to " | 
| 59 | 
            -
                          = link_to " | 
| 63 | 
            +
                          = link_to t("expense_gun.expense_line.edit"), expense_gun.edit_expense_expense_line_path(expense_line.expense, expense_line), class: "btn btn-default"
         | 
| 64 | 
            +
                          = link_to t("expense_gun.expense_line.destroy"), expense_gun.expense_expense_line_path(expense_line.expense, expense_line), class: "btn btn-danger", "data-method" => "delete", "data-confirm" => "Confirm ?"
         | 
| 60 65 | 
             
                      .col-md-6
         | 
| 61 66 | 
             
                        p
         | 
| 62 | 
            -
                          strong = " | 
| 67 | 
            +
                          strong = t("labels.employee_payback") + " : "
         | 
| 63 68 | 
             
                          = "#{expense_line.employee_payback} €"
         | 
| 64 69 | 
             
                        p
         | 
| 65 | 
            -
                          strong = " | 
| 70 | 
            +
                          strong = t("labels.deductible_vat") + " : "
         | 
| 66 71 | 
             
                          = "#{expense_line.total_vat_deductible} €"
         | 
| 67 72 |  | 
| 68 73 | 
             
              hr
         | 
| @@ -71,14 +76,14 @@ | |
| 71 76 | 
             
                .panel-body
         | 
| 72 77 | 
             
                  .row
         | 
| 73 78 | 
             
                    .col-md-6
         | 
| 74 | 
            -
                      strong = " | 
| 79 | 
            +
                      strong = t("labels.total") + " : "
         | 
| 75 80 | 
             
                    .col-md-6
         | 
| 76 81 | 
             
                      p
         | 
| 77 | 
            -
                        strong = " | 
| 82 | 
            +
                        strong = t("labels.total_all_taxes") + " : "
         | 
| 78 83 | 
             
                        = "#{@expense.total_all_taxes} €"
         | 
| 79 84 | 
             
                      p
         | 
| 80 | 
            -
                        strong = " | 
| 85 | 
            +
                        strong = t("labels.employee_payback") + " : "
         | 
| 81 86 | 
             
                        = "#{@expense.total_employee_payback} €"
         | 
| 82 87 | 
             
                      p
         | 
| 83 | 
            -
                        strong = " | 
| 88 | 
            +
                        strong = t("labels.deductible_vat") + " : "
         | 
| 84 89 | 
             
                        = "#{@expense.total_vat_deductible} €"
         | 
| @@ -0,0 +1,72 @@ | |
| 1 | 
            +
            fr:
         | 
| 2 | 
            +
              expense_gun:
         | 
| 3 | 
            +
                expense:
         | 
| 4 | 
            +
                  label  : "Note de frais"
         | 
| 5 | 
            +
                  list   : "Liste des notes de frais"
         | 
| 6 | 
            +
                  new    : "Nouvelle note de frais"
         | 
| 7 | 
            +
                  edit   : "Modifier la note"
         | 
| 8 | 
            +
                  print  : "Imprimer"
         | 
| 9 | 
            +
                  show   : "Afficher"
         | 
| 10 | 
            +
                  edit   : "Modifier"
         | 
| 11 | 
            +
                  submit : "Soumettre"
         | 
| 12 | 
            +
                  accept : "Accepter"
         | 
| 13 | 
            +
                  refuse : "Refuser"
         | 
| 14 | 
            +
                  cancel : "Annuler"
         | 
| 15 | 
            +
                  flash:
         | 
| 16 | 
            +
                    created  : "La note de frais a été créée."
         | 
| 17 | 
            +
                    updated  : "La note de frais a été mise à jour."
         | 
| 18 | 
            +
                    submited : "La note de frais a été soumise."
         | 
| 19 | 
            +
                    accepted : "La note de frais a été acceptée."
         | 
| 20 | 
            +
                    refused  : "La note de frais a été refusée."
         | 
| 21 | 
            +
                    canceled : "La note de frais a été annulée."
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
                expense_line:
         | 
| 24 | 
            +
                  label           : "Frais"
         | 
| 25 | 
            +
                  new             : "Nouveau frais"
         | 
| 26 | 
            +
                  edit            : "Modifier"
         | 
| 27 | 
            +
                  destroy         : "Supprimer"
         | 
| 28 | 
            +
                  back_to_expense : "Retour à la note"
         | 
| 29 | 
            +
                  flash:
         | 
| 30 | 
            +
                    created   : "Le frais a été ajouté."
         | 
| 31 | 
            +
                    updated   : "Le frais a été modifié."
         | 
| 32 | 
            +
                    destroyed : "Le frais a été supprimé."
         | 
| 33 | 
            +
              
         | 
| 34 | 
            +
              labels: &labels
         | 
| 35 | 
            +
                  name             : "Nom"
         | 
| 36 | 
            +
                  date             : "Date"
         | 
| 37 | 
            +
                  category         : "Catégorie"
         | 
| 38 | 
            +
                  category_id      : "Catégorie"
         | 
| 39 | 
            +
                  total_all_taxes  : "Total TTC"
         | 
| 40 | 
            +
                  vat              : "TVA"
         | 
| 41 | 
            +
                  company_part     : "Part entreprise"
         | 
| 42 | 
            +
                  employee         : "Employé"
         | 
| 43 | 
            +
                  state            : "État"
         | 
| 44 | 
            +
                  employee_payback : "Remboursement employé"
         | 
| 45 | 
            +
                  deductible_vat   : "TVA déductible"
         | 
| 46 | 
            +
                  total            : "Total"
         | 
| 47 | 
            +
                  
         | 
| 48 | 
            +
                  states:
         | 
| 49 | 
            +
                    all      : "Toutes"
         | 
| 50 | 
            +
                    new      : "Nouvelle"
         | 
| 51 | 
            +
                    submited : "Soumise"
         | 
| 52 | 
            +
                    accepted : "Accepée"
         | 
| 53 | 
            +
                    refused  : "Refusée"
         | 
| 54 | 
            +
                    canceled : "Annulée" 
         | 
| 55 | 
            +
              
         | 
| 56 | 
            +
              simple_form:
         | 
| 57 | 
            +
                "yes" : 'Oui'
         | 
| 58 | 
            +
                "no"  : 'Non'
         | 
| 59 | 
            +
                
         | 
| 60 | 
            +
                required:
         | 
| 61 | 
            +
                  text: 'Requis'
         | 
| 62 | 
            +
                  mark: '*'
         | 
| 63 | 
            +
                
         | 
| 64 | 
            +
                error_notification:
         | 
| 65 | 
            +
                  default_message: "Merci de vérifier les problèmes ci-desous :"
         | 
| 66 | 
            +
                
         | 
| 67 | 
            +
                labels:
         | 
| 68 | 
            +
                  defaults:
         | 
| 69 | 
            +
                    <<: *labels
         | 
| 70 | 
            +
                
         | 
| 71 | 
            +
                options:
         | 
| 72 | 
            +
                  defaults:
         | 
| @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            ActiveAdmin.register ExpenseGun::Category do
         | 
| 2 2 | 
             
              scope :all, default: true
         | 
| 3 3 |  | 
| 4 | 
            -
              permit_params :name, :code, : | 
| 4 | 
            +
              permit_params :name, :code, :vat_deductible
         | 
| 5 5 |  | 
| 6 6 | 
             
              index do
         | 
| 7 7 | 
             
                column :name
         | 
| 8 8 | 
             
                column :code
         | 
| 9 | 
            -
                column : | 
| 9 | 
            +
                column :vat_deductible
         | 
| 10 10 | 
             
                actions
         | 
| 11 11 | 
             
              end
         | 
| 12 12 | 
             
            end
         | 
    
        data/lib/expense_gun/version.rb
    CHANGED
    
    
| @@ -17,7 +17,7 @@ module Dummy | |
| 17 17 |  | 
| 18 18 | 
             
                # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
         | 
| 19 19 | 
             
                # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
         | 
| 20 | 
            -
                 | 
| 20 | 
            +
                config.i18n.default_locale = :fr
         | 
| 21 21 | 
             
              end
         | 
| 22 22 | 
             
            end
         | 
| 23 23 |  | 
| @@ -40,7 +40,7 @@ describe ExpenseGun::ExpenseLine do | |
| 40 40 | 
             
              it "#vat should be decimal" do
         | 
| 41 41 | 
             
                expense_line = FactoryGirl.build(:expense_line, vat: 123)
         | 
| 42 42 | 
             
                expect(expense_line.valid?).to be false
         | 
| 43 | 
            -
                expect(expense_line.vat).to  | 
| 43 | 
            +
                expect(expense_line.vat).to eq 123.0
         | 
| 44 44 | 
             
              end
         | 
| 45 45 |  | 
| 46 46 | 
             
              it "#company_part should be present" do
         | 
| @@ -53,29 +53,29 @@ describe ExpenseGun::ExpenseLine do | |
| 53 53 |  | 
| 54 54 | 
             
              it "#company_part should be 100 as default" do
         | 
| 55 55 | 
             
                expense_line = ExpenseGun::ExpenseLine.new
         | 
| 56 | 
            -
                expect(expense_line.company_part).to  | 
| 56 | 
            +
                expect(expense_line.company_part).to eq 100.0
         | 
| 57 57 | 
             
              end
         | 
| 58 58 |  | 
| 59 59 | 
             
              it "#employee_payback should be correct" do
         | 
| 60 60 | 
             
                expense_line = ExpenseGun::ExpenseLine.new(total_all_taxes: 100, company_part: 100)
         | 
| 61 | 
            -
                expect(expense_line.employee_payback).to  | 
| 61 | 
            +
                expect(expense_line.employee_payback).to eq 100.0
         | 
| 62 62 |  | 
| 63 63 | 
             
                expense_line = ExpenseGun::ExpenseLine.new(total_all_taxes: 250, company_part: 50)
         | 
| 64 | 
            -
                expect(expense_line.employee_payback).to  | 
| 64 | 
            +
                expect(expense_line.employee_payback).to eq 125.0
         | 
| 65 65 |  | 
| 66 66 | 
             
                expense_line = ExpenseGun::ExpenseLine.new(total_all_taxes: 200, company_part: 80)
         | 
| 67 | 
            -
                expect(expense_line.employee_payback).to  | 
| 67 | 
            +
                expect(expense_line.employee_payback).to eq 160.0
         | 
| 68 68 | 
             
              end
         | 
| 69 69 |  | 
| 70 70 | 
             
              it "#total_vat_deductible should be #vat if categorie is vat_decuctible" do
         | 
| 71 71 | 
             
                category     = FactoryGirl.build(:category, vat_deductible: true)
         | 
| 72 72 | 
             
                expense_line = FactoryGirl.build(:expense_line, category: category)
         | 
| 73 | 
            -
                expect(expense_line.total_vat_deductible).to  | 
| 73 | 
            +
                expect(expense_line.total_vat_deductible).to eq expense_line.vat
         | 
| 74 74 | 
             
              end
         | 
| 75 75 |  | 
| 76 76 | 
             
              it "#total_vat_deductible should be 0 if categorie is non vat_decuctible" do
         | 
| 77 77 | 
             
                category     = FactoryGirl.build(:category, vat_deductible: false)
         | 
| 78 78 | 
             
                expense_line = FactoryGirl.build(:expense_line, category: category)
         | 
| 79 | 
            -
                expect(expense_line.total_vat_deductible).to  | 
| 79 | 
            +
                expect(expense_line.total_vat_deductible).to eq 0.0
         | 
| 80 80 | 
             
              end
         | 
| 81 81 | 
             
            end
         | 
    
        data/spec/models/expense_spec.rb
    CHANGED
    
    | @@ -142,14 +142,14 @@ describe ExpenseGun::Expense do | |
| 142 142 | 
             
                expense = FactoryGirl.build(:expense, expense_lines: [])
         | 
| 143 143 | 
             
                expense.expense_lines << FactoryGirl.build(:expense_line, total_all_taxes: 10)
         | 
| 144 144 | 
             
                expense.expense_lines << FactoryGirl.build(:expense_line, total_all_taxes: 10)
         | 
| 145 | 
            -
                expect(expense.total_all_taxes).to  | 
| 145 | 
            +
                expect(expense.total_all_taxes).to eq 20.0
         | 
| 146 146 | 
             
              end
         | 
| 147 147 |  | 
| 148 148 | 
             
              it "#total_employee_payback should return sum of lines" do
         | 
| 149 149 | 
             
                expense = FactoryGirl.build(:expense, expense_lines: [])
         | 
| 150 150 | 
             
                expense.expense_lines << FactoryGirl.build(:expense_line, total_all_taxes: 10, company_part: 100)
         | 
| 151 151 | 
             
                expense.expense_lines << FactoryGirl.build(:expense_line, total_all_taxes: 10, company_part: 50)
         | 
| 152 | 
            -
                expect(expense.total_employee_payback).to  | 
| 152 | 
            +
                expect(expense.total_employee_payback).to eq 15.0
         | 
| 153 153 | 
             
              end
         | 
| 154 154 |  | 
| 155 155 | 
             
              it "#total_vat_deductible  should return sum of lines" do
         | 
| @@ -158,7 +158,7 @@ describe ExpenseGun::Expense do | |
| 158 158 | 
             
                category2 = FactoryGirl.build(:category, vat_deductible: false)
         | 
| 159 159 | 
             
                expense.expense_lines << FactoryGirl.build(:expense_line, vat: 10, category: category1)
         | 
| 160 160 | 
             
                expense.expense_lines << FactoryGirl.build(:expense_line, vat: 10, category: category2)
         | 
| 161 | 
            -
                expect(expense.total_vat_deductible).to  | 
| 161 | 
            +
                expect(expense.total_vat_deductible).to eq 10.0
         | 
| 162 162 | 
             
              end
         | 
| 163 163 |  | 
| 164 164 | 
             
              it "#may_edit? should return false unless expense is not submited" do
         | 
| @@ -168,4 +168,14 @@ describe ExpenseGun::Expense do | |
| 168 168 | 
             
                expect(ExpenseGun::Expense.new(state: :refused).may_edit?).to be false
         | 
| 169 169 | 
             
                expect(ExpenseGun::Expense.new(state: :canceled).may_edit?).to be false
         | 
| 170 170 | 
             
              end
         | 
| 171 | 
            +
              
         | 
| 172 | 
            +
              it "destroy an expense should destroy associated expense lines" do
         | 
| 173 | 
            +
                expense          = FactoryGirl.create(:expense)
         | 
| 174 | 
            +
                expense_line_ids = expense.expense_lines.map(&:id)
         | 
| 175 | 
            +
                expect(expense_line_ids.any?).to be true
         | 
| 176 | 
            +
                expense.destroy
         | 
| 177 | 
            +
                expense_line_ids.map do |id|
         | 
| 178 | 
            +
                  expect(ExpenseGun::ExpenseLine.exists?(id)).to be false
         | 
| 179 | 
            +
                end
         | 
| 180 | 
            +
              end
         | 
| 171 181 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,3 +1,8 @@ | |
| 1 | 
            +
            ENV["RAILS_ENV"] = 'test'
         | 
| 2 | 
            +
            require 'spec_helper'
         | 
| 3 | 
            +
            require File.expand_path("../dummy/config/environment", __FILE__)
         | 
| 4 | 
            +
            require 'rspec/rails'
         | 
| 5 | 
            +
             | 
| 1 6 | 
             
            # This file was generated by the `rails generate rspec:install` command. Conventionally, all
         | 
| 2 7 | 
             
            # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
         | 
| 3 8 | 
             
            # The generated `.rspec` file contains `--require spec_helper` which will cause this
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: expense_gun
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - AGILiDEE
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-02-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -109,7 +109,7 @@ dependencies: | |
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 110 | 
             
                    version: '0'
         | 
| 111 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            -
              name:  | 
| 112 | 
            +
              name: simple_form
         | 
| 113 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - '>='
         | 
| @@ -182,7 +182,7 @@ files: | |
| 182 182 | 
             
            - app/views/kaminari/bootstrap3/_page.html.slim
         | 
| 183 183 | 
             
            - app/views/kaminari/bootstrap3/_paginator.html.slim
         | 
| 184 184 | 
             
            - config/cucumber.yml
         | 
| 185 | 
            -
            - config/ | 
| 185 | 
            +
            - config/locales/expense_gun.fr.yml
         | 
| 186 186 | 
             
            - config/routes.rb
         | 
| 187 187 | 
             
            - db/migrate/20141201092102_create_expense_gun_expenses.rb
         | 
| 188 188 | 
             
            - db/migrate/20141201100548_expenses_add_state.rb
         | 
| @@ -225,6 +225,7 @@ files: | |
| 225 225 | 
             
            - spec/dummy/config/initializers/inflections.rb
         | 
| 226 226 | 
             
            - spec/dummy/config/initializers/mime_types.rb
         | 
| 227 227 | 
             
            - spec/dummy/config/initializers/session_store.rb
         | 
| 228 | 
            +
            - spec/dummy/config/initializers/simple_form.rb
         | 
| 228 229 | 
             
            - spec/dummy/config/initializers/wrap_parameters.rb
         | 
| 229 230 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 230 231 | 
             
            - spec/dummy/config/routes.rb
         | 
| @@ -296,6 +297,7 @@ test_files: | |
| 296 297 | 
             
            - spec/dummy/config/initializers/inflections.rb
         | 
| 297 298 | 
             
            - spec/dummy/config/initializers/mime_types.rb
         | 
| 298 299 | 
             
            - spec/dummy/config/initializers/session_store.rb
         | 
| 300 | 
            +
            - spec/dummy/config/initializers/simple_form.rb
         | 
| 299 301 | 
             
            - spec/dummy/config/initializers/wrap_parameters.rb
         | 
| 300 302 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 301 303 | 
             
            - spec/dummy/config/routes.rb
         | 
| @@ -1,78 +0,0 @@ | |
| 1 | 
            -
            # encoding: utf-8
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            # Set the default text field size when input is a string. Default is nil.
         | 
| 4 | 
            -
            # Formtastic::FormBuilder.default_text_field_size = 50
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            # Set the default text area height when input is a text. Default is 20.
         | 
| 7 | 
            -
            Formtastic::FormBuilder.default_text_area_height = nil
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            # Set the default text area width when input is a text. Default is nil.
         | 
| 10 | 
            -
            Formtastic::FormBuilder.default_text_area_width = nil
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            # Should all fields be considered "required" by default?
         | 
| 13 | 
            -
            # Defaults to true.
         | 
| 14 | 
            -
            Formtastic::FormBuilder.all_fields_required_by_default = false
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            # Should select fields have a blank option/prompt by default?
         | 
| 17 | 
            -
            # Defaults to true.
         | 
| 18 | 
            -
            Formtastic::FormBuilder.include_blank_for_select_by_default = false
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            # Set the string that will be appended to the labels/fieldsets which are required
         | 
| 21 | 
            -
            # It accepts string or procs and the default is a localized version of
         | 
| 22 | 
            -
            # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
         | 
| 23 | 
            -
            # in your locale, it will replace the abbr title properly. But if you don't want to use
         | 
| 24 | 
            -
            # abbr tag, you can simply give a string as below
         | 
| 25 | 
            -
            Formtastic::FormBuilder.required_string = "*"
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            # Set the string that will be appended to the labels/fieldsets which are optional
         | 
| 28 | 
            -
            # Defaults to an empty string ("") and also accepts procs (see required_string above)
         | 
| 29 | 
            -
            # Formtastic::FormBuilder.optional_string = "(optional)"
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            # Set the way inline errors will be displayed.
         | 
| 32 | 
            -
            # Defaults to :sentence, valid options are :sentence, :list, :first and :none
         | 
| 33 | 
            -
            # Formtastic::FormBuilder.inline_errors = :sentence
         | 
| 34 | 
            -
            # Formtastic uses the following classes as default for hints, inline_errors and error list
         | 
| 35 | 
            -
             | 
| 36 | 
            -
            # If you override the class here, please ensure to override it in your stylesheets as well
         | 
| 37 | 
            -
            # Formtastic::FormBuilder.default_hint_class = "inline-hints"
         | 
| 38 | 
            -
            # Formtastic::FormBuilder.default_inline_error_class = "inline-errors"
         | 
| 39 | 
            -
            # Formtastic::FormBuilder.default_error_list_class = "errors"
         | 
| 40 | 
            -
             | 
| 41 | 
            -
            # Set the method to call on label text to transform or format it for human-friendly
         | 
| 42 | 
            -
            # reading when formtastic is used without object. Defaults to :humanize.
         | 
| 43 | 
            -
            # Formtastic::FormBuilder.label_str_method = :humanize
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            # Set the array of methods to try calling on parent objects in :select and :radio inputs
         | 
| 46 | 
            -
            # for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
         | 
| 47 | 
            -
            # that is found on the object will be used.
         | 
| 48 | 
            -
            # Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
         | 
| 49 | 
            -
            # Formtastic::FormBuilder.collection_label_methods = [
         | 
| 50 | 
            -
            #   "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
         | 
| 51 | 
            -
             | 
| 52 | 
            -
            # Specifies if labels/hints for input fields automatically be looked up using I18n.
         | 
| 53 | 
            -
            # Default value: true. Overridden for specific fields by setting value to true,
         | 
| 54 | 
            -
            # i.e. :label => true, or :hint => true (or opposite depending on initialized value)
         | 
| 55 | 
            -
            Formtastic::FormBuilder.i18n_lookups_by_default = {label: true, hint: true}
         | 
| 56 | 
            -
             | 
| 57 | 
            -
            # Specifies if I18n lookups of the default I18n Localizer should be cached to improve performance.
         | 
| 58 | 
            -
            # Defaults to true.
         | 
| 59 | 
            -
            Formtastic::FormBuilder.i18n_cache_lookups = false
         | 
| 60 | 
            -
             | 
| 61 | 
            -
            # Specifies the class to use for localization lookups. You can create your own
         | 
| 62 | 
            -
            # class and use it instead by subclassing Formtastic::Localizer (which is the default).
         | 
| 63 | 
            -
            # Formtastic::FormBuilder.i18n_localizer = MyOwnLocalizer
         | 
| 64 | 
            -
             | 
| 65 | 
            -
            # You can add custom inputs or override parts of Formtastic by subclassing Formtastic::FormBuilder and
         | 
| 66 | 
            -
            # specifying that class here.  Defaults to Formtastic::FormBuilder.
         | 
| 67 | 
            -
            Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
         | 
| 68 | 
            -
             | 
| 69 | 
            -
            # You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>` 
         | 
| 70 | 
            -
            # and `<textarea>` tags by setting this to false (defaults to true).
         | 
| 71 | 
            -
            Formtastic::FormBuilder.use_required_attribute = false
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            # You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
         | 
| 74 | 
            -
            # this to false. Doing so will add a `novalidate` attribute to the `<form>` tag.
         | 
| 75 | 
            -
            # See http://diveintohtml5.org/forms.html#validation for more info.
         | 
| 76 | 
            -
            # Formtastic::FormBuilder.perform_browser_validations = true
         | 
| 77 | 
            -
             | 
| 78 | 
            -
            Formtastic::FormBuilder.escape_html_entities_in_hints_and_labels = false
         |