# HG changeset patch # User Nattee Niparnan # Date 2017-09-11 08:01:34 # Node ID 30ade25a1b9750a70124eb178e4ba52856f8d533 # Parent 0327c11ce2552fc62a81778a132ad95c84b0480a convert to haml diff --git a/app/views/contests/edit.html.erb b/app/views/contests/edit.html.erb deleted file mode 100644 --- a/app/views/contests/edit.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

Editing contest

- -<%= form_for(@contest) do |f| %> - <%= f.error_messages %> - - - - - - - - - - - - - - -
<%= f.label :name %><%= f.text_field :name %>
<%= f.label :title %><%= f.text_field :title %>
- <%= f.check_box :enabled %> - <%= f.label :enabled %> -
-

- <%= f.submit 'Update' %> -

-<% end %> - -<%= link_to 'Show', @contest %> | -<%= link_to 'Back', contests_path %> diff --git a/app/views/contests/edit.html.haml b/app/views/contests/edit.html.haml new file mode 100644 --- /dev/null +++ b/app/views/contests/edit.html.haml @@ -0,0 +1,20 @@ +%h1 Editing contest += form_for(@contest) do |f| + = f.error_messages + %table + %tr + %td= f.label :name + %td= f.text_field :name + %tr + %td= f.label :title + %td= f.text_field :title + %tr + %td + %td + = f.check_box :enabled + = f.label :enabled + %p + = f.submit 'Update' += link_to 'Show', @contest +| += link_to 'Back', contests_path diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb deleted file mode 100644 --- a/app/views/contests/index.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

Listing contests

- -
- Go back to: [<%= link_to 'contest management', :controller => 'contest_management', :action => 'index' %>] -
- - - - - - - - -<% @contests.each do |contest| %> - <% @contest = contest %> - - - - - - - - -<% end %> -
NameTitleEnabled
<%= in_place_editor_field :contest, :name, {}, :rows => 1 %><%= in_place_editor_field :contest, :title, {}, :rows => 1 %><%= in_place_editor_field :contest, :enabled, {}, :rows => 1 %><%= link_to 'Show', contest %><%= link_to 'Edit', edit_contest_path(contest) %><%= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New contest', new_contest_path %> diff --git a/app/views/contests/index.html.haml b/app/views/contests/index.html.haml new file mode 100644 --- /dev/null +++ b/app/views/contests/index.html.haml @@ -0,0 +1,27 @@ +%h1 Listing contests +.infobox + %b Go back to: + [#{link_to 'contest management', :controller => 'contest_management', :action => 'index'}] +%p= link_to 'New contest', new_contest_path, class: 'btn btn-success' +%table.table.table-striped + %tr + %th Name + %th Title + %th Enabled + %th + %th + %th + + - @contests.each do |contest| + - @contest = contest + %tr + -#%td= in_place_editor_field :contest, :name, {}, :rows => 1 + -#%td= in_place_editor_field :contest, :title, {}, :rows => 1 + -#%td= in_place_editor_field :contest, :enabled, {}, :rows => 1 + %td= best_in_place @contest, :name + %td= best_in_place @contest, :title + %td= best_in_place @contest, :enabled + %td= link_to 'Show', contest + %td= link_to 'Edit', edit_contest_path(contest) + %td= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete +%br/ diff --git a/app/views/contests/new.html.erb b/app/views/contests/new.html.erb deleted file mode 100644 --- a/app/views/contests/new.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -

New contest

- -<%= form_for(@contest) do |f| %> - <%= f.error_messages %> - -

- <%= f.label :name %>
- <%= f.text_field :name %> -

-

- <%= f.label :title %>
- <%= f.text_field :title %> -

-

- <%= f.label :enabled %>
- <%= f.check_box :enabled %> -

-

- <%= f.submit 'Create' %> -

-<% end %> - -<%= link_to 'Back', contests_path %> diff --git a/app/views/contests/new.html.haml b/app/views/contests/new.html.haml new file mode 100644 --- /dev/null +++ b/app/views/contests/new.html.haml @@ -0,0 +1,18 @@ +%h1 New contest += form_for(@contest) do |f| + = f.error_messages + %p + = f.label :name + %br/ + = f.text_field :name + %p + = f.label :title + %br/ + = f.text_field :title + %p + = f.label :enabled + %br/ + = f.check_box :enabled + %p + = f.submit 'Create' += link_to 'Back', contests_path diff --git a/app/views/contests/show.html.erb b/app/views/contests/show.html.erb deleted file mode 100644 --- a/app/views/contests/show.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

Contest: <%=h @contest.title %>

- -
- Go back to: [<%= link_to 'contest management', :controller => 'contest_management', :action => 'index' %>] -
- -

- Enabled: - <%=h @contest.enabled %> -

- - -<%= link_to 'Edit', edit_contest_path(@contest) %> | -<%= link_to 'Back', contests_path %> diff --git a/app/views/contests/show.html.haml b/app/views/contests/show.html.haml new file mode 100644 --- /dev/null +++ b/app/views/contests/show.html.haml @@ -0,0 +1,11 @@ +%h1 + Contest: #{h @contest.title} +.infobox + %b Go back to: + [#{link_to 'contest management', :controller => 'contest_management', :action => 'index'}] +%p + %b Enabled: + = h @contest.enabled += link_to 'Edit', edit_contest_path(@contest) +| += link_to 'Back', contests_path