Skip to content

Commit

Permalink
Add invalid organization link.
Browse files Browse the repository at this point in the history
  • Loading branch information
taitus committed Nov 26, 2017
1 parent eb8b89a commit 5a14694
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def organization_params
params.require(:organization)
.permit(:reference, :identifier, :name, :first_surname, :second_surname, :phones, :email,
:web, :address_type, :address, :number, :gateway, :stairs, :floor, :door,
:postal_code, :town, :province, :description, :registered_lobbies, :category_id,
:postal_code, :town, :province, :description, :registered_lobbies, :category_id, :invalidate,
:fiscal_year, :range_fund, :subvention, :contract, :denied_public_data, :denied_public_events, interest_ids: [],
legal_representant_attributes: [:identifier, :name, :first_surname, :second_surname, :phones, :email, :_destroy],
user_attributes: [:id, :first_name, :last_name, :role, :email, :active, :phones, :password, :password_confirmation],
Expand Down
3 changes: 1 addition & 2 deletions app/views/admin/organizations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
<%= render 'agents', f:f %>
<%= render 'terms', f:f %>
<%= submit_tag t('backend.save'), :class=> "button radius success right" %>
<%= submit_tag t('backend.save'), class: "button radius success right" %>
<% end %>
18 changes: 13 additions & 5 deletions app/views/admin/organizations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@
<i class="step fi-page-edit size-24"></i>
<% end if can? :edit, organization %>
<%= link_to admin_organization_path(organization), method: :delete,
data: { confirm: t("backend.delete_confirm") },
title: t('backend.delete') do %>
<i class="step fi-page-delete size-24"></i>
<% end if can? :destroy, organization %>
<% if organization.invalidate %>
<%= link_to admin_organization_path(organization, organization: { :invalidate => false }), method: :put,
data: {confirm: '¿Esta seguro que quiere validar la Organización?'},
title: "Validar" do %>
<i class="step fi-page-add size-24"></i>
<% end if can? :destroy, organization %>
<% else %>
<%= link_to admin_organization_path(organization, organization: { :invalidate => true }), method: :put,
data: {confirm: '¿Esta seguro que quiere invalidar la Organización?'},
title: "Invalidar" do %>
<i class="step fi-page-delete size-24"></i>
<% end if can? :destroy, organization %>
<% end %>
</td>
</tr>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddInvalidateFieldToOrganizations < ActiveRecord::Migration
def change
add_column :organizations, :invalidate, :boolean, default: false
end
end
7 changes: 4 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171123185532) do
ActiveRecord::Schema.define(version: 20171126194937) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -196,8 +196,8 @@
t.boolean "contract"
t.boolean "denied_public_data"
t.boolean "denied_public_events"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "inscription_reference"
t.date "inscription_date"
t.string "entity_type"
Expand All @@ -207,6 +207,7 @@
t.integer "associations_count"
t.integer "members_count"
t.string "approach"
t.boolean "invalidate", default: false
end

add_index "organizations", ["category_id"], name: "index_organizations_on_category_id", using: :btree
Expand Down
1 change: 1 addition & 0 deletions spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
denied_public_events false
entity_type :lobby
inscription_date { Date.current }
invalidate false

trait :company do
name { Faker::Company.name }
Expand Down

0 comments on commit 5a14694

Please sign in to comment.