From b708319c3b9ec3f9b0d18d2f1eb5d1cf17ed9a58 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 8 Sep 2015 16:19:48 +0200 Subject: [PATCH] Use haml! --- Gemfile | 3 +++ Gemfile.lock | 17 ++++++++++++++++ app/views/layouts/application.html.erb | 14 ------------- app/views/layouts/application.html.haml | 10 +++++++++ app/views/pages/landing.html.erb | 9 --------- app/views/pages/landing.html.haml | 6 ++++++ app/views/transactions/index.html.erb | 27 ------------------------- app/views/transactions/index.html.haml | 18 +++++++++++++++++ app/views/transactions/new.html.erb | 7 ------- app/views/transactions/new.html.haml | 4 ++++ 10 files changed, 58 insertions(+), 57 deletions(-) delete mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/application.html.haml delete mode 100644 app/views/pages/landing.html.erb create mode 100644 app/views/pages/landing.html.haml delete mode 100644 app/views/transactions/index.html.erb create mode 100644 app/views/transactions/index.html.haml delete mode 100644 app/views/transactions/new.html.erb create mode 100644 app/views/transactions/new.html.haml diff --git a/Gemfile b/Gemfile index 449e05c..d611f45 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,9 @@ gem 'omniauth-oauth2' # Authorisation gem 'cancancan' +# Haml for templating! +gem "haml-rails", "~> 0.9" + # Pure for css gem 'purecss-rails' # Use datatables diff --git a/Gemfile.lock b/Gemfile.lock index a81e6df..d0d04c2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,8 +91,21 @@ GEM multipart-post (>= 1.2, < 3) globalid (0.3.6) activesupport (>= 4.1.0) + haml (4.0.7) + tilt + haml-rails (0.9.0) + actionpack (>= 4.0.1) + activesupport (>= 4.0.1) + haml (>= 4.0.6, < 5.0) + html2haml (>= 1.0.1) + railties (>= 4.0.1) hashie (3.4.2) high_voltage (2.4.0) + html2haml (2.0.0) + erubis (~> 2.7.0) + haml (~> 4.0.0) + nokogiri (~> 1.6.0) + ruby_parser (~> 3.5) i18n (0.7.0) jbuilder (2.3.1) activesupport (>= 3.0.0, < 5) @@ -187,6 +200,8 @@ GEM rspec-mocks (~> 3.3.0) rspec-support (~> 3.3.0) rspec-support (3.3.0) + ruby_parser (3.7.1) + sexp_processor (~> 4.1) sass (3.4.18) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) @@ -199,6 +214,7 @@ GEM rdoc (~> 4.0) select2-rails (3.5.9.3) thor (~> 0.14) + sexp_processor (4.6.0) spring (1.3.6) sprockets (3.3.4) rack (~> 1.0) @@ -244,6 +260,7 @@ DEPENDENCIES devise factory_girl_rails faker + haml-rails (~> 0.9) high_voltage (~> 2.4.0) jbuilder (~> 2.0) jquery-datatables-rails (~> 3.3.0) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 1bf645f..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Tab - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000..2e2b5a0 --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,10 @@ +!!! +%html + %head + %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ + %title Tab + = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true + = javascript_include_tag 'application', 'data-turbolinks-track' => true + = csrf_meta_tags + %body + = yield diff --git a/app/views/pages/landing.html.erb b/app/views/pages/landing.html.erb deleted file mode 100644 index 31184f6..0000000 --- a/app/views/pages/landing.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

Hallo

- -<% if user_signed_in? %> -

Yeah! Je bent ingelogd.

-<% else %> - Log een keer in! -

<%= link_to "Log in met Zeus WPI", user_omniauth_authorize_path(:zeuswpi) %>

-<% end %> - diff --git a/app/views/pages/landing.html.haml b/app/views/pages/landing.html.haml new file mode 100644 index 0000000..f2b7291 --- /dev/null +++ b/app/views/pages/landing.html.haml @@ -0,0 +1,6 @@ +%h1 Hallo +- if user_signed_in? + %p Yeah! Je bent ingelogd. +- else + Log een keer in! + %p= link_to "Log in met Zeus WPI", user_omniauth_authorize_path(:zeuswpi) diff --git a/app/views/transactions/index.html.erb b/app/views/transactions/index.html.erb deleted file mode 100644 index e4a56d5..0000000 --- a/app/views/transactions/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - <% @transactions.each do |transaction| %> - - - - - - - <% end %> - -
iddebtorcreditoramount
<%= transaction.id %><%= transaction.debtor.name %><%= transaction.creditor.name %><%= transaction.amount%>
- - diff --git a/app/views/transactions/index.html.haml b/app/views/transactions/index.html.haml new file mode 100644 index 0000000..68b4c3c --- /dev/null +++ b/app/views/transactions/index.html.haml @@ -0,0 +1,18 @@ +%table#transactions.display + %thead + %tr + %th id + %th debtor + %th creditor + %th amount + %tbody + - @transactions.each do |transaction| + %tr + %td= transaction.id + %td= transaction.debtor.name + %td= transaction.creditor.name + %td= transaction.amount +:javascript + $(document).ready(function() { + $('#transactions').DataTable(); + }); diff --git a/app/views/transactions/new.html.erb b/app/views/transactions/new.html.erb deleted file mode 100644 index e977f40..0000000 --- a/app/views/transactions/new.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - -<%= form_for @transaction do |f| %> - <%= f.select :creditor, User.all, {}, { class: 'select2-selector' } %> - <%= f.number_field :amount %> - <%= f.submit "Send it!" %> -<% end %> - diff --git a/app/views/transactions/new.html.haml b/app/views/transactions/new.html.haml new file mode 100644 index 0000000..e1e2a52 --- /dev/null +++ b/app/views/transactions/new.html.haml @@ -0,0 +1,4 @@ += form_for @transaction do |f| + = f.select :creditor, User.all, {}, { class: 'select2-selector' } + = f.number_field :amount + = f.submit "Send it!"