jendiamond / babymaximus Goto Github PK
View Code? Open in Web Editor NEWTrack baby's feedings and stuff
Home Page: https://babymaximus.herokuapp.com
Track baby's feedings and stuff
Home Page: https://babymaximus.herokuapp.com
Add to Gemfile gem 'simple_form', '~> 3.2', '>= 3.2.1'
$ bundle
$ rails generate simple_form:install --bootstrap
<%= simple_form_for @user do |f| %>
<%= f.input :name, required: false %>
<%= f.input :username %>
<%= f.input :password %>
<%= f.button :submit %>
<% end %>
<%= simple_form_for @user do |f| %>
<%= f.input :user %>
<%= f.input :age, collection: 18..60 %>
<%= f.button :submit %>
<% end %>
http://stackoverflow.com/questions/33902692/rails-bootstrap-setup
Enter bday
if date is between bday && bday+7
week = 1
rails g scaffold User
rails g scaffold Day week:integer date:datetime notes:text
rails g scaffold Feeding day:references feeding_time:datetime left:boolean right:boolean minutes:integer feeding_type:string feeding_amount:integer notes:text
rails g scaffold Pump day:references pump_time:datetime pump_amount:integer notes:text
rails g scaffold Diaper day:references diaper_type:string notes:text
rails g scaffold Sleep day:references sleep_start:datetime sleep_end:datetime notes:text
rails g scaffold TummyTime day:references tummy_time:integer notes:text
rails g scaffold Bath day:references bath:boolean notes:text
def time_between_feedings
end
def total_feeding_time_per_day
end
def total_feeding_time_per_week
end
def total_feeding_time_per_month
end
def total_feeding_time_per_day
end
def total_feeding_time_per_week
end
def total_feeding_time_per_month
end
def total_diapers_per_day
end
https://fonts.google.com/
misopeso/google-webfonts-rails#4
app/views/layouts/application.html.erb
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Chewy" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Sansita+One" rel="stylesheet">
app/assets/stylesheets/application.scss
@import url('//fonts.googleapis.com/css?family=Raleway:400,700,300');
@import url('//fonts.googleapis.com/css?family=Chewy:400,700,300');
@import url('//fonts.googleapis.com/css?family=Sansita+One:400,700,300');
On the day/show page:
Add logic to show the improvement in tummy time from last week
ie: 2 minutes longer than last week
The following table shows the html element you will get for each attribute according to its database definition.
These defaults can be changed by specifying the helper method in the column Mapping
as the as:
option.
Example:
<%= simple_form_for @day do |f| %>
<%= f.input :week, label: "Change the week", as: :integer %>
<%= f.input :date, label: "Change the date", as: :datetime %>
<%= f.input :notes, label: "Notes about today", as: :text %>
<% end %>
Mapping | Generated HTML Element | Database Column Type
--------------- |:-------------------------------------|:--------------------
`boolean` | `input[type=checkbox]` | `boolean`
`string` | `input[type=text]` | `string`
`email` | `input[type=email]` | `string` with `name =~ /email/`
`url` | `input[type=url]` | `string` with `name =~ /url/`
`tel` | `input[type=tel]` | `string` with `name =~ /phone/`
`password` | `input[type=password]` | `string` with `name =~ /password/`
`search` | `input[type=search]` | -
`uuid` | `input[type=text]` | `uuid`
`text` | `textarea` | `text`
`file` | `input[type=file]` | `string` responding to file methods
`hidden` | `input[type=hidden]` | -
`integer` | `input[type=number]` | `integer`
`float` | `input[type=number]` | `float`
`decimal` | `input[type=number]` | `decimal`
`range` | `input[type=range]` | -
`datetime` | `datetime select` | `datetime/timestamp`
`date` | `date select` | `date`
`time` | `time select` | `time`
`select` | `select` | `belongs_to`/`has_many`/`has_and_belongs_to_many` associations
`radio_buttons` | collection of `input[type=radio]` | `belongs_to` associations
`check_boxes` | collection of `input[type=checkbox]` | `has_many`/`has_and_belongs_to_many` associations
`country` | `select` (countries as options) | `string` with `name =~ /country/`
`time_zone` | `select` (timezones as options) | `string` with `name =~ /time_zone/`
https://github.com/plataformatec/simple_form/wiki/Nested-Models
http://stackoverflow.com/questions/10606619/nested-rails-forms-with-simple-form
https://github.com/nathanvda/cocoon/wiki/A-guide-to-doing-nested-model-forms
<%= f.simple_fields_for :friend_birthdays do |friend_birthday| %>
<%= friend_birthday.input :name %>
<%= friend_birthday.input :gender, :collection => ['male','female'] %>
<% end %>
class Machine < ActiveRecord::Base
has_many :parts , inverse_of: :machine
accepts_nested_attributes_for :parts
end
<%= simple_form_for @machine do |m| %>
<%= m.simple_fields_for :parts do |p| %>
<%= p.input :name %>
<% end %>
<% end %>
def new
@machine = Machine.new
@machine.parts.build
end
Add image to the public
file
Add this link to layouts/application.rb
<%= favicon_link_tag 'favicon.ico' %>
http://stackoverflow.com/questions/11071445/favicon-in-ruby-on-rails-application
$ RAILS_ENV=production bundle exec rake assets:precompile
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.