diff --git a/app/views/sites/edit.html.erb b/app/views/sites/edit.html.erb deleted file mode 100644 --- a/app/views/sites/edit.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -

Editing site

- -<%= error_messages_for :site %> - -<%= form_for(@site) do |f| %> -

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

- -

- Password
- <%= f.text_field :password %> -

- -

- Started
- <%= f.check_box :started %> -

- -

- Start time
- <%= f.datetime_select :start_time %> -

- -

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

-<% end %> - -<%= link_to 'Show', @site %> | -<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/edit.html.haml b/app/views/sites/edit.html.haml new file mode 100644 --- /dev/null +++ b/app/views/sites/edit.html.haml @@ -0,0 +1,24 @@ +%h1 Editing site += error_messages_for :site += form_for(@site) do |f| + %p + %b Name + %br/ + = f.text_field :name + %p + %b Password + %br/ + = f.text_field :password + %p + %b Started + %br/ + = f.check_box :started + %p + %b Start time + %br/ + = f.datetime_select :start_time, :include_blank => true + %p + = f.submit "Update" += link_to 'Show', @site +| += link_to 'Back', sites_path diff --git a/app/views/sites/index.html.erb b/app/views/sites/index.html.erb deleted file mode 100644 --- a/app/views/sites/index.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

Listing sites

- - - - - - - - - -<% for site in @sites %> - <% background = "white" %> - <% background = "grey" if (site.started==true) and (site.finished? == true) %> - <% background = "lightgreen" if (site.started==true) and (site.finished? != true) %> - - - - - - - - - -<% end %> -
NamePasswordStartedStart time
<%=h site.name %><%=h site.password %><%=h site.started %><%=h site.start_time %><%= link_to 'Show', site %><%= link_to 'Edit', edit_site_path(site) %><%= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete %>
- -
- -<%= link_to 'New site', new_site_path %> diff --git a/app/views/sites/index.html.haml b/app/views/sites/index.html.haml new file mode 100644 --- /dev/null +++ b/app/views/sites/index.html.haml @@ -0,0 +1,24 @@ +%h1 Listing sites +%table.table.table-striped + %tr + %th Name + %th Password + %th Started + %th Start time + %th + %th + %th + - for site in @sites + - background = "white" + - background = "grey" if (site.started==true) and (site.finished? == true) + - background = "lightgreen" if (site.started==true) and (site.finished? != true) + %tr{:style => "background: #{background};"} + %td= h site.name + %td= h site.password + %td= h site.started + %td= h site.start_time + %td= link_to 'Show', site, class: 'btn btn-default' + %td= link_to 'Edit', edit_site_path(site), class: 'btn btn-default' + %td= link_to 'Destroy', site, :confirm => 'Are you sure?', :method => :delete, class: 'btn btn-default' +%br/ += link_to '+ New site', new_site_path, class: 'btn btn-success' diff --git a/app/views/sites/new.html.erb b/app/views/sites/new.html.erb deleted file mode 100644 --- a/app/views/sites/new.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -

New site

- -<%= error_messages_for :site %> - -<%= form_for(@site) do |f| %> -

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

- -

- Password
- <%= f.text_field :password %> -

- -

- Started
- <%= f.check_box :started %> -

- -

- Start time
- <%= f.datetime_select :start_time %> -

- -

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

-<% end %> - -<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/new.html.haml b/app/views/sites/new.html.haml new file mode 100644 --- /dev/null +++ b/app/views/sites/new.html.haml @@ -0,0 +1,22 @@ +%h1 New site += error_messages_for :site += form_for(@site) do |f| + %p + %b Name + %br/ + = f.text_field :name + %p + %b Password + %br/ + = f.text_field :password + %p + %b Started + %br/ + = f.check_box :started + %p + %b Start time + %br/ + = f.datetime_select :start_time + %p + = f.submit "Create" += link_to 'Back', sites_path diff --git a/app/views/sites/show.html.erb b/app/views/sites/show.html.erb deleted file mode 100644 --- a/app/views/sites/show.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -

- Name: - <%=h @site.name %> -

- -

- Password: - <%=h @site.password %> -

- -

- Started: - <%=h @site.started %> -

- -

- Start time: - <%=h @site.start_time %> -

- - -<%= link_to 'Edit', edit_site_path(@site) %> | -<%= link_to 'Back', sites_path %> diff --git a/app/views/sites/show.html.haml b/app/views/sites/show.html.haml new file mode 100644 --- /dev/null +++ b/app/views/sites/show.html.haml @@ -0,0 +1,15 @@ +%p + %b Name: + = h @site.name +%p + %b Password: + = h @site.password +%p + %b Started: + = h @site.started +%p + %b Start time: + = h @site.start_time += link_to 'Edit', edit_site_path(@site) +| += link_to 'Back', sites_path