From 7789e2138fc0479846c20bc68d68973636a4a760 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 12 Mar 2019 21:50:00 -0400 Subject: Started game tracker --- app/views/admin/games/_form.html.haml | 23 +++++++++++++++++++++++ app/views/admin/games/edit.html.haml | 3 +++ app/views/admin/games/index.html.haml | 13 +++++++++++++ app/views/admin/games/new.html.haml | 3 +++ app/views/games/index.html.haml | 14 ++++++++++++++ app/views/layouts/admin.html.haml | 4 ++++ 6 files changed, 60 insertions(+) create mode 100644 app/views/admin/games/_form.html.haml create mode 100644 app/views/admin/games/edit.html.haml create mode 100644 app/views/admin/games/index.html.haml create mode 100644 app/views/admin/games/new.html.haml create mode 100644 app/views/games/index.html.haml (limited to 'app/views') diff --git a/app/views/admin/games/_form.html.haml b/app/views/admin/games/_form.html.haml new file mode 100644 index 0000000..4b17664 --- /dev/null +++ b/app/views/admin/games/_form.html.haml @@ -0,0 +1,23 @@ +%fieldset#content + .title-field + = f.label :title + = f.text_field :title, placeholder: "Title" + .description-field + = f.label :description + = f.cktext_area :description +%fieldset#details + - if f.object.errors.any? + #errors.details-module + %h3 Error! + %ul + - f.object.errors.full_messages.each do |error| + %li= error + .details-module + .progress-field + = f.label :progress + = f.text_area :progress + .details-module + .status-field + = f.select :status, options_for_select(Game.status.values) + = f.label :status + .details-module= f.submit diff --git a/app/views/admin/games/edit.html.haml b/app/views/admin/games/edit.html.haml new file mode 100644 index 0000000..d7a480b --- /dev/null +++ b/app/views/admin/games/edit.html.haml @@ -0,0 +1,3 @@ +- title "Editing #{@game.title}" += form_for @game, url: admin_game_url(@game), html: { id: "entry-form" } do |f| + = render partial: "form", locals: { f: f } diff --git a/app/views/admin/games/index.html.haml b/app/views/admin/games/index.html.haml new file mode 100644 index 0000000..96c69b8 --- /dev/null +++ b/app/views/admin/games/index.html.haml @@ -0,0 +1,13 @@ +- title "Games" +%table#entries + %tr + %th Title + %th Date published + %th + - @games.each do |game| + %tr{ class: cycle("even", "odd") } + %td= game.title + %td= game.created_at.strftime("%B %d, %Y, %l:%M%P") + %td + %ul.admin-actions + %li= link_to "Edit", edit_admin_game_url(game) diff --git a/app/views/admin/games/new.html.haml b/app/views/admin/games/new.html.haml new file mode 100644 index 0000000..00dfb92 --- /dev/null +++ b/app/views/admin/games/new.html.haml @@ -0,0 +1,3 @@ +- title "New game" += form_for @game, url: admin_games_url, html: { id: "entry-form" } do |f| + = render partial: "form", locals: { f: f } diff --git a/app/views/games/index.html.haml b/app/views/games/index.html.haml new file mode 100644 index 0000000..64fbfd9 --- /dev/null +++ b/app/views/games/index.html.haml @@ -0,0 +1,14 @@ +- title "Games" +%h2 Games +%table#games-table + %tr + %th Title + %th Status + %th Score + %th Progress + - @games.each do |game| + %tr{ class: cycle("even", "odd") } + %td= game.title + %td= game.status + %td= game.score + %td.game-progress= simple_format game.progress diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 4bfe60a..1c865b0 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -33,5 +33,9 @@ = link_to "Links", admin_links_url, class: "major-link" %ul.minors %li.minor= link_to "New link", new_admin_link_url + %li{major_sidebar_attrs("games")} + = link_to "Games", admin_games_url, class: "major-link" + %ul.minors + %li.minor= link_to "New game", new_admin_game_url #main = yield -- cgit 1.4.1