Skip to content

Instantly share code, notes, and snippets.

@sandinist
Created January 13, 2012 22:36
Show Gist options
  • Save sandinist/1609147 to your computer and use it in GitHub Desktop.
Save sandinist/1609147 to your computer and use it in GitHub Desktop.
#clrh66 demo
r g scaffold attend name:string mail:string receipt_name:string be_lightning:boolean be_party:boolean other:text
#config/application.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { :host => 'clrh66.heroku.com' }
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'gmail.com',
:authentication => :plain,
:user_name => 'clrh66.demo',
:password => ENV["GMAIL_PASSWORD"]
}
#app/model/attend.rb
validates :name, :presence => true
validates :be_lightning, :be_party, :inclusion => { :in => [true, false] }
validates :mail, :uniqueness => true,
:length => { :maximum => 50 },
:format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ }
r g mailer AtndNotifier received
curl -o config/locales/ja.yml https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml
#config/locales/ja.yml
activerecord:
errors:
models:
attend:
attributes:
mail:
invalid: "の形式が不正です。"
inclusion: "を選択してください"
messages:
<<: *errors_messages
template:
<<: *errors_template
full_messages:
format: "%{attribute}%{message}"
models:
attend: "参加登録"
attributes:
attend:
name: "名前"
mail: "メール"
receipt_name: "領収書宛名"
be_lightning: "LT登壇"
be_party: "懇親会参加"
other: "その他"
list: "一覧"
show: "表示"
edit: "編集"
destroy: "削除"
new: "新規作成"
back: "戻る"
create: "作成"
search: "検索"
update: "更新"
save: "登録"
#app/views/layouts/application.html.slim
doctype html
html lang="ja"
head
title #clrh66 demo
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
body
div{class="container"}
p{class="notice"} =notice
p{class="alert"} =alert
= yield
#app/assets/stylesheet/attends.css.sass
.container
display: block
background-attachment: scroll
background-clip: border-box
background-color: transparent
background-image: none
background-origin: padding-box
border-bottom-width: 0px
border-left-width: 0px
border-right-width: 0px
border-top-width: 0px
color: #1A6329
direction: ltr
display: block
font-family: Arial, sans-serif
font-size: 13px
height: 640px
margin-bottom: 0px
margin-left: 0px
margin-right: 0px
margin-top: 30px
padding-bottom: 6px
padding-left: 12px
padding-right: 12px
padding-top: 6px
unicode-bidi: embed
.base-body
background-attachment: scroll
background-clip: border-box
background-color: white
background-image: url(https://lh3.googleusercontent.com/2rIjESCGDCKwcdMGIxF39ArWBz8yifiva5GDkoeJWer_mdfyqxhweds4TFdOnykRT3wDsfQM-Zp17mby7Xl3sus=s0)
background-origin: padding-box
border-bottom-color: #1A6329
border-bottom-style: solid
border-bottom-width: 5px
border-left-color: #1A6329
border-left-style: solid
border-left-width: 5px
border-right-color: #1A6329
border-right-style: solid
border-right-width: 5px
border-top-color: #1A6329
border-top-style: solid
border-top-width: 5px
background-repeat: repeat-y
color: #1A6329
display: block
font-family: Arial, sans-serif
font-size: 13px
height: 640px
margin: 0 auto
padding-bottom: 12px
padding-left: 160px
padding-right: 12px
padding-top: 12px
width: 576px
.container form
margin: 30px 20px
.container textarea
width: 40em
height: 10em
#attend_other
width: 450px
div
display: block
.new_attend label
display: block
float: left
width: 100px
.new_attend
background-attachment: scroll
background-clip: border-box
background-color: transparent
background-image: none
background-origin: padding-box
border-bottom-width: 0px
border-left-width: 0px
border-right-width: 0px
border-top-width: 0px
color: #1A6329
display: block
font-family: Arial, sans-serif
font-size: 13px
height: 629px
margin-bottom: 0px
margin-left: 0px
margin-right: 0px
margin-top: 0px
padding-bottom: 0px
padding-left: 0px
padding-right: 0px
padding-top: 0px
width: 576px
#show_table
background-color: #1A6329
border: 1px solid #1A6329
#show_table td
background-color: ivory
border: 1px solid #1A6329
curl -o config/locales/devise.ja.yml https://raw.github.com/gist/606476/15605bdbc28067c7983cefae3ae12105ee93c243/devise.ja.yml
#app/views/admin/index.html.slim
= image_tag 'http://clr-h.jp/Portals/0/clr-h_logo.png
'h1 #clrh66 管理画面
- if user_signed_in?
p
'現在の登録人数 #{@attends.count}名 ->
= link_to "一覧画面へ", attends_path
p = button_to "ログアウト", destroy_user_session_path, method: :delete
- else
= link_to "ログイン", new_user_session_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment