Giter VIP home page Giter VIP logo

babymaximus's People

Contributors

jendiamond avatar

Watchers

 avatar

babymaximus's Issues

Add Simple Form / Bootstrap & Font Awesome

Pull Request #3

Simple Form

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

Set up datastructures

Commits

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

Create methods for...

Create methods for:

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

Add google webfonts

Pull Request #8

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');

Add improvement to Tummy Time

On the day/show page:
Add logic to show the improvement in tummy time from last week
ie: 2 minutes longer than last week

Reformat forms using simpleform format

Reformat #12

https://github.com/plataformatec/simple_form#available-input-types-and-defaults-for-each-column-type

Available input types and defaults for each column type

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/`

Add nested fields to day#edit

Nested 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.