Padrino-admin Twitter Bootstrap v2.0 is ready

(Padrino Admin TwitterBootstrap 2.0)

  • Padrino-Modal: rack-flash and delete function into modal πŸ˜€
  • highlights error field
  • tof helper: Automatic replace true or false with relative image (list.slim and list.haml)
  • Breadcrumbs
  • Automatic time_ago_in_words when column model is created_at or updated_at
  • Migrate function for MiniRecord

Padrino-Modal

All result from rack-flash and delete request, now is automatic insert into modal javascript plugin

highlights error field

tof_helper

Automatic replace true or false with relative image (list.slim and list.haml)

Breadcrumbs

Automatic Breadcrumbs system:

time_ago_in_words

Automatic time_ago_in_words when column model is created_at or updated_at

MiniRecord migrate

Migrate function for MiniRecord

Demo:

http://padrino.waydotnet.com/admin
user: test@padrinorb.cpm
password: test

By WaYdotNET

Padrino Admin another new layout (based on Twitter Bootstrap v2.0-wip)

http://glowing-leaf-7114.heroku.com/admin/
user: test@padrinorb.com
pass: test

PLEASE DON’T CHANGE LOGIN/PASSWORD

Additional feature:

  • ✔ Padrino-Modal: rack-flash and delete function into modal πŸ˜€
  • ✔ highlights error field
  • ✔ tof helper: Automatic replace true or false with relative image (list.slim and list.haml)
  • ✔ Breadcrumbs
  • ✔ Automatic time_ago_in_words when column model is created_at or updated_at
  • ✔ Migrate function for MiniRecord

clone my repository and enjoy πŸ˜€

https://github.com/WaYdotNET/padrino-framework

See the code and comment please !!!!

LAZY Agnostic Application Generators (padrino-lazy)

Overview

Through padrino-lazy, we can include some common properties shared between the model object used a base model object

Padrino is very good framework, and almost follows the DRY principle (Don’t Repeat Yourself) When we need to have some common properties shared between the model object of our ORM, using the generator padrino-gen, We can only include these properties in each model to generate.

I hope this idea will be included in Padrino Framework.
Principle / Step

  1. generate a model
  2. convert the model into base model ( move this model into lib/ folder)
  3. save config file with model base’s list
  4. generate a model from base model
  5. generate a migration file

Usage

Step 1-2-3

$ padrino-lazy base --c config_file --b base_model_name --f field_to_create

Step 4-5

$ padrino-lazy model --c config_file --b base_model_name --f field_to_create --m model_name

Install

gem install padrino-lazy --pre

Example

$ padrino-lazy base --c config --b BaseModel --f "create_at:datetime is_active:boolean"

now we have

lib/base_model.rb class BaseModel


include DataMapper::Resource

  # property ,
  property :id, Serial
  property :create_at, DateTime
  property :is_active, Boolean

end

config/config.yml


---
- base: BaseModel
fields: create_at:datetime is_active:boolean
$ padrino-lazy model --c config --b BaseModel --f "name:string have_children:boolean born:date foo:integer"  --m User

app/models/user.rb

class User <  BaseModel

  # property ,
  property :name, String
  property :have_children, Boolean
  property :born, Date
  property :foo, Integer
end

db/migrate/001_create_users.rb


migration 1, :create_users do
  up do
    create_table :users do
      column :id, Integer, :serial =&gt; true
      column :name, String
      column :have_children, Boolean
      column :born, Date
      column :foo, Integer
    end
  end

  down do
    drop_table :users
    end
  end

db/migrate/002_add_basic_model_to_user.rb


migration 2, :add_basic_model_to_user do
  up do
    modify_table :users do
      add_column :name, String
      add_column :have_children, Boolean
      add_column :born, Date
      add_column :foo, Integer
  end
end

down do
modify_table :users do
drop_column :name
drop_column :have_children
drop_column :born
drop_column :foo
end
end
end

Known issue

  • VERY VERY alpha code !! (thanks to my pig/lazy side πŸ˜€ )
  • β€”f options need dobule quote around fields
  • β€”b write in CamelCase
  • TESTING only with datamapper and activerecord into linux machine

TODO:

  • Test all code !
  • Use Padrino::Generators instead of Commander
  • Default config file name (very lazy πŸ˜› )

THANK

  • Team Padrino
  • DaddYE
  • Piedinodifata

CODE
https://github.com/WaYdotNET/padrino-lazy