diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index b0d81a8..9ada889 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -8,6 +8,8 @@ class CategoriesController < ApplicationController
@page_title = 'Portfolio'
+ @num_blank = 4 - @categories.length
+
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @categories }
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
index 5bde376..91c6b7a 100644
--- a/app/controllers/photos_controller.rb
+++ b/app/controllers/photos_controller.rb
@@ -8,6 +8,9 @@ class PhotosController < ApplicationController
@photos = Photo.enabled.order{taken_at.desc}.paginate(page: params[:page], per_page: 11)
@page_title = 'All Photos'
end
+
+ @num_blank = 11 - @photos.length
+
respond_to do |format|
format.html
end
diff --git a/app/helpers/entity_helper.rb b/app/helpers/entity_helper.rb
new file mode 100644
index 0000000..124b54f
--- /dev/null
+++ b/app/helpers/entity_helper.rb
@@ -0,0 +1,5 @@
+module EntityHelper
+ def e(entity)
+ "{entity};".html_safe
+ end
+end
diff --git a/app/presenters/page_presenter.rb b/app/presenters/page_presenter.rb
index 6eabd08..ff46816 100644
--- a/app/presenters/page_presenter.rb
+++ b/app/presenters/page_presenter.rb
@@ -1,6 +1,6 @@
class PagePresenter < SimpleDelegator
def content_as_html
- PagePresenter.markdown.render(content)
+ PagePresenter.markdown.render(content).html_safe
end
def self.markdown
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb
index a2b92d6..d9bec3c 100644
--- a/app/views/categories/index.html.erb
+++ b/app/views/categories/index.html.erb
@@ -3,18 +3,16 @@
<% content_for :navigation do %>
<% if @categories.previous_page -%>
- <%= link_to raw('
←
'), { :page => @categories.previous_page }, :class => 'prev-link' %>
+ <%= link_to content_tag(:div, e(:larr)), { page: @categories.previous_page }, class: 'prev-link' %>
<% end %>
<% if @categories.next_page -%>
- <%= link_to raw('
→
'), { :page => @categories.next_page }, :class => 'next-link' %>
+ <%= link_to content_tag(:div, e(:rarr)), { page: @categories.next_page }, class: 'next-link' %>
<% end %>
<% end %>
-<% @num_blank = 4 - @categories.length -%>
-
<% @photos.each do |photo| %>
<%= link_to_photo photo %>
@@ -23,7 +21,7 @@
<% @categories.each do |category| %>
- <%= link_to raw('
'+h(category.name.downcase)+'
'), category_photos_path(category) %>
+ <%= link_to content_tag(:h3, h(category.name.downcase)), category_photos_path(category) %>
<% end %>
diff --git a/app/views/contacts/new.html.erb b/app/views/contacts/new.html.erb
index 2de1240..865a90a 100644
--- a/app/views/contacts/new.html.erb
+++ b/app/views/contacts/new.html.erb
@@ -9,7 +9,7 @@
<% if flash[:alert] -%>
<%= flash[:alert] %>
<% end -%>
- <%= form_for :contact, :url => { :action => 'create' }, :html => { :id => 'contact_form' } do |f| %>
+ <%= form_for :contact, url: { action: 'create' }, html: { id: 'contact_form' } do |f| %>
Please use the form below to contact me.
<%= f.label :name %>
@@ -28,7 +28,7 @@
<%= f.text_area :message %>
- <%= f.label "-", :style => "opacity: 0;" %>
+ <%= f.label "-", style: "opacity: 0;" %>
<%= f.submit 'Send Message' %>
<% end %>
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index 6be8d40..f56dcae 100644
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -15,5 +15,5 @@
- <%= link_to raw('contact'), new_contact_path %>
+ <%= link_to content_tag(:span, 'contact'), new_contact_path %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index ff367e5..17bcb84 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -7,10 +7,10 @@
- <%= stylesheet_link_tag "application" %>
+ <%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag 'application' %>
<%= favicon_link_tag 'favicon.ico' %>
- <%= render :partial => "shared/typekit" %>
+ <%= render 'shared/typekit' %>
@@ -22,7 +22,7 @@
- <%= link_to image_tag(asset_url('title.svg'), :alt => 'Dan Barber Photography', :width => 236), '/' %>
+ <%= link_to image_tag(asset_url('title.svg'), alt: 'Dan Barber Photography', width: 236), '/' %>
<%= yield :navigation %>
@@ -38,7 +38,7 @@
- <%= render :partial => 'shared/analytics' if Rails.env.production? %>
+ <%= render 'shared/analytics' if Rails.env.production? %>
diff --git a/app/views/notifier/contact_notification.text.erb b/app/views/notifier/contact_notification.text.erb
index b6bdc83..8ec3f06 100644
--- a/app/views/notifier/contact_notification.text.erb
+++ b/app/views/notifier/contact_notification.text.erb
@@ -1 +1 @@
-<%=h @sender.message %>
\ No newline at end of file
+<%= h @sender.message %>
diff --git a/app/views/pages/show.html.erb b/app/views/pages/show.html.erb
index 440299e..542f3f8 100644
--- a/app/views/pages/show.html.erb
+++ b/app/views/pages/show.html.erb
@@ -2,13 +2,13 @@
- <%= link_to raw('portfolio'), :controller => 'categories' %>
+ <%= link_to content_tag(:span, 'portfolio'), controller: 'categories' %>
<% end %>
- <%= raw(@page.content_as_html) %>
+ <%= @page.content_as_html %>
@@ -22,5 +22,5 @@
- <%= link_to raw('contact'), new_contact_path %>
+ <%= link_to content_tag(:span, 'contact'), new_contact_path %>
diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb
index da56767..7964fbd 100644
--- a/app/views/photos/index.html.erb
+++ b/app/views/photos/index.html.erb
@@ -3,19 +3,21 @@
<% content_for :navigation do %>
<% if @photos.previous_page -%>
- <%= link_to raw('
←
'), { :page => @photos.previous_page }, :class => 'prev-link' %>
+ <%= link_to content_tag(:div, e(:larr)), { page: @photos.previous_page }, class: 'prev-link' %>
<% end %>
<% if @photos.next_page -%>
- <%= link_to raw('
→
'), { :page => @photos.next_page }, :class => 'next-link' %>
+ <%= link_to content_tag(:div, e(:rarr)), { page: @photos.next_page }, class: 'next-link' %>
<% end %>
<% end %>
<% if @category %>
- <%= link_to raw('
'+h(@category.name.downcase)+'
↑
'), categories_path %>
+ <%= link_to categories_path do %>
+
<%= h(@category.name.downcase) %>
↑
+ <% end %>
<% else %>
@@ -23,8 +25,6 @@
<% end %>
-<% @num_blank = 11 - @photos.length -%>
-
<% @photos.each do |photo| %>
<%= link_to_photo photo %>
diff --git a/app/views/shared/_analytics.html.erb b/app/views/shared/_analytics.html.erb
index 16076b9..cf43eb1 100644
--- a/app/views/shared/_analytics.html.erb
+++ b/app/views/shared/_analytics.html.erb
@@ -1,5 +1,4 @@
-
+<% end %>
diff --git a/app/views/shared/_flash_messages.html.haml b/app/views/shared/_flash_messages.html.haml
index 669d69c..064ef6c 100644
--- a/app/views/shared/_flash_messages.html.haml
+++ b/app/views/shared/_flash_messages.html.haml
@@ -1,9 +1,9 @@
- if !flash[:notice].blank?
%p.flash.notice
= flash[:notice]
- = link_to raw("×"), "#", :class => :close
+ = link_to raw("×"), "#", class: :close
- if !flash[:alert].blank?
%p.flash.alert
= flash[:alert]
- = link_to raw("×"), "#", :class => :close
+ = link_to raw("×"), "#", class: :close
diff --git a/app/views/shared/_main_nav.html.erb b/app/views/shared/_main_nav.html.erb
index b2a52d8..2dd41cc 100644
--- a/app/views/shared/_main_nav.html.erb
+++ b/app/views/shared/_main_nav.html.erb
@@ -1,6 +1,6 @@
- <%= link_to raw('about'), page_path(:about) %>
+ <%= link_to content_tag(:span, 'about'), page_path(:about) %>
- <%= link_to raw('portfolio'), :controller => 'categories' %>
+ <%= link_to content_tag(:span, 'portfolio'), controller: 'categories' %>