mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Rename weight=>position, remove tag (will add in later)
This commit is contained in:
@@ -19,7 +19,7 @@ class HabitsController < ApplicationController
|
|||||||
# GET /habits/new.json
|
# GET /habits/new.json
|
||||||
def new
|
def new
|
||||||
@habit = Habit.new
|
@habit = Habit.new
|
||||||
@habit.weight = Habit.maximum('weight') + 1
|
@habit.position = (Habit.maximum('position') || 0) + 1
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ class Habit < ActiveRecord::Base
|
|||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
default_scope :order => 'position ASC'
|
||||||
|
|
||||||
# TODO set cron for this
|
# TODO set cron for this
|
||||||
def self.clear_done
|
def self.clear_done
|
||||||
Habit.where(:habit_type => Habit::DAILY).collect do |h|
|
Habit.where(:habit_type => Habit::DAILY).collect do |h|
|
||||||
|
|||||||
@@ -23,14 +23,6 @@
|
|||||||
<%= f.label :notes %><br />
|
<%= f.label :notes %><br />
|
||||||
<%= f.text_area :notes %>
|
<%= f.text_area :notes %>
|
||||||
</div>
|
</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">
|
<div class="actions">
|
||||||
<%= f.submit %>
|
<%= f.submit %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,12 +5,11 @@ class CreateHabits < ActiveRecord::Migration
|
|||||||
t.string :name
|
t.string :name
|
||||||
t.integer :habit_type, :default => 1
|
t.integer :habit_type, :default => 1
|
||||||
t.integer :score, :default => 0
|
t.integer :score, :default => 0
|
||||||
|
t.text :notes
|
||||||
t.boolean :up, :default => true
|
t.boolean :up, :default => true
|
||||||
t.boolean :down, :default => true
|
t.boolean :down, :default => true
|
||||||
t.boolean :done, :default => false
|
t.boolean :done, :default => false
|
||||||
t.text :notes
|
t.integer :position, :default => 0
|
||||||
t.integer :weight, :default => 1
|
|
||||||
t.string :tag
|
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user