DRY up flash display code, fix colors for success/error

This commit is contained in:
Kyle Drake 2017-03-03 20:36:58 -08:00
parent 019ceff01c
commit ae1f3a81e3
11 changed files with 15 additions and 87 deletions

View file

@ -110,3 +110,7 @@ end
def sanitize_comment(text)
Rinku.auto_link Sanitize.fragment(text), :all, 'target="_blank" rel="nofollow"'
end
def flash_display(opts={})
erb :'_flash', layout: false, locals: {opts: opts}
end

View file

@ -14,13 +14,7 @@
</div>
</div>
<% if flash.keys.length > 0 %>
<div class="alert alert-error alert-block">
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</div>
<% end %>
<%== flash_display %>
<div class="row">
<div class="col col-50">

View file

@ -7,13 +7,7 @@
<div class="content misc-page single-Col txt-Center" style="padding-top: 20px;">
<% if flash.keys.length > 0 %>
<div class="alert alert-error alert-block">
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</div>
<% end %>
<%== flash_display %>
<div class="row">
<div class="col col-100">

View file

@ -58,21 +58,7 @@
</div>
<% end %>
<% if @error %>
<div class="alert alert-block alert-error">
<p><%== @error %></p>
</div>
<% end %>
<% if flash.keys.length > 0 %>
<div class="alert alert-block">
<p>
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</p>
</div>
<% end %>
<%== flash_display %>
<div id="filesDisplay" class="files">
<script>

View file

@ -32,13 +32,7 @@
</ul>
</nav>
<% if flash.keys.length > 0 %>
<div class="alert alert-block txt-Center">
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</div>
<% end %>
<%== flash_display centered: true %>
<div class="int-Logo hp-Logo">
<a href="/" title="back to home">

View file

@ -6,15 +6,7 @@
</div>
<div class="content txt-Center single-Col misc-page">
<% if flash.keys.length > 0 %>
<div class="alert alert-block">
<p>
<% flash.keys.select {|s| s == :error}.each do |key| %>
<%= flash[key] %>
<% end %>
</p>
</div>
<% end %>
<%== flash_display %>
<p>If you forgot your sitename (AKA username), you can have it emailed to you here.</p>

View file

@ -32,13 +32,7 @@
</ul>
</nav>
<% if flash.keys.length > 0 %>
<div class="alert alert-block txt-Center">
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</div>
<% end %>
<%== flash_display centered: true %>
<div class="int-Logo hp-Logo">
<a href="/" title="back to home">

View file

@ -6,17 +6,7 @@
<div class="content single-Col misc-page">
<% if flash.keys.length > 0 %>
<div class="alert alert-block txt-Center">
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</div>
<% end %>
<p>
Note: If you provided your e-mail, you can reset your password. If you didn't, you will not be able to reset your password, and instead should create a new account. We cannot change a password without an entered email for security reasons.
</p>
<%== flash_display centered: true %>
<form method="post" action="/send_password_reset" class="content">
<fieldset>

View file

@ -1,12 +1,7 @@
<h2>Custom Domain</h2>
<h3 class="subtitle">Add your own domain name to your Neocities site</h3>
<p>
Adding a custom domain allows you to have a domain name attached to your web site. So if you had a domain like <strong>catsknitting.com</strong>, you could have it point to your Neocities site.
</p>
<p>
You will have to purchase a domain name from a registrar like <a href="http://www.namecheap.com/?aff=87835" target="_blank">Namecheap</a> first. We are working on providing domain purchasing from Neocities in the future, but in general it is best if you own the domain, because then you control your site.
Adding a custom domain allows you to have a domain name attached to your web site. So if you had a domain like <strong>catsknitting.com</strong>, you could have it point to your Neocities site. If you don't have the domain yet, you will have to purchase a domain name from a registrar like <a href="http://www.namecheap.com/?aff=87835" target="_blank">Namecheap</a> first.
</p>
<% if current_site.custom_domain_available? %>
@ -14,7 +9,6 @@
We will be using <strong>catsknitting.com</strong> for the examples below.
</p>
<h3>Step 1</h3>
<p>
First, you need to add an "A record" to point your root domain (sometimes shown with an @ symbol) (catsknitting.com) to the following IP address:

View file

@ -6,15 +6,7 @@
</div>
<div class="content txt-Center single-Col misc-page">
<% if flash.keys.length > 0 %>
<div class="alert alert-block">
<p>
<% flash.keys.select {|s| s == :error}.each do |key| %>
<%= flash[key] %>
<% end %>
</p>
</div>
<% end %>
<%== flash_display %>
<form method="POST" action="/signin" class="content">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">

View file

@ -1,11 +1,5 @@
<section class="section plans welcome">
<% if flash.keys.length > 0 %>
<div class="alert alert-block txt-Center">
<% flash.keys.each do |key| %>
<%== flash[key] %>
<% end %>
</div>
<% end %>
<%== flash_display centered: true %>
<% if request.path == '/welcome' %>
<h2>Welcome to Neocities, <%= current_site.username %>!</h2>