-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): ensure the inputs are mandatory
Move the forms to a partial (had a hard time with HAML-based partials...) Small box-shadow if not specified Add a "I'm the owner of that website" checkbox
- Loading branch information
Showing
7 changed files
with
89 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
%form.join-form{action: '#', method: 'POST'} | ||
%h3 Get Started. It’s FREE! | ||
.spacer20 | ||
.input-group | ||
%span.input-group-addon | ||
%i.fa.fa-fw.fa-globe | ||
%input.form-control{type: 'text', placeholder: 'https://website.com/doc', name: 'url'} | ||
%p.text-sm We’ll crawl the <u>documentation pages</u> of your website and index them on Algolia. | ||
.spacer10 | ||
.input-group | ||
%span.input-group-addon | ||
%i.fa.fa-fw.fa-envelope-o | ||
%input.form-control{type: 'email', placeholder: '[email protected]', name: 'email'} | ||
%p.text-sm We’ll email you the code you need to integrate the search into your documentation. | ||
%p.checkbox.text-center | ||
%label | ||
%input{type: 'checkbox', name: 'owner'} | ||
%span I'm the <u>owner</u> of that website | ||
.spacer20 | ||
.text-center | ||
%button.btn.btn-primary.btn-lg{type: 'submit'} | ||
JOIN THE BETA! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
require 'jekyll-haml' | ||
|
||
module Jekyll | ||
class HamlConverter < Converter | ||
safe true | ||
|
||
def setup | ||
return if @setup | ||
require 'haml' | ||
@setup = true | ||
rescue | ||
STDERR.puts 'do `gem install haml`' | ||
raise FatalException.new("Missing dependency: haml") | ||
end | ||
|
||
def matches(ext) | ||
ext =~ /haml/i | ||
class HamlPartialTag < Liquid::Tag | ||
def initialize(tag_name, file, tokens) | ||
super | ||
@file = file.strip | ||
end | ||
|
||
def output_ext(ext) | ||
".html" | ||
end | ||
def render(context) | ||
includes_dir = File.join(context.registers[:site].source, '_includes') | ||
|
||
if File.symlink?(includes_dir) | ||
return "Includes directory '#{includes_dir}' cannot be a symlink" | ||
end | ||
|
||
def convert(content) | ||
setup | ||
engine = Haml::Engine.new(content) | ||
engine.render | ||
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./ | ||
return "Include file '#{@file}' contains invalid characters or sequences" | ||
end | ||
|
||
return "File must have \".haml\" extension" if @file !~ /\.haml$/ | ||
|
||
Dir.chdir(includes_dir) do | ||
choices = Dir['**/*'].reject { |x| File.symlink?(x) } | ||
if choices.include?(@file) | ||
source = File.read(@file) | ||
conversion = ::Haml::Engine.new(source).render | ||
partial = Liquid::Template.parse(conversion) | ||
return partial.render!(context).gsub(/\s+/, ' ') | ||
else | ||
"Included file '#{@file}' not found in _includes directory" | ||
end | ||
end | ||
end | ||
end | ||
|
||
end | ||
|
||
Liquid::Template.register_tag('haml', Jekyll::HamlPartialTag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,24 +16,8 @@ layout: default | |
.text-center | ||
%p We’ve created the fastest, easiest way to search within documentation. | ||
%p And best of all? It’s FREE. | ||
%form.join-form{action: '#', method: 'POST'} | ||
%h3 Get Started. It’s FREE! | ||
.spacer20 | ||
.input-group | ||
%span.input-group-addon | ||
%i.fa.fa-fw.fa-envelope-o | ||
%input.form-control{type: 'email', placeholder: '[email protected]', name: 'email'} | ||
%p.text-sm We’ll email you the code you need to integrate the search into your documentation. | ||
.spacer20 | ||
.input-group | ||
%span.input-group-addon | ||
%i.fa.fa-fw.fa-globe | ||
%input.form-control{type: 'text', placeholder: 'https://website.com/doc', name: 'url'} | ||
%p.text-sm We’ll crawl the documentation pages of your website and index them on Algolia. | ||
.spacer20 | ||
.text-center | ||
%button.btn.btn-primary.btn-lg{type: 'submit'} | ||
JOIN THE BETA! | ||
|
||
{% haml join-form.haml %} | ||
#section_why.page-section | ||
.m800.m-l-r-auto | ||
%h2.page-section-title Why DocSearch? | ||
|
@@ -128,22 +112,8 @@ layout: default | |
%p We’ll get back to you within a few hours with everything you need to integrate your new search into your website. | ||
%p Oh, and did we mention it's FREE? No commitment. No subscription. Everything is on us! | ||
.spacer30 | ||
%form.join-form{action: '#', method: 'POST'} | ||
.input-group | ||
%span.input-group-addon | ||
%i.fa.fa-fw.fa-envelope-o | ||
%input.form-control{type: 'email', placeholder: '[email protected]', name: 'email'} | ||
%p.text-sm We’ll email you the code you need to integrate the search into your documentation. | ||
.spacer20 | ||
.input-group | ||
%span.input-group-addon | ||
%i.fa.fa-fw.fa-globe | ||
%input.form-control{type: 'text', placeholder: 'https://website.com/doc', name: 'url'} | ||
%p.text-sm We’ll crawl the documentation pages of your website and index them on Algolia. | ||
.spacer20 | ||
.text-center | ||
%button.btn.btn-primary.btn-lg{type: 'submit'} | ||
JOIN THE BETA! | ||
|
||
{% haml join-form.haml %} | ||
|
||
{% contentfor site-footer %} | ||
<script src="{{ "/js/home.js" | prepend: site.baseurl }}"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters