Adding active flag to enterprises

This commit is contained in:
Will Marshall
2014-04-25 16:08:22 +10:00
parent 5505f3aa06
commit 22b87cc236
4 changed files with 16 additions and 4 deletions

View File

@@ -31,6 +31,9 @@
 
= f.check_box :is_distributor
= f.label :is_distributor, 'Hub'
 
= f.check_box :active
= f.label :active, 'Active?'
.with-tip{'data-powertip' => "Select 'Producer' if you are a primary producer of food. Select 'Hub' if you want a shop-front. You can choose either or both."}
%a What's this?

View File

@@ -14,7 +14,8 @@
<colgroup>
<col style="width: 20%;">
<col style="width: 5%;">
<col style="width: 20%;">
<col style="width: 5%;">
<col style="width: 15%;">
<col>
<col style="width: 20%;">
</colgroup>
@@ -23,6 +24,7 @@
<tr data-hook="enterprises_header">
<th>Name</th>
<th>Role</th>
<th>Active?</th>
<th>Next Collection Date/Time</th>
<th>Description</th>
<th></th>
@@ -34,6 +36,7 @@
<tr class="enterprise-<%= enterprise.id %>">
<td><%= link_to enterprise.name, main_app.admin_enterprise_path(enterprise) %></td>
<td><%= 'PP ' if enterprise.is_primary_producer %><%= 'D' if enterprise.is_distributor %></td>
<td><%= enterprise.active ? 'Active' : 'Inactive' %></td>
<td><%= enterprise_form.text_field :next_collection_at %></td>
<td><%= enterprise.description %></td>
<td data-hook="admin_users_index_row_actions">

View File

@@ -0,0 +1,5 @@
class AddActiveFlagToEnterprises < ActiveRecord::Migration
def change
add_column :enterprises, :active, :boolean, default: true
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140402032034) do
ActiveRecord::Schema.define(:version => 20140425055718) do
create_table "adjustment_metadata", :force => true do |t|
t.integer "adjustment_id"
@@ -219,8 +219,8 @@ ActiveRecord::Schema.define(:version => 20140402032034) do
t.integer "address_id"
t.string "pickup_times"
t.string "next_collection_at"
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.text "distributor_info"
t.string "logo_file_name"
t.string "logo_content_type"
@@ -230,6 +230,7 @@ ActiveRecord::Schema.define(:version => 20140402032034) do
t.string "promo_image_content_type"
t.integer "promo_image_file_size"
t.datetime "promo_image_updated_at"
t.boolean "active", :default => true
end
add_index "enterprises", ["address_id"], :name => "index_enterprises_on_address_id"