aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/views/layouts/application.html.erb24
-rw-r--r--app/views/layouts/application.html.haml16
-rw-r--r--app/views/results/_result.html.erb16
-rw-r--r--app/views/results/_result.html.haml13
-rw-r--r--app/views/snippets/_form.html.erb26
-rw-r--r--app/views/snippets/_form.html.haml15
-rw-r--r--app/views/snippets/new.html.erb1
-rw-r--r--app/views/snippets/new.html.haml1
-rw-r--r--app/views/snippets/show.html.erb6
-rw-r--r--app/views/snippets/show.html.haml4
10 files changed, 49 insertions, 73 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
deleted file mode 100644
index fd1d40c..0000000
--- a/app/views/layouts/application.html.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html lang="ja">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Poe</title>
- <%= csrf_meta_tags %>
- <%= stylesheet_link_tag "application", media: "all" %>
- </head>
-
- <body>
- <nav class="navbar navbar-default navbar-static-top">
- <div class="container-fluid">
- <div class="navbar-header">
- <a class="navbar-brand" href="/"><%= application_name %></a>
- </div>
- </div>
- </nav>
- <div class="container-fluid">
- <%= yield %>
- </div>
- <%= javascript_include_tag "application" %>
- </body>
-</html>
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
new file mode 100644
index 0000000..2cbbeb0
--- /dev/null
+++ b/app/views/layouts/application.html.haml
@@ -0,0 +1,16 @@
+!!!
+%html{lang: "ja"}
+ %head
+ %meta{charset: "UTF-8"}/
+ %meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
+ %title poe
+ = csrf_meta_tags
+ = stylesheet_link_tag("application", media: "all")
+ %body
+ %nav.navbar.navbar-default.navbar-static-top
+ .container-fluid
+ .navbar-header
+ %a.navbar-brand{href: "/"}= application_name
+ .container-fluid
+ = yield
+ = javascript_include_tag("application")
diff --git a/app/views/results/_result.html.erb b/app/views/results/_result.html.erb
deleted file mode 100644
index fd59416..0000000
--- a/app/views/results/_result.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-<% if result && result.finished? %>
- <div class="result-item panel <%= result.success? ? "panel-success" : "panel-danger" %>" data-id="<%= result.id %>">
- <div class="panel-heading"><%= compiler %></div>
- <div class="panel-body">
- <pre><code><%= result.formatted_output %></code></pre>
- </div>
- </div>
-<% else %>
- <div class="result-item panel panel-default" data-status="<%= result ? "running" : "notran" %>" data-id="<%= result&.id %>" data-compiler-id="<%= compiler.id %>">
- <div class="panel-heading"><%= compiler %></div>
- <div class="panel-body">
- <p>running....</p>
- </div>
- </div>
-<% end %>
-
diff --git a/app/views/results/_result.html.haml b/app/views/results/_result.html.haml
new file mode 100644
index 0000000..0f4c8cd
--- /dev/null
+++ b/app/views/results/_result.html.haml
@@ -0,0 +1,13 @@
+- if result && result.finished?
+ .result-item.panel{class: (result.success? ? "panel-success" : "panel-danger"), "data-id": result.id}
+ .panel-heading= compiler
+ .panel-body
+ %pre
+ %code= result.formatted_output
+ %div
+ Status: #{result.status}
+- else
+ .result-item.panel.panel-default{"data-compiler-id": compiler.id, "data-id": result.id, "data-status": (result ? "running" : "notran")}
+ .panel-heading= compiler
+ .panel-body
+ %p running....
diff --git a/app/views/snippets/_form.html.erb b/app/views/snippets/_form.html.erb
deleted file mode 100644
index 8b21b3d..0000000
--- a/app/views/snippets/_form.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-<div class="panel panel-default">
- <div class="panel-body">
- <%= form_for(snippet, url: "/", html: { method: "post" }) do |f| %>
- <% if snippet.errors.any? %>
- <div class="alert alert-danger" role="alert">
- <p><%= pluralize(snippet.errors.count, "error") %> prohibited this snippet from being saved:</p>
-
- <ul>
- <% snippet.errors.full_messages.each do |message| %>
- <li><%= message %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div class="form-group">
- <%= f.text_field :title, placeholder: "Untitled", class: "form-control" %>
- </div>
- <div class="form-group" id="code-field">
- <%= f.text_area :code, style: "display: none" %>
- </div>
- <%= f.hidden_field :language, value: "Ruby" %>
- <button type="submit" class="btn btn-default">Run</button>
- <% end %>
- </div>
-</div>
diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml
new file mode 100644
index 0000000..d19ec65
--- /dev/null
+++ b/app/views/snippets/_form.html.haml
@@ -0,0 +1,15 @@
+.panel.panel-default
+ .panel-body
+ = form_for(snippet, url: "/", html: { method: "post" }) do |f|
+ - if snippet.errors.any?
+ .alert.alert-danger{:role => "alert"}
+ %p
+ = pluralize(snippet.errors.count, "error")
+ prohibited this snippet from being saved:
+ %ul
+ - snippet.errors.full_messages.each do |message|
+ %li= message
+ #code-field.form-group
+ %textarea{name: "snippet[code]", style: "display: none"}= snippet.code
+ %input{type: "hidden", name: "snippet[language]", value: "Ruby"}
+ %button.btn.btn-default{type: "submit"} Run
diff --git a/app/views/snippets/new.html.erb b/app/views/snippets/new.html.erb
deleted file mode 100644
index 2d2567d..0000000
--- a/app/views/snippets/new.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= render "form", snippet: @snippet %>
diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml
new file mode 100644
index 0000000..fb79a20
--- /dev/null
+++ b/app/views/snippets/new.html.haml
@@ -0,0 +1 @@
+= render "form", snippet: @snippet
diff --git a/app/views/snippets/show.html.erb b/app/views/snippets/show.html.erb
deleted file mode 100644
index e2a1566..0000000
--- a/app/views/snippets/show.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%= render "form", snippet: @snippet %>
-<span style="display: none" id="snippet-id"><%= @snippet.id %></span>
-
-<% @snippet.results_all.each do |result, compiler| %>
- <%= render partial: "results/result", locals: { result: result, compiler: compiler } %>
-<% end %>
diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml
new file mode 100644
index 0000000..644af96
--- /dev/null
+++ b/app/views/snippets/show.html.haml
@@ -0,0 +1,4 @@
+= render "form", snippet: @snippet
+%span#snippet-id{style: "display: none"}= @snippet.id
+- @snippet.results_all.each do |result, compiler|
+ = render partial: "results/result", locals: { result: result, compiler: compiler }