mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-12 06:57:47 +00:00
Adding weight & tag
This commit is contained in:
parent
be779df79b
commit
571325d61d
3 changed files with 12 additions and 1 deletions
|
|
@ -18,7 +18,8 @@ class HabitsController < ApplicationController
|
|||
# GET /habits/new
|
||||
# GET /habits/new.json
|
||||
def new
|
||||
@habit = Habit.new(:user_id => current_user.id)
|
||||
@habit = Habit.new
|
||||
@habit.weight = Habit.maximum('weight') + 1
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@
|
|||
<%= f.label :notes %><br />
|
||||
<%= f.text_area :notes %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :weight %><br />
|
||||
<%= f.text_field :weight %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :tag %><br />
|
||||
<%= f.text_field :tag %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ class CreateHabits < ActiveRecord::Migration
|
|||
t.boolean :down, :default => true
|
||||
t.boolean :done, :default => false
|
||||
t.text :notes
|
||||
t.integer :weight, :default => 1
|
||||
t.string :tag
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue