1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

event categoriy is required

This commit is contained in:
Peng DU 2016-06-22 18:56:45 +02:00
parent 1383483a54
commit 60f504c660
3 changed files with 3 additions and 1 deletions

View File

@ -228,6 +228,7 @@ Application.Controllers.controller "NewEventController", ["$scope", "$state", "$
end_time: new Date() end_time: new Date()
all_day: 'false' all_day: 'false'
recurrence: 'none' recurrence: 'none'
category_ids: []
## Possible types of recurrences for an event ## Possible types of recurrences for an event
$scope.recurrenceTypes = [ $scope.recurrenceTypes = [

View File

@ -69,7 +69,7 @@
</div> <!-- ./panel-body --> </div> <!-- ./panel-body -->
<div class="panel-footer no-padder"> <div class="panel-footer no-padder">
<input type="submit" ng-value="submitName" class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c" ng-disabled="eventForm.$invalid"/> <input type="submit" ng-value="submitName" class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c" ng-disabled="eventForm.$invalid || event.category_ids.length === 0"/>
</div> </div>
</section> </section>

View File

@ -6,6 +6,7 @@ class Event < ActiveRecord::Base
has_many :event_files, as: :viewable, dependent: :destroy has_many :event_files, as: :viewable, dependent: :destroy
accepts_nested_attributes_for :event_files, allow_destroy: true, reject_if: :all_blank accepts_nested_attributes_for :event_files, allow_destroy: true, reject_if: :all_blank
has_and_belongs_to_many :categories, join_table: :events_categories has_and_belongs_to_many :categories, join_table: :events_categories
validates :categories, presence: true
belongs_to :availability, dependent: :destroy belongs_to :availability, dependent: :destroy
accepts_nested_attributes_for :availability accepts_nested_attributes_for :availability