Commit 995bd023 authored by jz143's avatar jz143

fixes app_file#_form layout

parent 4addef69
...@@ -2,8 +2,10 @@ class AppFile < ActiveRecord::Base ...@@ -2,8 +2,10 @@ class AppFile < ActiveRecord::Base
belongs_to :app belongs_to :app
belongs_to :user belongs_to :user
validates :app, presence: true
validates_inclusion_of :platform, :in => %w( Android iOS ) validates_inclusion_of :platform, :in => %w( Android iOS )
validates :version, presence: true
has_attached_file :archive has_attached_file :archive
validates_attachment_file_name :archive, matches: [/apk\Z/, /zip\Z/] validates_attachment_file_name :archive, matches: [/apk\Z/, /zip\Z/]
validates_with AttachmentPresenceValidator, attributes: :archive, :on => :create validates_with AttachmentPresenceValidator, attributes: :archive, :on => :create
......
<%= simple_form_for([@app_file.app, @app_file], html: { class: 'form-horizontal' }) do |f| %> <div class="row">
<%= f.input :platform, collection: ['iOS', 'Android'], as: :radio_buttons %> <div class="col-md-12">
<%= f.input :version %> <%= simple_form_for([@app_file.app, @app_file]) do |f| %>
<%= f.input :archive, as: :file %> <%= f.input :platform, collection: ['iOS', 'Android'], as: :radio_buttons, required: true %>
<%= f.button :submit, 'Upload New App Release' %> <%= f.input :version, required: true %>
<% end %> <%= f.input :archive, as: :file, required: true %>
<%= f.button :submit, 'Upload New App Release' %>
<% end %>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment