(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
WaYdotNET AiS, OpenOttica, ruby bootsrtap, github, padrino, padrino-admin, padrinorb, ruby, twitter, twitter bootstrap
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 !!!!
WaYdotNET AiS, OpenOttica, ruby github, padrino, padrino-admin, padrinorb, ruby, twitter, twtitter-bootstrap, waydotnet
Hi to all, i’ve publish my version of padrino admin… based on Twitter Bootstrap
Login page:

Welcome page

List user:

clone my repository and enjoy
1
| https://github.com/WaYdotNET/padrino-framework |
comment please
WaYdotNET ruby, Script ruby padrino padrino-admin github
CoffeScript (1.1.1) on Windows: simple method !
Inspiration: http://blog.mnasyrov.com/post/2872046541/coffeescript-on-windows-how-to-roast-coffee
To use CoffeScript you need:
- Node.js
- CoffeeScript
- Batch file to run CoffeeScript
STEP 1: Node.js
I’m very very lazy dev… 
And i don’t recompile NodeJs into Windows….. but I’m using v0.4.7 from http://node-js.prcn.co.cc/ [many thx]
and install into:
1
2
3
4
| D:\>cd Tools\NodeJs\bin
D:\Tools\NodeJs\bin>node --version
v0.4.7 |
STEP 2: CoffeeScript
Use the last version , grab it from https://github.com/jashkenas/coffee-script
and install into:
Check version
1
2
| D:\Tools\NodeJs\bin\node /cygdrive/D/Tools/CoffeeScript/bin/coffee --version
CoffeeScript version 1.1.1 |
Node.js need unix-path
Step 3: Batch file
I don’t know well bat syntax, and my code is VERY VERY ugly.. but it works
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
| @echo off
:: Directories of the tools
SET coffeeDir=D:\Tools\Coffeescript\bin
SET nodeDir=D:\Tools\NodeJs\bin
:: var
SET a=%1
SET b=%2
SET c=%3
SET d=%4
SET e=%5
SET f=%6
SET g=%7
SET h=%8
SET i=%9
:: Check input value if exist and if it's option or file
:A
IF "%a%"=="" GOTO :B
IF "%a:~0,1%"=="-" GOTO :B
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %1') DO SET a=%%o
:B
IF "%b%"=="" GOTO :C
IF "%b:~0,1%"=="-" GOTO :C
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %2') DO SET b=%%o
:C
IF "%c%"=="" GOTO :D
IF "%c:~0,1%"=="-" GOTO :D
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %3') DO SET c=%%o
:D
IF "%d%"=="" GOTO :E
IF "%d:~0,1%"=="-" GOTO :E
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %4') DO SET d=%%o
:E
IF "%e%"=="" GOTO :F
IF "%e:~0,1%"=="-" GOTO :F
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %5') DO SET e=%%o
:F
IF "%f%"=="" GOTO :G
IF "%f:~0,1%"=="-" GOTO :G
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %6') DO SET f=%%o
:G
IF "%g%"=="" GOTO :H
IF "%g:~0,1%"=="-" GOTO :H
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %7') DO SET g=%%o
:H
IF "%h%"=="" GOTO :I
IF "%h:~0,1%"=="-" GOTO :I
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %8') DO SET h=%%o
:I
IF "%i%"=="" GOTO :COMMAND
IF "%i:~0,1%"=="-" GOTO :COMMAND
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %9') DO SET i=%%o
:COMMAND
FOR /f %%o IN ('%nodeDir%/cygpath.exe -a -u %coffeeDir%') DO SET p=%%o
%nodeDir%\node %p%/coffee %a% %b% %c% %d% %e% %f% %g% %h% %i% |
set the PATH environment variable contains a path to coffee.bat
the name of the file is very important, in my case it works well with coffee-rack
Enjoy
Many thanks to:
Mikhail Nasyrov => http://blog.mnasyrov.com/post/2872046541/coffeescript-on-windows-how-to-roast-coffee
Node.js self-contained Windows binaries => http://node-js.prcn.co.cc/index.html
Jeremy Ashkenas => http://jashkenas.github.com/coffee-script/
WaYdotNET OpenOttica, ruby, Script, tips, Uncategorized batch, CoffeeScript, Javascript, Node.js, ruby, windows
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
- generate a model
- convert the model into base model ( move this model into lib/ folder)
- save config file with model base’s list
- generate a model from base model
- generate a migration file
Usage
Step 1-2-3
1
| $ padrino-lazy base --c config_file --b base_model_name --f field_to_create |
Step 4-5
1
| $ padrino-lazy model --c config_file --b base_model_name --f field_to_create --m model_name |
Install
1
| gem install padrino-lazy --pre |
Example
1
| $ padrino-lazy base --c config --b BaseModel --f "create_at:datetime is_active:boolean" |
now we have
lib/base_model.rb class BaseModel
1
2
3
4
5
6
7
8
9
|
include DataMapper::Resource
# property ,
property :id, Serial
property :create_at, DateTime
property :is_active, Boolean
end |
config/config.yml
1
2
3
4
|
---
- base: BaseModel
fields: create_at:datetime is_active:boolean |
1
| $ padrino-lazy model --c config --b BaseModel --f "name:string have_children:boolean born:date foo:integer" --m User |
app/models/user.rb
1
2
3
4
5
6
7
8
| class User < BaseModel
# property ,
property :name, String
property :have_children, Boolean
property :born, Date
property :foo, Integer
end |
db/migrate/001_create_users.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
migration 1, :create_users do
up do
create_table :users do
column :id, Integer, :serial => 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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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
WaYdotNET ruby, Script, tips, Uncategorized lazy, linux, orm, padrino, ruby