Adds color to event types

This commit is contained in:
Chrisbr
2014-06-12 16:24:24 +02:00
parent e34a972b74
commit bf4758a54a
5 changed files with 15 additions and 1 deletions

View File

@@ -109,6 +109,13 @@ $(function() {
},
5)
});
$('a:contains("Add event_type")').click(function () {
setTimeout(function () {
$("div.nested-fields:last div:nth-of-type(5) input").val(get_color());
},
5)
});
});
function get_color() {

View File

@@ -1,5 +1,5 @@
class EventType < ActiveRecord::Base
attr_accessible :title, :length, :minimum_abstract_length, :maximum_abstract_length
attr_accessible :title, :length, :minimum_abstract_length, :maximum_abstract_length, :color
belongs_to :conference

View File

@@ -4,6 +4,7 @@
<%= f.input :length, :input_html => {:size => 3} %>
<%= f.input :minimum_abstract_length, :input_html => {:size => 3} %>
<%= f.input :maximum_abstract_length, :input_html => {:size => 3} %>
<%= f.input :color, :input_html => { :size => 6, :type => 'color' } %>
<%= remove_association_link :event_type, f %>
<% end %>
</div>

View File

@@ -0,0 +1,5 @@
class AddColorToEventType < ActiveRecord::Migration
def change
add_column :event_types, :color, :string
end
end

View File

@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(version: 20140612181230) do
t.integer "length", default: 30
t.integer "minimum_abstract_length", default: 0
t.integer "maximum_abstract_length", default: 500
t.string "color"
end
create_table "events", force: true do |t|