over 2 years ago

用戶前台:

  1. 登入: - 帳號密碼:devise
    - 個人資訊:has_one :profile,地點、性別、生日 - 準備題:同時送出五題單選題 (暫定使用select_tag) (這邊要參考阿之的解法,記得select_tag要跟controller搭配好,實際作法是這樣:profile/new.html.erb
  2. 回答配對問題:點選想要回答的問題,進去個別頁面後,一次回答一個的單選題 (暫定使用check_box_tag) - 有全部未答過問題的index page。(要把SpecialCates的問題排除掉。在個別頁面的地方要檢查一下,如果以前回答過,就應該跳回去index)
    - 可能要分作價值觀、戀愛觀、金錢觀等分頁:尚未決定 - 可能要分作今日新題目、時事題、特殊題:尚未決定,但應該都是一頁回答一個問題。
  3. 用戶後台: - 可以看到自己已經回答過的問題,然後可以一次edit一個問題的答案。
    - 可以看到自己的profile,然後決定要不要edit自己的準備題。(profile edit的code可以用profile new的code)
  4. 其他用戶前台(User show page):可以看到其他用戶回答過的問題與答案。 - 如果自己有回答過的話,可以看到自己的答案,也可以選擇要不要換答案。 - 如果自己沒有回答過的話,可以選擇要不要回答。
    - 可以看到其他用戶的profile跟準備題 (不過這邊不能重複使用profile new的code) (這邊還沒弄好)

http://guides.rubyonrails.org/form_helpers.html
3.3 Option Tags from a Collection of Arbitrary Objects

<% cities_array = City.all.map { |city| [city.name, city.id] } %>
<%= options_for_select(cities_array) %>

http://blog.xdite.net/posts/2012/02/06/how-to-design-select-in-rails
http://blog.jex.tw/blog/2015/08/02/rails-view/

 <div class="form-group">
                    <%= label_tag "類別:" %> <%= f.select :cate_ids, Issue::CATES_ARRAY, { }, {:class =>"form-control", :multiple => true} %>
              </div>
              <div class="form-group">
                    <%= label_tag "一般類別:" %> <%= f.select :ordinary_cate_ids, Issue::ORDINARY_CATES_ARRAY, { }, {:class =>"form-control", :multiple => true} %>
              </div>
              <div class="form-group">
                    <%= label_tag "特殊類別:" %> <%= f.select :special_cate_ids, Issue::SPECIAL_CATES_ARRAY, { include_blank: true }, {:class =>"form-control", :multiple => true} %>
              </div>
Started GET "/dashboard/admin/issues/new" for 218.161.40.151 at 2016-06-15 08:25:02 +0000
Cannot render console from 218.161.40.151! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Dashboard::Admin::IssuesController#new as HTML
  Manager Load (0.7ms)  SELECT  "managers".* FROM "managers" WHERE "managers"."id" = ?  ORDER BY "managers"."id" ASC LIMIT 1  [["id", 1]]
  Rendered dashboard/admin/issues/new.html.erb within layouts/admin (33.3ms)
  Rendered common/_managernavbar.html.erb (0.7ms)
  Rendered common/_footer.html.erb (0.2ms)
Completed 200 OK in 1199ms (Views: 1188.3ms | ActiveRecord: 0.7ms)
Started GET "/dashboard/admin/issues/new" for 218.161.40.151 at 2016-06-15 08:14:27 +0000
Cannot render console from 218.161.40.151! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Dashboard::Admin::IssuesController#new as HTML
  Manager Load (0.8ms)  SELECT  "managers".* FROM "managers" WHERE "managers"."id" = ?  ORDER BY "managers"."id" ASC LIMIT 1  [["id", 1]]
  Rendered dashboard/admin/issues/new.html.erb within layouts/admin (34.6ms)
  Rendered common/_managernavbar.html.erb (1.0ms)
  Rendered common/_footer.html.erb (0.6ms)
Completed 200 OK in 1118ms (Views: 1075.2ms | ActiveRecord: 0.8ms)
Started GET "/dashboard/admin/issues/new" for 218.161.40.151 at 2016-06-15 08:22:42 +0000
Cannot render console from 218.161.40.151! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Dashboard::Admin::IssuesController#new as HTML
  Manager Load (0.4ms)  SELECT  "managers".* FROM "managers" WHERE "managers"."id" = ?  ORDER BY "managers"."id" ASC LIMIT 1  [["id", 1]]
  Cate Load (0.5ms)  SELECT "cates".* FROM "cates"
  OrdinaryCate Load (0.3ms)  SELECT "ordinary_cates".* FROM "ordinary_cates"
  SpecialCate Load (0.3ms)  SELECT "special_cates".* FROM "special_cates"
  Rendered dashboard/admin/issues/new.html.erb within layouts/admin (40.4ms)
  Rendered common/_managernavbar.html.erb (1.0ms)
  Rendered common/_footer.html.erb (0.3ms)
Completed 200 OK in 1405ms (Views: 1350.6ms | ActiveRecord: 1.9ms)
Started GET "/dashboard/admin/issues/new" for 218.161.40.151 at 2016-06-15 08:23:46 +0000
Cannot render console from 218.161.40.151! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Dashboard::Admin::IssuesController#new as HTML
  Manager Load (20.5ms)  SELECT  "managers".* FROM "managers" WHERE "managers"."id" = ?  ORDER BY "managers"."id" ASC LIMIT 1  [["id", 1]]
  Cate Load (9.0ms)  SELECT "cates".* FROM "cates"
  OrdinaryCate Load (0.5ms)  SELECT "ordinary_cates".* FROM "ordinary_cates"
  SpecialCate Load (1.5ms)  SELECT "special_cates".* FROM "special_cates"
  Rendered dashboard/admin/issues/new.html.erb within layouts/admin (84.1ms)
  Rendered common/_managernavbar.html.erb (0.9ms)
  Rendered common/_footer.html.erb (0.3ms)
Completed 200 OK in 2669ms (Views: 2598.7ms | ActiveRecord: 31.4ms)
← 後台:Cate, Issue, Option的建置 (Active Record Associations) 新增PROFILE: view/dashboard/profile/new.html.erb →