teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

# mypages/index.html.hamlを追加。今回のリンク先です。

2020/07/17 02:59

投稿

gaffai
gaffai

スコア1

title CHANGED
File without changes
body CHANGED
@@ -19,6 +19,7 @@
19
19
 
20
20
  ```ruby
21
21
  #config/routes.rb
22
+
22
23
  Rails.application.routes.draw do
23
24
  devise_for :users
24
25
  root "toppages#index"
@@ -29,6 +30,7 @@
29
30
  ```
30
31
  ```ruby
31
32
  #mypages_controller.rb
33
+
32
34
  class MypagesController < ApplicationController
33
35
  def index
34
36
  @chart = [['7月9日', 70], ['7月10日', 75], ['7月11日', 80],['7月12日', 65]]
@@ -66,6 +68,7 @@
66
68
  ```ruby
67
69
  #app/views/mypages/edit.html.haml
68
70
  #app/views/mypages/new.html.haml
71
+
69
72
  .Main__Contents
70
73
  = form_with model: @feature, local: true do |f|
71
74
  = f.number_field :length, placeholder: '身長'
@@ -75,7 +78,29 @@
75
78
  = f.datetime_field :goaldate, placeholder: '目標日'
76
79
  = f.submit '送信'
77
80
  ```
81
+ ```ruby
82
+ #app/views/mypages/index.html.haml
83
+
84
+ .UpperContents
85
+ .UpperContents__userName
86
+ = current_user.name
87
+ .UpperContents__topmessage
88
+ 体重の変化
89
+ .UpperContents__edit
90
+ = link_to edit_user_path(current_user) do
91
+ = icon('fas', 'cog')
92
+ .UpperContents__information
93
+ = link_to edit_mypage_path(current_user) do #今回のリンク先
94
+ 情報
95
+ = line_chart @chart, width: "900px", height: "500px"
96
+ .BottomContents
97
+ = render partial: "feature", collection: @features
98
+ .BottomMain
99
+ %form.BottomMain__Weight
100
+ %input.weightBtn{url: '#', type: 'number', placeholder: '今日の体重を入力'}
101
+ %input.submitBtn{url: '#', type: 'submit', value: '登録する'}
78
102
  ```
103
+ ```
79
104
  #rails routes
80
105
 
81
106
  root_path GET /