diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin/games/_form.html.haml | 23 | ||||
-rw-r--r-- | app/views/admin/games/edit.html.haml | 3 | ||||
-rw-r--r-- | app/views/admin/games/index.html.haml | 13 | ||||
-rw-r--r-- | app/views/admin/games/new.html.haml | 3 | ||||
-rw-r--r-- | app/views/games/index.html.haml | 14 | ||||
-rw-r--r-- | app/views/layouts/admin.html.haml | 4 |
6 files changed, 60 insertions, 0 deletions
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 @@ | |||
1 | %fieldset#content | ||
2 | .title-field | ||
3 | = f.label :title | ||
4 | = f.text_field :title, placeholder: "Title" | ||
5 | .description-field | ||
6 | = f.label :description | ||
7 | = f.cktext_area :description | ||
8 | %fieldset#details | ||
9 | - if f.object.errors.any? | ||
10 | #errors.details-module | ||
11 | %h3 Error! | ||
12 | %ul | ||
13 | - f.object.errors.full_messages.each do |error| | ||
14 | %li= error | ||
15 | .details-module | ||
16 | .progress-field | ||
17 | = f.label :progress | ||
18 | = f.text_area :progress | ||
19 | .details-module | ||
20 | .status-field | ||
21 | = f.select :status, options_for_select(Game.status.values) | ||
22 | = f.label :status | ||
23 | .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 @@ | |||
1 | - title "Editing #{@game.title}" | ||
2 | = form_for @game, url: admin_game_url(@game), html: { id: "entry-form" } do |f| | ||
3 | = 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 @@ | |||
1 | - title "Games" | ||
2 | %table#entries | ||
3 | %tr | ||
4 | %th Title | ||
5 | %th Date published | ||
6 | %th | ||
7 | - @games.each do |game| | ||
8 | %tr{ class: cycle("even", "odd") } | ||
9 | %td= game.title | ||
10 | %td= game.created_at.strftime("%B %d, %Y, %l:%M%P") | ||
11 | %td | ||
12 | %ul.admin-actions | ||
13 | %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 @@ | |||
1 | - title "New game" | ||
2 | = form_for @game, url: admin_games_url, html: { id: "entry-form" } do |f| | ||
3 | = 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 @@ | |||
1 | - title "Games" | ||
2 | %h2 Games | ||
3 | %table#games-table | ||
4 | %tr | ||
5 | %th Title | ||
6 | %th Status | ||
7 | %th Score | ||
8 | %th Progress | ||
9 | - @games.each do |game| | ||
10 | %tr{ class: cycle("even", "odd") } | ||
11 | %td= game.title | ||
12 | %td= game.status | ||
13 | %td= game.score | ||
14 | %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 @@ | |||
33 | = link_to "Links", admin_links_url, class: "major-link" | 33 | = link_to "Links", admin_links_url, class: "major-link" |
34 | %ul.minors | 34 | %ul.minors |
35 | %li.minor= link_to "New link", new_admin_link_url | 35 | %li.minor= link_to "New link", new_admin_link_url |
36 | %li{major_sidebar_attrs("games")} | ||
37 | = link_to "Games", admin_games_url, class: "major-link" | ||
38 | %ul.minors | ||
39 | %li.minor= link_to "New game", new_admin_game_url | ||
36 | #main | 40 | #main |
37 | = yield | 41 | = yield |