OSDN Git Service

Bootstrap users/registrations#edit
authoreagletmt <eagletmt@gmail.com>
Sun, 11 Nov 2012 03:29:54 +0000 (12:29 +0900)
committereagletmt <eagletmt@gmail.com>
Sun, 11 Nov 2012 03:40:00 +0000 (12:40 +0900)
CutenServer/app/views/users/registrations/edit.html.haml
CutenServer/config/locales/ja.yml

index 3c8b74b..71f2baf 100644 (file)
@@ -1,27 +1,29 @@
-%h2
-  Edit #{resource_name.to_s.humanize}
-= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
-  = devise_error_messages!
-  %div
-    = f.label :email
-    %br/
-    = f.email_field :email
-  %div
-    = f.label :password
-    %i (leave blank if you don't want to change it)
-    %br/
-    = f.password_field :password, :autocomplete => "off"
-  %div
-    = f.label :password_confirmation
-    %br/
-    = f.password_field :password_confirmation
-  %div
-    = f.label :current_password
-    %i (we need your current password to confirm your changes)
-    %br/
-    = f.password_field :current_password
-  %div= f.submit "Update"
-%h3 Cancel my account
-%p
-  Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}.
-= link_to "Back", :back
+- if resource.errors.any?
+  #alert= I18n.t("errors.messages.not_saved", :count => resource.errors.count, :resource => resource.class.model_name.human.downcase)
+
+= bootstrap_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'submit-form' }) do |f|
+  %fieldset
+    = f.control_group :email do |g|
+      = g.label
+      = g.controls do |c|
+        = c.email_field
+    = f.control_group :password do |g|
+      = g.label
+      = g.controls do |c|
+        = c.password_field :autocomplete => "off"
+        %i.inline-help leave blank if you don't want to change it
+    = f.control_group :password_confirmation do |g|
+      = g.label
+      = g.controls do |c|
+        = c.password_field
+    = f.control_group :current_password do |g|
+      = g.label
+      = g.controls do |c|
+        = c.password_field
+        %i.inline-help we need your current password to confirm your changes
+    = f.control_group :student_number do |g|
+      = g.label
+      = g.controls do |c|
+        = c.text_field
+    = f.submit "Update"
+= link_to "Back", :back, :class => 'btn'
index c3d1f23..f061a1d 100644 (file)
@@ -14,6 +14,7 @@ ja:
     registrations:
       user:
         signed_up: サインアップしました
+        updated: 更新しました
       teacher:
         signed_up: 教師としてサインアップしました
         updated: 更新しました
@@ -69,6 +70,7 @@ ja:
         email: メールアドレス
         password: パスワード
         password_confirmation: パスワード (再入力)
+        current_password: 現在のパスワード
         student_number: 学籍番号
         authentication_token: 認証トークン
         remember_me: 次回から自動ログイン